diff --git a/Core/Src/yunhorn_sts_presence_rss.c b/Core/Src/yunhorn_sts_presence_rss.c index 2771a88..5928014 100644 --- a/Core/Src/yunhorn_sts_presence_rss.c +++ b/Core/Src/yunhorn_sts_presence_rss.c @@ -52,7 +52,7 @@ #define DEFAULT_DETECTION_THRESHOLD (2.0f) #define DEFAULT_NBR_REMOVED_PC_2 (0) -#define DEFAULT_PROFILE ACC_SERVICE_PROFILE_4 //ACC_SERVICE_PROFILE_4 +#define DEFAULT_PROFILE ACC_SERVICE_PROFILE_2 //ACC_SERVICE_PROFILE_4 #define DEFAULT_UPDATE_RATE (10) #define DEFAULT_POWER_SAVE_MODE ACC_POWER_SAVE_MODE_ACTIVE #define DEFAULT_SENSOR_ID (1) @@ -448,9 +448,10 @@ int sts_presence_rss_fall_rise_detection(void) //if (detected_hs_zone == 0) //APP_LOG(TS_OFF, VLEVEL_L, "\r\nPresence_Distance=%u \r\n", (int)result.presence_distance*1000.0); //APP_LOG(TS_OFF, VLEVEL_L, "\r\nHS_ZONE=%u", (int)detected_hs_zone); - detected_hs_zone = 10 - detected_zone; - motion_in_hs_zone[detected_hs_zone][(motion_detected_count)]++; - + //detected_hs_zone = 12 - detected_zone; + detected_hs_zone = (sts_sensor_install_height/1000)/(DEFAULT_ZONE_LENGTH) - detected_zone; + //motion_in_hs_zone[detected_hs_zone][(motion_detected_count)]++; + motion_in_hs_zone[detected_hs_zone][motion_detected_count]++; sts_motion_dataset[motion_count].presence_distance = 1000*result.presence_distance; sts_motion_dataset[motion_count].presence_score = 1000*result.presence_score; @@ -535,7 +536,8 @@ int sts_presence_rss_fall_rise_detection(void) //APP_LOG(TS_OFF, VLEVEL_L, "\r\nHS_ZONE=%u", detected_hs_zone); //(sts_sensor_install_height/1000)/(DEFAULT_ZONE_LENGTH) detected_hs_zone = (sts_sensor_install_height/1000)/(DEFAULT_ZONE_LENGTH) - detected_zone; - motion_in_hs_zone[detected_hs_zone][(motion_detected_count)]++; + //motion_in_hs_zone[detected_hs_zone][(motion_detected_count)]++; + motion_in_hs_zone[detected_hs_zone][motion_detected_count]++; sts_motion_dataset[motion_count].presence_distance = 1000*result.presence_distance; sts_motion_dataset[motion_count].presence_score = 1000*result.presence_score; @@ -615,10 +617,11 @@ int sts_presence_rss_fall_rise_detection(void) uint8_t thiscnt= motion_detected_count; if (motion_detected_count++ == 10) { motion_detected_count=0; - } else { - OnSensorRSS3CStateChanged(); } + OnSensorRSS3CStateChanged(); + + //#ifdef LOG_RSS if (sts_work_mode == STS_UNI_MODE) { diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index b5a7543..58d5a3a 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -1272,11 +1272,11 @@ void OnSensorRSS3CStateChanged(void) return ; } #endif - if (sts_rss_result == STS_RESULT_MOTION) + if ((sts_rss_result == STS_RESULT_MOTION)&&(last_sts_rss_result == STS_RESULT_NO_MOTION)) { sts_o7_sensorData.event_sensor3_motion_start_time = sensor_event_time.Seconds; sts_o7_sensorData.event_sensor3_motion_duration = 0; - } else if (sts_rss_result == STS_RESULT_NO_MOTION) + } else if ((sts_rss_result == STS_RESULT_NO_MOTION)&&(last_sts_rss_result==STS_RESULT_MOTION)) { sts_o7_sensorData.event_sensor3_motion_stop_time = sensor_event_time.Seconds; //sts_o7_sensorData.event_sensor3_motion_duration = 0; diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index 40fb73e..93edae5 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -154,7 +154,6 @@