sampling vs heart-beat

This commit is contained in:
Yunhorn 2023-06-30 10:50:43 +08:00
parent 9e0a206e9b
commit 70e1bc16d7
1 changed files with 12 additions and 6 deletions
LoRaWAN/App

View File

@ -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();