diff --git a/Core/Inc/sys_conf.h b/Core/Inc/sys_conf.h index 3611754..988f1e8 100644 --- a/Core/Inc/sys_conf.h +++ b/Core/Inc/sys_conf.h @@ -42,7 +42,7 @@ extern "C" { * @brief Temperature and pressure values are retrieved from sensors shield * (instead of sending dummy values). It requires MEMS IKS shield */ -#define SENSOR_ENABLED 1 +#define SENSOR_ENABLED 0 /** * @brief Verbose level for all trace logs @@ -75,7 +75,7 @@ extern "C" { * @brief Enable/Disable MCU Debugger pins (dbg serial wires) * @note by HW serial wires are ON by default, need to put them OFF to save power */ -#define DEBUGGER_ENABLED 0 +#define DEBUGGER_ENABLED 1 /** * @brief Disable Low Power mode diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 752931f..73625c8 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -61,7 +61,7 @@ volatile sts_cfg_nvm_t sts_cfg_nvm={sts_mtmcode1,sts_mtmcode2, sts_version, sts_ volatile uint32_t SamplingPeriodicity = 1000; //unit ms volatile uint32_t HeartBeatPeriodicity = 120000; //unit ms -volatile uint8_t STS_LoRa_WAN_Joined = 0; + volatile uint8_t periodicity_level=0; char outbuf[128]=""; volatile uint8_t upload_message_timer =0; @@ -343,7 +343,7 @@ static LmHandlerParams_t LmHandlerParams = /** * @brief Type of Event to generate application Tx */ -static TxEventType_t EventType = TX_ON_TIMER; //TX_ON_EVENT; //TX_ON_TIMER +static TxEventType_t EventType = TX_ON_EVENT; //TX_ON_EVENT; //TX_ON_TIMER /** * @brief Timer to handle the application Tx @@ -413,6 +413,7 @@ void LoRaWAN_Init(void) /* USER CODE BEGIN LoRaWAN_Init_1 */ APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n##### YUNHORN_STS_FW:%d SWV%d HWV:%d MTM:%d.%d R:%d.%d.%d####\r\n\n\n", FirmwareVersion, sts_version, sts_hardware_ver, sts_mtmcode1,sts_mtmcode2, MajorVer, MinorVer, SubMinorVer); + APP_LOG(TS_OFF, VLEVEL_M, "\r\r\n------------------ V13 HMAC -------------------\r\r\n"); /* Get LoRaWAN APP version*/ APP_LOG(TS_OFF, VLEVEL_M, "APPLICATION_VERSION: V%X.%X.%X\r\n", (uint8_t)(APP_VERSION_MAIN), @@ -498,8 +499,8 @@ void LoRaWAN_Init(void) STS_REBOOT_CONFIG_Init(); - //UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, HeartBeatPeriodicity, UTIL_TIMER_ONESHOT, OnYunhornSTSHeartBeatTimerEvent, NULL); - //UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer); + UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, HeartBeatPeriodicity, UTIL_TIMER_ONESHOT, OnYunhornSTSHeartBeatTimerEvent, NULL); + UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer); /* USER CODE END LoRaWAN_Init_Last */ @@ -514,6 +515,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) #if defined(USE_STM32WLE5) case MEMS_EXTI2_Pin: + APP_LOG(TS_OFF, VLEVEL_M, "\r\n(1) Vibration Sensor EXTI 2 Event \r\n"); break; #endif @@ -543,7 +545,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) #endif #if defined(USE_STM32WLE5) case MEMS_EXTI1_Pin: - //APP_LOG(TS_OFF, VLEVEL_H, "\r\n(3) Vibration Sensor EXTI Event BUT3 3 3 3 \r\n"); //YUNHORN_STS_TODO + APP_LOG(TS_OFF, VLEVEL_M, "\r\n(3) Vibration Sensor EXTI 1 \r\n"); //YUNHORN_STS_TODO mems_int1_detected=1; UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0); @@ -661,7 +663,7 @@ static void OnYunhornSTSHeartBeatTimerEvent(void *context) UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer); - if ((STS_LoRa_WAN_Joined ) && (sts_ac_code[0]==0x0)) + if ((sts_lorawan_joined ) && (sts_ac_code[0]==0x0)) { /* RFAC Challenge */ if (rfac_timer < (STS_BURN_IN_RFAC+3)) { @@ -1628,7 +1630,7 @@ void STS_REBOOT_CONFIG_Init(void) void OnRestoreSTSCFGContextProcess(void) { - uint32_t periodicity_length = (sts_cfg_nvm.periodicity); //TxPeriodicty interval + periodicity_length = (sts_cfg_nvm.periodicity); //TxPeriodicty interval if ((char)sts_cfg_nvm.unit =='M') { periodicity_length *= 60; } else if ((char) sts_cfg_nvm.unit =='H') { diff --git a/LoRaWAN/App/lora_app.h b/LoRaWAN/App/lora_app.h index 4969b8f..f3832b0 100644 --- a/LoRaWAN/App/lora_app.h +++ b/LoRaWAN/App/lora_app.h @@ -68,7 +68,7 @@ extern "C" { /*! * LoRaWAN default class */ -#define LORAWAN_DEFAULT_CLASS CLASS_C +#define LORAWAN_DEFAULT_CLASS CLASS_A /*! * LoRaWAN default confirm state diff --git a/LoRaWAN/Target/lorawan_conf.h b/LoRaWAN/Target/lorawan_conf.h index 644672c..7f6eb8f 100644 --- a/LoRaWAN/Target/lorawan_conf.h +++ b/LoRaWAN/Target/lorawan_conf.h @@ -55,7 +55,7 @@ extern "C" { * @brief LoRaWAN version definition * @note possible values: 0x01000300 or 0x01000400 */ -#define LORAMAC_SPECIFICATION_VERSION 0x01000300 //YUNHORN_STS_MM 2022-10-20 +#define LORAMAC_SPECIFICATION_VERSION 0x01000400 //YUNHORN_STS_MM 2022-10-20 /* Region ------------------------------------*/ /* the region listed here will be linked in the MW code */