revised PIR and door open/close lamp bar color logic
This commit is contained in:
parent
535665dc25
commit
b955c1bdb4
|
@ -686,24 +686,26 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
|
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
|
||||||
//__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
|
//__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
|
||||||
sts_hall1_read = HALL1_STATE;
|
sts_hall1_read = HALL1_STATE;
|
||||||
|
if (sts_hall1_read == STS_Status_Door_Close)
|
||||||
|
{
|
||||||
|
sts_lamp_bar_color = STS_OCCUPY_COLOR;
|
||||||
|
sts_status_color = STS_OCCUPY_COLOR;
|
||||||
|
// APP_LOG(TS_OFF, VLEVEL_M,"\r\n EXIT_CALLBACK, Door CLOSED: sts status color =%d, lampbar_color=%d \r\n", sts_status_color, sts_lamp_bar_color);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
//sts_lamp_bar_color = prev_color;
|
||||||
|
sts_status_color = STS_VACANT_COLOR;
|
||||||
|
sts_lamp_bar_color = STS_VACANT_COLOR;
|
||||||
|
// APP_LOG(TS_OFF, VLEVEL_M,"\r\n EXTI_CALLBACK, Door Open: sts status color =%d, lampbar_color=%d \r\n", sts_status_color, sts_lamp_bar_color);
|
||||||
|
}
|
||||||
|
|
||||||
if (last_sts_hall1_read != sts_hall1_read) // to eliminate power drop issue of PCB with long REEDSWITCH CABLES
|
if (last_sts_hall1_read != sts_hall1_read) // to eliminate power drop issue of PCB with long REEDSWITCH CABLES
|
||||||
{
|
{
|
||||||
// 1) record event start/stop time
|
// 1) record event start/stop time
|
||||||
APP_LOG(TS_OFF, VLEVEL_M,"\r\n EXIT_CALLBACK, Door state =%d \r\n", sts_hall1_read);
|
APP_LOG(TS_OFF, VLEVEL_M,"\r\n EXIT_CALLBACK, Door state =%d \r\n", sts_hall1_read);
|
||||||
OnSensor1StateChanged();
|
OnSensor1StateChanged();
|
||||||
// 2) change lamp bar color
|
// 2) change lamp bar color
|
||||||
if (sts_hall1_read == STS_Status_Door_Close)
|
|
||||||
{
|
|
||||||
sts_lamp_bar_color = STS_OCCUPY_COLOR;
|
|
||||||
sts_status_color = STS_OCCUPY_COLOR;
|
|
||||||
// APP_LOG(TS_OFF, VLEVEL_M,"\r\n EXIT_CALLBACK, Door CLOSED: sts status color =%d, lampbar_color=%d \r\n", sts_status_color, sts_lamp_bar_color);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
//sts_lamp_bar_color = prev_color;
|
|
||||||
sts_status_color = STS_VACANT_COLOR;
|
|
||||||
sts_lamp_bar_color = STS_VACANT_COLOR;
|
|
||||||
// APP_LOG(TS_OFF, VLEVEL_M,"\r\n EXTI_CALLBACK, Door Open: sts status color =%d, lampbar_color=%d \r\n", sts_status_color, sts_lamp_bar_color);
|
|
||||||
}
|
|
||||||
// 3) combine states and colors
|
// 3) combine states and colors
|
||||||
//STS_YunhornSTSEventP1_Process();
|
//STS_YunhornSTSEventP1_Process();
|
||||||
//STS_Combined_Status_Processing();
|
//STS_Combined_Status_Processing();
|
||||||
|
@ -818,7 +820,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||||
}
|
}
|
||||||
// HAL_Delay(50);
|
// HAL_Delay(50);
|
||||||
//__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
|
//__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
|
||||||
// APP_LOG(TS_OFF, VLEVEL_M, "\r\nMotion Detection result=%d \r\n", sts_pir_state);
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\nMotion Detection result=%d \r\n", sts_pir_read);
|
||||||
OnSensorPIR1StateChanged();
|
OnSensorPIR1StateChanged();
|
||||||
|
|
||||||
if ( sts_pir_state_changed == 1)
|
if ( sts_pir_state_changed == 1)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue