From 6178d63b18d967770ab52f131bb8ec136daff959 Mon Sep 17 00:00:00 2001 From: sundp Date: Fri, 6 Oct 2023 19:02:15 +0800 Subject: [PATCH] add code to disable soap level sensor PB-3 when not use it. --- Core/Src/yunhorn_sts_process.c | 12 +++- LoRaWAN/App/lora_app.c | 18 ++++- STM32CubeIDE/.cproject | 3 +- STM32CubeIDE/.settings/language.settings.xml | 4 +- .../Debug/Application/User/Core/subdir.mk | 44 ++++++------- .../Application/User/LoRaWAN/App/subdir.mk | 8 +-- .../Application/User/LoRaWAN/Target/subdir.mk | 2 +- .../Debug/Application/User/TOF/App/subdir.mk | 6 +- .../Application/User/TOF/Target/subdir.mk | 2 +- .../Application/User/TOF/vl53l0x/subdir.mk | 14 ++-- .../Drivers/BSP/STM32WLxx_Nucleo/subdir.mk | 4 +- STM32CubeIDE/Debug/Drivers/CMSIS/subdir.mk | 2 +- .../Drivers/STM32WLxx_HAL_Driver/subdir.mk | 48 +++++++------- .../Debug/Middlewares/LoRaWAN/subdir.mk | 66 +++++++++---------- .../Debug/Middlewares/SubGHz_Phy/subdir.mk | 6 +- STM32CubeIDE/Debug/Utilities/subdir.mk | 16 ++--- STM32CubeIDE/Debug/makefile | 4 +- STM32CubeIDE/STS_RR_R125.launch | 6 +- TOF/App/app_tof_vl53l0x_range.c | 8 +-- 19 files changed, 149 insertions(+), 124 deletions(-) diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index 9faf618..66c10f7 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -271,10 +271,11 @@ void STS_YunhornSTSEventP3_Process(void) void STS_YunhornSTSEventP4_Process(void) { STS_SENSOR_Power_ON(0); - HAL_Delay(100); + LED_ON; + HAL_Delay(50); APP_LOG(TS_OFF, VLEVEL_L, "\r\n P4 Testing Process\r\n"); STS_TOF_VL53L0X_Range_Process(); - + LED_OFF; STS_SENSOR_Power_OFF(0); } @@ -301,6 +302,13 @@ void STS_YunhornSTSEventP6_Process(void) { APP_LOG(TS_OFF, VLEVEL_L, "\r\n P6 Testing Process\r\n"); STS_SENSOR_Power_ON(0); + LED_ON; + HAL_Delay(50); + LED_OFF; + HAL_Delay(20); + LED_ON; + HAL_Delay(50); + LED_OFF; /* 1. Sensor Power On */ #if defined(SOAP_LEVEL_SENSOR) HAL_GPIO_WritePin(SOAP_SWITCH_GPIO_Port, SOAP_SWITCH_Pin, GPIO_PIN_SET); diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 3fc30ce..b83642a 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -639,9 +639,19 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) APP_LOG(TS_OFF, VLEVEL_L, "##################################### BUTTON-1 DETECTED: %2d \r\n", pinstate); //if (EventType == TX_ON_EVENT) + if (pinstate == 1) { UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); + } else { + LED_ON; + HAL_Delay(50); + LED_OFF; + HAL_Delay(20); + LED_ON; + HAL_Delay(50); + LED_OFF; } + #endif break; case BUT2_Pin: @@ -786,12 +796,18 @@ static void SendTxData(void) uint8_t i = 0; //MX_TOF_Process(); LED_ON; +#if defined(SOAP_LEVEL_SENSOR) STS_YunhornSTSEventP6_Process(); HAL_Delay(200); + STS_YunhornSTSEventP4_Process(); LED_OFF; + HAL_Delay(200); + LED_ON; +#endif //UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), CFG_SEQ_Prio_0); - //UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0); + UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0); + LED_OFF; STS_R0_SENSOR_Read(&r0_data); r0_data.battery_mV = batteryLevelmV; r0_data.battery_Pct = (uint8_t)(99*batteryLevel/254); diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index 364820f..81f4f20 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -68,6 +68,7 @@ + @@ -78,7 +79,7 @@