diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index d8c73f0..94992eb 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -197,6 +197,9 @@ void STS_Lamp_Bar_Set_STS_RGB_Color(uint8_t sts_lamp_color, uint8_t lum) case STS_WHITE: STS_Lamp_Bar_Set_RGB_Color(lum, lum, lum); break; + case STS_COLOR_MAX: + sts_status_color = STS_RED_BLUE; + break; } } diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index 19033cc..96329c2 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -223,9 +223,17 @@ void STS_YunhornSTSEventRFAC_Process(void) void STS_YunhornSTSEventP1_Process(void) { sts_reed_hall_1_result = HALL1_STATE; //sts_hall1_read; + if (sts_reed_hall_1_result != last_sts_reed_hall_1_result) + { + sts_reed_hall_changed_flag = TRUE; + } last_sts_reed_hall_1_result = sts_reed_hall_1_result; sts_reed_hall_2_result = HALL2_STATE;// sts_hall2_read; + if (sts_reed_hall_2_result != last_sts_reed_hall_2_result) + { + sts_reed_hall_changed_flag = TRUE; + } last_sts_reed_hall_2_result = sts_reed_hall_2_result; STS_Combined_Status_Processing(); @@ -463,8 +471,11 @@ void STS_Combined_Status_Processing(void) break; case STS_REEDSWITCH_MODE: - sts_status_color = (sts_reed_hall_result == STS_Status_Door_Open )? STS_GREEN: STS_RED; - + sts_status_color = (sts_reed_hall_1_result == STS_Status_Door_Open )? STS_GREEN: STS_RED; + if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown ) + { + sts_status_color = STS_RED_BLUE; + } break; case STS_RSS_MODE: if (sts_rss_result == STS_RESULT_NO_MOTION){ diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 7f05380..262ace4 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -905,7 +905,8 @@ static void SendTxData(void) } else if (sts_work_mode == STS_UNI_MODE) { AppData.Port = (uint8_t)YUNHORN_STS_O7_LORA_APP_DATA_PORT; - } else if (sts_work_mode == STS_RSS_MODE) { + } else if ((sts_work_mode == STS_RSS_MODE)||(sts_work_mode == STS_REEDSWITCH_MODE)) + { AppData.Port = (uint8_t)YUNHORN_STS_O2_LORA_APP_DATA_PORT; } @@ -918,7 +919,7 @@ static void SendTxData(void) AppData.Port = (uint8_t)YUNHORN_STS_O6_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1; else if (sts_work_mode == STS_UNI_MODE) AppData.Port = (uint8_t)YUNHORN_STS_O7_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1; - else if (sts_work_mode == STS_RSS_MODE) + else if ((sts_work_mode == STS_RSS_MODE)||(sts_work_mode == STS_REEDSWITCH_MODE)) AppData.Port = (uint8_t)YUNHORN_STS_O2_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1; //AppData.Port = (uint8_t)sts_sendhtbtport; //LORAWAN_USER_APP_PORT+1; @@ -929,14 +930,19 @@ static void SendTxData(void) } else if ((sensor_data_ready!= 0U)) //sensor_data_ready for manual push button-1 trigger) { sensor_data_ready =0; - if (sts_work_mode != STS_RSS_MODE) // keep compatible with previous version, PIXEL-NETWORK + if (sts_work_mode > STS_RSS_MODE) // keep compatible with previous version, PIXEL-NETWORK { AppData.Buffer[i++] = (uint8_t)(AppLedStateOn|0x80)&0x0ff; //00 ************ MUST KEEP IT HERE, NON-ZERO ****** } AppData.Buffer[i++] = (uint8_t)(sensorData.lamp_bar_color)&0xff; //01 AppData.Buffer[i++] = (uint8_t)(sensorData.workmode)&0xff; //02 WORK MODE - if (sts_work_mode == STS_RSS_MODE) + if (sts_work_mode == STS_REEDSWITCH_MODE) + { + AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status reed switch + AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor2_on_off)&0xff; //04 Sensor head #2 status reed switch + } + else if (sts_work_mode == STS_RSS_MODE) { AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status reed switch AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor3_on_off)&0xff; //04 Sensor head #3 status RSS motion @@ -2880,7 +2886,7 @@ uint32_t STS_Get_Date_Time_Stamp(void) UnixEpoch.Seconds -= 18; /*removing leap seconds*/ SysTimeLocalTime(UnixEpoch.Seconds, &localtime); - APP_LOG(TS_OFF, VLEVEL_M, "UTC TIME:%02dh%02dm%02ds on %02d/%02d/%04d\r\n", + APP_LOG(TS_OFF, VLEVEL_L, "UTC TIME:%02dh%02dm%02ds on %02d/%02d/%04d\r\n", localtime.tm_hour, localtime.tm_min, localtime.tm_sec, localtime.tm_mday, localtime.tm_mon + 1, localtime.tm_year + 1900); diff --git a/STM32CubeIDE/Release/STS_O7.bin b/STM32CubeIDE/Release/STS_O7.bin index e1abd70..85dfd75 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ