workable O6 (mode 3,4) not uni_mode yet

This commit is contained in:
Yunhorn 2025-05-08 18:53:09 +08:00
parent 00e47ea0ce
commit 15595112b0
6 changed files with 96 additions and 75 deletions

View File

@ -757,7 +757,7 @@ int sts_distance_rss_detector_distance(uint16_t *rss_distance);
int acc_example_detector_distance(uint16_t *rss_distance); int acc_example_detector_distance(uint16_t *rss_distance);
int acc_example_service_sparse(int argc, char *argv[]); int acc_example_service_sparse(int argc, char *argv[]);
int acc_example_detector_distance_recorded(int argc, char *argv[]); int acc_example_detector_distance_recorded(int argc, char *argv[]);
int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result); int sts_presence_rss_bring_up_test(void);
int acc_ref_app_tank_level(int argc, char *argv[]); int acc_ref_app_tank_level(int argc, char *argv[]);
/* /*
void STS_MOTION_SENSOR_Disable_Wake_Up_Detection(void); void STS_MOTION_SENSOR_Disable_Wake_Up_Detection(void);
@ -776,7 +776,7 @@ void STS_MOTION_SENSOR_Initialization(void);
void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size); void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size);
void STS_SENSOR_Function_Test_Process(void); void STS_SENSOR_Function_Test_Process(void);
void STS_SENSOR_Distance_Test_Process(void); void STS_SENSOR_Distance_Test_Process(void);
void STS_PRESENCE_SENSOR_Function_Test_Process(uint8_t *self_test_result, uint8_t *count); void STS_PRESENCE_SENSOR_Function_Test_Process(void);
//void STS_PRESENCE_SENSOR_Distance_Measure_Process(void); //void STS_PRESENCE_SENSOR_Distance_Measure_Process(void);
void STS_PRESENCE_SENSOR_Distance_Measure_Process(uint16_t *rss_distance); void STS_PRESENCE_SENSOR_Distance_Measure_Process(uint16_t *rss_distance);
void STS_PRESENCE_SENSOR_Background_Measure_Process(uint16_t *bg_distance, uint16_t *bg_motion_noise); void STS_PRESENCE_SENSOR_Background_Measure_Process(uint16_t *bg_distance, uint16_t *bg_motion_noise);

View File

@ -54,7 +54,7 @@
#define DEFAULT_PROFILE ACC_SERVICE_PROFILE_4 //ACC_SERVICE_PROFILE_4 #define DEFAULT_PROFILE ACC_SERVICE_PROFILE_4 //ACC_SERVICE_PROFILE_4
#define DEFAULT_UPDATE_RATE (10) #define DEFAULT_UPDATE_RATE (10)
#define DEFAULT_POWER_SAVE_MODE ACC_POWER_SAVE_MODE_ACTIVE #define DEFAULT_POWER_SAVE_MODE ACC_POWER_SAVE_MODE_SLEEP // ACC_POWER_SAVE_MODE_ACTIVE 2025 05 08 update
#define DEFAULT_SENSOR_ID (1) #define DEFAULT_SENSOR_ID (1)
#define DEFAULT_START_M (0.8f) //(0.80f) //default 0.2 unit(meter) [1] #define DEFAULT_START_M (0.8f) //(0.80f) //default 0.2 unit(meter) [1]
@ -63,7 +63,7 @@
#define DEFAULT_UPDATE_RATE_WAKEUP (2.0f) //default 80 unit(hz) #define DEFAULT_UPDATE_RATE_WAKEUP (2.0f) //default 80 unit(hz)
#define DEFAULT_UPDATE_RATE_TRACKING (10.0f) //default 80 unit(hz) [7] #define DEFAULT_UPDATE_RATE_TRACKING (10.0f) //default 80 unit(hz) [7]
#define DEFAULT_UPDATE_RATE_PRESENCE (65.0F) //(65.0f) //default 80 unit(hz) #define DEFAULT_UPDATE_RATE_PRESENCE (10.0F) //(65.0f) //default 80 unit(hz)
//#define DEFAULT_UPDATE_RATE_PRESENCE (80.0F) //(65.0f) //default 80 unit(hz) //#define DEFAULT_UPDATE_RATE_PRESENCE (80.0F) //(65.0f) //default 80 unit(hz)
#define DEFAULT_HWAAS (63) //default 10 unit(hz) #define DEFAULT_HWAAS (63) //default 10 unit(hz)
@ -71,8 +71,8 @@
//acc_detector_presence_configuration_filter_parameters_t //acc_detector_presence_configuration_filter_parameters_t
#define DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST (0.5f) //default 0.5 unit(seconds) [6] #define DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST (0.5f) //default 0.5 unit(seconds) [6]
#define DEFAULT_INTER_FRAME_FAST_CUTOFF (20.0f) //default 20.0 unit(hz) [8] #define DEFAULT_INTER_FRAME_FAST_CUTOFF (18.0f) //default 20.0 unit(hz) [8]
#define DEFAULT_INTER_FRAME_SLOW_CUTOFF (0.20f) //(0.01f) 0.2 hz unit(hz) [9] #define DEFAULT_INTER_FRAME_SLOW_CUTOFF (0.17f) //(0.01f) 0.2 hz unit(hz) [9]
#define DEFAULT_INTRA_FRAME_TIME_CONST (0) //default 0.0 unit(seconds) #define DEFAULT_INTRA_FRAME_TIME_CONST (0) //default 0.0 unit(seconds)
#define DEFAULT_INTRA_FRAME_WEIGHT (0) //default 0.6 for normal slow tracking 1.0 for fast tracking #define DEFAULT_INTRA_FRAME_WEIGHT (0) //default 0.6 for normal slow tracking 1.0 for fast tracking
@ -85,7 +85,7 @@
#define DEFAULT_DOWNSAMPLING_FACTOR (2) //default 1 #define DEFAULT_DOWNSAMPLING_FACTOR (2) //default 1
//#define DEFAULT_RECEIVER_GAIN (0.65f) //default 0.9 gain mdB [4] //#define DEFAULT_RECEIVER_GAIN (0.65f) //default 0.9 gain mdB [4]
#define DEFAULT_RECEIVER_GAIN (0.65f) //default 0.9 gain mdB [4] #define DEFAULT_RECEIVER_GAIN (0.80f) //default 0.9 gain mdB [4]
#define DEFAULT_MOTION_DATASET_LEN (128) //MOTION DATASET/PATTERN COLLECTION #define DEFAULT_MOTION_DATASET_LEN (128) //MOTION DATASET/PATTERN COLLECTION
#define DEFAULT_MOTION_FEATURE_LEN (10) //MOTION FEATURE IDENDIFIED #define DEFAULT_MOTION_FEATURE_LEN (10) //MOTION FEATURE IDENDIFIED
@ -224,24 +224,25 @@ float frame_slow = 0.1f;
void update_configuration_with_type(acc_detector_presence_configuration_t presence_configuration, uint8_t cfg_type) void update_configuration_with_type(acc_detector_presence_configuration_t presence_configuration, uint8_t cfg_type)
{ {
acc_detector_presence_configuration_service_profile_set(presence_configuration, sts_presence_rss_config.default_profile); acc_detector_presence_configuration_service_profile_set(presence_configuration, (uint8_t)sts_presence_rss_config.default_profile);
Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration); Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration);
acc_detector_presence_configuration_sweeps_per_frame_set(presence_configuration, Sweeps_per_frame); acc_detector_presence_configuration_sweeps_per_frame_set(presence_configuration, (uint16_t)Sweeps_per_frame);
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, sts_presence_rss_config.default_downsampling_factor); acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, (uint16_t)sts_presence_rss_config.default_downsampling_factor);
acc_detector_presence_configuration_hw_accelerated_average_samples_set(presence_configuration, sts_presence_rss_config.default_hwaas); acc_detector_presence_configuration_hw_accelerated_average_samples_set(presence_configuration, (uint8_t)sts_presence_rss_config.default_hwaas);
acc_detector_presence_configuration_update_rate_set(presence_configuration, sts_presence_rss_config.default_update_rate_presence ); acc_detector_presence_configuration_update_rate_set(presence_configuration, (float)sts_presence_rss_config.default_update_rate_presence );
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, sts_presence_rss_config.default_threshold); //acc_detector_presence_configuration_update_rate_set(presence_configuration, 10.0f);
acc_detector_presence_configuration_start_set(presence_configuration, sts_presence_rss_config.default_start_m); acc_detector_presence_configuration_detection_threshold_set(presence_configuration, (float)sts_presence_rss_config.default_threshold);
acc_detector_presence_configuration_length_set(presence_configuration, sts_presence_rss_config.default_length_m); acc_detector_presence_configuration_start_set(presence_configuration, (float)sts_presence_rss_config.default_start_m);
acc_detector_presence_configuration_length_set(presence_configuration, (float)(sts_presence_rss_config.default_length_m - sts_presence_rss_config.default_start_m));
acc_detector_presence_configuration_power_save_mode_set(presence_configuration, DEFAULT_POWER_SAVE_MODE); acc_detector_presence_configuration_power_save_mode_set(presence_configuration, DEFAULT_POWER_SAVE_MODE);
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, sts_presence_rss_config.default_receiver_gain); acc_detector_presence_configuration_receiver_gain_set(presence_configuration, (float)sts_presence_rss_config.default_receiver_gain);
acc_detector_presence_configuration_filter_parameters_t filter; acc_detector_presence_configuration_filter_parameters_t filter;
filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration); filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
filter.inter_frame_fast_cutoff = sts_presence_rss_config.default_inter_frame_fast_cutoff;; filter.inter_frame_fast_cutoff = (float)sts_presence_rss_config.default_inter_frame_fast_cutoff;;
filter.inter_frame_slow_cutoff = sts_presence_rss_config.default_inter_frame_slow_cutoff; filter.inter_frame_slow_cutoff = (float)sts_presence_rss_config.default_inter_frame_slow_cutoff;
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter); acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
switch (cfg_type) { switch (cfg_type) {
@ -542,7 +543,7 @@ static void print_current_configuration(acc_detector_presence_configuration_t pr
sts_run_gain = acc_detector_presence_configuration_receiver_gain_get(presence_configuration); sts_run_gain = acc_detector_presence_configuration_receiver_gain_get(presence_configuration);
float sts_run_update_rate = acc_detector_presence_configuration_update_rate_get(presence_configuration); float sts_run_update_rate = acc_detector_presence_configuration_update_rate_get(presence_configuration);
sts_run_profile = acc_detector_presence_configuration_service_profile_get(presence_configuration); sts_run_profile = acc_detector_presence_configuration_service_profile_get(presence_configuration);
float Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration); uint16_t Sweeps_per_frame = acc_detector_presence_configuration_sweeps_per_frame_get(presence_configuration);
sts_rss_threshold = sts_run_threshold; sts_rss_threshold = sts_run_threshold;
acc_detector_presence_configuration_filter_parameters_t sts_run_filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration); acc_detector_presence_configuration_filter_parameters_t sts_run_filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
@ -796,6 +797,7 @@ int sts_presence_rss_detection_init(void)
if (!acc_detector_presence_activate(rss_handle)) if (!acc_detector_presence_activate(rss_handle))
{ {
APP_LOG(TS_OFF, VLEVEL_M, "Failed to activate detector \n"); APP_LOG(TS_OFF, VLEVEL_M, "Failed to activate detector \n");
acc_detector_presence_destroy(&rss_handle);
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View File

@ -32,37 +32,46 @@
#include "acc_version.h" #include "acc_version.h"
#include "sys_app.h" #include "sys_app.h"
uint8_t bring_up_test_result[12]={0x0};
extern uint8_t self_test_result[18];
#define DEFAULT_SENSOR_ID 1 #define DEFAULT_SENSOR_ID 1
static bool run_test(acc_rss_assembly_test_configuration_t configuration); static bool run_test(acc_rss_assembly_test_configuration_t configuration);
int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result); int sts_presence_rss_bring_up_test(void);
int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) int sts_presence_rss_bring_up_test(void)
{ {
uint8_t t=0; uint8_t t=0;
uint8_t test_result[10]={0x0}; //uint8_t test_result[10]={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(); const acc_hal_t *hal = acc_hal_integration_get_implementation();
if (!acc_rss_activate(hal)) if (!acc_rss_activate(hal))
{ {
APP_LOG(TS_OFF, VLEVEL_M, "Failed to activate RSS\n"); APP_LOG(TS_OFF, VLEVEL_M, "Failed to activate RSS\n");
test_result[t++] = 0; bring_up_test_result[t++] = 0;
return EXIT_FAILURE; return EXIT_FAILURE;
} else { } else {
test_result[t++] = 1; //(1) bring_up_test_result[t++] = 1; //(1)
} }
acc_rss_override_sensor_id_check_at_creation(true); acc_rss_override_sensor_id_check_at_creation(true);
//APP_LOG(TS_OFF, VLEVEL_L,"\r\n ---- test config create \r\n");
acc_rss_assembly_test_configuration_t configuration = acc_rss_assembly_test_configuration_create(); acc_rss_assembly_test_configuration_t configuration = acc_rss_assembly_test_configuration_create();
test_result[t++] = (uint8_t)((configuration != NULL)? 2:0); //(2) if (configuration == NULL) {
bring_up_test_result[t++] = 0; //(2)
return EXIT_FAILURE;
} else {
bring_up_test_result[t++] = 2; //(2)
}
//bring_up_test_result[t++] = (uint8_t)((configuration != NULL)? 2:0); //(2)
acc_rss_assembly_test_configuration_sensor_set(configuration, DEFAULT_SENSOR_ID); acc_rss_assembly_test_configuration_sensor_set(configuration, DEFAULT_SENSOR_ID);
@ -70,29 +79,31 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_all_tests_disable(configuration); acc_rss_assembly_test_configuration_all_tests_disable(configuration);
// Enable and run: Read Test // Enable and run: Read Test
//APP_LOG(TS_OFF, VLEVEL_L,"-- communication_read_test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_communication_read_test_enable(configuration); acc_rss_assembly_test_configuration_communication_read_test_enable(configuration);
if (!run_test(configuration)) if (!run_test(configuration))
{ {
test_result[t++] = 0; //(3) bring_up_test_result[t++] = 0; //(3)
acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate(); acc_rss_deactivate();
//return EXIT_FAILURE; //return EXIT_FAILURE;
} else { } else {
test_result[t++] = 3; bring_up_test_result[t++] = 3;
} }
acc_rss_assembly_test_configuration_communication_read_test_disable(configuration); acc_rss_assembly_test_configuration_communication_read_test_disable(configuration);
// Enable and run: Write Read Test // Enable and run: Write Read Test
//APP_LOG(TS_OFF, VLEVEL_L,"-- communication_write read_test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_communication_write_read_test_enable(configuration); acc_rss_assembly_test_configuration_communication_write_read_test_enable(configuration);
if (!run_test(configuration)) if (!run_test(configuration))
{ {
test_result[t++] = 0; //(4) bring_up_test_result[t++] = 0; //(4)
acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate(); acc_rss_deactivate();
//return EXIT_FAILURE; //return EXIT_FAILURE;
} else { } else {
test_result[t++] = 4; bring_up_test_result[t++] = 4;
} }
acc_rss_assembly_test_configuration_communication_write_read_test_disable(configuration); acc_rss_assembly_test_configuration_communication_write_read_test_disable(configuration);
@ -102,13 +113,13 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_communication_interrupt_test_enable(configuration); acc_rss_assembly_test_configuration_communication_interrupt_test_enable(configuration);
if (!run_test(configuration)) if (!run_test(configuration))
{ {
test_result[t++] = 0; //(5) bring_up_test_result[t++] = 0; //(5)
acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate(); acc_rss_deactivate();
//return EXIT_FAILURE; //return EXIT_FAILURE;
} else { } else {
test_result[t++] = 5; bring_up_test_result[t++] = 5;
} }
acc_rss_assembly_test_configuration_communication_interrupt_test_disable(configuration); acc_rss_assembly_test_configuration_communication_interrupt_test_disable(configuration);
@ -157,13 +168,13 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_communication_hibernate_test_enable(configuration); acc_rss_assembly_test_configuration_communication_hibernate_test_enable(configuration);
if (!run_test(configuration)) if (!run_test(configuration))
{ {
test_result[t++] = 0; //(6) bring_up_test_result[t++] = 0; //(6)
acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate(); acc_rss_deactivate();
//return EXIT_FAILURE; //return EXIT_FAILURE;
} else { } else {
test_result[t++] = 6; bring_up_test_result[t++] = 6;
} }
acc_rss_assembly_test_configuration_communication_hibernate_test_disable(configuration); acc_rss_assembly_test_configuration_communication_hibernate_test_disable(configuration);
@ -174,13 +185,13 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_supply_test_enable(configuration); acc_rss_assembly_test_configuration_supply_test_enable(configuration);
if (!run_test(configuration)) if (!run_test(configuration))
{ {
test_result[t++] = 0; //(7) bring_up_test_result[t++] = 0; //(7)
acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate(); acc_rss_deactivate();
//return EXIT_FAILURE; //return EXIT_FAILURE;
} else { } else {
test_result[t++] = 7; bring_up_test_result[t++] = 7;
} }
acc_rss_assembly_test_configuration_supply_test_disable(configuration); acc_rss_assembly_test_configuration_supply_test_disable(configuration);
@ -191,13 +202,13 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_clock_test_enable(configuration); acc_rss_assembly_test_configuration_clock_test_enable(configuration);
if (!run_test(configuration)) if (!run_test(configuration))
{ {
test_result[t++] = 0; // (8) bring_up_test_result[t++] = 0; // (8)
acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate(); acc_rss_deactivate();
//return EXIT_FAILURE; //return EXIT_FAILURE;
} else { } else {
test_result[t++] = 8; bring_up_test_result[t++] = 8;
} }
acc_rss_assembly_test_configuration_clock_test_disable(configuration); acc_rss_assembly_test_configuration_clock_test_disable(configuration);
@ -208,25 +219,26 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration); acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration);
if (!run_test(configuration)) if (!run_test(configuration))
{ {
test_result[t++] = 0; //(9) bring_up_test_result[t++] = 0; //(9)
acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate(); acc_rss_deactivate();
//return EXIT_FAILURE; //return EXIT_FAILURE;
} else { } else {
test_result[t++] = 9; bring_up_test_result[t++] = 9;
} }
acc_rss_assembly_test_configuration_power_cycle_test_disable(configuration); acc_rss_assembly_test_configuration_power_cycle_test_disable(configuration);
// APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- end ********************\r\n"); // APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- end ********************\r\n");
acc_rss_assembly_test_configuration_all_tests_disable(configuration);
//APP_LOG(TS_OFF, VLEVEL_L,"-- 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++] = 10; //(10) bring_up_test_result[t++] = 10; //(10)
for (uint8_t j=0; j<10; j++) { for (uint8_t j=0; j<10; j++) {
//APP_LOG(TS_OFF, VLEVEL_M, "|%02x ", test_result[j]); // APP_LOG(TS_OFF, VLEVEL_M, "|%02x ", bring_up_test_result[j]);
*(rss_self_test_result+j) = (void*)test_result[j]; self_test_result[j] = (uint8_t)bring_up_test_result[j];
//APP_LOG(TS_OFF, VLEVEL_M, "=%02x ", rss_self_test_result[j]); // APP_LOG(TS_OFF, VLEVEL_M, "=%02x ", self_test_result[j]);
} }
//UTIL_MEM_cpy_8((void*)rss_self_test_result, (void*)test_result, 10); //UTIL_MEM_cpy_8((void*)rss_self_test_result, (void*)test_result, 10);

View File

@ -108,7 +108,7 @@ extern volatile uint8_t detected_hs_zone;
extern volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config; extern volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config;
volatile uint32_t cnt=0; volatile uint32_t cnt=0;
volatile uint8_t self_test_result[18]={0x0};
volatile uint8_t sts_tof_result_changed_flag = 0; volatile uint8_t sts_tof_result_changed_flag = 0;
@ -1074,8 +1074,10 @@ void STS_PRESENCE_SENSOR_Distance_Measure_Process(uint16_t *rss_distance)
int exit_status = EXIT_SUCCESS, i=0; int exit_status = EXIT_SUCCESS, i=0;
uint16_t tmp_distance=0; uint16_t tmp_distance=0;
if (rss_handle != NULL)
sts_presence_rss_detection_deinit(); {
sts_presence_rss_detection_deinit();
}
APP_LOG(TS_OFF, VLEVEL_M, "\r\n ****start_m=%u length_m=%u profile=%u hwaas=%u \r\n", APP_LOG(TS_OFF, VLEVEL_M, "\r\n ****start_m=%u length_m=%u profile=%u hwaas=%u \r\n",
(unsigned int)(distance_cfg.start_m*1000),(unsigned int)(distance_cfg.length_m*1000), (unsigned int)(distance_cfg.start_m*1000),(unsigned int)(distance_cfg.length_m*1000),
@ -1121,9 +1123,9 @@ 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) void STS_PRESENCE_SENSOR_Function_Test_Process(void)
{ {
uint8_t bring_up_result[18]={0}; //uint8_t bring_up_result[18]={0};
uint8_t previous_lamp_bar_color=sts_lamp_bar_color; uint8_t previous_lamp_bar_color=sts_lamp_bar_color;
uint16_t bg_range=0, bg_noise=0; uint16_t bg_range=0, bg_noise=0;
int test_res=0; int test_res=0;
@ -1139,34 +1141,36 @@ void STS_PRESENCE_SENSOR_Function_Test_Process(uint8_t *self_test_result, uint8_
HAL_Delay(200); HAL_Delay(200);
sts_lamp_bar_color = STS_PINK; sts_lamp_bar_color = STS_PINK;
sts_presence_rss_detection_deinit(); sts_presence_rss_detection_deinit();
test_res = sts_presence_rss_bring_up_test(bring_up_result); test_res = sts_presence_rss_bring_up_test();
if (test_res != EXIT_SUCCESS) { if (test_res != EXIT_SUCCESS) {
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Bring up test failed \r\n"); APP_LOG(TS_OFF, VLEVEL_M, "\r\n Bring up test failed \r\n");
} else { } else {
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Bring up test success \r\n"); APP_LOG(TS_OFF, VLEVEL_M, "\r\n Bring up test success \r\n");
} }
//sts_presence_rss_detection_deinit();
HAL_Delay(200); HAL_Delay(50);
sts_lamp_bar_color = STS_CYAN; sts_lamp_bar_color = STS_CYAN;
uint16_t tmp_dist=0; uint16_t tmp_dist=0;
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Distance Measure process \r\n");
STS_PRESENCE_SENSOR_Distance_Measure_Process(&tmp_dist); STS_PRESENCE_SENSOR_Distance_Measure_Process(&tmp_dist);
sts_sensor_install_height = tmp_dist; sts_sensor_install_height = tmp_dist;
bring_up_result[12]=sts_sensor_install_height>>8&0xff; self_test_result[12] = sts_sensor_install_height>>8&0xff;
bring_up_result[13]=sts_sensor_install_height&0xff; self_test_result[13] = sts_sensor_install_height&0xff;
HAL_Delay(50); HAL_Delay(50);
sts_lamp_bar_color = STS_BLUE; sts_lamp_bar_color = STS_BLUE;
STS_PRESENCE_SENSOR_Background_Measure_Process(&bg_range, &bg_noise); STS_PRESENCE_SENSOR_Background_Measure_Process(&bg_range, &bg_noise);
bring_up_result[14]=bg_range>>8&0xff; self_test_result[14] = bg_range>>8&0xff;
bring_up_result[15]=bg_range&0xff; self_test_result[15] = bg_range&0xff;
bring_up_result[16]=bg_noise>>8&0xff; self_test_result[16] = bg_noise>>8&0xff;
bring_up_result[17]=bg_noise&0xff; self_test_result[17] = bg_noise&0xff;
} }
HAL_Delay(50); HAL_Delay(50);
sts_lamp_bar_color = previous_lamp_bar_color; sts_lamp_bar_color = previous_lamp_bar_color;
*count = sizeof(bring_up_result); // *count = sizeof(bring_up_result);
UTIL_MEM_cpy_8((void*)self_test_result, (void*)bring_up_result, sizeof(bring_up_result)); // UTIL_MEM_cpy_8((void*)self_test_result, (void*)bring_up_result, sizeof(bring_up_result));
} }

View File

@ -91,7 +91,7 @@ static uint8_t sts_cfg_nvm_factory_default[YUNHORN_STS_MAX_NVM_CFG_SIZE];
static void STS_Show_STS_CFG_NVM(uint8_t * store_value, uint16_t store_size); static void STS_Show_STS_CFG_NVM(uint8_t * store_value, uint16_t store_size);
extern volatile uint8_t sts_rss_cfg_slid_win_threshold; extern volatile uint8_t sts_rss_cfg_slid_win_threshold;
extern volatile uint8_t sts_rss_cfg_slid_win_size; extern volatile uint8_t sts_rss_cfg_slid_win_size;
extern volatile uint8_t self_test_result[18];
volatile sts_cfg_nvm_t sts_cfg_nvm = { volatile sts_cfg_nvm_t sts_cfg_nvm = {
sts_mtmcode1, sts_mtmcode1,
sts_mtmcode2, sts_mtmcode2,
@ -106,21 +106,21 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
0x00, //sts_ioc_mask 0x00, //sts_ioc_mask
0x20, //32 bytes, below start of p[0] 20 BYTES AND 12 BYTES FALL DOWN CFG 0x20, //32 bytes, below start of p[0] 20 BYTES AND 12 BYTES FALL DOWN CFG
{ // below 20 bytes { // below 20 bytes
0x08, //start_m [8]*0.1 meter =0.8 0x05, //start_m [8]*0.1 meter =0.8
0x14, //lenght_m 0x19=[25]*0.1=2.5f meter 0x11, //lenght_m 0x19=[25]*0.1=2.5f meter
0x0F, //threshold 0X0F=[15]*0.1=1.5f 0x0F, //threshold 0X0F=[15]*0.1=1.5f
0x50, //receiver gain 0x28 =[40]*0.01=0.40f max 99=0x63 0x50, //receiver gain 0x28 =[40]*0.01=0.40f max 99=0x63
0x04, //profile [4]=4 0x04, //profile [4]=4
0x0A, //rate tracking 0x0A=10= 10U 0x0A, //rate tracking 0x0A=10= 10U
0x41, //rate presence 0x41=65= 65U 0x0A, //rate presence 0x41=65= 65U
0x3F, //hwaas 0x3F=63 =63U 0x3F, //hwaas 0x3F=63 =63U
0x00, //nbr removed pc [0]=0 0x00, //nbr removed pc [0]=0
0x05, //inter frame deviation time const 0x05=[5]*0.1=0.5f 0x05, //inter frame deviation time const 0x05=[5]*0.1=0.5f
0x14, //inter frame fast cutoff 0x0A=[10] = 10U 0x12, //inter frame fast cutoff 0x0A=[10] = 10U
0x11, //inter frame slow cutoff,0x01=1[1]*0.01=0.01f 0x11, //inter frame slow cutoff,0x01=1[1]*0.01=0.01f
0x00, //intra frame time const [0]=0 Lower to reduce sensitivity, higher to increase sensitivity 0x01, //intra frame time const [0]=0 Lower to reduce sensitivity, higher to increase sensitivity
0x0A, //intra frame weight, 0x00=[0]*0.1=0.0F 0x0A=10, 10*0.1=1 FOR FAST MOVEMENT TRACKING FALL DETECTION 0x0A, //intra frame weight, 0x00=[0]*0.1=0.0F 0x0A=10, 10*0.1=1 FOR FAST MOVEMENT TRACKING FALL DETECTION
0x09, //output time const 0x05=[5]*0.1=0.5 0.5--> 0.9 2025-03-26 TODO XXXXXX 0x01, //output time const 0x05=[5]*0.1=0.5 0.5--> 0.9 2025-03-26 TODO XXXXXX
0x01, //downsampling factor [2]=2 0x01, //downsampling factor [2]=2
0x03, //power saving mode ACTIVE [3] = 3U 0x03, //power saving mode ACTIVE [3] = 3U
0x02, //P[17] RSS CFG UPDATE FLAG 2025-04-14 0x02, //P[17] RSS CFG UPDATE FLAG 2025-04-14
@ -2067,8 +2067,10 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
//outbuf[i++] = (uint8_t) 'D'; //outbuf[i++] = (uint8_t) 'D';
//STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)outbuf); //STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)outbuf);
uint16_t rss_distance=0; uint16_t rss_distance=0;
uint8_t previous_lamp_bar_color = sts_lamp_bar_color;
sts_lamp_bar_color = STS_CYAN;
STS_PRESENCE_SENSOR_Distance_Measure_Process(&rss_distance); STS_PRESENCE_SENSOR_Distance_Measure_Process(&rss_distance);
sts_lamp_bar_color = previous_lamp_bar_color;
APP_LOG(TS_OFF, VLEVEL_M, "\r\nRSS Measured Distance=[%u] mm \r\n", (uint16_t)sts_distance_rss_distance); APP_LOG(TS_OFF, VLEVEL_M, "\r\nRSS Measured Distance=[%u] mm \r\n", (uint16_t)sts_distance_rss_distance);
// Store valid installation height value // Store valid installation height value
@ -3166,13 +3168,14 @@ void STS_SENSOR_Function_Test_Process(void)
{ {
tstbuf[i++] = (uint8_t)18; //length of following data 16 bytes tstbuf[i++] = (uint8_t)18; //length of following data 16 bytes
#if defined(STS_O7)||defined(STS_O6) #if defined(STS_O7)||defined(STS_O6)
uint8_t self_test_result[18]={0x0}; //uint8_t self_test_result[18]={0x0};
STS_PRESENCE_SENSOR_Function_Test_Process(self_test_result, &count); STS_PRESENCE_SENSOR_Function_Test_Process();
for (uint8_t j=0; j < count; j++)
tstbuf[i++] = (uint8_t) (self_test_result[j]&0xff);
for (uint8_t j=0; j < 12; j++)
{
tstbuf[i ++] = self_test_result[j];
}
//STS_PRESENCE_SENSOR_Distance_Measure_Process(); //STS_PRESENCE_SENSOR_Distance_Measure_Process();
#if 0 #if 0
tstbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/1000)%10+0x30)&0xff; tstbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/1000)%10+0x30)&0xff;

Binary file not shown.