---- revised motion count

This commit is contained in:
Yunhorn 2024-08-20 13:31:15 +08:00
parent 029c3fcda3
commit 6f69bd7ab7
3 changed files with 12 additions and 10 deletions

View File

@ -52,7 +52,7 @@
#define DEFAULT_DETECTION_THRESHOLD (2.0f) #define DEFAULT_DETECTION_THRESHOLD (2.0f)
#define DEFAULT_NBR_REMOVED_PC_2 (0) #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_UPDATE_RATE (10)
#define DEFAULT_POWER_SAVE_MODE ACC_POWER_SAVE_MODE_ACTIVE #define DEFAULT_POWER_SAVE_MODE ACC_POWER_SAVE_MODE_ACTIVE
#define DEFAULT_SENSOR_ID (1) #define DEFAULT_SENSOR_ID (1)
@ -448,9 +448,10 @@ int sts_presence_rss_fall_rise_detection(void)
//if (detected_hs_zone == 0) //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\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); //APP_LOG(TS_OFF, VLEVEL_L, "\r\nHS_ZONE=%u", (int)detected_hs_zone);
detected_hs_zone = 10 - detected_zone; //detected_hs_zone = 12 - detected_zone;
motion_in_hs_zone[detected_hs_zone][(motion_detected_count)]++; 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_distance = 1000*result.presence_distance;
sts_motion_dataset[motion_count].presence_score = 1000*result.presence_score; 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); //APP_LOG(TS_OFF, VLEVEL_L, "\r\nHS_ZONE=%u", detected_hs_zone);
//(sts_sensor_install_height/1000)/(DEFAULT_ZONE_LENGTH) //(sts_sensor_install_height/1000)/(DEFAULT_ZONE_LENGTH)
detected_hs_zone = (sts_sensor_install_height/1000)/(DEFAULT_ZONE_LENGTH) - 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)]++;
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_distance = 1000*result.presence_distance;
sts_motion_dataset[motion_count].presence_score = 1000*result.presence_score; 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; uint8_t thiscnt= motion_detected_count;
if (motion_detected_count++ == 10) { if (motion_detected_count++ == 10) {
motion_detected_count=0; motion_detected_count=0;
} else {
OnSensorRSS3CStateChanged();
} }
OnSensorRSS3CStateChanged();
//#ifdef LOG_RSS //#ifdef LOG_RSS
if (sts_work_mode == STS_UNI_MODE) if (sts_work_mode == STS_UNI_MODE)
{ {

View File

@ -1272,11 +1272,11 @@ void OnSensorRSS3CStateChanged(void)
return ; return ;
} }
#endif #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_start_time = sensor_event_time.Seconds;
sts_o7_sensorData.event_sensor3_motion_duration = 0; 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_stop_time = sensor_event_time.Seconds;
//sts_o7_sensorData.event_sensor3_motion_duration = 0; //sts_o7_sensorData.event_sensor3_motion_duration = 0;

View File

@ -154,7 +154,6 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1119592399" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.os" valueType="enumerated"/> <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1119592399" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.os" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.2024044405" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.2024044405" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="CORE_CM4"/> <listOptionValue builtIn="false" value="CORE_CM4"/>
<listOptionValue builtIn="false" value="STS_BAT"/>
<listOptionValue builtIn="false" value="CLOCK_SYNC"/> <listOptionValue builtIn="false" value="CLOCK_SYNC"/>
<listOptionValue builtIn="false" value="RM2_1"/> <listOptionValue builtIn="false" value="RM2_1"/>
<listOptionValue builtIn="false" value="STS_O7"/> <listOptionValue builtIn="false" value="STS_O7"/>