diff --git a/Core/Src/sts_cmox_hmac_sha.c b/Core/Src/sts_cmox_hmac_sha.c index ac73c59..270e9c7 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,13 @@ 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;iBufferSize == 1) @@ -984,8 +1004,9 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams) STS_LoRa_WAN_Joined = (uint8_t) joinParams->Mode; - //APP_LOG(TS_OFF, VLEVEL_M,"\r\n STS_LoRa_WAN_Joined = %d \r\n", STS_LoRa_WAN_Joined); - + OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity); + OnTxPeriodicityChanged(TxPeriodicity); + APP_LOG(TS_OFF, VLEVEL_L,"\r\n STS_LoRa_WAN_Joined = %s \r\n", (STS_LoRa_WAN_Joined == 1)?"ABP":"OTAA"); } else { @@ -994,6 +1015,7 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams) APP_LOG(TS_OFF, VLEVEL_H, "###### U/L FRAME:JOIN | DR:%d | PWR:%d\r\n", joinParams->Datarate, joinParams->TxPower); } + UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); /* USER CODE END OnJoinRequest_1 */ } @@ -1253,33 +1275,34 @@ static void OnYunhornSTSOORSSWakeUpTimerEvent(void *context) } /** - * @brief Yunhorn STS Sensor Heart Beat Timer callback function - * @param context ptr of STS Sampling Check context - */ -/* -static void OnYunhornSTSHeartBeatTimerEvent(void *context) + * @brief Yunhorn STS Sensor Live Heart Beat Periodicity/interval Change callback function + * @param context ptr of STS Live Heart Beat context + * YL x x x + * */ + +static void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity) { - if (STS_LoRa_WAN_Joined ) - { + /* USER CODE BEGIN OnTxPeriodicityChanged_1 */ - heart_beat_timer = 1; - UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); + /* USER CODE END OnTxPeriodicityChanged_1 */ + HeartBeatPeriodicity = periodicity; - if (sts_ac_code[0]==0x0) { - // RFAC Challenge - if (rfac_timer < (STS_BURN_IN_RFAC+3)) { - rfac_timer ++; - } - UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), CFG_SEQ_Prio_0); - } + if (HeartBeatPeriodicity == 0) + { + /* Revert to application default periodicity */ + HeartBeatPeriodicity = 10*APP_TX_DUTYCYCLE; + } + /* Update timer periodicity */ - UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer); - - } + UTIL_TIMER_Stop(&YunhornSTSHeartBeatTimer); + UTIL_TIMER_SetPeriod(&YunhornSTSHeartBeatTimer, HeartBeatPeriodicity); + UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer); + /* USER CODE BEGIN OnTxPeriodicityChanged_2 */ + APP_LOG(TS_OFF, VLEVEL_H,"**************** HeartBeatPeriodicity Changed to: %u (ms)\r\n", HeartBeatPeriodicity ); + /* USER CODE END OnTxPeriodicityChanged_2 */ } -*/ /** * @brief Yunhorn STS Sensor Sampling Periodicity/interval Change callback function diff --git a/STM32CubeIDE/Release/STS_O7.bin b/STM32CubeIDE/Release/STS_O7.bin index 59f7cfd..a4812ef 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ