From a19ca44bf0b032a933993cea0d2eeff1bb3566b3 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Thu, 24 Apr 2025 20:21:27 +0800 Subject: [PATCH] old pixel rm2 --- Core/Inc/sys_conf.h | 6 ++-- .../yunhorn_sts_presence_rss_bring_up_test.c | 32 +++++++++--------- Core/Src/yunhorn_sts_process.c | 30 ++++++++-------- LoRaWAN/App/lora_app.c | 6 ++-- STM32CubeIDE/.cproject | 2 +- STM32CubeIDE/Release/STS_O7.bin | Bin 247132 -> 258660 bytes 6 files changed, 39 insertions(+), 37 deletions(-) diff --git a/Core/Inc/sys_conf.h b/Core/Inc/sys_conf.h index 2661f50..6059cf0 100644 --- a/Core/Inc/sys_conf.h +++ b/Core/Inc/sys_conf.h @@ -50,12 +50,12 @@ extern "C" { * #define VLEVEL_M 2 functional traces * #define VLEVEL_H 3 all traces */ -#define VERBOSE_LEVEL VLEVEL_OFF +#define VERBOSE_LEVEL VLEVEL_M /** * @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 @@ -78,7 +78,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/yunhorn_sts_presence_rss_bring_up_test.c b/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c index d5f8567..e1c316d 100644 --- a/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c +++ b/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c @@ -67,7 +67,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) test_result[t++] = 0; //(3) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; } @@ -81,7 +81,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) test_result[t++] = 0; //(4) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; } @@ -97,7 +97,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) test_result[t++] = 0; //(5) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; @@ -111,10 +111,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) acc_rss_assembly_test_configuration_clock_test_enable(configuration); if (!run_test(configuration)) { - test_result[t++] = 0; // (8) + test_result[t++] = 0; // (6) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; @@ -129,10 +129,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration); if (!run_test(configuration)) { - test_result[t++] = 0; //(9) + test_result[t++] = 0; //(7) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; @@ -147,10 +147,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) acc_rss_assembly_test_configuration_communication_hibernate_test_enable(configuration); if (!run_test(configuration)) { - test_result[t++] = 0; //(6) + test_result[t++] = 0; //(8) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; @@ -164,10 +164,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) acc_rss_assembly_test_configuration_supply_test_enable(configuration); if (!run_test(configuration)) { - test_result[t++] = 0; //(7) + test_result[t++] = 0; //(9) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; @@ -181,10 +181,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) acc_rss_assembly_test_configuration_clock_test_enable(configuration); if (!run_test(configuration)) { - test_result[t++] = 0; // (8) + test_result[t++] = 0; // (10) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; @@ -198,10 +198,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration); if (!run_test(configuration)) { - test_result[t++] = 0; //(9) + test_result[t++] = 0; //(11) acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); - //return EXIT_FAILURE; + return EXIT_FAILURE; } else { test_result[t++] = 1; @@ -212,7 +212,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) // APP_LOG(TS_OFF, VLEVEL_L,"-- 10 -- Bring up test: All tests passed\n"); - test_result[t++] = 1; //(10) + test_result[t++] = 1; //(12) memcpy(rss_self_test_result, test_result, 12); // APP_LOG(TS_OFF, VLEVEL_L,"--Bring up test result #=%d \r\n", t); diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index 340830d..ec50e0e 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -1097,7 +1097,7 @@ void STS_PRESENCE_SENSOR_Background_Measure_Process(uint16_t *bg_distance, uint1 void STS_PRESENCE_SENSOR_Function_Test_Process(uint8_t *self_test_result, uint8_t count) { - uint8_t bring_up_result[16]; + uint8_t bring_up_result[18]={0}; uint8_t previous_lamp_bar_color=sts_lamp_bar_color; uint16_t bg_range=0, bg_noise=0; PME_ON; @@ -1112,22 +1112,24 @@ void STS_PRESENCE_SENSOR_Function_Test_Process(uint8_t *self_test_result, uint8_ STS_Lamp_Bar_Refresh(); HAL_Delay(200); sts_lamp_bar_color = STS_PINK; - sts_presence_rss_bring_up_test(bring_up_result); + int bur = sts_presence_rss_bring_up_test(bring_up_result); - HAL_Delay(200); - sts_lamp_bar_color = STS_CYAN; - STS_PRESENCE_SENSOR_Distance_Measure_Process(); - bring_up_result[10]=sts_sensor_install_height>>8&0xff; - bring_up_result[11]=sts_sensor_install_height&0xff; + if (bur == EXIT_SUCCESS) + { + HAL_Delay(200); + sts_lamp_bar_color = STS_CYAN; + STS_PRESENCE_SENSOR_Distance_Measure_Process(); + bring_up_result[12]=sts_sensor_install_height>>8&0xff; + bring_up_result[13]=sts_sensor_install_height&0xff; - HAL_Delay(200); - - STS_PRESENCE_SENSOR_Background_Measure_Process(&bg_range, &bg_noise); - bring_up_result[12]=bg_range>>8&0xff; - bring_up_result[13]=bg_range&0xff; - bring_up_result[14]=bg_noise>>8&0xff; - bring_up_result[15]=bg_noise&0xff; + HAL_Delay(200); + STS_PRESENCE_SENSOR_Background_Measure_Process(&bg_range, &bg_noise); + bring_up_result[14]=bg_range>>8&0xff; + bring_up_result[15]=bg_range&0xff; + bring_up_result[16]=bg_noise>>8&0xff; + bring_up_result[17]=bg_noise&0xff; + } } HAL_Delay(200); diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 9453e10..51abfdf 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -3146,13 +3146,13 @@ void STS_SENSOR_Function_Test_Process(void) } else { - tstbuf[i++] = (uint8_t)16; //length of following data 16 bytes + tstbuf[i++] = (uint8_t)18; //length of following data 16 bytes #if defined(STS_O7)||defined(STS_O6) - uint8_t self_test_result[16]={0x0}; + uint8_t self_test_result[18]={0x0}; STS_PRESENCE_SENSOR_Function_Test_Process(self_test_result, count); - for (uint8_t j=0; j < 16; j++) + for (uint8_t j=0; j < 18; j++) tstbuf[i++] = (uint8_t) (self_test_result[j])&0xff; //STS_PRESENCE_SENSOR_Distance_Measure_Process(); diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index 7870d0d..2763ff6 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -155,7 +155,7 @@