diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index d17a762..f7aa3df 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -102,7 +102,7 @@ void STS_YunhornSTSEventP1_Process(void) void STS_YunhornSTSEventP2_Process(void) { - STS_Lamp_Bar_Refresh(); + //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)) { STS_RSS_Smart_Presence_Detection(); diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 73fc2fb..1d2a569 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -146,6 +146,7 @@ typedef enum TxEventType_e /* USER CODE BEGIN PTD */ #define YUNHORN_STS_RSS_WAKEUP_CHECK_TIME SamplingPeriodicity //3000 ms #define YUNHORN_STS_SAMPLING_CHECK_TIME SamplingPeriodicity +#define YUNHORN_STS_HEART_BEAT_CHECK_TIME HeartBeatPeriodicity /* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ @@ -322,6 +323,14 @@ static void OnJoinTimerLedEvent(void *context); static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context); +/** + * @brief Yunhorn STS Heart beat timer callback function + * @param context ptr of context + */ + +static void OnYunhornSTSHeartBeatTimerEvent(void *context); + + /** * @brief Yunhorn STS Heart Beat Periodicity Chagne function * @param duration of periodicty in ms (1/1000 sec) @@ -568,6 +577,13 @@ void LoRaWAN_Init(void) YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSOORSSWakeUpTimerEvent, NULL); UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer); + + UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, + YUNHORN_STS_HEART_BEAT_CHECK_TIME, + UTIL_TIMER_PERIODIC, OnYunhornSTSHeartBeatTimerEvent, NULL); + UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer); + + #else UTIL_TIMER_Create(&YunhornSTSSamplingCheckTimer, YUNHORN_STS_SAMPLING_CHECK_TIME, @@ -1274,6 +1290,22 @@ static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context) } } +/** + * @brief Yunhorn STS Heart beat timer callback function + * @param context ptr of context + */ + +static void OnYunhornSTSHeartBeatTimerEvent(void *context) +{ + heart_beat_timer = 1; + + if (STS_LoRa_WAN_Joined != 0) + { + UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); + + } +} + /** * @brief Yunhorn STS Sensor Live Heart Beat Periodicity/interval Change callback function * @param context ptr of STS Live Heart Beat context