revised over stay state
This commit is contained in:
parent
470b3e1a74
commit
08fa70857e
|
@ -177,7 +177,7 @@ typedef struct STS_OO_SensorStatusDataTypeDef
|
||||||
uint8_t fall_state; // FALL DETECION NONE, FALL DOWN, RISE UP, LAYDOWN_STILL
|
uint8_t fall_state; // FALL DETECION NONE, FALL DOWN, RISE UP, LAYDOWN_STILL
|
||||||
uint8_t fall_speed; // speed of fall down measure
|
uint8_t fall_speed; // speed of fall down measure
|
||||||
uint8_t fall_gravity; // gravity of fall down measure
|
uint8_t fall_gravity; // gravity of fall down measure
|
||||||
uint8_t overtime; // occupancy over time or not 0:1
|
uint8_t over_stay_state; // occupancy over time or not 0:1
|
||||||
uint16_t over_stay_duration; // time lenght of overstay in seconds
|
uint16_t over_stay_duration; // time lenght of overstay in seconds
|
||||||
uint8_t battery_Pct; /* % of battery two digits, 88% (00-99)% */
|
uint8_t battery_Pct; /* % of battery two digits, 88% (00-99)% */
|
||||||
uint8_t dutycycletimelevel; /* level=0,255 */
|
uint8_t dutycycletimelevel; /* level=0,255 */
|
||||||
|
|
|
@ -195,7 +195,7 @@ void STS_YunhornSTSEventRFAC_Process(void)
|
||||||
if ((rfac_timer >= STS_BURN_IN_RFAC) && (rfac_timer < (STS_BURN_IN_RFAC +3)))
|
if ((rfac_timer >= STS_BURN_IN_RFAC) && (rfac_timer < (STS_BURN_IN_RFAC +3)))
|
||||||
{
|
{
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n -------------------RFAC Process\r\n");
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n -------------------RFAC Process\r\n");
|
||||||
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, 4, "RFAC");
|
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, 4, (uint8_t *)"RFAC");
|
||||||
}
|
}
|
||||||
if ((rfac_timer > (STS_BURN_IN_RFAC + 2)))
|
if ((rfac_timer > (STS_BURN_IN_RFAC + 2)))
|
||||||
{
|
{
|
||||||
|
@ -514,7 +514,7 @@ void STS_PRESENCE_SENSOR_Init_Send_Data(void)
|
||||||
sts_o7_sensorData.fall_gravity = 0x0;
|
sts_o7_sensorData.fall_gravity = 0x0;
|
||||||
sts_o7_sensorData.event_start_time = 0x0;
|
sts_o7_sensorData.event_start_time = 0x0;
|
||||||
sts_o7_sensorData.event_stop_time = 0x0;
|
sts_o7_sensorData.event_stop_time = 0x0;
|
||||||
sts_o7_sensorData.overtime = 0x0;
|
sts_o7_sensorData.over_stay_state = 0x0;
|
||||||
sts_o7_sensorData.over_stay_duration = 0x0;
|
sts_o7_sensorData.over_stay_duration = 0x0;
|
||||||
sts_o7_sensorData.unconcious_state = 0x0;
|
sts_o7_sensorData.unconcious_state = 0x0;
|
||||||
sts_o7_sensorData.unconcious_duration = 0x0;
|
sts_o7_sensorData.unconcious_duration = 0x0;
|
||||||
|
@ -569,7 +569,7 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso
|
||||||
{
|
{
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n......OVER STAY............\r\n");
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n......OVER STAY............\r\n");
|
||||||
sts_occupancy_overtime_state = 1U;
|
sts_occupancy_overtime_state = 1U;
|
||||||
sensor_data->overtime = sts_occupancy_overtime_state;
|
sensor_data->over_stay_state = sts_occupancy_overtime_state;
|
||||||
sensor_data->over_stay_duration = check_time_tmp;
|
sensor_data->over_stay_duration = check_time_tmp;
|
||||||
|
|
||||||
sts_status_color = STS_RED_BLUE;
|
sts_status_color = STS_RED_BLUE;
|
||||||
|
@ -601,7 +601,7 @@ void STS_PRESENCE_SENSOR_Read(STS_OO_SensorStatusDataTypeDef *oo_data)
|
||||||
oo_data->fall_state = (uint8_t)sts_o7_sensorData.fall_state;
|
oo_data->fall_state = (uint8_t)sts_o7_sensorData.fall_state;
|
||||||
oo_data->event_start_time = (uint32_t)sts_o7_sensorData.event_start_time;
|
oo_data->event_start_time = (uint32_t)sts_o7_sensorData.event_start_time;
|
||||||
oo_data->event_stop_time = (uint32_t)sts_o7_sensorData.event_stop_time;
|
oo_data->event_stop_time = (uint32_t)sts_o7_sensorData.event_stop_time;
|
||||||
oo_data->overtime = (uint8_t)sts_o7_sensorData.overtime;
|
oo_data->over_stay_state = (uint8_t)sts_o7_sensorData.over_stay_state;
|
||||||
oo_data->over_stay_duration = (uint16_t)sts_o7_sensorData.over_stay_duration;
|
oo_data->over_stay_duration = (uint16_t)sts_o7_sensorData.over_stay_duration;
|
||||||
|
|
||||||
oo_data->battery_Pct = (uint8_t)sts_o7_sensorData.battery_Pct;
|
oo_data->battery_Pct = (uint8_t)sts_o7_sensorData.battery_Pct;
|
||||||
|
@ -627,7 +627,7 @@ void STS_PRESENCE_SENSOR_Init(void)
|
||||||
sts_o7_sensorData.dutycycletimelevel = 1;
|
sts_o7_sensorData.dutycycletimelevel = 1;
|
||||||
sts_o7_sensorData.event_start_time = 0;
|
sts_o7_sensorData.event_start_time = 0;
|
||||||
sts_o7_sensorData.event_stop_time = 0;
|
sts_o7_sensorData.event_stop_time = 0;
|
||||||
sts_o7_sensorData.overtime = 0;
|
sts_o7_sensorData.over_stay_state = 0;
|
||||||
sts_o7_sensorData.over_stay_duration = 0;
|
sts_o7_sensorData.over_stay_duration = 0;
|
||||||
|
|
||||||
STS_SENSOR_Power_ON(0);
|
STS_SENSOR_Power_ON(0);
|
||||||
|
|
|
@ -852,7 +852,7 @@ static void SendTxData(void)
|
||||||
#if 1
|
#if 1
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.unconcious_state)&0xff; //11 unconcious state detected or not
|
AppData.Buffer[i++] = (uint8_t)(sensorData.unconcious_state)&0xff; //11 unconcious state detected or not
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_state)&0xff; //12 fall detected or not
|
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_state)&0xff; //12 fall detected or not
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.overtime)&0xff; //13 occupancy over time or not
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_state)&0xff; //13 occupancy over time or not
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration>>8)&0xff; //14 occupancy over time or not
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration>>8)&0xff; //14 occupancy over time or not
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration)&0xff; //15 occupancy over time or not
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration)&0xff; //15 occupancy over time or not
|
||||||
#endif
|
#endif
|
||||||
|
@ -962,6 +962,7 @@ static void OnJoinTimerLedEvent(void *context)
|
||||||
#ifndef STM32WLE5xx
|
#ifndef STM32WLE5xx
|
||||||
HAL_GPIO_TogglePin(LED3_GPIO_Port, LED3_Pin); /* LED_RED */
|
HAL_GPIO_TogglePin(LED3_GPIO_Port, LED3_Pin); /* LED_RED */
|
||||||
#endif
|
#endif
|
||||||
|
HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin); /* STS GREEN */
|
||||||
if ((sts_work_mode != STS_WIRED_MODE))
|
if ((sts_work_mode != STS_WIRED_MODE))
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), CFG_SEQ_Prio_0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue