diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index d8c73f0..206c0c7 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: // RED/BLUE + 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..81f0e26 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -223,9 +223,18 @@ 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,7 +472,12 @@ 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: diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 1de9786..7ab28a0 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -905,7 +905,7 @@ 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 +918,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; @@ -936,7 +936,12 @@ static void SendTxData(void) 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 @@ -1149,18 +1154,12 @@ static void OnYunhornSTSLampBarColorTimerEvent(void *context) } else { if (r_b) { - //__disable_irq(); STS_Lamp_Bar_Set_STS_RGB_Color(high4, DEFAULT_LUMINANCE_LEVEL); - //__enable_irq(); last_sts_lamp_bar_color = high4; - //STS_WS2812B_Refresh(); } else { - //__disable_irq(); STS_Lamp_Bar_Set_STS_RGB_Color(low4, DEFAULT_LUMINANCE_LEVEL); - //__enable_irq(); last_sts_lamp_bar_color = low4; - //STS_WS2812B_Refresh(); } r_b = !r_b; @@ -2583,6 +2582,9 @@ void OnStoreSTSCFGContextRequest(void) nvm_store_value[i++] = sts_cfg_nvm.mtmcode2; nvm_store_value[i++] = sts_cfg_nvm.version; nvm_store_value[i++] = sts_cfg_nvm.hardware_ver; + + APP_LOG(TS_OFF, VLEVEL_L, "\r\n\n\n\n\n STS_CFG_NVM periodicity=%02x unit=%02x \r\n",sts_cfg_nvm.periodicity,sts_cfg_nvm.unit); + nvm_store_value[i++] = sts_cfg_nvm.periodicity; nvm_store_value[i++] = sts_cfg_nvm.unit; nvm_store_value[i++] = sts_cfg_nvm.sampling; @@ -2881,7 +2883,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 1e8df8e..d4c14ca 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ