From 693d33d23408c6f5d873d554159c2a6fa473ffc9 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Fri, 7 Mar 2025 19:31:15 +0800 Subject: [PATCH] good R1x R5x for KWH --- Core/Inc/main.h | 3 +- Core/Inc/utilities_def.h | 2 +- Core/Src/gpio.c | 6 +- LoRaWAN/App/lora_app.c | 15 ++-- STM32CubeIDE/.cproject | 7 +- .../Release/Application/User/Core/subdir.mk | 38 +++++----- .../Application/User/LoRaWAN/App/subdir.mk | 8 +-- .../Application/User/LoRaWAN/Target/subdir.mk | 2 +- .../Application/User/STS/Core/Src/subdir.mk | 6 +- .../Application/User/STS/TOF/App/subdir.mk | 6 +- .../Application/User/STS/TOF/Target/subdir.mk | 2 +- .../User/STS/TOF/vl53l0x/subdir.mk | 14 ++-- STM32CubeIDE/Release/Drivers/CMSIS/subdir.mk | 2 +- .../Drivers/STM32WLxx_HAL_Driver/subdir.mk | 48 ++++++------- .../Release/Middlewares/LoRaWAN/subdir.mk | 66 +++++++++--------- .../Release/Middlewares/SubGHz_Phy/subdir.mk | 6 +- .../Release/STS_R1x_KWH_HK_20250307.bin | Bin 0 -> 102732 bytes .../Release/STS_R1x_KWH_HK_20250307.elf | Bin 0 -> 190468 bytes ...DE_STS.bin => STS_R5x_KWH_HK_20250307.bin} | Bin 102932 -> 102748 bytes .../Release/STS_R5x_KWH_HK_20250307.elf | Bin 0 -> 190468 bytes STM32CubeIDE/Release/Utilities/subdir.mk | 16 ++--- STM32CubeIDE/Release/WLE5CC_NODE_STS.elf | Bin 190552 -> 0 bytes STS/Core/Inc/yunhorn_sts_prd_conf.h | 7 +- STS/Core/Src/yunhorn_sts_process.c | 2 +- STS/TOF/App/X-WL55_WLE5_53L0X.c | 2 +- STS/TOF/App/app_tof_vl53l0x_range.c | 4 +- 26 files changed, 135 insertions(+), 127 deletions(-) create mode 100644 STM32CubeIDE/Release/STS_R1x_KWH_HK_20250307.bin create mode 100644 STM32CubeIDE/Release/STS_R1x_KWH_HK_20250307.elf rename STM32CubeIDE/Release/{WLE5CC_NODE_STS.bin => STS_R5x_KWH_HK_20250307.bin} (74%) create mode 100644 STM32CubeIDE/Release/STS_R5x_KWH_HK_20250307.elf delete mode 100644 STM32CubeIDE/Release/WLE5CC_NODE_STS.elf diff --git a/Core/Inc/main.h b/Core/Inc/main.h index ef3c532..2061557 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -157,6 +157,7 @@ void Error_Handler(void); /* | TOF-2 | */ /* U4, PA-9 XSHUT | */ /* NT PIN PB-3 | */ +#if 0 #define TOF_L_INT_Pin GPIO_PIN_3 #define TOF_L_INT_GPIO_Port GPIOB #define TOF_L_INT_EXTI_IRQn EXTI3_IRQn @@ -173,7 +174,7 @@ void Error_Handler(void); #define TOF_R_XSHUT_Pin GPIO_PIN_10 #define TOF_R_XSHUT_GPIO_Port GPIOA - +#endif /* **** PCB BOARD RM2 **** */ /* **** NO LONG USED ANYMORE FOR TEST ONLY */ #elif defined(RM2) diff --git a/Core/Inc/utilities_def.h b/Core/Inc/utilities_def.h index 16c631e..479c158 100644 --- a/Core/Inc/utilities_def.h +++ b/Core/Inc/utilities_def.h @@ -89,7 +89,7 @@ typedef enum CFG_SEQ_Task_YunhornSTSEventP2, /* MOTION */ CFG_SEQ_Task_YunhornSTSEventP3, /* LAMP BAR LED */ #endif -#if defined(STS_R1)||defined(STS_R1D)||defined(STS_R5)||defined(STS_R2) +#if defined(STS_R1)||defined(STS_R1D)||defined(STS_R5)||defined(STS_R2)||defined(STS_R5x)||defined(STS_R1x) CFG_SEQ_Task_YunhornSTSEventP4, /* TOF RANGE */ #endif #if defined(STS_P2)||defined(STS_T6)||defined(L8) diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 557e202..113a9fc 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -138,6 +138,7 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(TOF_C_XSHUT_GPIO_Port, &GPIO_InitStruct); +#if defined(TOF_2) /*Configure GPIO pins : TOF_L_XSHUT_Pin */ GPIO_InitStruct.Pin = TOF_L_XSHUT_Pin; @@ -147,6 +148,8 @@ void MX_GPIO_Init(void) HAL_GPIO_Init(TOF_L_XSHUT_GPIO_Port, &GPIO_InitStruct); #endif +#endif + #if defined(TOF_1) HAL_GPIO_WritePin(TOF_C_XSHUT_GPIO_Port, TOF_C_XSHUT_Pin, GPIO_PIN_SET); #endif @@ -203,13 +206,14 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(TOF_C_XSHUT_GPIO_Port, &GPIO_InitStruct); +#ifdef TOF_2 /*Configure GPIO pins : TOF_L_XSHUT_Pin */ GPIO_InitStruct.Pin = TOF_L_XSHUT_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(TOF_L_XSHUT_GPIO_Port, &GPIO_InitStruct); - +#endif HAL_NVIC_SetPriority(TOF_C_INT_EXTI_IRQn, 0, 0); HAL_NVIC_EnableIRQ(TOF_C_INT_EXTI_IRQn); diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index ebbc4b6..318b9b6 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -758,7 +758,7 @@ static void SendTxData(void) sts_people_count_sensor_data_t sts_p2_sensor_data={0x0}; #elif defined(STS_T6) sts_tof_presence_detection_sensor_data_t sts_t6_sensor_data={0x0}; -#elif defined(STS_R1)||defined(STS_R1D)||defined(STS_R2)||defined(STS_R5) +#elif defined(STS_R1)||defined(STS_R1D)||defined(STS_R2)||defined(STS_R5)||defined(STS_R5x)||defined(STS_R1x) sts_tof_range_data_t sts_rr_sensor_data={0x0,0x0,0x0}; #elif defined(STS_R4) sts_r_sensor_data_t sts_r4_sensor_data={0}; @@ -811,13 +811,13 @@ static void SendTxData(void) STS_RR_Sensor_Read(&sts_rr_sensor_data); APP_LOG(TS_OFF, VLEVEL_H, "\r\n VL53L0 sensor data read \r\n"); -#ifdef STS_R1 +#if defined(STS_R1)||defined(STS_R1x) AppData.Port = YUNHORN_STS_R1_LORA_APP_DATA_PORT; /* STS-R1 Data Port */ #elif defined(STS_R1D) AppData.Port = YUNHORN_STS_R1D_LORA_APP_DATA_PORT; /* STS-R1D Data Port */ #elif defined(STS_R2) AppData.Port = YUNHORN_STS_R2_LORA_APP_DATA_PORT; /* STS-R2 Data Port */ -#elif defined(STS_R5) +#elif defined(STS_R5)||defined(STS_R5x) AppData.Port = YUNHORN_STS_R5_LORA_APP_DATA_PORT; /* STS-R5 Data Port */ #endif //STS_R1 @@ -924,9 +924,10 @@ static void SendTxData(void) AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_3_distance_mm >>8 & 0xFF); AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_3_distance_mm & 0xFF); -#elif defined(STS_R5_EXT) - AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_3_distance_mm >>8 & 0xFF); - AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_3_distance_mm & 0xFF); +#elif (defined(STS_R1x)||defined(STS_R5x)) + AppData.Buffer[i++] = 2; + AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_2_distance_mm >>8 & 0xFF); + AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_2_distance_mm & 0xFF); #endif #endif //VL53L0 @@ -1032,7 +1033,7 @@ static void OnTxTimerEvent(void *context) UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), CFG_SEQ_Prio_0); #elif defined(STS_M1) UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0); -#elif (defined(STS_R1D)||defined(STS_R5)||defined(STS_R1)) +#elif (defined(STS_R1D)||defined(STS_R5)||defined(STS_R1)||defined(STS_R5x)||defined(STS_R1x)) APP_LOG(TS_OFF, VLEVEL_H, "\nSET TASK P4\r\n"); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0); #endif diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index 06c6d58..c0f5819 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -22,7 +22,7 @@