|
|
@ -939,6 +939,12 @@ static void SendTxData(void)
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor2_on_off)&0xff; //04 Sensor head #2 status
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor2_on_off)&0xff; //04 Sensor head #2 status
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor3_on_off)&0xff; //05 Sensor head #3 status
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor3_on_off)&0xff; //05 Sensor head #3 status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_state)&0xff; //06 occupancy over time or not
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration>>8)&0xff; //07 occupancy over stay duration MSB
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration)&0xff; //08 occupancy over stay duration LSB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (sts_work_mode == STS_UNI_MODE)
|
|
|
|
} else if (sts_work_mode == STS_UNI_MODE)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status
|
|
|
@ -959,6 +965,10 @@ static void SendTxData(void)
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration)&0xff; //15 occupancy over stay duration LSB
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration)&0xff; //15 occupancy over stay duration LSB
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.no_movement_duration>>8)&0xff; //16 occupancy over stay duration LSB
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.no_movement_duration>>8)&0xff; //16 occupancy over stay duration LSB
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.no_movement_duration)&0xff; //17 occupancy over stay duration LSB
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.no_movement_duration)&0xff; //17 occupancy over stay duration LSB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_speed)&0xff; //18 fall detected speed
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_gravity)&0xff; //19 fall detected gravity
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
uint8_t ich= (sts_lamp_bar_color>>4 & 0x0f);
|
|
|
|
uint8_t ich= (sts_lamp_bar_color>>4 & 0x0f);
|
|
|
|
uint8_t icl= (sts_lamp_bar_color & 0x0f);
|
|
|
|
uint8_t icl= (sts_lamp_bar_color & 0x0f);
|
|
|
@ -1145,6 +1155,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
sts_o7_sensorData.event_sensor1_duration = current_time.Seconds - sts_o7_sensorData.event_sensor1_start_time;
|
|
|
|
sts_o7_sensorData.event_sensor1_duration = current_time.Seconds - sts_o7_sensorData.event_sensor1_start_time;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
sts_o7_sensorData.event_sensor1_duration = 0;
|
|
|
|
sts_o7_sensorData.event_sensor1_duration = 0;
|
|
|
|
|
|
|
|
sts_o7_sensorData.over_stay_state = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
//if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*60) //for debug
|
|
|
|
if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*60) //for debug
|
|
|
@ -1162,6 +1173,8 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
sts_o7_sensorData.event_sensor2_duration = current_time.Seconds - sts_o7_sensorData.event_sensor2_start_time;
|
|
|
|
sts_o7_sensorData.event_sensor2_duration = current_time.Seconds - sts_o7_sensorData.event_sensor2_start_time;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
sts_o7_sensorData.event_sensor2_duration =0;
|
|
|
|
sts_o7_sensorData.event_sensor2_duration =0;
|
|
|
|
|
|
|
|
sts_o7_sensorData.over_stay_state = 0;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
//if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*60) //for debug
|
|
|
|
if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*60) //for debug
|
|
|
@ -1179,6 +1192,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
sts_o7_sensorData.event_sensor3_motion_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_motion_start_time;
|
|
|
|
sts_o7_sensorData.event_sensor3_motion_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_motion_start_time;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
sts_o7_sensorData.event_sensor3_motion_duration =0;
|
|
|
|
sts_o7_sensorData.event_sensor3_motion_duration =0;
|
|
|
|
|
|
|
|
sts_o7_sensorData.occupancy_over_stay_state = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
//if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min) //for debug
|
|
|
|
if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min) //for debug
|
|
|
@ -1208,7 +1222,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
if (sts_o7_sensorData.event_sensor3_fall_duration > 10*sts_cfg_nvm.fall_confirm_threshold_in_10sec)
|
|
|
|
if (sts_o7_sensorData.event_sensor3_fall_duration > 10*sts_cfg_nvm.fall_confirm_threshold_in_10sec)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//sts_o7_sensorData.occupancy_over_stay_state = 1;
|
|
|
|
//sts_o7_sensorData.occupancy_over_stay_state = 1;
|
|
|
|
sts_o7_sensorData.fall_state = 1;
|
|
|
|
sts_o7_sensorData.fall_state = sts_fall_rising_detected_result;
|
|
|
|
sts_o7_sensorData.fall_laydown_duration =sts_o7_sensorData.event_sensor3_fall_duration;
|
|
|
|
sts_o7_sensorData.fall_laydown_duration =sts_o7_sensorData.event_sensor3_fall_duration;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1221,6 +1235,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
case STS_PRESENCE_UNCONSCIOUS:
|
|
|
|
case STS_PRESENCE_UNCONSCIOUS:
|
|
|
|
case STS_PRESENCE_STAYSTILL:
|
|
|
|
case STS_PRESENCE_STAYSTILL:
|
|
|
|
case STS_PRESENCE_NO_MOVEMENT:
|
|
|
|
case STS_PRESENCE_NO_MOVEMENT:
|
|
|
|
|
|
|
|
sts_o7_sensorData.fall_state = sts_fall_rising_detected_result;
|
|
|
|
sts_o7_sensorData.event_sensor3_no_movement_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_no_movement_start_time;
|
|
|
|
sts_o7_sensorData.event_sensor3_no_movement_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_no_movement_start_time;
|
|
|
|
sts_o7_sensorData.event_sensor3_unconcious_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_unconcious_start_time;
|
|
|
|
sts_o7_sensorData.event_sensor3_unconcious_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_unconcious_start_time;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|