diff --git a/Core/Inc/sts_lamp_bar.h b/Core/Inc/sts_lamp_bar.h
index fdd98ac..848d190 100644
--- a/Core/Inc/sts_lamp_bar.h
+++ b/Core/Inc/sts_lamp_bar.h
@@ -65,7 +65,7 @@ enum sts_lamp_color {
STS_REDGREEN=0x45, // RED/GREEN FLASH 'E'
STS_BLUEGREEN=0x46 // BLUE/GREEN FLASH 'F'
};
-
+#ifndef SERCO_PWH
#define STS_VACANT_COLOR STS_BLUE
#define STS_OCCUPY_COLOR STS_GREEN
#define STS_SOS_COLOR STS_RED_BLUE
@@ -81,6 +81,26 @@ enum sts_lamp_color {
#define STS_OCCUPANCY_NORMAL_COLOR STS_GREEN
#define STS_OCCUPANCY_STAYLONGER_COLOR STS_YELLOW //NOT REALLY USED, JUST TO ALIGN FOR COLORS PATTERN
#define STS_OCCUPANCY_OVERSTAY_COLOR STS_RED
+
+#else
+#define STS_VACANT_COLOR STS_GREEN
+#define STS_OCCUPY_COLOR STS_RED
+#define STS_SOS_COLOR STS_RED_BLUE
+
+#define STS_FALL_NORMAL_COLOR STS_GREEN
+#define STS_FALL_SUSPICIOUS_COLOR STS_YELLOW
+#define STS_FALL_CONFIRMED_COLOR STS_RED
+
+#define STS_HUMAN_MOVEMENT_MOTIONLESS_NORMAL STS_GREEN
+#define STS_HUMAN_MOVEMENT_MOTIONLESS_SHORT_COLOR STS_YELLOW
+#define STS_HUMAN_MOVEMENT_MOTIONLESS_LONG_COLOR STS_RED
+
+#define STS_OCCUPANCY_NORMAL_COLOR STS_GREEN
+#define STS_OCCUPANCY_STAYLONGER_COLOR STS_YELLOW //NOT REALLY USED, JUST TO ALIGN FOR COLORS PATTERN
+#define STS_OCCUPANCY_OVERSTAY_COLOR STS_BLUE
+
+#endif
+
/*
enum sts_oo_work_mode {
STS_NETWORK_MODE = 0, // 0 NETWORK MODE
diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c
index fe81187..382ab01 100644
--- a/LoRaWAN/App/lora_app.c
+++ b/LoRaWAN/App/lora_app.c
@@ -613,6 +613,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
case BUT1_Pin:
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
HAL_Delay(250);
+ __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
//__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
sts_hall1_read = HALL1_STATE;
if (last_sts_hall1_read != sts_hall1_read) // to eliminate power drop issue of PCB with long REEDSWITCH CABLES
@@ -623,8 +624,8 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
// 2) change lamp bar color
if (sts_hall1_read == STS_Status_Door_Close)
{
- sts_lamp_bar_color = STS_OCCUPANCY_NORMAL_COLOR;
- sts_status_color = STS_OCCUPANCY_NORMAL_COLOR;
+ 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
{
@@ -648,9 +649,9 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
last_sts_hall1_read = sts_hall1_read;
- } else {
- APP_LOG(TS_OFF, VLEVEL_M, "\r\n --- ---- ----- -------- hall 1, door close again \r\n");
- }
+ } //else {
+ //APP_LOG(TS_OFF, VLEVEL_M, "\r\n --- ---- ----- -------- hall 1, door close again \r\n");
+ //}
break;
#ifndef STS_R4
@@ -703,48 +704,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
#if 1
case PIR_Pin:
sts_pir_read = PIR_STATE;
-
-#if 0
- motionDetected = true;
- lastMotionTime = TIMER_IF_GetTimerValue();
- printf("\r\n pir state =%u \r\n", sts_pir_read);
-
-
- //sts_pir_read = PIR_STATE;
-
-
- if (sts_pir_read)
- {
- if (locklow) {
- sts_pir_read = 1;
- locklow = false;
- printf("\r\n Motion detected, PIR state =%d \r\n", sts_pir_read);
- HAL_Delay(50);
- }
- takelowTime=true;
-
- }
- else if (!sts_pir_read)
- {
- //printf("\r\n pir state =%u \r\n", sts_pir_state);
- check_time=TIMER_IF_GetTimerValue();
- if (takelowTime) {
- lowin = check_time;
- printf("\r\n lowin start at: %u \r\n", lowin);
- takelowTime = false;
- }
- //printf("\r\n low duration=%d \r\n", check_time-lowin);
- else if ((!locklow && (check_time - lowin >= 5000))) {
- printf("\r\n low duration=%d \r\n", check_time-lowin);
- sts_pir_read = 0;
- locklow = true;
- printf("\r\n Motion End, PIR state =%d \r\n", sts_pir_read);
-
- }
-
- }
-#endif
-
+ __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
OnSensorPIR1StateChanged();
#endif
//OnSensor3StateChanged();
diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject
index 53b9c46..6abc669 100644
--- a/STM32CubeIDE/.cproject
+++ b/STM32CubeIDE/.cproject
@@ -138,6 +138,7 @@