fix heart-beat timer event issue

This commit is contained in:
Yunhorn 2024-04-09 15:30:52 +08:00
parent 8bcf26d9f9
commit c8932353a6
2 changed files with 33 additions and 1 deletions

View File

@ -102,7 +102,7 @@ void STS_YunhornSTSEventP1_Process(void)
void STS_YunhornSTSEventP2_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)) if ((sts_work_mode >= STS_RSS_MODE) && (sts_work_mode <= STS_TOF_RSS_MODE))
{ {
STS_RSS_Smart_Presence_Detection(); STS_RSS_Smart_Presence_Detection();

View File

@ -146,6 +146,7 @@ typedef enum TxEventType_e
/* USER CODE BEGIN PTD */ /* USER CODE BEGIN PTD */
#define YUNHORN_STS_RSS_WAKEUP_CHECK_TIME SamplingPeriodicity //3000 ms #define YUNHORN_STS_RSS_WAKEUP_CHECK_TIME SamplingPeriodicity //3000 ms
#define YUNHORN_STS_SAMPLING_CHECK_TIME SamplingPeriodicity #define YUNHORN_STS_SAMPLING_CHECK_TIME SamplingPeriodicity
#define YUNHORN_STS_HEART_BEAT_CHECK_TIME HeartBeatPeriodicity
/* USER CODE END PTD */ /* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/
@ -322,6 +323,14 @@ static void OnJoinTimerLedEvent(void *context);
static void OnYunhornSTSOORSSWakeUpTimerEvent(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 * @brief Yunhorn STS Heart Beat Periodicity Chagne function
* @param duration of periodicty in ms (1/1000 sec) * @param duration of periodicty in ms (1/1000 sec)
@ -568,6 +577,13 @@ void LoRaWAN_Init(void)
YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, YUNHORN_STS_RSS_WAKEUP_CHECK_TIME,
UTIL_TIMER_PERIODIC, OnYunhornSTSOORSSWakeUpTimerEvent, NULL); UTIL_TIMER_PERIODIC, OnYunhornSTSOORSSWakeUpTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer); UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer,
YUNHORN_STS_HEART_BEAT_CHECK_TIME,
UTIL_TIMER_PERIODIC, OnYunhornSTSHeartBeatTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
#else #else
UTIL_TIMER_Create(&YunhornSTSSamplingCheckTimer, UTIL_TIMER_Create(&YunhornSTSSamplingCheckTimer,
YUNHORN_STS_SAMPLING_CHECK_TIME, 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 * @brief Yunhorn STS Sensor Live Heart Beat Periodicity/interval Change callback function
* @param context ptr of STS Live Heart Beat context * @param context ptr of STS Live Heart Beat context