From 91d43020c86b3e976212fd44f3ebdd863aeb99ac Mon Sep 17 00:00:00 2001
From: YunHorn Technology <dp.s@yunhorn.com>
Date: Fri, 23 Feb 2024 12:04:30 +0800
Subject: [PATCH] fix DevNonce issue, and set debug on for tracing

---
 Core/Inc/sys_conf.h    | 6 +++---
 Core/Src/sys_app.c     | 1 +
 LoRaWAN/App/lora_app.c | 5 +++--
 LoRaWAN/App/lora_app.h | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Core/Inc/sys_conf.h b/Core/Inc/sys_conf.h
index bd4dd8b..cf0598b 100644
--- a/Core/Inc/sys_conf.h
+++ b/Core/Inc/sys_conf.h
@@ -47,12 +47,12 @@ extern "C" {
 /**
   * @brief  Verbose level for all trace logs
   */
-#define VERBOSE_LEVEL                        VLEVEL_L
+#define VERBOSE_LEVEL                        VLEVEL_H
 
 /**
   * @brief Enable trace logs
   */
-#define APP_LOG_ENABLED                      0
+#define APP_LOG_ENABLED                      1
 
 /**
   * @brief Activate monitoring (probes) of some internal RF signals for debug purpose
@@ -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/Core/Src/sys_app.c b/Core/Src/sys_app.c
index 1c7d950..619e64b 100644
--- a/Core/Src/sys_app.c
+++ b/Core/Src/sys_app.c
@@ -122,6 +122,7 @@ void SystemApp_Init(void)
   UTIL_LPM_Init();
   /* Disable Stand-by mode */
   UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_DISABLE);
+	//UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_ENABLE);
 
 #if defined (LOW_POWER_DISABLE) && (LOW_POWER_DISABLE == 1)
   /* Disable Stop Mode */
diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c
index 19061a2..09dcaa4 100644
--- a/LoRaWAN/App/lora_app.c
+++ b/LoRaWAN/App/lora_app.c
@@ -334,7 +334,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
@@ -507,6 +507,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(3) Vibration Sensor EXTI 2 Event \r\n"); //YUNHORN_STS_TODO
 			break;
 #endif		
 		
@@ -536,7 +537,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
 #endif
 #if defined(USE_STM32WLE5)
     case  MEMS_EXTI1_Pin:												
-			//APP_LOG(TS_OFF, VLEVEL_L, "\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 Event \r\n"); //YUNHORN_STS_TODO
 			mems_int1_detected=1;
 			UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
 			
diff --git a/LoRaWAN/App/lora_app.h b/LoRaWAN/App/lora_app.h
index 6f7a5ed..cbf4436 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