good stable 20250421 for pixel_network
This commit is contained in:
parent
157949c433
commit
1786bb502e
|
@ -128,6 +128,7 @@ volatile float sts_presence_rss_distance, sts_presence_rss_score;
|
||||||
volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config;
|
volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config;
|
||||||
//static void update_configuration(acc_detector_presence_configuration_t presence_configuration);
|
//static void update_configuration(acc_detector_presence_configuration_t presence_configuration);
|
||||||
static void print_result(acc_detector_presence_result_t result);
|
static void print_result(acc_detector_presence_result_t result);
|
||||||
|
void STS_Yunhorn_DistanceStandardDeviation(void);
|
||||||
volatile uint8_t motion_detected_count=0;
|
volatile uint8_t motion_detected_count=0;
|
||||||
volatile uint8_t motion_in_hs_zone[12][10]={0}; //0.4*12=4.8meter high, past 10 measures
|
volatile uint8_t motion_in_hs_zone[12][10]={0}; //0.4*12=4.8meter high, past 10 measures
|
||||||
volatile uint8_t detected_hs_zone=0;;
|
volatile uint8_t detected_hs_zone=0;;
|
||||||
|
@ -148,6 +149,7 @@ volatile uint16_t sts_fall_rising_pattern_factor1=0, sts_fall_rising_pattern_fac
|
||||||
volatile uint16_t sts_roc_acc_standard_variance=0;
|
volatile uint16_t sts_roc_acc_standard_variance=0;
|
||||||
extern volatile uint8_t sts_presence_fall_detection;
|
extern volatile uint8_t sts_presence_fall_detection;
|
||||||
static uint8_t sts_rss_init_ok=0;
|
static uint8_t sts_rss_init_ok=0;
|
||||||
|
volatile uint8_t sts_presence_singularity=1;
|
||||||
extern uint8_t sts_lamp_bar_color;
|
extern uint8_t sts_lamp_bar_color;
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
@ -665,7 +667,7 @@ int sts_presence_rss_fall_rise_detection(void)
|
||||||
//print_result(result);
|
//print_result(result);
|
||||||
if (result.presence_detected)
|
if (result.presence_detected)
|
||||||
{
|
{
|
||||||
print_result(result);
|
//print_result(result);
|
||||||
average_result++;
|
average_result++;
|
||||||
average_distance += result.presence_distance;
|
average_distance += result.presence_distance;
|
||||||
average_score += result.presence_score;
|
average_score += result.presence_score;
|
||||||
|
@ -806,9 +808,12 @@ int sts_presence_rss_fall_rise_detection(void)
|
||||||
|
|
||||||
average_distance = (float)(1000.0f*average_distance)/(float)average_result; // in meters
|
average_distance = (float)(1000.0f*average_distance)/(float)average_result; // in meters
|
||||||
average_score = (float)(1000.0f*average_score)/(float)average_result;
|
average_score = (float)(1000.0f*average_score)/(float)average_result;
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nAverage Distance: %d (mm) Score: %d \r\n",(int)average_distance, (int)average_score);
|
|
||||||
sts_presence_rss_distance = average_distance;
|
sts_presence_rss_distance = average_distance;
|
||||||
sts_presence_rss_score = average_score;
|
sts_presence_rss_score = average_score;
|
||||||
|
|
||||||
|
STS_Yunhorn_DistanceStandardDeviation();
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_H, "\r\nAverage Distance: %d (mm) Score: %d Singularity: %d \r\n",(int)average_distance, (int)average_score, sts_presence_singularity);
|
||||||
// uint8_t pre_sts_rss_result = (average_result > (DEFAULT_UPDATE_RATE_PRESENCE/5))? 1: 0;
|
// uint8_t pre_sts_rss_result = (average_result > (DEFAULT_UPDATE_RATE_PRESENCE/5))? 1: 0;
|
||||||
// sts_rss_result=STS_RSS_Filter(pre_sts_rss_result);
|
// sts_rss_result=STS_RSS_Filter(pre_sts_rss_result);
|
||||||
|
|
||||||
|
@ -820,19 +825,27 @@ int sts_presence_rss_fall_rise_detection(void)
|
||||||
// sts_rss_result = (average_result > 0)? 1: 0;
|
// sts_rss_result = (average_result > 0)? 1: 0;
|
||||||
|
|
||||||
uint8_t pre_sts_rss_result=0;
|
uint8_t pre_sts_rss_result=0;
|
||||||
|
|
||||||
if (sts_work_mode == STS_UNI_MODE) {
|
if (sts_work_mode == STS_UNI_MODE) {
|
||||||
pre_sts_rss_result = (average_result > 0)? 1: 0;
|
pre_sts_rss_result = (average_result > 0)? 1: 0;
|
||||||
} else {
|
} else {
|
||||||
pre_sts_rss_result = (average_result > 0)? 1: 0;
|
|
||||||
|
pre_sts_rss_result = ((average_result > 0)&&(sts_presence_singularity ==0))? 1: 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Write_RingBuff(pre_sts_rss_result);
|
//Write_RingBuff(pre_sts_rss_result);
|
||||||
//STS_RSS_Filter_ring();
|
//STS_RSS_Filter_ring();
|
||||||
STS_RSS_Filter(pre_sts_rss_result);
|
STS_RSS_Filter(pre_sts_rss_result);
|
||||||
|
|
||||||
|
//else {
|
||||||
|
// sts_rss_result = 0;
|
||||||
|
// }
|
||||||
|
|
||||||
// APP_LOG(TS_OFF, VLEVEL_M, "\r\nMotionCount=%4d Overall Motion=%d \r\n", (int)motion_count, (int)sts_rss_result);
|
// APP_LOG(TS_OFF, VLEVEL_M, "\r\nMotionCount=%4d Overall Motion=%d \r\n", (int)motion_count, (int)sts_rss_result);
|
||||||
//APP_LOG(TS_OFF, VLEVEL_M, "\r\nAverage Result=%d Distance=%d, Score=%d MotionCount=%d ---Overall Result=%d \r\n",
|
//APP_LOG(TS_OFF, VLEVEL_M, "\r\nAverage Result=%d Distance=%d, Score=%d MotionCount=%d ---Overall Result=%d \r\n",
|
||||||
// (int)average_result, (int)average_distance, (int)average_score, (int)motion_count, (int)sts_rss_result);
|
// (int)average_result, (int)average_distance, (int)average_score, (int)motion_count, (int)sts_rss_result);
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nMotion Status: %d %d (mm) %d Rated-> %d \r\n",(int)average_result, (int)average_distance, (int)average_score, (int)sts_rss_result);
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\nMotion Status: %d %d (mm) %d singularity: %d Rated-> %d \r\n",(int)average_result, (int)average_distance, (int)average_score, (int)sts_presence_singularity, (int)sts_rss_result);
|
||||||
#if 0
|
#if 0
|
||||||
if (sts_rss_result) //if (average_score !=0) //if (sts_rss_result)
|
if (sts_rss_result) //if (average_score !=0) //if (sts_rss_result)
|
||||||
{
|
{
|
||||||
|
@ -913,7 +926,36 @@ int sts_presence_rss_fall_rise_detection(void)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void STS_Yunhorn_DistanceStandardDeviation(void)
|
||||||
|
{
|
||||||
|
uint16_t i,j;
|
||||||
|
uint32_t sum_presence_distance = 0;
|
||||||
|
uint32_t average_presence_distance = 0;
|
||||||
|
|
||||||
|
uint8_t SAMPLE_DATASET_NUM = MIN(motion_count,DEFAULT_UPDATE_RATE_PRESENCE );
|
||||||
|
|
||||||
|
for(i= 0; i< SAMPLE_DATASET_NUM; i++)
|
||||||
|
{
|
||||||
|
sum_presence_distance += (uint32_t)sts_motion_dataset[i].presence_distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
average_presence_distance = ((uint32_t)sum_presence_distance/(uint32_t)(SAMPLE_DATASET_NUM));
|
||||||
|
|
||||||
|
sum_presence_distance = 0;
|
||||||
|
for (j = 0; j < SAMPLE_DATASET_NUM; j++)
|
||||||
|
{
|
||||||
|
sum_presence_distance += (uint32_t)(sts_motion_dataset[j].presence_distance - average_presence_distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sum_presence_distance > 0)
|
||||||
|
{
|
||||||
|
sts_presence_singularity = 0;
|
||||||
|
} else {
|
||||||
|
sts_presence_singularity = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// APP_LOG(TS_OFF, VLEVEL_M, "\r\n*** STS_Singularity=%u ***\r\n", sts_presence_singularity);
|
||||||
|
}
|
||||||
void STS_YunhornCheckStandardDeviation(void)
|
void STS_YunhornCheckStandardDeviation(void)
|
||||||
{
|
{
|
||||||
uint16_t i,j; // sts_sensor_install_height <--- average_presence_distance should be approaching this distance - 50cm
|
uint16_t i,j; // sts_sensor_install_height <--- average_presence_distance should be approaching this distance - 50cm
|
||||||
|
|
|
@ -118,7 +118,7 @@ volatile uint8_t sts_rss_2nd_result = STS_RESULT_NO_MOTION; //2nd RSS sensor st
|
||||||
volatile uint8_t sts_tof_result = STS_RESULT_NO_MOTION;
|
volatile uint8_t sts_tof_result = STS_RESULT_NO_MOTION;
|
||||||
volatile uint8_t last_sts_rss_result=STS_RESULT_NO_MOTION;
|
volatile uint8_t last_sts_rss_result=STS_RESULT_NO_MOTION;
|
||||||
_Bool Motion_Flag = 0;
|
_Bool Motion_Flag = 0;
|
||||||
|
extern volatile uint8_t sts_presence_singularity;
|
||||||
volatile uint8_t sts_rss_cfg_slid_win_threshold=8;
|
volatile uint8_t sts_rss_cfg_slid_win_threshold=8;
|
||||||
volatile uint8_t sts_rss_cfg_slid_win_size=12;
|
volatile uint8_t sts_rss_cfg_slid_win_size=12;
|
||||||
|
|
||||||
|
@ -1551,6 +1551,7 @@ void Radar_Filtering_clutter(volatile uint8_t *color)
|
||||||
//
|
//
|
||||||
static uint8_t motion_read[FILTER_LEN]={0};
|
static uint8_t motion_read[FILTER_LEN]={0};
|
||||||
static uint8_t idx_filter=0;
|
static uint8_t idx_filter=0;
|
||||||
|
static uint8_t sts_cnt_singularity=0;
|
||||||
|
|
||||||
void STS_RSS_Filter(uint8_t pre_sts_rss_result)
|
void STS_RSS_Filter(uint8_t pre_sts_rss_result)
|
||||||
{
|
{
|
||||||
|
@ -1582,11 +1583,21 @@ void STS_RSS_Filter(uint8_t pre_sts_rss_result)
|
||||||
//sts_rss_result= ((sum_filter >= SLIDING_THRESHOLD))? 1:0;
|
//sts_rss_result= ((sum_filter >= SLIDING_THRESHOLD))? 1:0;
|
||||||
// sts_rss_result= ((sum_filter > (SLIDING_WIN_LEN - SLIDING_THRESHOLD)))? 1:0;
|
// sts_rss_result= ((sum_filter > (SLIDING_WIN_LEN - SLIDING_THRESHOLD)))? 1:0;
|
||||||
sts_rss_result= ((sum_filter > (sts_rss_cfg_slid_win_size - sts_rss_cfg_slid_win_threshold)))? 1:0;
|
sts_rss_result= ((sum_filter > (sts_rss_cfg_slid_win_size - sts_rss_cfg_slid_win_threshold)))? 1:0;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
sts_rss_result= ((sum_filter > sts_rss_cfg_slid_win_threshold))? 1:0;
|
sts_rss_result= ((sum_filter > sts_rss_cfg_slid_win_threshold))? 1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if ((sts_presence_singularity == 1 )&& (sts_cnt_singularity ++ > sts_rss_cfg_slid_win_threshold))
|
||||||
|
{
|
||||||
|
sts_rss_result = 0;
|
||||||
|
sts_cnt_singularity =0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue