wip
This commit is contained in:
parent
540e9e55a9
commit
1ea6d47bc8
|
@ -96,6 +96,7 @@ enum RSS_CFG_order{
|
||||||
#define STS_RSS_CONFIG_DEFAULT 0x01
|
#define STS_RSS_CONFIG_DEFAULT 0x01
|
||||||
#define STS_RSS_CONFIG_SIMPLE 0x02
|
#define STS_RSS_CONFIG_SIMPLE 0x02
|
||||||
#define STS_RSS_CONFIG_FULL 0x04
|
#define STS_RSS_CONFIG_FULL 0x04
|
||||||
|
#define STS_RSS_CONFIG_BGN_SCAN 0x05
|
||||||
#define STS_RSS_CONFIG_FALL_DETECTION 0x08
|
#define STS_RSS_CONFIG_FALL_DETECTION 0x08
|
||||||
#if 0
|
#if 0
|
||||||
enum sts_rss_config_update_t {
|
enum sts_rss_config_update_t {
|
||||||
|
|
|
@ -220,7 +220,68 @@ float update_m = 0.0f;
|
||||||
|
|
||||||
float frame_fast = 20.0f;
|
float frame_fast = 20.0f;
|
||||||
float frame_slow = 0.1f;
|
float frame_slow = 0.1f;
|
||||||
|
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);
|
||||||
|
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_downsampling_factor_set(presence_configuration, 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_update_rate_set(presence_configuration, 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_start_set(presence_configuration, sts_presence_rss_config.default_start_m);
|
||||||
|
acc_detector_presence_configuration_length_set(presence_configuration, sts_presence_rss_config.default_length_m);
|
||||||
|
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_filter_parameters_t filter;
|
||||||
|
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_slow_cutoff = sts_presence_rss_config.default_inter_frame_slow_cutoff;
|
||||||
|
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
|
||||||
|
|
||||||
|
switch (cfg_type) {
|
||||||
|
|
||||||
|
case STS_RSS_CONFIG_NON:
|
||||||
|
case STS_RSS_CONFIG_DEFAULT:
|
||||||
|
case STS_RSS_CONFIG_SIMPLE:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case STS_RSS_CONFIG_FULL:
|
||||||
|
//filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
|
||||||
|
filter.inter_frame_deviation_time_const = sts_presence_rss_config.default_inter_frame_deviation_time_const;
|
||||||
|
filter.inter_frame_fast_cutoff = sts_presence_rss_config.default_inter_frame_fast_cutoff;
|
||||||
|
filter.inter_frame_slow_cutoff = sts_presence_rss_config.default_inter_frame_slow_cutoff;
|
||||||
|
filter.intra_frame_time_const = sts_presence_rss_config.default_intra_frame_time_const;
|
||||||
|
filter.intra_frame_weight = sts_presence_rss_config.default_intra_frame_weight;
|
||||||
|
filter.output_time_const = sts_presence_rss_config.default_output_time_const; //0.0f;
|
||||||
|
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
|
||||||
|
break;
|
||||||
|
case STS_RSS_CONFIG_FALL_DETECTION:
|
||||||
|
//filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
|
||||||
|
// if intra-frame-weight set to 1.0, then the following inter-frame parameters have no effect
|
||||||
|
filter.inter_frame_deviation_time_const = DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST;
|
||||||
|
filter.inter_frame_fast_cutoff = 10.0f; //DEFAULT_INTER_FRAME_FAST_CUTOFF;
|
||||||
|
filter.inter_frame_slow_cutoff = 0.5f; //DEFAULT_INTER_FRAME_SLOW_CUTOFF;
|
||||||
|
// For fast movement, decrease the time constant
|
||||||
|
// filter.intra_frame_time_const = DEFAULT_INTRA_FRAME_TIME_CONST;
|
||||||
|
filter.intra_frame_time_const = 0.2f;
|
||||||
|
// filter.intra_frame_weight = DEFAULT_INTRA_FRAME_WEIGHT;
|
||||||
|
// FOR fast movement tracking set intra-frame-weight to 1.0
|
||||||
|
filter.intra_frame_weight = 1.0f;
|
||||||
|
// if detection toggles too often, increase the following, if too sluggish, decrease it instead
|
||||||
|
filter.output_time_const = DEFAULT_OUTPUT_TIME_CONST; //0.0f;
|
||||||
|
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
void update_configuration(acc_detector_presence_configuration_t presence_configuration)
|
void update_configuration(acc_detector_presence_configuration_t presence_configuration)
|
||||||
{
|
{
|
||||||
float start_m_t = 0.0f;
|
float start_m_t = 0.0f;
|
||||||
|
@ -253,7 +314,7 @@ void update_configuration(acc_detector_presence_configuration_t presence_configu
|
||||||
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
|
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void set_default_configuration_common(acc_detector_presence_configuration_t presence_configuration)
|
static void set_default_configuration_common(acc_detector_presence_configuration_t presence_configuration)
|
||||||
{
|
{
|
||||||
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, sts_presence_rss_config.default_update_rate_presence);
|
||||||
|
@ -280,6 +341,9 @@ static void set_default_configuration_common(acc_detector_presence_configuration
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void set_default_configuration(acc_detector_presence_configuration_t presence_configuration)
|
static void set_default_configuration(acc_detector_presence_configuration_t presence_configuration)
|
||||||
{
|
{
|
||||||
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
|
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
|
||||||
|
@ -327,6 +391,8 @@ static void set_default_configuration(acc_detector_presence_configuration_t pres
|
||||||
// by set_default_configuration_common
|
// by set_default_configuration_common
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set default values in fall_rise detection configuration
|
* @brief Set default values in fall_rise detection configuration
|
||||||
*
|
*
|
||||||
|
@ -431,7 +497,7 @@ static void sts_rss_set_configuration_background_evalution(acc_detector_presence
|
||||||
//set_default_configuration_common(presence_configuration);
|
//set_default_configuration_common(presence_configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void sts_rss_set_current_configuration_simple(acc_detector_presence_configuration_t presence_configuration)
|
static void sts_rss_set_current_configuration_simple(acc_detector_presence_configuration_t presence_configuration)
|
||||||
{
|
{
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nsts_rss_cfg-start: %4d ,length: %4d ,threshold: %4d ,gain: %2d ,rate: %2d ,profile: %1d \r\n",
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\nsts_rss_cfg-start: %4d ,length: %4d ,threshold: %4d ,gain: %2d ,rate: %2d ,profile: %1d \r\n",
|
||||||
|
@ -455,36 +521,44 @@ static void sts_rss_set_current_configuration_simple(acc_detector_presence_confi
|
||||||
|
|
||||||
//set_default_configuration_common(presence_configuration);
|
//set_default_configuration_common(presence_configuration);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void print_current_configuration(acc_detector_presence_configuration_t presence_configuration)
|
static void print_current_configuration(acc_detector_presence_configuration_t presence_configuration)
|
||||||
{
|
{
|
||||||
static uint32_t cnt_0=0;
|
static uint32_t cnt_0=0;
|
||||||
//if (cnt_0++%200 !=0) return;
|
if (cnt_0++%200 !=0) return;
|
||||||
float sts_run_start = acc_detector_presence_configuration_start_get(presence_configuration);
|
float sts_run_start = acc_detector_presence_configuration_start_get(presence_configuration);
|
||||||
float sts_run_length = acc_detector_presence_configuration_length_get(presence_configuration);
|
float sts_run_length = acc_detector_presence_configuration_length_get(presence_configuration);
|
||||||
float sts_run_threshold = acc_detector_presence_configuration_detection_threshold_get(presence_configuration);
|
float sts_run_threshold = acc_detector_presence_configuration_detection_threshold_get(presence_configuration);
|
||||||
float sts_run_gain = acc_detector_presence_configuration_receiver_gain_get(presence_configuration);
|
float 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);
|
||||||
float sts_run_profile = acc_detector_presence_configuration_service_profile_get(presence_configuration);
|
float 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);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
float sts_run_f_inter_fast_cutoff = sts_run_filter.inter_frame_fast_cutoff;
|
float sts_run_f_inter_fast_cutoff = sts_run_filter.inter_frame_fast_cutoff;
|
||||||
float sts_run_f_inter_slow_cutoff = sts_run_filter.inter_frame_slow_cutoff;
|
float sts_run_f_inter_slow_cutoff = sts_run_filter.inter_frame_slow_cutoff;
|
||||||
|
#if 0
|
||||||
float sts_run_f_inter_frame_dev_time_const = sts_run_filter.inter_frame_deviation_time_const;
|
float sts_run_f_inter_frame_dev_time_const = sts_run_filter.inter_frame_deviation_time_const;
|
||||||
|
|
||||||
float sts_run_f_intra_frame_time_const = sts_run_filter.intra_frame_time_const;
|
float sts_run_f_intra_frame_time_const = sts_run_filter.intra_frame_time_const;
|
||||||
float sts_run_f_intra_frame_weight = sts_run_filter.intra_frame_weight;
|
float sts_run_f_intra_frame_weight = sts_run_filter.intra_frame_weight;
|
||||||
float sts_run_f_output_time_const = sts_run_filter.output_time_const;
|
float sts_run_f_output_time_const = sts_run_filter.output_time_const;
|
||||||
|
#endif
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nWork_mode:%2d Start: %4d (mm) Length: %4d (mm) Threshold: %4d (*) Gain= %2d (%) UpdateRate=%4d Profile= %d \r\n",
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\nWork_mode:%2d Start: %4d (mm) Length: %4d (mm) Threshold: %4d (*) Gain= %2d (%) UpdateRate=%4d Profile= %d \r\n",
|
||||||
sts_work_mode, (int)(1000.0*sts_run_start), (int)(1000.0*sts_run_length), (int)(1000.0*sts_run_threshold),
|
sts_work_mode, (int)(1000.0*sts_run_start), (int)(1000.0*sts_run_length), (int)(1000.0*sts_run_threshold),
|
||||||
(int)(100.0*sts_run_gain),(int)sts_run_update_rate, (int)sts_run_profile);
|
(int)(100.0*sts_run_gain),(int)sts_run_update_rate, (int)sts_run_profile);
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n(1)FastCut:%4u (2)SlowCut:%4u (3)Sweeps_per_frame:%4u \r\n",
|
||||||
|
(int)(1000.0*sts_run_f_inter_fast_cutoff), (int)(1000*sts_run_f_inter_slow_cutoff), (int)Sweeps_per_frame);
|
||||||
|
|
||||||
|
#if 0
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\rn\n(1)FastCut:%4u (2)SlowCut:%4u (3)InterFrameDevTime:%4u "
|
APP_LOG(TS_OFF, VLEVEL_M, "\rn\n(1)FastCut:%4u (2)SlowCut:%4u (3)InterFrameDevTime:%4u "
|
||||||
"(4)IntraFrameTimeConst:%4d (5)IntraWeight:%4u (5)OutputTime:%4u \r\n",
|
"(4)IntraFrameTimeConst:%4d (5)IntraWeight:%4u (5)OutputTime:%4u \r\n",
|
||||||
(int)(1000.0*sts_run_f_inter_fast_cutoff), (int)(1000*sts_run_f_inter_slow_cutoff), (int)(1000*sts_run_f_inter_frame_dev_time_const),
|
(int)(1000.0*sts_run_f_inter_fast_cutoff), (int)(1000*sts_run_f_inter_slow_cutoff), (int)(1000*sts_run_f_inter_frame_dev_time_const),
|
||||||
(int)(1000*sts_run_f_intra_frame_time_const),(int)(1000*sts_run_f_intra_frame_weight),(int)(1000*sts_run_f_output_time_const));
|
(int)(1000*sts_run_f_intra_frame_time_const),(int)(1000*sts_run_f_intra_frame_weight),(int)(1000*sts_run_f_output_time_const));
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,81 +679,36 @@ static void print_result(acc_detector_presence_result_t result)
|
||||||
|
|
||||||
int sts_presence_rss_background_evaluation_process(uint16_t *evaluated_distance, uint16_t *evaluated_score)
|
int sts_presence_rss_background_evaluation_process(uint16_t *evaluated_distance, uint16_t *evaluated_score)
|
||||||
{
|
{
|
||||||
|
sts_rss_config_updated_flag = STS_RSS_CONFIG_BGN_SCAN;
|
||||||
|
|
||||||
const acc_hal_t *hal = acc_hal_integration_get_implementation();
|
if (rss_handle == NULL) {
|
||||||
|
sts_presence_rss_detection_init();
|
||||||
if (!acc_rss_activate(hal))
|
|
||||||
{
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_H,"Failed to activate RSS\n");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
acc_rss_override_sensor_id_check_at_creation(true);
|
|
||||||
|
|
||||||
acc_detector_presence_configuration_t presence_configuration = acc_detector_presence_configuration_create();
|
|
||||||
if (presence_configuration == NULL)
|
|
||||||
{
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_H,"Failed to create configuration\n");
|
|
||||||
acc_rss_deactivate();
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sts_rss_set_configuration_background_evalution(presence_configuration);
|
|
||||||
|
|
||||||
acc_detector_presence_handle_t handle = acc_detector_presence_create(presence_configuration);
|
|
||||||
if (handle == NULL)
|
|
||||||
{
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_H,"Failed to create detector\n");
|
|
||||||
acc_detector_presence_configuration_destroy(&presence_configuration);
|
|
||||||
acc_detector_presence_destroy(&handle);
|
|
||||||
acc_rss_deactivate();
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
print_current_configuration(presence_configuration);
|
|
||||||
|
|
||||||
acc_detector_presence_configuration_destroy(&presence_configuration);
|
|
||||||
|
|
||||||
|
|
||||||
if (!acc_detector_presence_activate(handle))
|
|
||||||
{
|
|
||||||
APP_LOG(TS_OFF, VLEVEL_H, "Failed to activate detector \n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool deactivated = false;
|
|
||||||
bool success = true;
|
|
||||||
const int iterations = 1000;
|
const int iterations = 1000;
|
||||||
acc_detector_presence_result_t result;
|
//acc_detector_presence_result_t result;
|
||||||
uint16_t motioncount = 0;
|
uint16_t motioncount = 0;
|
||||||
float average_distance =0.0f;
|
float average_distance =0.0f;
|
||||||
float average_score =0.0f;
|
float average_score =0.0f;
|
||||||
|
|
||||||
for (int i = 0; i < (iterations); i++)
|
for (int i = 0; i < (iterations); i++)
|
||||||
{
|
{
|
||||||
success = acc_detector_presence_get_next(handle, &result);
|
sts_presence_rss_detection_process();
|
||||||
if (!success)
|
//print_result(result);
|
||||||
|
//if (!rss_result.data_saturated)
|
||||||
|
{
|
||||||
|
//if (rss_result.presence_detected)
|
||||||
{
|
{
|
||||||
APP_LOG(TS_OFF, VLEVEL_H,"acc_detector_presence_get_next() failed\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//print_result(result);
|
|
||||||
if (!result.data_saturated)
|
|
||||||
{
|
|
||||||
if (result.presence_detected)
|
|
||||||
{
|
|
||||||
//print_result(result);
|
|
||||||
motioncount++;
|
motioncount++;
|
||||||
average_distance += result.presence_distance;
|
average_distance += rss_result.presence_distance;
|
||||||
average_score += result.presence_score;
|
average_score += rss_result.presence_score;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acc_integration_sleep_ms(60); //--- around 1000ms in total
|
acc_integration_sleep_ms(60); //--- around 1000ms in total
|
||||||
if (motioncount%10 ==0)
|
if (motioncount%20 ==0)
|
||||||
{
|
{
|
||||||
|
|
||||||
LED1_TOGGLE;
|
LED1_TOGGLE;
|
||||||
|
@ -687,9 +716,6 @@ int sts_presence_rss_background_evaluation_process(uint16_t *evaluated_distance,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivated = acc_detector_presence_deactivate(handle);
|
|
||||||
acc_detector_presence_destroy(&handle);
|
|
||||||
acc_rss_deactivate();
|
|
||||||
|
|
||||||
average_distance = (1000.0f*average_distance)/motioncount; // in meters
|
average_distance = (1000.0f*average_distance)/motioncount; // in meters
|
||||||
average_score = (1000.0f*average_score)/motioncount;
|
average_score = (1000.0f*average_score)/motioncount;
|
||||||
|
@ -724,7 +750,14 @@ int sts_presence_rss_detection_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sts_rss_set_current_configuration_simple(presence_configuration);
|
//sts_rss_set_current_configuration_simple(presence_configuration);
|
||||||
update_configuration(presence_configuration);
|
//update_configuration(presence_configuration);
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n STS CFG Configuration \r\n");
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\nWork_mode:%2d Start: %4d (mm) Length: %4d (mm) Threshold: %4d (*) Gain= %2d (%) UpdateRate=%4d Profile= %d \r\n",
|
||||||
|
sts_work_mode, (int)(1000.0*sts_presence_rss_config.default_start_m), (int)(1000.0*sts_presence_rss_config.default_length_m), (int)(1000.0*sts_presence_rss_config.default_threshold),
|
||||||
|
(int)(100.0*sts_presence_rss_config.default_receiver_gain),(int)sts_presence_rss_config.default_update_rate_presence, (int)sts_presence_rss_config.default_profile);
|
||||||
|
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n STS CFG update flag =%d \r\n", sts_rss_config_updated_flag);
|
||||||
|
update_configuration_with_type(presence_configuration, sts_rss_config_updated_flag);
|
||||||
//set_default_configuration(presence_configuration);
|
//set_default_configuration(presence_configuration);
|
||||||
print_current_configuration(presence_configuration);
|
print_current_configuration(presence_configuration);
|
||||||
|
|
||||||
|
@ -758,6 +791,7 @@ int sts_presence_rss_detection_process(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
success = acc_detector_presence_get_next(rss_handle, &rss_result);
|
success = acc_detector_presence_get_next(rss_handle, &rss_result);
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
|
@ -781,6 +815,7 @@ int sts_presence_rss_detection_deinit(void)
|
||||||
} else return EXIT_FAILURE;
|
} else return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sts_presence_rss_fall_rise_detection(void)
|
int sts_presence_rss_fall_rise_detection(void)
|
||||||
{
|
{
|
||||||
const acc_hal_t *hal = acc_hal_integration_get_implementation();
|
const acc_hal_t *hal = acc_hal_integration_get_implementation();
|
||||||
|
|
|
@ -786,6 +786,9 @@ void STS_PRESENCE_SENSOR_NVM_CFG_SIMPLE(void)
|
||||||
sts_presence_rss_config.default_update_rate_presence = (float)(sts_cfg_nvm.p[RSS_CFG_RATE_PRESENCE]);
|
sts_presence_rss_config.default_update_rate_presence = (float)(sts_cfg_nvm.p[RSS_CFG_RATE_PRESENCE]);
|
||||||
sts_presence_rss_config.default_hwaas = (float)(sts_cfg_nvm.p[RSS_CFG_HWAAS]);
|
sts_presence_rss_config.default_hwaas = (float)(sts_cfg_nvm.p[RSS_CFG_HWAAS]);
|
||||||
|
|
||||||
|
sts_presence_rss_config.default_inter_frame_fast_cutoff = (float)(sts_cfg_nvm.p[RSS_CFG_ITE_FAST_CUTOFF]);
|
||||||
|
sts_presence_rss_config.default_inter_frame_slow_cutoff = (float)(sts_cfg_nvm.p[RSS_CFG_ITE_SLOW_CUTOFF]*0.01f);
|
||||||
|
|
||||||
sts_presence_rss_config.default_nbr_removed_pc = (float)(sts_cfg_nvm.p[RSS_CFG_NBR_REMOVED_PC]);
|
sts_presence_rss_config.default_nbr_removed_pc = (float)(sts_cfg_nvm.p[RSS_CFG_NBR_REMOVED_PC]);
|
||||||
|
|
||||||
// sts_rss_config_updated_flag = (sts_rss_config_updated_flag|STS_RSS_CONFIG_SIMPLE); //set to 1 for simple config effect in next detection
|
// sts_rss_config_updated_flag = (sts_rss_config_updated_flag|STS_RSS_CONFIG_SIMPLE); //set to 1 for simple config effect in next detection
|
||||||
|
|
|
@ -100,28 +100,28 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
|
||||||
0x0A,
|
0x0A,
|
||||||
'M', //Uplink data interval for heart-beat uplink
|
'M', //Uplink data interval for heart-beat uplink
|
||||||
0x01,
|
0x01,
|
||||||
'S', //Sampling sensor interval for real-time sensing of MEMS
|
'L', //Sampling sensor interval for real-time sensing of MEMS
|
||||||
0x03, // dual mode=4, uni_mode =5
|
0x03, // dual mode=4, uni_mode =5
|
||||||
0x00, // sts service mask
|
0x00, // sts service mask
|
||||||
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
|
0x08, //start_m [8]*0.1 meter =0.8
|
||||||
0x19, //lenght_m 0x19=[25]*0.1=2.5f meter
|
0x14, //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
|
||||||
0x28, //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
|
0x41, //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
|
||||||
0x0A, //inter frame fast cutoff 0x0A=[10] = 10U
|
0x14, //inter frame fast cutoff 0x0A=[10] = 10U
|
||||||
0x01, //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
|
0x00, //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
|
0x09, //output time const 0x05=[5]*0.1=0.5 0.5--> 0.9 2025-03-26 TODO XXXXXX
|
||||||
0x02, //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
|
||||||
0x6E, //P[18] RSS_CFG_BG_MOTION_NOISE 2025-04-14
|
0x6E, //P[18] RSS_CFG_BG_MOTION_NOISE 2025-04-14
|
||||||
|
@ -3047,14 +3047,18 @@ void OnRestoreSTSCFGContextProcess(void)
|
||||||
periodicity *= 1000; // to ms
|
periodicity *= 1000; // to ms
|
||||||
|
|
||||||
uint32_t sampling = (sts_cfg_nvm.sampling);
|
uint32_t sampling = (sts_cfg_nvm.sampling);
|
||||||
|
#if defined(STS_O6)||defined(STS_O7)
|
||||||
if ((char)sts_cfg_nvm.s_unit =='M') {
|
if ((char)sts_cfg_nvm.s_unit =='M') {
|
||||||
sampling *= 60;
|
sampling *= 60;
|
||||||
} else if ((char) sts_cfg_nvm.s_unit =='H') {
|
} else if ((char) sts_cfg_nvm.s_unit =='H') {
|
||||||
sampling *= 3600;
|
sampling *= 3600;
|
||||||
} else if ((char) sts_cfg_nvm.s_unit =='S') {
|
} else if ((char) sts_cfg_nvm.s_unit =='S') {
|
||||||
sampling *= 1;
|
sampling *= 1;
|
||||||
|
} else if ((char) sts_cfg_nvm.s_unit =='L') {
|
||||||
|
sampling *= 100;
|
||||||
}
|
}
|
||||||
sampling= sampling*1000; // to ms
|
// sampling= sampling*1000; // to ms
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((sts_cfg_nvm.ac[0] ==0x0 )&& (sts_cfg_nvm.ac[19]==0x0))
|
if ((sts_cfg_nvm.ac[0] ==0x0 )&& (sts_cfg_nvm.ac[19]==0x0))
|
||||||
{ // ensure it's not in production yet
|
{ // ensure it's not in production yet
|
||||||
|
@ -3078,7 +3082,7 @@ void OnRestoreSTSCFGContextProcess(void)
|
||||||
//OnYunhornSTSHeartBeatPeriodicityChanged(APP_TX_DUTYCYCLE);
|
//OnYunhornSTSHeartBeatPeriodicityChanged(APP_TX_DUTYCYCLE);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//OnYunhornSTSSamplingPeriodicityChanged(sampling); // in m-sec unit
|
OnYunhornSTSSamplingPeriodicityChanged(sampling); // in m-sec unit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R4_ENABLED)
|
#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R4_ENABLED)
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue