diff --git a/Core/Src/yunhorn_sts_presence_rss.c b/Core/Src/yunhorn_sts_presence_rss.c index b118726..f62f388 100644 --- a/Core/Src/yunhorn_sts_presence_rss.c +++ b/Core/Src/yunhorn_sts_presence_rss.c @@ -90,6 +90,7 @@ volatile float sts_presence_rss_distance, sts_presence_rss_score; volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config; //static void update_configuration(acc_detector_presence_configuration_t presence_configuration); static void print_result(acc_detector_presence_result_t result); + volatile uint16_t motion_count, motion_feature_count; static acc_detector_presence_result_t sts_motion_dataset[DEFAULT_MOTION_DATASET_LEN]; static STS_PRESENCE_Motion_Featuer_t sts_motion_feature[DEFAULT_MOTION_FEATURE_LEN]; @@ -364,6 +365,10 @@ int sts_presence_rss_fall_rise_detection(void) uint8_t average_result = 0; float average_distance =0.0f; float average_score =0.0f; + uint8_t k=0; + uint16_t motion_in_zone[10]={0x0}; + //for (k=0; k<5; k++) {motion_in_zone[k]=0;} + #if 0 for (int i = 0; i < (iterations/2); i++) { @@ -441,6 +446,8 @@ int sts_presence_rss_fall_rise_detection(void) average_result++; average_distance += result.presence_distance; average_score += result.presence_score; + uint16_t detected_zone = (uint16_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH); + motion_in_zone[detected_zone]++; } if (sts_presence_fall_detection == 1) @@ -463,6 +470,12 @@ int sts_presence_rss_fall_rise_detection(void) 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; + APP_LOG(TS_OFF, VLEVEL_L,"Average Motion Result = %u OUTPUT RSS RESULT=%u \r\n", (int)average_result, sts_rss_result); + for (k=0; k<10; k++) { + if (motion_in_zone[k]>0) + APP_LOG(TS_OFF, VLEVEL_L,"\nMotion in Zone %u, Count=%u \r\n", k, motion_in_zone[k]); + } + average_distance = (1000.0f*average_distance)/average_result; // in meters average_score = (1000.0f*average_score)/average_result; sts_presence_rss_distance = average_distance; diff --git a/STM32CubeIDE/Release/STS_O7.bin b/STM32CubeIDE/Release/STS_O7.bin index 76f3e92..9b93e41 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ