Revert "--- refine STS-R4 txperiod and heart-beat period"

This reverts commit 78e652fd20.
This commit is contained in:
Yunhorn 2024-10-23 20:43:12 +08:00
parent 0a7df45a5c
commit 9b3f200fa5
4 changed files with 18 additions and 27 deletions

View File

@ -104,20 +104,8 @@ int main(void)
MX_I2C2_Init();
MX_DMA_Init();
if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) == RESET)
{
MX_LoRaWAN_Init();
} else
{
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
/* Enable access to RTC domain for following wake-up source configuration */
//HAL_PWR_EnableBkUpAccess();
//__HAL_RCC_RTCAPB_CLK_ENABLE();
}
MX_LoRaWAN_Init();
/* USER CODE BEGIN 2 */
//MX_USART2_UART_Init();
/* USER CODE END 2 */

View File

@ -1107,7 +1107,6 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
LmHandlerParams.IsTxConfirmed = true;
LmHandlerErrorStatus_t status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
if (status ==LORAMAC_HANDLER_SUCCESS ) LmHandlerParams.IsTxConfirmed = false;
}
else
{
@ -1457,26 +1456,28 @@ static void OnYunhornSTSHeartBeatTimerEvent(void *context)
* @brief Yunhorn STS Heart Beat Periodicity Chagne function
* @param duration of periodicty in ms (1/1000 sec)
*/
void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t newperiodicity)
void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity)
{
/* USER CODE BEGIN OnYunhornSTSHeartBeatPeriodicityChanged_1 */
/* USER CODE END OnYunhornSTSHeartBeatPeriodicityChanged_1 */
if (newperiodicity == 0)
if (periodicity == 0)
{
/* Revert to application default Heat-beat periodicity */
newperiodicity = 10*APP_TX_DUTYCYCLE; //10*10 000 ms
periodicity = 10*APP_TX_DUTYCYCLE; //10*10 000 ms
}
/* Update timer YunhornSTSHeartBeatTimer */
UTIL_TIMER_Stop(&YunhornSTSHeartBeatTimer);
UTIL_TIMER_SetPeriod(&YunhornSTSHeartBeatTimer, newperiodicity);
UTIL_TIMER_SetPeriod(&YunhornSTSHeartBeatTimer, periodicity);
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
/* USER CODE BEGIN OnYunhornSTSHeartBeatPeriodicityChanged_2 */
APP_LOG(TS_OFF, VLEVEL_M,"* STS HeartBeatPeriodicity = %u (sec)\r\n", newperiodicity/1000 );
APP_LOG(TS_OFF, VLEVEL_M,"* STS HeartBeatPeriodicity = %u (sec)\r\n", periodicity/1000 );
/* USER CODE END OnYunhornSTSHeartBeatPeriodicityChanged_2 */
}

View File

@ -68,7 +68,7 @@ extern "C" {
/*!
* LoRaWAN default class
*/
#define LORAWAN_DEFAULT_CLASS CLASS_A
#define LORAWAN_DEFAULT_CLASS CLASS_C
/*!
* LoRaWAN default confirm state

View File

@ -1363,11 +1363,7 @@ void USER_APP_AUTO_RESPONDER_Parse(uint8_t *parse_buffer, uint8_t parse_buffer_s
sts_cfg_nvm.sts_service_mask = sts_service_mask;
OnStoreSTSCFGContextRequest();
i=0;
UTIL_MEM_set_8((void*)outbuf, 0x0, sizeof(outbuf));
UTIL_MEM_cpy_8((void*)outbuf,(void*)tlv_buf, parse_buffer_size);
i = parse_buffer_size;
STS_SENSOR_Upload_Message(YUNHORN_STS_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)outbuf);
} else {
sts_service_mask = STS_SERVICE_MASK_L2;
@ -1375,6 +1371,12 @@ void USER_APP_AUTO_RESPONDER_Parse(uint8_t *parse_buffer, uint8_t parse_buffer_s
sts_ac_code[19] =0x0;
}
i=0;
UTIL_MEM_set_8((void*)outbuf, 0x0, sizeof(outbuf));
UTIL_MEM_cpy_8((void*)outbuf,(void*)tlv_buf, parse_buffer_size);
i = parse_buffer_size;
STS_SENSOR_Upload_Message(YUNHORN_STS_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)outbuf);
}
break;
default:
@ -1609,8 +1611,7 @@ void OnRestoreSTSCFGContextProcess(void)
APP_LOG(TS_OFF, VLEVEL_M, "\n\n Tx periodicity in NVM =%u sec\n",periodicity);
TxPeriodicity= periodicity*1000; // to ms
STS_TxPeriod_sec = periodicity;
//STS_TxPeriod_sec=10, STS_HeartBeatTimerPeriod_sec=60;
uint32_t sampling_heartbeat_periodicity = (sts_cfg_nvm.sampling); //Heart-beat or Sampling interval
if ((char)sts_cfg_nvm.s_unit =='M') {
sampling_heartbeat_periodicity *= 60;
@ -1619,6 +1620,7 @@ void OnRestoreSTSCFGContextProcess(void)
} else if ((char) sts_cfg_nvm.s_unit =='S') {
sampling_heartbeat_periodicity *= 1;
}
STS_HeartBeatTimerPeriod_sec = sampling_heartbeat_periodicity;
APP_LOG(TS_OFF, VLEVEL_M, "\n\n sampling or heartbeat periodicity in NVM =%u sec\n",sampling_heartbeat_periodicity);