diff --git a/Core/Src/main.c b/Core/Src/main.c index 3e0fcae..390eb02 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -20,7 +20,7 @@ #include "main.h" #include "app_lorawan.h" #include "gpio.h" -#include +//#include /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ #include "i2c.h" diff --git a/Core/Src/usart.c b/Core/Src/usart.c index 64cf905..29a8855 100644 --- a/Core/Src/usart.c +++ b/Core/Src/usart.c @@ -41,7 +41,7 @@ void MX_USART2_UART_Init(void) /* USER CODE END USART2_Init 1 */ huart2.Instance = USART2; -#ifdef L8 +#if defined(L8)||defined(STS_P2) huart2.Init.BaudRate = 460800; #else huart2.Init.BaudRate = 115200; diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index e30b13c..2d04230 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -538,7 +538,8 @@ void LoRaWAN_Init(void) #endif #if defined(STS_P2)||defined(STS_T6)||defined(L8) - UTIL_TIMER_Create(&YunhornSTSWakeUpScanTimer, STS_TOFScanPeriod_msec, UTIL_TIMER_ONESHOT, (void*)OnYunhornSTSWakeUpScanTimerEvent, NULL); + //UTIL_TIMER_Create(&YunhornSTSWakeUpScanTimer, STS_TOFScanPeriod_msec, UTIL_TIMER_PERIODIC, (void*)OnYunhornSTSWakeUpScanTimerEvent, NULL); + UTIL_TIMER_Create(&YunhornSTSWakeUpScanTimer, STS_TOFScanPeriod_msec, UTIL_TIMER_PERIODIC, (void*)STS_TOF_VL53LX_PeopleCounting_Process_Start, NULL); UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer); #endif @@ -1103,9 +1104,19 @@ static void OnTxTimerEvent(void *context) #elif (defined(STS_R1D)||defined(STS_R5)||defined(STS_R1)) APP_LOG(TS_OFF, VLEVEL_H, "\nSET TASK P4\r\n"); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0); +#elif (defined(STS_P2)) + + UTIL_TIMER_Stop(&YunhornSTSWakeUpScanTimer); + + APP_LOG(TS_OFF, VLEVEL_M, "\r\nTxTimer Event \r\n"); #endif - UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); + UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); + + +#if (defined(STS_P2)) + UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer); +#endif /*Wait for next tx slot*/ UTIL_TIMER_Start(&TxTimer); @@ -1571,7 +1582,7 @@ static void OnYunhornSTSWakeUpScanTimerEvent(void *context) #if defined(STS_P2)||defined(STS_T6)||defined(L8) UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), CFG_SEQ_Prio_0); - UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer); + //UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer); #endif } diff --git a/LoRaWAN/App/lora_app.h b/LoRaWAN/App/lora_app.h index ae4a403..52f4d16 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_A +#define LORAWAN_DEFAULT_CLASS CLASS_C /*! * LoRaWAN default confirm state diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index 1e6f094..61e853c 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -99,7 +99,7 @@ - + @@ -136,7 +136,7 @@