RM2_1 #2

Merged
sundp merged 208 commits from RM2_1 into master 2024-09-13 09:16:14 +08:00
2 changed files with 18 additions and 15 deletions
Showing only changes of commit 1b36e3115e - Show all commits

View File

@ -350,7 +350,8 @@ int sts_presence_rss_fall_rise_detection(void)
return EXIT_FAILURE;
}
// BEFORE MERGE FIRST AND SECOND HALF FALL RISE DETECTION
// ******** First Half detection of fall down and rise up
if (!acc_detector_presence_activate(handle))
{
APP_LOG(TS_OFF, VLEVEL_H, "Failed to activate detector \n");
@ -363,6 +364,7 @@ int sts_presence_rss_fall_rise_detection(void)
uint8_t average_result = 0;
float average_distance =0.0f;
float average_score =0.0f;
#if 0
for (int i = 0; i < (iterations/2); i++)
{
success = acc_detector_presence_get_next(handle, &result);
@ -400,7 +402,7 @@ int sts_presence_rss_fall_rise_detection(void)
acc_detector_presence_deactivate(handle);
APP_LOG(TS_OFF, VLEVEL_H,"First Half Presence Detection, Motion Count = %u \r\n", (int)motion_count);
#endif
// ******** Second Half detection of fall down and rise up
set_default_fall_rise_configuration(presence_configuration);
@ -421,8 +423,8 @@ int sts_presence_rss_fall_rise_detection(void)
return false;
}
acc_detector_presence_configuration_destroy(&presence_configuration);
for (int i = 0; i < (iterations/2); i++)
// set to full lenght of iteration
for (int i = 0; i < (iterations); i++)
{
success = acc_detector_presence_get_next(handle, &result);
if (!success)
@ -441,23 +443,24 @@ int sts_presence_rss_fall_rise_detection(void)
average_score += result.presence_score;
}
if (sts_presence_fall_detection == 1)
{
sts_motion_dataset[motion_count].presence_distance = result.presence_distance;
sts_motion_dataset[motion_count].presence_score = result.presence_score;
if (sts_presence_fall_detection == 1)
{
sts_motion_dataset[motion_count].presence_distance = result.presence_distance;
sts_motion_dataset[motion_count].presence_score = result.presence_score;
if (motion_count ++ == DEFAULT_MOTION_DATASET_LEN)
{
STS_YunhornCheckStandardDeviation();
motion_count = 0;
}
if (motion_count ++ == DEFAULT_MOTION_DATASET_LEN)
{
STS_YunhornCheckStandardDeviation();
motion_count = 0;
}
}
}
acc_integration_sleep_ms(1000 / DEFAULT_UPDATE_RATE_PRESENCE); // DEFAULT_UPDATE_RATE);
acc_integration_sleep_ms(1000 / DEFAULT_UPDATE_RATE_PRESENCE); // DEFAULT_UPDATE_RATE);
}
APP_LOG(TS_OFF, VLEVEL_L,"Second Half, Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
//APP_LOG(TS_OFF, VLEVEL_L,"Second Half, Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
APP_LOG(TS_OFF, VLEVEL_L,"Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
sts_rss_result = (average_result > 3)? 1: 0;
average_distance = (1000.0f*average_distance)/average_result; // in meters

Binary file not shown.