From 85796b3cd4b7a0e4b46fdc854804bb444c7f814f Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Tue, 6 Aug 2024 14:59:35 +0800 Subject: [PATCH] refine output format --- Core/Inc/yunhorn_sts_sensors.h | 3 +- Core/Src/yunhorn_sts_distance_rss.c | 12 +++--- Core/Src/yunhorn_sts_presence_rss.c | 11 +++-- .../yunhorn_sts_presence_rss_bring_up_test.c | 40 +++++++++---------- STM32CubeIDE/.cproject | 2 +- STM32CubeIDE/Release/makefile | 2 +- 6 files changed, 37 insertions(+), 33 deletions(-) diff --git a/Core/Inc/yunhorn_sts_sensors.h b/Core/Inc/yunhorn_sts_sensors.h index c6606ef..62ddb8d 100644 --- a/Core/Inc/yunhorn_sts_sensors.h +++ b/Core/Inc/yunhorn_sts_sensors.h @@ -91,7 +91,8 @@ enum RSS_CFG_order{ enum sts_rss_config_t { STS_RSS_CONFIG_DEFAULT=0, STS_RSS_CONFIG_SIMPLE, - STS_RSS_CONFIG_FULL + STS_RSS_CONFIG_FULL, + STS_RSS_CONFIG_FALL_DETECTION }; enum sts_ctrl_cmd_type { diff --git a/Core/Src/yunhorn_sts_distance_rss.c b/Core/Src/yunhorn_sts_distance_rss.c index 2e515e4..8e65986 100644 --- a/Core/Src/yunhorn_sts_distance_rss.c +++ b/Core/Src/yunhorn_sts_distance_rss.c @@ -73,7 +73,7 @@ int sts_distance_rss_detector_distance(void) if (!acc_rss_activate(hal)) { - APP_LOG(TS_OFF, VLEVEL_M, "Failed to activate RSS\n"); + APP_LOG(TS_OFF, VLEVEL_L, "Failed to activate RSS\n"); return EXIT_FAILURE; } @@ -83,7 +83,7 @@ int sts_distance_rss_detector_distance(void) if (distance_configuration == NULL) { - APP_LOG(TS_OFF, VLEVEL_M, "acc_detector_distance_configuration_create() failed\n"); + APP_LOG(TS_OFF, VLEVEL_L, "acc_detector_distance_configuration_create() failed\n"); acc_rss_deactivate(); return EXIT_FAILURE; } @@ -94,7 +94,7 @@ int sts_distance_rss_detector_distance(void) if (distance_handle == NULL) { - APP_LOG(TS_OFF, VLEVEL_M, "acc_detector_distance_create() failed\n"); + APP_LOG(TS_OFF, VLEVEL_L, "acc_detector_distance_create() failed\n"); acc_detector_distance_configuration_destroy(&distance_configuration); acc_rss_deactivate(); return EXIT_FAILURE; @@ -104,7 +104,7 @@ int sts_distance_rss_detector_distance(void) if (!acc_detector_distance_activate(distance_handle)) { - APP_LOG(TS_OFF, VLEVEL_M, "acc_detector_distance_activate() failed\n"); + APP_LOG(TS_OFF, VLEVEL_L, "acc_detector_distance_activate() failed\n"); acc_detector_distance_destroy(&distance_handle); acc_rss_deactivate(); return EXIT_FAILURE; @@ -123,7 +123,7 @@ int sts_distance_rss_detector_distance(void) if (!success) { - APP_LOG(TS_OFF, VLEVEL_M, "acc_detector_distance_get_next() failed\n"); + APP_LOG(TS_OFF, VLEVEL_L, "acc_detector_distance_get_next() failed\n"); break; } for(uint8_t j=0; j< result_info.number_of_peaks; j++) @@ -146,7 +146,7 @@ int sts_distance_rss_detector_distance(void) if (deactivated && success) { - APP_LOG(TS_OFF, VLEVEL_H, "Application finished OK\n"); + APP_LOG(TS_OFF, VLEVEL_L, "Application finished OK\n"); return EXIT_SUCCESS; } diff --git a/Core/Src/yunhorn_sts_presence_rss.c b/Core/Src/yunhorn_sts_presence_rss.c index ce61366..f030323 100644 --- a/Core/Src/yunhorn_sts_presence_rss.c +++ b/Core/Src/yunhorn_sts_presence_rss.c @@ -168,7 +168,7 @@ extern volatile uint8_t sts_presence_fall_detection; /* USER CODE END PFP */ /* Exported functions --------------------------------------------------------*/ - +#if 0 void STS_PRESENCE_RSS_update_default_configuration(acc_detector_presence_configuration_t presence_configuration) { acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID); @@ -187,7 +187,7 @@ void STS_PRESENCE_RSS_update_default_configuration(acc_detector_presence_configu acc_detector_presence_configuration_nbr_removed_pc_set(presence_configuration, DEFAULT_NBR_REMOVED_PC); } - +#endif /** * @brief Set default values in presence configuration * @@ -328,7 +328,7 @@ static void print_result(acc_detector_presence_result_t result) } else { - APP_LOG(TS_OFF, VLEVEL_H,"No motion, score: %d\n", (int)(result.presence_score * 1000.0f)); + APP_LOG(TS_OFF, VLEVEL_H,"No motion, score: %u\n", (int)(result.presence_score * 1000.0f)); } } @@ -365,12 +365,15 @@ int sts_presence_rss_fall_rise_detection(void) case STS_RSS_CONFIG_SIMPLE: sts_rss_set_current_configuration_simple(presence_configuration); APP_LOG(TS_OFF, VLEVEL_L,"\r\n##### YUNHORN STS *** Simple *** cfg applied\n"); - break; case STS_RSS_CONFIG_FULL: sts_rss_set_current_configuration_full(presence_configuration); APP_LOG(TS_OFF, VLEVEL_L,"\r\n######### YUNHORN STS *** FULL *** cfg applied\n"); break; + case STS_RSS_CONFIG_FALL_DETECTION: + set_default_fall_rise_configuration(presence_configuration); + APP_LOG(TS_OFF, VLEVEL_L,"\r\n######### YUNHORN STS *** FALL DETECTION *** cfg applied\n"); + break; default: break; } 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 75fa886..d631606 100644 --- a/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c +++ b/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c @@ -45,7 +45,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) uint8_t t=0; uint8_t test_result[20]={0x0}; - APP_LOG(TS_OFF, VLEVEL_H,"-- 0 -- Acconeer software version %s\n", acc_version_get()); + APP_LOG(TS_OFF, VLEVEL_L,"-- 0 -- Acconeer software version %s\n", acc_version_get()); const acc_hal_t *hal = acc_hal_integration_get_implementation(); @@ -89,7 +89,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) acc_rss_assembly_test_configuration_communication_write_read_test_disable(configuration); // Enable and run: Interrupt Test - APP_LOG(TS_OFF, VLEVEL_H,"-- Interrupt Test --- Start ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Interrupt Test --- Start ********************\r\n"); acc_rss_assembly_test_configuration_communication_interrupt_test_enable(configuration); if (!run_test(configuration)) @@ -104,10 +104,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) } acc_rss_assembly_test_configuration_communication_interrupt_test_disable(configuration); - APP_LOG(TS_OFF, VLEVEL_H,"-- Interrupt Test --- End ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Interrupt Test --- End ********************\r\n"); // Enable and run: Clock Test - APP_LOG(TS_OFF, VLEVEL_H,"-- Clock Test --- Start ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- Start ********************\r\n"); acc_rss_assembly_test_configuration_clock_test_enable(configuration); if (!run_test(configuration)) { @@ -121,11 +121,11 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) } acc_rss_assembly_test_configuration_clock_test_disable(configuration); - APP_LOG(TS_OFF, VLEVEL_H,"-- Clock Test --- end ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- end ********************\r\n"); // Enable and run: Power cycle test - APP_LOG(TS_OFF, VLEVEL_H,"-- Power cycle test --- Start ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- Start ********************\r\n"); acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration); if (!run_test(configuration)) { @@ -139,11 +139,11 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) } acc_rss_assembly_test_configuration_power_cycle_test_disable(configuration); - APP_LOG(TS_OFF, VLEVEL_H,"-- Power cycle test --- end ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- end ********************\r\n"); // Enable and run: Hibernate Test - APP_LOG(TS_OFF, VLEVEL_H,"-- Hibernate Test --- Start ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Hibernate Test --- Start ********************\r\n"); acc_rss_assembly_test_configuration_communication_hibernate_test_enable(configuration); if (!run_test(configuration)) { @@ -157,10 +157,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) } acc_rss_assembly_test_configuration_communication_hibernate_test_disable(configuration); - APP_LOG(TS_OFF, VLEVEL_H,"-- Hibernate Test --- End ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Hibernate Test --- End ********************\r\n"); // Enable and run: Supply Test - APP_LOG(TS_OFF, VLEVEL_H,"-- Supply Test --- Start ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Supply Test --- Start ********************\r\n"); acc_rss_assembly_test_configuration_supply_test_enable(configuration); if (!run_test(configuration)) { @@ -174,10 +174,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) } acc_rss_assembly_test_configuration_supply_test_disable(configuration); - APP_LOG(TS_OFF, VLEVEL_H,"-- Supply Test --- End ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Supply Test --- End ********************\r\n"); // Enable and run: Clock Test - APP_LOG(TS_OFF, VLEVEL_H,"-- Clock Test --- Start ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- Start ********************\r\n"); acc_rss_assembly_test_configuration_clock_test_enable(configuration); if (!run_test(configuration)) { @@ -191,10 +191,10 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) } acc_rss_assembly_test_configuration_clock_test_disable(configuration); - APP_LOG(TS_OFF, VLEVEL_H,"-- Clock Test --- end ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- end ********************\r\n"); // Enable and run: Power cycle test - APP_LOG(TS_OFF, VLEVEL_H,"-- Power cycle test --- Start ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- Start ********************\r\n"); acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration); if (!run_test(configuration)) { @@ -208,14 +208,14 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) } acc_rss_assembly_test_configuration_power_cycle_test_disable(configuration); - APP_LOG(TS_OFF, VLEVEL_H,"-- Power cycle test --- end ********************\r\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- end ********************\r\n"); - APP_LOG(TS_OFF, VLEVEL_H,"-- 10 -- Bring up test: All tests passed\n"); + APP_LOG(TS_OFF, VLEVEL_L,"-- 10 -- Bring up test: All tests passed\n"); test_result[t++] = 1; //(10) memcpy(rss_self_test_result, test_result, 12); - APP_LOG(TS_OFF, VLEVEL_H,"--Bring up test result #=%d \r\n", t); + APP_LOG(TS_OFF, VLEVEL_L,"--Bring up test result #=%d \r\n", t); acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); @@ -231,17 +231,17 @@ static bool run_test(acc_rss_assembly_test_configuration_t configuration) if (!acc_rss_assembly_test(configuration, test_results, &nr_of_test_results)) { - APP_LOG(TS_OFF, VLEVEL_H,"Bring up test: Failed to complete\n"); + APP_LOG(TS_OFF, VLEVEL_L,"Bring up test: Failed to complete\n"); return false; } else { - APP_LOG(TS_OFF, VLEVEL_H,"Bring up test: SUCCESS to complete\n"); + APP_LOG(TS_OFF, VLEVEL_L,"Bring up test: SUCCESS to complete\n"); } for (uint16_t i = 0; i < nr_of_test_results; i++) { const bool passed = test_results[i].test_passed; - APP_LOG(TS_OFF, VLEVEL_H,"Name: %s, result: %s\n", test_results[i].test_name, passed ? "Pass" : "Fail"); + APP_LOG(TS_OFF, VLEVEL_L,"Name: %s, result: %s\n", test_results[i].test_name, passed ? "Pass" : "Fail"); if (!passed) { diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index cb5c54d..93edae5 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -135,7 +135,7 @@