diff --git a/Core/Src/sts_cmox_hmac_sha.c b/Core/Src/sts_cmox_hmac_sha.c index ed4438e..91acbf9 100644 --- a/Core/Src/sts_cmox_hmac_sha.c +++ b/Core/Src/sts_cmox_hmac_sha.c @@ -42,22 +42,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; @@ -2051,16 +2042,25 @@ void OnRestoreSTSCFGContextProcess(void) samplingperiodicity *= 1; } - //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 ((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); -#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED) - OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity); -#endif + } 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)||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; @@ -2073,7 +2073,6 @@ void OnRestoreSTSCFGContextProcess(void) sts_occupancy_overtime_threshold = (uint8_t)sts_cfg_nvm.occupancy_overtime_threshold*10; // minutes #endif - for (uint8_t j=0; j< YUNHORN_STS_AC_CODE_SIZE; j++) { sts_ac_code[j] = sts_cfg_nvm.ac[j]; diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index c670f75..75fbda9 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -140,7 +140,6 @@