Merge pull request 'P2' (#28) from P2 into master
Reviewed-on: https://gitea.yunhorn.com/sundp/WLE5CC_NODE_STS/pulls/28
This commit is contained in:
commit
0d2a60631d
|
@ -839,6 +839,8 @@ static void SendTxData(void)
|
|||
|
||||
#ifdef STS_P2
|
||||
AppData.Port = YUNHORN_STS_P2_LORA_APP_DATA_PORT; /* STS-P2 Data Port */
|
||||
#elif defined(STS_T6)
|
||||
AppData.Port = YUNHORN_STS_T6_LORA_APP_DATA_PORT; /* STS-T6 Data Port */
|
||||
#endif
|
||||
|
||||
#ifdef CAYENNE_LPP
|
||||
|
@ -947,6 +949,11 @@ static void SendTxData(void)
|
|||
|
||||
#endif //STS_P2
|
||||
|
||||
#if defined(STS_T6)
|
||||
AppData.Buffer[i++] = 1;
|
||||
AppData.Buffer[i++] = (uint8_t)((sts_t6_sensor_data.tof_range_presence_state & 0xFF));
|
||||
|
||||
#endif //STS_T6
|
||||
/* STS-R4 SOAP LEVEL SENSOR */
|
||||
#ifdef STS_R4
|
||||
AppData.Buffer[i++] = 2;
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "app_tof.h"
|
||||
#include "app_tof_peoplecount.h"
|
||||
extern volatile uint8_t sts_door_jam_profile;
|
||||
extern volatile uint8_t sts_tof_presence_state_changed;
|
||||
#endif
|
||||
volatile sts_cfg_nvm_t sts_cfg_nvm = {
|
||||
sts_mtmcode1,
|
||||
|
@ -109,7 +110,7 @@ volatile uint8_t sts_work_mode=4;
|
|||
volatile uint32_t rfac_timer=0;
|
||||
volatile uint16_t sts_sensor_install_height=3000;
|
||||
volatile uint8_t sensor_data_ready=0;
|
||||
volatile uint32_t STS_TOFScanPeriod_msec=1000, STS_TxPeriod_sec=10, STS_HeartBeatTimerPeriod_sec=60;
|
||||
volatile uint32_t STS_TOFScanPeriod_msec=250, STS_TxPeriod_sec=10, STS_HeartBeatTimerPeriod_sec=60;
|
||||
static uint8_t outbuf[128]={0x0};
|
||||
extern volatile hmac_result_t hmac_result;
|
||||
extern uint16_t sensor_id;
|
||||
|
@ -423,6 +424,12 @@ void STS_YunhornSTSEventP5_Process(void)
|
|||
STS_TOF_VL53LX_PeopleCounting_Process_Start();
|
||||
#elif defined(STS_T6)
|
||||
STS_TOF_VL53LX_PresenceDetection_Process_Start();
|
||||
if (sts_tof_presence_state_changed)
|
||||
{
|
||||
sts_tof_presence_state_changed = 0;
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
extern I2C_HandleTypeDef hi2c2;
|
||||
volatile sts_people_count_sensor_data_t sts_people_count_sensor_data={0,0,0,2,'M',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
|
||||
extern volatile uint32_t STS_TOFScanPeriod_sec, STS_TxPeriod_sec, STS_HeartBeatTimerPeriod_sec;
|
||||
volatile uint8_t sts_tof_presence_state=0;
|
||||
volatile uint8_t sts_tof_presence_state=0, sts_tof_presence_state_changed=0;
|
||||
|
||||
/* TIMING_BUDGET, in ms possible values [15, 20, 50, 100, 200, 500] */
|
||||
/* DISTANCE_THRESHOLD = MAX - ASSUME_CHILD_HEIGHT(800mm) */
|
||||
|
@ -36,7 +36,7 @@ volatile sts_zone_center_by_rows_of_spads_t zone_center[4]={
|
|||
#if (defined(STS_P2)||defined(STS_T6))
|
||||
extern volatile uint8_t sts_door_jam_profile;
|
||||
volatile uint8_t sts_presence_state=0;
|
||||
static int PresenceState=0;
|
||||
static int PresenceState=0, PrevPresenceState=0;
|
||||
volatile uint8_t sts_distance_mode = 0; //sts_door_jam_profile; //DOOR_JAM_3000;
|
||||
#endif
|
||||
|
||||
|
@ -613,12 +613,23 @@ int sts_tof_vl53lx_presence_detection_start(void)
|
|||
if (Distance < ppc_cfg[sts_distance_mode].dist_threshold)
|
||||
{
|
||||
PresenceState = 1;
|
||||
LED1_ON;
|
||||
} else {
|
||||
PresenceState = 0;
|
||||
LED1_OFF;
|
||||
}
|
||||
//PresenceState = ProcessPresenceDetectionData(Distance, Zone, RangeStatus);
|
||||
printf("\nPresenceState =%d \n\r", PresenceState);
|
||||
APP_LOG(TS_OFF, VLEVEL_M,"%d,%d,%d\n", Zone, Distance, Signal);
|
||||
//printf("\nPresenceState =%d \n\r", PresenceState);
|
||||
if (PresenceState == PrevPresenceState)
|
||||
{
|
||||
sts_tof_presence_state_changed = 0;
|
||||
return 0;
|
||||
} else {
|
||||
sts_tof_presence_state = PresenceState;
|
||||
PrevPresenceState = PresenceState;
|
||||
sts_tof_presence_state_changed = 1;
|
||||
}
|
||||
//APP_LOG(TS_OFF, VLEVEL_M,"%d,%d,%d\n", Zone, Distance, Signal);
|
||||
Zone++;
|
||||
Zone = Zone%2;
|
||||
|
||||
|
|
Loading…
Reference in New Issue