--minor changes for fall state

This commit is contained in:
Yunhorn 2024-08-14 19:37:49 +08:00
parent 3acc23d107
commit 872482893f
3 changed files with 16 additions and 5 deletions

View File

@ -529,6 +529,7 @@ int sts_presence_rss_fall_rise_detection(void)
motion_count = motion_count%DEFAULT_MOTION_DATASET_LEN; // get all required number of motion data motion_count = motion_count%DEFAULT_MOTION_DATASET_LEN; // get all required number of motion data
sts_fall_rising_detected_result = STS_PRESENCE_NORMAL;
if ((sts_presence_fall_detection == TRUE)&& (motion_count>10)) if ((sts_presence_fall_detection == TRUE)&& (motion_count>10))
STS_YunhornCheckStandardDeviation(); STS_YunhornCheckStandardDeviation();
@ -808,7 +809,7 @@ void STS_YunhornCheckStandardDeviation(void)
} }
} }
if ((last_sts_fall_rising_detected_result == STS_PRESENCE_FALL)) if ((last_sts_fall_rising_detected_result == STS_PRESENCE_FALL)&&( sts_fall_rising_detected_result != STS_PRESENCE_FALL ))
{ {
if ((average_presence_distance < (sts_motion_feature[motion_feature_count].p_dist_avg + sts_motion_feature[motion_feature_count].p_dist_standard))) if ((average_presence_distance < (sts_motion_feature[motion_feature_count].p_dist_avg + sts_motion_feature[motion_feature_count].p_dist_standard)))
{ {

View File

@ -1195,7 +1195,11 @@ void OnSensorRSS3BStateChanged(void)
{ {
sts_o7_sensorData.event_sensor3_fall_start_time_stamp = time_stamp; sts_o7_sensorData.event_sensor3_fall_start_time_stamp = time_stamp;
sts_o7_sensorData.event_sensor3_fall_start_time = sensor_event_time.Seconds; sts_o7_sensorData.event_sensor3_fall_start_time = sensor_event_time.Seconds;
//start counter of fall after rising up or other release actions/states
sts_o7_sensorData.event_sensor3_fall_duration = 0; sts_o7_sensorData.event_sensor3_fall_duration = 0;
sts_o7_sensorData.event_sensor3_fall_stop_time_stamp = 0;
sts_o7_sensorData.event_sensor3_fall_stop_time = 0;
} }
break; break;

View File

@ -70,7 +70,7 @@ volatile uint8_t sts_unconscious_or_motionless_level_threshold=6; //6*128
volatile uint8_t sts_motionless_duration_threshold_in_min=1; // test mode, 1 min, normal 10 min. long occupation 30 min volatile uint8_t sts_motionless_duration_threshold_in_min=1; // test mode, 1 min, normal 10 min. long occupation 30 min
volatile uint16_t sts_unconscious_level_threshold=600; volatile uint16_t sts_unconscious_level_threshold=600;
volatile uint8_t sts_alarm_mute_reset_timer_in_10sec=6; volatile uint8_t sts_alarm_mute_reset_timer_in_10sec=6;
extern volatile uint8_t sts_fall_rising_detected_result, sts_fall_rising_detected_result_changed_flag; extern volatile uint8_t sts_fall_rising_detected_result, sts_fall_rising_detected_result_changed_flag, last_sts_fall_rising_detected_result;
extern volatile uint32_t event_start_time, event_stop_time; extern volatile uint32_t event_start_time, event_stop_time;
extern volatile uint16_t sts_unconscious_threshold; extern volatile uint16_t sts_unconscious_threshold;
volatile uint8_t sts_occupancy_overtime_state = 0; volatile uint8_t sts_occupancy_overtime_state = 0;
@ -1042,12 +1042,12 @@ static void SendTxData(void)
strcpy(colorshow, (ich==0)?"":sts_lamp_color_code[ich]); strcpy(colorshow, (ich==0)?"":sts_lamp_color_code[ich]);
APP_LOG(TS_OFF, VLEVEL_L, APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color = %s%s | Mode = %5s |\r\n",(char *)colorshow, sts_lamp_color_code[icl], (char*)sts_work_mode_code[sensorData.workmode]); "\r\n######| Color = %s%s | Mode = %5s |\r\n",(char *)colorshow, sts_lamp_color_code[icl], (char*)sts_work_mode_code[sts_work_mode]);
if (sts_work_mode == STS_UNI_MODE) if (sts_work_mode == STS_UNI_MODE)
{ {
APP_LOG(TS_OFF, VLEVEL_L, APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| S1-Door | S2-SOS | S3-Motion | S4 |Distance(mm) | MotionScore| Unconscious | Over_Stay_(min) | Fall Detected|" "\r\n######| S1-Door | S2-SOS | S3-Motion| S4 |Distance(mm) | MotionScore| Unconscious | Over_Stay_(min) | Fall Detected|"
"\r\n######| %s | %s | %d | %1d | %04d | %04d | %1d | %4d | %s |\r\n", "\r\n######| %s | %s | %d | %1d | %04d | %04d | %1d | %4d | %s |\r\n",
sts_door_status_code[sensorData.state_sensor1_on_off], sts_door_status_code[sensorData.state_sensor1_on_off],
sts_sos_status_code[sensorData.state_sensor2_on_off], sts_sos_status_code[sensorData.state_sensor2_on_off],
sensorData.state_sensor3_on_off, sensorData.state_sensor3_on_off,
@ -1274,6 +1274,12 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
case STS_PRESENCE_NORMAL: case STS_PRESENCE_NORMAL:
sts_o7_sensorData.fall_state = STS_PRESENCE_NORMAL; sts_o7_sensorData.fall_state = STS_PRESENCE_NORMAL;
sts_o7_sensorData.fall_laydown_duration=0; sts_o7_sensorData.fall_laydown_duration=0;
if (last_sts_fall_rising_detected_result == STS_PRESENCE_FALL)
{
sts_o7_sensorData.event_sensor3_fall_stop_time_stamp = time_stamp;
sts_o7_sensorData.fall_laydown_duration = sts_o7_sensorData.event_sensor3_fall_duration;
}
sts_o7_sensorData.unconscious_state =STS_PRESENCE_NORMAL; sts_o7_sensorData.unconscious_state =STS_PRESENCE_NORMAL;
sts_o7_sensorData.unconscious_duration =0; sts_o7_sensorData.unconscious_duration =0;
sts_o7_sensorData.no_movement_duration =0; sts_o7_sensorData.no_movement_duration =0;