From b8b4e6a1445fec590387de72a1eab0e7c5ce96c1 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Wed, 8 Nov 2023 17:51:55 +0800 Subject: [PATCH] revised RFAC process --- Core/Src/sts_cmox_hmac_sha.c | 18 ++++++------------ LoRaWAN/App/lora_app.c | 31 +++++++++++++++---------------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/Core/Src/sts_cmox_hmac_sha.c b/Core/Src/sts_cmox_hmac_sha.c index ed4438e..195d98f 100644 --- a/Core/Src/sts_cmox_hmac_sha.c +++ b/Core/Src/sts_cmox_hmac_sha.c @@ -34,7 +34,6 @@ hmac_result_t hmac_result; uint32_t sts_hmac_verify(void) { - uint8_t i=0; uint8_t uid[8]=""; uint32_t ret=0; hmac_result.ac_pass = 60; @@ -42,22 +41,17 @@ uint32_t sts_hmac_verify(void) GetUniqueId(uid); ret = sts_hmac_sha1((const uint8_t *) mKey, sizeof(mKey), (const uint8_t*)(uid+4), 4, &hmac_result); +/* for (i=0;i 10)? periodicity : 10; // in seconds unit TxPeriodicity= periodicity*1000; // to ms - if ((sts_cfg_nvm.ac[0] ==0x0 )&& (sts_cfg_nvm.ac[19]==0x0)) - { - OnTxPeriodicityChanged(APP_TX_DUTYCYCLE); // in msec unit - - } else - { // ensure it's not in production yet - OnTxPeriodicityChanged(TxPeriodicity); // in msec unit - } - uint32_t samplingperiodicity = (sts_cfg_nvm.sampling); //Heart-beat or Sampling interval if ((char)sts_cfg_nvm.s_unit =='M') { samplingperiodicity *= 60; @@ -2048,16 +2039,24 @@ void OnRestoreSTSCFGContextProcess(void) samplingperiodicity *= 1; } - //Heart-beat or Sampling interval - samplingperiodicity = (samplingperiodicity > 0)? samplingperiodicity : 1; // in seconds unit - HeartBeatPeriodicity = samplingperiodicity*1000; + 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 + OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity); + } else + { + OnTxPeriodicityChanged(TxPeriodicity); // in msec unit + //Heart-beat or Sampling interval + samplingperiodicity = (samplingperiodicity > 0)? samplingperiodicity : 1; // in seconds unit + HeartBeatPeriodicity = samplingperiodicity*1000; #if defined(YUNHORN_STS_O6_ENABLED) ||defined(YUNHORN_STS_O5_ENABLED) OnYunhornSTSSamplingPeriodicityChanged(HeartBeatPeriodicity); // in m-sec unit #endif -#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED) +#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R4_ENABLED) OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity); #endif + } sts_work_mode = sts_cfg_nvm.work_mode; sts_service_mask = sts_cfg_nvm.sts_service_mask;