|
|
@ -53,8 +53,10 @@
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//volatile distance_measure_cfg_t distance_cfg={1.5, 2.0, 1, 63, 2, 10, 0.5, 1.3, 0.2};
|
|
|
|
//volatile distance_measure_cfg_t distance_cfg={1.5, 2.0, 1, 63, 2, 10, 0.5, 1.3, 0.2};
|
|
|
|
//volatile distance_measure_cfg_t distance_cfg={1.5, 2.0, 2, 63, 2, 10, 0.5, 1.3, 0.2};
|
|
|
|
// SPARK FUN EXAMPLE
|
|
|
|
volatile distance_measure_cfg_t distance_cfg={1.5, 3.3, 2, 63, 4, 10, 0.8182f, 0.4, 0.2};
|
|
|
|
// GOOD --- volatile distance_measure_cfg_t distance_cfg={0.4, 3.5, 4, 63, 0, 10, 0.5, 1.3, 0.2};
|
|
|
|
|
|
|
|
volatile distance_measure_cfg_t distance_cfg={0.8, 3.5, 4, 63, 2, 10, 0.5, 1.3, 0.2};
|
|
|
|
|
|
|
|
//volatile distance_measure_cfg_t distance_cfg={1.5, 3.3, 2, 63, 4, 10, 0.8182f, 0.4, 0.2};
|
|
|
|
extern float sts_distance_rss_distance, sts_sensor_install_height;
|
|
|
|
extern float sts_distance_rss_distance, sts_sensor_install_height;
|
|
|
|
|
|
|
|
|
|
|
|
static void sts_distance_rss_update_configuration(acc_detector_distance_configuration_t distance_configuration);
|
|
|
|
static void sts_distance_rss_update_configuration(acc_detector_distance_configuration_t distance_configuration);
|
|
|
@ -75,7 +77,7 @@ int sts_distance_rss_detector_distance(void)
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
acc_rss_override_sensor_id_check_at_creation(true);
|
|
|
|
//acc_rss_override_sensor_id_check_at_creation(true);
|
|
|
|
|
|
|
|
|
|
|
|
acc_detector_distance_configuration_t distance_configuration = acc_detector_distance_configuration_create();
|
|
|
|
acc_detector_distance_configuration_t distance_configuration = acc_detector_distance_configuration_create();
|
|
|
|
|
|
|
|
|
|
|
@ -87,6 +89,7 @@ int sts_distance_rss_detector_distance(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sts_distance_rss_update_configuration(distance_configuration);
|
|
|
|
sts_distance_rss_update_configuration(distance_configuration);
|
|
|
|
|
|
|
|
|
|
|
|
acc_detector_distance_handle_t distance_handle = acc_detector_distance_create(distance_configuration);
|
|
|
|
acc_detector_distance_handle_t distance_handle = acc_detector_distance_create(distance_configuration);
|
|
|
|
|
|
|
|
|
|
|
|
if (distance_handle == NULL)
|
|
|
|
if (distance_handle == NULL)
|
|
|
@ -108,8 +111,8 @@ int sts_distance_rss_detector_distance(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool success = true;
|
|
|
|
bool success = true;
|
|
|
|
const int iterations = 1; //5;
|
|
|
|
const int iterations = 5; //5;
|
|
|
|
uint16_t number_of_peaks = 10.0f;
|
|
|
|
uint16_t number_of_peaks = 5;
|
|
|
|
acc_detector_distance_result_t result[number_of_peaks];
|
|
|
|
acc_detector_distance_result_t result[number_of_peaks];
|
|
|
|
acc_detector_distance_result_info_t result_info;
|
|
|
|
acc_detector_distance_result_info_t result_info;
|
|
|
|
float tmp_distance = 0.0f;
|
|
|
|
float tmp_distance = 0.0f;
|
|
|
@ -129,6 +132,7 @@ int sts_distance_rss_detector_distance(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sts_distance_rss_distance = (uint16_t)(1000*tmp_distance/result_info.number_of_peaks);
|
|
|
|
sts_distance_rss_distance = (uint16_t)(1000*tmp_distance/result_info.number_of_peaks);
|
|
|
|
|
|
|
|
sts_distance_rss_distance /= iterations;
|
|
|
|
|
|
|
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\nAverage Distance= %u mm\r\n", (uint16_t)sts_distance_rss_distance);
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\nAverage Distance= %u mm\r\n", (uint16_t)sts_distance_rss_distance);
|
|
|
|
// ensure it's a valid installation height
|
|
|
|
// ensure it's a valid installation height
|
|
|
@ -169,6 +173,7 @@ static void sts_distance_rss_update_configuration(acc_detector_distance_configur
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
//backup. ... previous setting ----don't delete
|
|
|
|
//backup. ... previous setting ----don't delete
|
|
|
|
|
|
|
|
|
|
|
|
static void sts_distance_rss_update_configuration(acc_detector_distance_configuration_t distance_configuration)
|
|
|
|
static void sts_distance_rss_update_configuration(acc_detector_distance_configuration_t distance_configuration)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
acc_detector_distance_configuration_requested_start_set(distance_configuration, distance_cfg.start_m);
|
|
|
|
acc_detector_distance_configuration_requested_start_set(distance_configuration, distance_cfg.start_m);
|
|
|
@ -185,6 +190,7 @@ static void sts_distance_rss_update_configuration(acc_detector_distance_configur
|
|
|
|
acc_detector_distance_configuration_record_background_sweeps_set(distance_configuration, 16);
|
|
|
|
acc_detector_distance_configuration_record_background_sweeps_set(distance_configuration, 16);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
static void print_distances(acc_detector_distance_result_t *result, uint16_t reflection_count)
|
|
|
|
static void print_distances(acc_detector_distance_result_t *result, uint16_t reflection_count)
|
|
|
|
{
|
|
|
|
{
|
|
|
|