diff --git a/Core/Src/yunhorn_sts_presence_rss.c b/Core/Src/yunhorn_sts_presence_rss.c index 9786b44..976cfdb 100644 --- a/Core/Src/yunhorn_sts_presence_rss.c +++ b/Core/Src/yunhorn_sts_presence_rss.c @@ -290,13 +290,13 @@ static void print_result(acc_detector_presence_result_t result) { uint32_t detected_zone = (uint32_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH); - APP_LOG(TS_OFF, VLEVEL_H,"Motion in zone: %u, distance: %d, score: %d\n", (unsigned int)detected_zone, + APP_LOG(TS_OFF, VLEVEL_M,"Motion in zone: %u, distance: %d, score: %d\n", (unsigned int)detected_zone, (int)(result.presence_distance * 1000.0f), (int)(result.presence_score * 1000.0f)); } else { - APP_LOG(TS_OFF, VLEVEL_H,"No motion, score: %d\n", (int)(result.presence_score * 1000.0f)); + APP_LOG(TS_OFF, VLEVEL_M,"No motion, score: %d\n", (int)(result.presence_score * 1000.0f)); } } diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index ad11a7b..6b73bf0 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -231,6 +231,7 @@ void STS_YunhornSTSEventP1_Process(void) */ void STS_YunhornSTSEventP2_Process(void) { + STS_Lamp_Bar_Refresh(); //TODO XXX eliminate refresh every second.... try if ((sts_work_mode >= STS_RSS_MODE) && (sts_work_mode <= STS_TOF_RSS_MODE)) { diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index d41391c..02f78bf 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -596,12 +596,14 @@ void LoRaWAN_Init(void) UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_YunhornSTSEventP1_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), UTIL_SEQ_RFU, STS_YunhornSTSEventP2_Process); +#if 1 UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), UTIL_SEQ_RFU, STS_YunhornSTSEventP3_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), UTIL_SEQ_RFU, STS_YunhornSTSEventP4_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), UTIL_SEQ_RFU, STS_YunhornSTSEventP5_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), UTIL_SEQ_RFU, STS_YunhornSTSEventP6_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP7), UTIL_SEQ_RFU, STS_YunhornSTSEventP7_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP8), UTIL_SEQ_RFU, STS_YunhornSTSEventP8_Process); +#endif #ifdef YUNHORN_STS_O7_ENABLED UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer, @@ -1327,8 +1329,8 @@ static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context) if ((STS_LoRa_WAN_Joined != 0)&&(sts_rss_result_changed_flag==1)) { - UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); - + sts_rss_result_changed_flag = 0; + UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); } } @@ -1402,7 +1404,7 @@ static void OnYunhornSTSSamplingPeriodicityChanged(uint32_t periodicity) /* Update timer periodicity */ -#ifdef YUNHORN_STS_O7_ENABLED +#ifdef STS_O7 UTIL_TIMER_Stop(&YunhornSTSRSSWakeUpTimer); UTIL_TIMER_SetPeriod(&YunhornSTSRSSWakeUpTimer, SamplingPeriodicity); UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer); @@ -2275,6 +2277,17 @@ void OnRestoreSTSCFGContextProcess(void) periodicity = (periodicity > 10)? periodicity : 10; // in seconds unit TxPeriodicity= periodicity*1000; // to ms //OnTxPeriodicityChanged(TxPeriodicity); // in msec unit + + uint32_t sampling = (sts_cfg_nvm.sampling); + if ((char)sts_cfg_nvm.s_unit =='M') { + sampling *= 60; + } else if ((char) sts_cfg_nvm.s_unit =='H') { + sampling *= 3600; + } else if ((char) sts_cfg_nvm.s_unit =='S') { + sampling *= 1; + } + sampling= sampling*1000; // to ms + if ((sts_cfg_nvm.ac[0] ==0x0 )&& (sts_cfg_nvm.ac[19]==0x0)) { // ensure it's not in production yet OnTxPeriodicityChanged(APP_TX_DUTYCYCLE); // in msec unit @@ -2288,7 +2301,7 @@ void OnRestoreSTSCFGContextProcess(void) HeartBeatPeriodicity = samplingperiodicity*1000; #endif #if defined(STS_O7)|| defined(STS_O6) ||defined(STS_O5) - OnYunhornSTSSamplingPeriodicityChanged(HeartBeatPeriodicity); // in m-sec unit + OnYunhornSTSSamplingPeriodicityChanged(sampling); // in m-sec unit #endif #if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R4_ENABLED) diff --git a/STM32CubeIDE/Release/STS_O7.bin b/STM32CubeIDE/Release/STS_O7.bin index c65943e..8ecfad6 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ