From 70e1bc16d73299229ab638c21861488e47dad078 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Fri, 30 Jun 2023 10:50:43 +0800 Subject: [PATCH] sampling vs heart-beat --- LoRaWAN/App/lora_app.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 1606e55..b8a5e08 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -1665,16 +1665,22 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size) && ((char)tlv_buf[CFG_CMD4] >='0') && ((char)tlv_buf[CFG_CMD4] <='9')) && (((char)tlv_buf[CFG_CMD5] == 'M' || ((char)tlv_buf[CFG_CMD5] =='H') ||((char)tlv_buf[CFG_CMD5] =='S')))) { - uint32_t sampling_periodicity_length = (tlv_buf[CFG_CMD3]-0x30)*10+ (tlv_buf[CFG_CMD4]-0x30); + uint32_t heart_beat_or_sampling_periodicity_length = (tlv_buf[CFG_CMD3]-0x30)*10+ (tlv_buf[CFG_CMD4]-0x30); if ((char)tlv_buf[CFG_CMD5] == 'M') { - sampling_periodicity_length *= 60; + heart_beat_or_sampling_periodicity_length *= 60; } else if ((char)tlv_buf[CFG_CMD5] == 'H') { - sampling_periodicity_length *= 3600; + heart_beat_or_sampling_periodicity_length *= 3600; } - SamplingPeriodicity = sampling_periodicity_length*1000; //translate to 1000ms=1s - OnYunhornSTSSamplingPeriodicityChanged(SamplingPeriodicity); +#ifdef YUNHORN_STS_E0_ENABLED + SamplingPeriodicity = heart_beat_or_sampling_periodicity_length*1000; //translate to 1000ms=1s + OnYunhornSTSSamplingPeriodicityChanged(SamplingPeriodicity); +#endif +#ifdef YUNHORN_STS_R0_ENABLED + HeartBeatPeriodicity = heart_beat_or_sampling_periodicity_length*1000; //translate to 1000ms=1s + OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity); +#endif i = 0; outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD1]; outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD2]; @@ -1694,7 +1700,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size) sts_cfg_nvm.sts_service_mask = (uint8_t)sts_service_mask; OnStoreSTSCFGContextRequest(); - APP_LOG(TS_OFF, VLEVEL_M, "###### YUNHORN Sampling Interval Changed to [ %d ] Seconds\r\n", sampling_periodicity_length); + APP_LOG(TS_OFF, VLEVEL_M, "###### YUNHORN Sampling Or Heart-Beat Interval Changed to [ %d ] Seconds\r\n", heart_beat_or_sampling_periodicity_length); } else { STS_SENSOR_Upload_Config_Invalid_Message();