--- revise presence normal vs presence staystill threshold

This commit is contained in:
Yunhorn 2024-07-25 13:57:14 +08:00
parent cbe349ddff
commit b0ddf93ed8
4 changed files with 31 additions and 9 deletions

View File

@ -181,6 +181,7 @@ typedef struct STS_OO_SensorStatusDataTypeDef
uint32_t over_stay_duration; // sensor 1, door lock or door contact, time lenght of overstay in seconds
uint16_t occupancy_duration; // sensor 3, motion detection duration
uint32_t fall_laydown_duration; // sensor 3, fall down not rise up duration
uint8_t no_movement_state;
uint32_t no_movement_duration;
uint8_t occupancy_over_stay_state; //
uint8_t battery_Pct; /* % of battery two digits, 88% (00-99)% */

View File

@ -722,9 +722,12 @@ void STS_YunhornCheckStandardDeviation(void)
// *******************************************
// *********** detection situation suggestion
if (standard_variance_presence_score <= MIN(DEFAULT_UNCONSCIOUS_THRESHOLD, sts_unconscious_threshold)) {
//sts_fall_rising_detected_result = STS_PRESENCE_STAYSTILL;
sts_fall_rising_detected_result = STS_PRESENCE_NO_MOVEMENT;
if ((standard_variance_presence_score > DEFAULT_UNCONSCIOUS_THRESHOLD) && (standard_variance_presence_score <= sts_unconscious_threshold))
{
sts_fall_rising_detected_result = STS_PRESENCE_STAYSTILL;
//sts_fall_rising_detected_result = STS_PRESENCE_NO_MOVEMENT;
} else {
sts_fall_rising_detected_result = STS_PRESENCE_NORMAL;
}
if ( sts_fall_rising_pattern_factor1 > (uint16_t)sts_fall_detection_acc_threshold)
@ -755,7 +758,7 @@ void STS_YunhornCheckStandardDeviation(void)
if ( sts_fall_rising_detected_result == STS_PRESENCE_FALL )
{
APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n >>>>>>>>>>>>>>>>> Suspecious Object FALL DOWN detected \r\n");
APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n >>>>>>>>>>>>>>>>> Suspicious Object FALL DOWN detected \r\n");
}
//if (average_presence_distance > DEFAULT_START_M)
{

View File

@ -120,7 +120,8 @@ char sts_presence_fall_detection_message[10][20]={
"State_Rising_Up",
"State_Laydown",
"State_Unconscious",
"State_StayStill"
"State_StayStill",
"State_No_Movement"
};
#endif
@ -698,6 +699,7 @@ void STS_PRESENCE_SENSOR_Init_Send_Data(void)
sts_o7_sensorData.over_stay_state = 0x0;
sts_o7_sensorData.over_stay_duration = 0x0;
sts_o7_sensorData.unconscious_state = 0x0;
sts_o7_sensorData.no_movement_state = 0x0;
sts_o7_sensorData.unconscious_duration = 0x0;
sts_o7_sensorData.no_movement_duration = 0x0;
@ -739,8 +741,12 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso
}
// no_movement or unconcious duration
sensor_data->unconscious_state = (sts_fall_rising_detected_result == STS_PRESENCE_UNCONSCIOUS)? 1:0;
sensor_data->unconscious_state = ((sts_fall_rising_detected_result == STS_PRESENCE_UNCONSCIOUS) ||
(sts_fall_rising_detected_result==STS_PRESENCE_STAYSTILL) ||
(sts_fall_rising_detected_result==STS_PRESENCE_NO_MOVEMENT))? 1:0;
sensor_data->unconscious_duration = sts_o7_sensorData.event_sensor3_unconcious_duration;
sensor_data->no_movement_state = sensor_data->unconscious_state;
sensor_data->no_movement_duration = sts_o7_sensorData.event_sensor3_no_movement_duration;
if (sensor_data->unconscious_state !=0)
{
@ -823,9 +829,12 @@ void STS_PRESENCE_SENSOR_Init(void)
sts_o7_sensorData.over_stay_state = 0;
sts_o7_sensorData.over_stay_duration = 0;
sts_o7_sensorData.unconscious_duration = 0;
sts_o7_sensorData.no_movement_state = 0;
sts_o7_sensorData.no_movement_duration = 0;
sts_o7_sensorData.unconscious_state = 0;
sts_o7_sensorData.unconscious_duration = 0;
STS_SENSOR_Power_ON(0);
STS_PRESENCE_SENSOR_REEDSWITCH_HALL_Init();

View File

@ -188,6 +188,15 @@ char sts_work_mode_code[15][25] ={
"OTHER_MODE1",
"OTHER_MODE2",
};
char sts_fall_mode_code[8][25] = {
"State_Normal",
"State_Fall_Down",
"State_Rising_Up",
"State_Laydown",
"State_Unconscious",
"State_StayStill",
"State_No_Movement"
};
#endif
/* USER CODE END EV */
@ -990,10 +999,10 @@ static void SendTxData(void)
{
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| S1-Door | S2-Motion | S3-SOS | S4 |Distance(mm) | MotionScore| Unconscious | Over_Stay_(min) | Fall Detected|"
"\r\n######| %s | %1d | %s | %1d | %04d | %04d | %1d | %4d | %1d |\r\n",
"\r\n######| %s | %1d | %s | %1d | %04d | %04d | %1d | %4d | %s |\r\n",
sts_door_status_code[sensorData.state_sensor1_on_off], sensorData.state_sensor2_on_off,sts_sos_status_code[sensorData.state_sensor3_on_off], sensorData.state_sensor4_on_off,
(uint16_t)sensorData.rss_presence_distance,(uint16_t)sensorData.rss_presence_score,
sensorData.unconscious_state, sensorData.over_stay_duration, sensorData.fall_state );
sensorData.unconscious_state, sensorData.over_stay_duration, sts_fall_mode_code[sensorData.fall_state]);
} else if (sts_work_mode == STS_DUAL_MODE) {
APP_LOG(TS_OFF, VLEVEL_L,