---minor changes, changed flag not used
This commit is contained in:
parent
9edfa3c816
commit
c68f3c1a4e
|
@ -30,8 +30,8 @@ extern "C" {
|
||||||
#define DEFAULT_SATURATION 50 // 0 - 100 S:Saturation, 0~100
|
#define DEFAULT_SATURATION 50 // 0 - 100 S:Saturation, 0~100
|
||||||
#define DEFAULT_BRIGHTNESS 50 // 0 - 100 V:Value of lightness, 0~100
|
#define DEFAULT_BRIGHTNESS 50 // 0 - 100 V:Value of lightness, 0~100
|
||||||
#define DEFAULT_LUMINANCE_LEVEL (30)
|
#define DEFAULT_LUMINANCE_LEVEL (30)
|
||||||
#define STS_Status_Door_Close (0) //Normal Close NC:Open **2024-07-15 changed
|
#define STS_Status_Door_Close (1) //Normal Close NC:Open **2024-07-15 changed
|
||||||
#define STS_Status_Door_Open (1) //Normal Close NC:Close **2024-07-15 changed
|
#define STS_Status_Door_Open (0) //Normal Close NC:Close **2024-07-15 changed
|
||||||
#define STS_Status_SOS_Pushdown (0) //Normal Open NO:Open
|
#define STS_Status_SOS_Pushdown (0) //Normal Open NO:Open
|
||||||
#define STS_Status_SOS_Release (1) //Normal Open NO:Close
|
#define STS_Status_SOS_Release (1) //Normal Open NO:Close
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ void EXTI0_IRQHandler(void)
|
||||||
|
|
||||||
/* USER CODE END EXTI0_IRQn 0 */
|
/* USER CODE END EXTI0_IRQn 0 */
|
||||||
#ifdef STS_O7
|
#ifdef STS_O7
|
||||||
sts_reed_hall_1_changed = 1;
|
//sts_reed_hall_1_changed = 1;
|
||||||
HAL_GPIO_EXTI_IRQHandler(HALL1_Pin);
|
HAL_GPIO_EXTI_IRQHandler(HALL1_Pin);
|
||||||
#else
|
#else
|
||||||
HAL_GPIO_EXTI_IRQHandler(BUT1_Pin);
|
HAL_GPIO_EXTI_IRQHandler(BUT1_Pin);
|
||||||
|
@ -252,7 +252,7 @@ void EXTI1_IRQHandler(void)
|
||||||
|
|
||||||
/* USER CODE END EXTI1_IRQn 0 */
|
/* USER CODE END EXTI1_IRQn 0 */
|
||||||
#ifdef STS_O7
|
#ifdef STS_O7
|
||||||
sts_reed_hall_2_changed = 1;
|
//sts_reed_hall_2_changed = 1;
|
||||||
HAL_GPIO_EXTI_IRQHandler(HALL2_Pin);
|
HAL_GPIO_EXTI_IRQHandler(HALL2_Pin);
|
||||||
#else
|
#else
|
||||||
HAL_GPIO_EXTI_IRQHandler(BUT2_Pin);
|
HAL_GPIO_EXTI_IRQHandler(BUT2_Pin);
|
||||||
|
|
|
@ -101,7 +101,7 @@ void STS_Lamp_Bar_Set_Dark(void)
|
||||||
|
|
||||||
void STS_WS2812B_Refresh(void)
|
void STS_WS2812B_Refresh(void)
|
||||||
{
|
{
|
||||||
HAL_TIM_PWM_Start_DMA(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL, (uint32_t *)&rgb_buf, (RESET_PULSE+WS2812B_DATA_LEN+1));
|
HAL_TIM_PWM_Start_DMA(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL, (uint32_t *)&rgb_buf, (uint16_t)(RESET_PULSE+WS2812B_DATA_LEN+1));
|
||||||
|
|
||||||
HAL_TIM_PWM_Start_IT(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL);
|
HAL_TIM_PWM_Start_IT(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL);
|
||||||
}
|
}
|
||||||
|
@ -151,9 +151,9 @@ void STS_WS2812B_Set_RGB(uint8_t R, uint8_t G, uint8_t B, uint8_t idx)
|
||||||
{
|
{
|
||||||
for (uint8_t j = 0; j < 8; j ++)
|
for (uint8_t j = 0; j < 8; j ++)
|
||||||
{
|
{
|
||||||
rgb_buf.GRB[idx*24+j] = (G&(0X80)>>j)? ONE_PULSE : ZERO_PULSE;
|
rgb_buf.GRB[idx*24+j] = (uint16_t)((G&(0X80)>>j)? ONE_PULSE : ZERO_PULSE);
|
||||||
rgb_buf.GRB[idx*24+8+j] = (R&(0X80)>>j)? ONE_PULSE : ZERO_PULSE;
|
rgb_buf.GRB[idx*24+8+j] = (uint16_t)((R&(0X80)>>j)? ONE_PULSE : ZERO_PULSE);
|
||||||
rgb_buf.GRB[idx*24+16+j] = (B&(0X80)>>j)? ONE_PULSE : ZERO_PULSE;
|
rgb_buf.GRB[idx*24+16+j] = (uint16_t)((B&(0X80)>>j)? ONE_PULSE : ZERO_PULSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CHANGED AT 2023-05-10
|
// CHANGED AT 2023-05-10
|
||||||
|
@ -164,8 +164,8 @@ void STS_WS2812B_Set_RGB(uint8_t R, uint8_t G, uint8_t B, uint8_t idx)
|
||||||
|
|
||||||
void STS_Lamp_Bar_Set_RGB_Color(uint8_t red, uint8_t green, uint8_t blue )
|
void STS_Lamp_Bar_Set_RGB_Color(uint8_t red, uint8_t green, uint8_t blue )
|
||||||
{
|
{
|
||||||
//HAL_Delay(1);
|
HAL_Delay(1);
|
||||||
memset((void*)rgb_buf.GRB,0x0,(2*24*STS_LAMP_BAR_LED_NUM));
|
UTIL_MEM_set_8((void*)rgb_buf.GRB,0x0,(2*24*STS_LAMP_BAR_LED_NUM));
|
||||||
|
|
||||||
for(uint8_t i = 0; i < STS_LAMP_BAR_LED_NUM; i++)
|
for(uint8_t i = 0; i < STS_LAMP_BAR_LED_NUM; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ volatile float sts_distance_rss_distance, sts_sensor_install_height=0;//in mm
|
||||||
extern volatile float sts_presence_rss_distance, sts_presence_rss_score;
|
extern volatile float sts_presence_rss_distance, sts_presence_rss_score;
|
||||||
extern volatile uint8_t sts_hall1_read,sts_hall2_read;
|
extern volatile uint8_t sts_hall1_read,sts_hall2_read;
|
||||||
volatile uint8_t sts_reed_hall_1_result=STS_Status_Door_Open,sts_reed_hall_2_result=STS_Status_SOS_Release, last_sts_reed_hall_1_result=STS_Status_Door_Open, last_sts_reed_hall_2_result=STS_Status_SOS_Release;
|
volatile uint8_t sts_reed_hall_1_result=STS_Status_Door_Open,sts_reed_hall_2_result=STS_Status_SOS_Release, last_sts_reed_hall_1_result=STS_Status_Door_Open, last_sts_reed_hall_2_result=STS_Status_SOS_Release;
|
||||||
volatile uint8_t sts_reed_hall_1_changed=0, sts_reed_hall_2_changed=0;
|
|
||||||
volatile uint8_t sts_rss_config_updated_flag = 0;
|
volatile uint8_t sts_rss_config_updated_flag = 0;
|
||||||
extern volatile uint8_t mems_int1_detected, link_wakeup, link_sleep;
|
extern volatile uint8_t mems_int1_detected, link_wakeup, link_sleep;
|
||||||
volatile uint32_t event_start_time=0, event_stop_time=0;
|
volatile uint32_t event_start_time=0, event_stop_time=0;
|
||||||
|
@ -221,14 +221,16 @@ void STS_YunhornSTSEventRFAC_Process(void)
|
||||||
void STS_YunhornSTSEventP1_Process(void)
|
void STS_YunhornSTSEventP1_Process(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (sts_reed_hall_1_changed) {
|
|
||||||
|
{
|
||||||
sts_reed_hall_1_result = HALL1_STATE; //sts_hall1_read;
|
sts_reed_hall_1_result = HALL1_STATE; //sts_hall1_read;
|
||||||
sts_reed_hall_1_changed =0;
|
|
||||||
last_sts_reed_hall_1_result = sts_reed_hall_1_result;
|
last_sts_reed_hall_1_result = sts_reed_hall_1_result;
|
||||||
}
|
}
|
||||||
if (sts_reed_hall_2_changed){
|
|
||||||
|
{
|
||||||
sts_reed_hall_2_result = HALL2_STATE;// sts_hall2_read;
|
sts_reed_hall_2_result = HALL2_STATE;// sts_hall2_read;
|
||||||
sts_reed_hall_2_changed =0;
|
|
||||||
last_sts_reed_hall_2_result = sts_reed_hall_2_result;
|
last_sts_reed_hall_2_result = sts_reed_hall_2_result;
|
||||||
}
|
}
|
||||||
STS_Combined_Status_Processing();
|
STS_Combined_Status_Processing();
|
||||||
|
@ -553,8 +555,10 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso
|
||||||
// no_movement or unconcious duration
|
// no_movement or unconcious duration
|
||||||
sensor_data->unconscious_duration = sts_o7_sensorData.event_sensor3_unconcious_duration;
|
sensor_data->unconscious_duration = sts_o7_sensorData.event_sensor3_unconcious_duration;
|
||||||
sensor_data->no_movement_duration = sts_o7_sensorData.event_sensor3_no_movement_duration;
|
sensor_data->no_movement_duration = sts_o7_sensorData.event_sensor3_no_movement_duration;
|
||||||
|
if (sensor_data->over_stay_state !=0)
|
||||||
|
{
|
||||||
APP_LOG(TS_OFF,VLEVEL_L,"\r\n ... Over Stay Duration = %u Sec [Threshold: %u Seconds]\r\n", sensor_data->over_stay_duration, sts_occupancy_overtime_threshold_in_10min*60);
|
APP_LOG(TS_OFF,VLEVEL_L,"\r\n ... Over Stay Duration = %u Sec [Threshold: %u Seconds]\r\n", sensor_data->over_stay_duration, sts_occupancy_overtime_threshold_in_10min*60);
|
||||||
|
}
|
||||||
|
|
||||||
sensor_data->fall_state = sts_fall_rising_detected_result;
|
sensor_data->fall_state = sts_fall_rising_detected_result;
|
||||||
if (sts_fall_rising_detected_result == STS_PRESENCE_FALL)
|
if (sts_fall_rising_detected_result == STS_PRESENCE_FALL)
|
||||||
|
@ -891,6 +895,7 @@ void OnSensor2StateChanged(void)
|
||||||
{
|
{
|
||||||
sts_o7_sensorData.event_sensor2_start_time = sensor_event_time.Seconds;
|
sts_o7_sensorData.event_sensor2_start_time = sensor_event_time.Seconds;
|
||||||
sts_o7_sensorData.event_sensor2_duration = 0;
|
sts_o7_sensorData.event_sensor2_duration = 0;
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_L, "SOS PushDown ---Timer start: %u\r\n",sts_o7_sensorData.event_sensor2_start_time );
|
||||||
}else if (sts_hall2_read==STS_Status_SOS_Release)
|
}else if (sts_hall2_read==STS_Status_SOS_Release)
|
||||||
{
|
{
|
||||||
sts_o7_sensorData.event_sensor2_start_time =0;
|
sts_o7_sensorData.event_sensor2_start_time =0;
|
||||||
|
|
|
@ -55,7 +55,7 @@ extern hmac_result_t hmac_result;
|
||||||
extern volatile uint8_t sts_reed_hall_ext_int;
|
extern volatile uint8_t sts_reed_hall_ext_int;
|
||||||
extern volatile uint8_t sts_hall1_read, sts_hall2_read;
|
extern volatile uint8_t sts_hall1_read, sts_hall2_read;
|
||||||
volatile uint8_t last_sts_hall1_read=STS_Status_Door_Open, last_sts_hall2_read=STS_Status_SOS_Release;
|
volatile uint8_t last_sts_hall1_read=STS_Status_Door_Open, last_sts_hall2_read=STS_Status_SOS_Release;
|
||||||
extern volatile uint8_t sts_reed_hall_1_changed, sts_reed_hall_2_changed;
|
|
||||||
volatile uint8_t sts_reed_hall_result =0, sts_emergency_button_pushed=0; // inital 0 = close
|
volatile uint8_t sts_reed_hall_result =0, sts_emergency_button_pushed=0; // inital 0 = close
|
||||||
extern volatile uint8_t sts_work_mode, sts_cloud_netcolor, sts_lamp_bar_color, sts_status_color;
|
extern volatile uint8_t sts_work_mode, sts_cloud_netcolor, sts_lamp_bar_color, sts_status_color;
|
||||||
extern volatile uint8_t sts_lamp_bar_flashing_color;
|
extern volatile uint8_t sts_lamp_bar_flashing_color;
|
||||||
|
@ -145,8 +145,8 @@ extern volatile float sts_distance_rss_distance, sts_sensor_install_height;
|
||||||
//#define STS_Status_Door_Open (0) //Normal Close NC:Close **2024-07-15 changed
|
//#define STS_Status_Door_Open (0) //Normal Close NC:Close **2024-07-15 changed
|
||||||
|
|
||||||
char sts_door_status_code[2][10]={
|
char sts_door_status_code[2][10]={
|
||||||
"Close",
|
"Open ",
|
||||||
"Open "
|
"Close"
|
||||||
};
|
};
|
||||||
char sts_sos_status_code[2][10]={
|
char sts_sos_status_code[2][10]={
|
||||||
"PushDown",
|
"PushDown",
|
||||||
|
@ -701,16 +701,16 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
{
|
{
|
||||||
#if defined(STS_O6)||defined(STS_O7)
|
#if defined(STS_O6)||defined(STS_O7)
|
||||||
case HALL1_Pin:
|
case HALL1_Pin:
|
||||||
if (sts_reed_hall_1_changed)
|
|
||||||
{
|
{
|
||||||
sts_hall1_read = HALL1_STATE;
|
sts_hall1_read = HALL1_STATE;
|
||||||
HAL_Delay(30); //de-bouncing
|
HAL_Delay(30); //de-bouncing
|
||||||
|
|
||||||
if (sts_hall1_read == HALL1_STATE)
|
if (sts_hall1_read == HALL1_STATE)
|
||||||
{
|
{
|
||||||
SysTime_t current_event_time = SysTimeGetMcuTime();
|
//SysTime_t current_event_time = SysTimeGetMcuTime();
|
||||||
if ((last_sts_hall1_read !=sts_hall1_read) && ((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_start_time)>5)
|
//if ((last_sts_hall1_read !=sts_hall1_read) && ((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_start_time)>5)
|
||||||
&&((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_stop_time)>5))
|
// &&((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_stop_time)>5))
|
||||||
{
|
{
|
||||||
//if (((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_start_time) > 5) || ((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_stop_time) > 5))
|
//if (((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_start_time) > 5) || ((current_event_time.Seconds - sts_o7_sensorData.event_sensor1_stop_time) > 5))
|
||||||
// if (last_sts_hall1_read !=sts_hall1_read)
|
// if (last_sts_hall1_read !=sts_hall1_read)
|
||||||
|
@ -724,7 +724,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||||
}
|
}
|
||||||
//sts_reed_hall_1_changed =0;
|
|
||||||
last_sts_hall1_read = sts_hall1_read;
|
last_sts_hall1_read = sts_hall1_read;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HALL2_Pin:
|
case HALL2_Pin:
|
||||||
if (sts_reed_hall_2_changed)
|
|
||||||
{
|
{
|
||||||
sts_hall2_read = HALL2_STATE;
|
sts_hall2_read = HALL2_STATE;
|
||||||
HAL_Delay(30); //de-bouncing
|
HAL_Delay(30); //de-bouncing
|
||||||
|
@ -749,7 +749,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
//sensor_data_ready =1;
|
//sensor_data_ready =1;
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||||
//sts_reed_hall_2_changed =0;
|
|
||||||
}
|
}
|
||||||
last_sts_hall2_read = sts_hall2_read;
|
last_sts_hall2_read = sts_hall2_read;
|
||||||
}
|
}
|
||||||
|
@ -1156,10 +1156,6 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
||||||
if (STS_Status_Door_Close==sts_hall1_read)
|
if (STS_Status_Door_Close==sts_hall1_read)
|
||||||
{
|
{
|
||||||
sts_o7_sensorData.event_sensor1_duration = current_time.Seconds - sts_o7_sensorData.event_sensor1_start_time;
|
sts_o7_sensorData.event_sensor1_duration = current_time.Seconds - sts_o7_sensorData.event_sensor1_start_time;
|
||||||
} else {
|
|
||||||
sts_o7_sensorData.event_sensor1_duration = 0;
|
|
||||||
sts_o7_sensorData.over_stay_state = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
//if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
||||||
if (sts_o7_sensorData.event_sensor1_duration > (sts_occupancy_overtime_threshold_in_10min*60)) //for debug
|
if (sts_o7_sensorData.event_sensor1_duration > (sts_occupancy_overtime_threshold_in_10min*60)) //for debug
|
||||||
|
@ -1169,11 +1165,14 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
||||||
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\nSensor 1 Over Stay State=%d, Duration= %d Sec, Threshold =%u \r\n", sts_o7_sensorData.over_stay_state,(sts_o7_sensorData.over_stay_duration),(sts_occupancy_overtime_threshold_in_10min*60) );
|
APP_LOG(TS_OFF, VLEVEL_L, "\r\nSensor 1 Over Stay State=%d, Duration= %d Sec, Threshold =%u \r\n", sts_o7_sensorData.over_stay_state,(sts_o7_sensorData.over_stay_duration),(sts_occupancy_overtime_threshold_in_10min*60) );
|
||||||
sts_lamp_bar_color = STS_RED_DARK;
|
sts_lamp_bar_color = STS_RED_DARK;
|
||||||
sts_lamp_bar_flashing_color = 0x20;
|
//sts_lamp_bar_flashing_color = 0x20;
|
||||||
//volatile uint8_t sts_lamp_bar_color = STS_GREEN; //puColor
|
//volatile uint8_t sts_lamp_bar_color = STS_GREEN; //puColor
|
||||||
//volatile uint8_t sts_lamp_bar_flashing_color = 0x23; // RED_BLUE;
|
//volatile uint8_t sts_lamp_bar_flashing_color = 0x23; // RED_BLUE;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
sts_o7_sensorData.event_sensor1_duration =0;
|
||||||
|
|
||||||
sts_o7_sensorData.over_stay_state = 0;
|
sts_o7_sensorData.over_stay_state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1181,12 +1180,6 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
||||||
if (STS_Status_SOS_Pushdown==sts_hall2_read)
|
if (STS_Status_SOS_Pushdown==sts_hall2_read)
|
||||||
{
|
{
|
||||||
sts_o7_sensorData.event_sensor2_duration = current_time.Seconds - sts_o7_sensorData.event_sensor2_start_time;
|
sts_o7_sensorData.event_sensor2_duration = current_time.Seconds - sts_o7_sensorData.event_sensor2_start_time;
|
||||||
} else {
|
|
||||||
sts_o7_sensorData.event_sensor2_duration =0;
|
|
||||||
//sts_o7_sensorData.over_stay_state = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
//if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
||||||
if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*60) //for debug
|
if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*60) //for debug
|
||||||
{
|
{
|
||||||
sts_o7_sensorData.over_stay_state = 1;
|
sts_o7_sensorData.over_stay_state = 1;
|
||||||
|
@ -1196,20 +1189,25 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
||||||
}
|
}
|
||||||
// to be defiend later for SOS threshold TODO XXXX
|
// to be defiend later for SOS threshold TODO XXXX
|
||||||
|
|
||||||
|
} else {
|
||||||
|
sts_o7_sensorData.event_sensor2_duration =0;
|
||||||
|
//sts_o7_sensorData.over_stay_state = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (sts_rss_result==STS_RESULT_MOTION)
|
if (sts_rss_result==STS_RESULT_MOTION)
|
||||||
{
|
{
|
||||||
sts_o7_sensorData.event_sensor3_motion_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_motion_start_time;
|
sts_o7_sensorData.event_sensor3_motion_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_motion_start_time;
|
||||||
} else {
|
|
||||||
sts_o7_sensorData.event_sensor3_motion_duration =0;
|
|
||||||
sts_o7_sensorData.occupancy_over_stay_state = 0;
|
|
||||||
}
|
|
||||||
//if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
//if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
||||||
if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min) //for debug
|
if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min) //for debug
|
||||||
{
|
{
|
||||||
sts_o7_sensorData.occupancy_over_stay_state = 1;
|
sts_o7_sensorData.occupancy_over_stay_state = 1;
|
||||||
sts_o7_sensorData.occupancy_duration =sts_o7_sensorData.event_sensor3_motion_duration;
|
sts_o7_sensorData.occupancy_duration =sts_o7_sensorData.event_sensor3_motion_duration;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
sts_o7_sensorData.event_sensor3_motion_duration =0;
|
||||||
|
//sts_o7_sensorData.occupancy_over_stay_state = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
STS_PRESENCE_NONE=0,
|
STS_PRESENCE_NONE=0,
|
||||||
|
|
Loading…
Reference in New Issue