RM2_1 #2
|
@ -197,6 +197,8 @@ typedef struct STS_OO_SensorStatusDataTypeDef
|
||||||
uint32_t event_sensor3_motion_stop_time;
|
uint32_t event_sensor3_motion_stop_time;
|
||||||
uint32_t event_sensor3_motion_duration;
|
uint32_t event_sensor3_motion_duration;
|
||||||
uint32_t event_sensor3_fall_start_time;
|
uint32_t event_sensor3_fall_start_time;
|
||||||
|
uint32_t event_sensor3_fall_start_time_stamp;
|
||||||
|
uint32_t event_sensor3_fall_stop_time_stamp;
|
||||||
uint32_t event_sensor3_fall_stop_time;
|
uint32_t event_sensor3_fall_stop_time;
|
||||||
uint32_t event_sensor3_fall_duration;
|
uint32_t event_sensor3_fall_duration;
|
||||||
uint32_t event_sensor3_no_movement_start_time;
|
uint32_t event_sensor3_no_movement_start_time;
|
||||||
|
@ -672,7 +674,7 @@ void OnSensor3AStateChanged(void);
|
||||||
void OnSensor3BStateChanged(void);
|
void OnSensor3BStateChanged(void);
|
||||||
void OnSensor3CStateChanged(void);
|
void OnSensor3CStateChanged(void);
|
||||||
void OnSensor4StateChanged(void);
|
void OnSensor4StateChanged(void);
|
||||||
|
void STS_Get_Date_Time_Stamp(uint32_t *time_stamp, uint8_t *datetimestamp);
|
||||||
void STS_SENSOR_Power_ON(uint8_t cnt);
|
void STS_SENSOR_Power_ON(uint8_t cnt);
|
||||||
void STS_SENSOR_Power_OFF(uint8_t cnt);
|
void STS_SENSOR_Power_OFF(uint8_t cnt);
|
||||||
void STS_SENSOR_MEMS_Reset(uint8_t cnt);
|
void STS_SENSOR_MEMS_Reset(uint8_t cnt);
|
||||||
|
|
|
@ -701,7 +701,9 @@ void STS_PRESENCE_SENSOR_Init_Send_Data(void)
|
||||||
sts_o7_sensorData.event_sensor3_motion_start_time = 0x0;
|
sts_o7_sensorData.event_sensor3_motion_start_time = 0x0;
|
||||||
sts_o7_sensorData.event_sensor3_motion_duration = 0x0;
|
sts_o7_sensorData.event_sensor3_motion_duration = 0x0;
|
||||||
sts_o7_sensorData.event_sensor3_fall_start_time = 0x0;
|
sts_o7_sensorData.event_sensor3_fall_start_time = 0x0;
|
||||||
|
sts_o7_sensorData.event_sensor3_fall_start_time_stamp = 0x0;
|
||||||
sts_o7_sensorData.event_sensor3_fall_duration = 0x0;
|
sts_o7_sensorData.event_sensor3_fall_duration = 0x0;
|
||||||
|
sts_o7_sensorData.event_sensor3_fall_stop_time_stamp = 0x0;
|
||||||
sts_o7_sensorData.event_sensor4_start_time = 0x0;
|
sts_o7_sensorData.event_sensor4_start_time = 0x0;
|
||||||
sts_o7_sensorData.event_sensor4_duration = 0x0;
|
sts_o7_sensorData.event_sensor4_duration = 0x0;
|
||||||
|
|
||||||
|
@ -765,6 +767,8 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso
|
||||||
(char*)sts_presence_fall_detection_message[sts_fall_rising_detected_result] );
|
(char*)sts_presence_fall_detection_message[sts_fall_rising_detected_result] );
|
||||||
sensor_data->fall_speed = (uint8_t)sts_fall_rising_pattern_factor1;
|
sensor_data->fall_speed = (uint8_t)sts_fall_rising_pattern_factor1;
|
||||||
sensor_data->fall_gravity = (uint8_t)sts_roc_acc_standard_variance;
|
sensor_data->fall_gravity = (uint8_t)sts_roc_acc_standard_variance;
|
||||||
|
sensor_data->event_sensor3_fall_start_time_stamp = sts_o7_sensorData.event_sensor3_fall_start_time_stamp;
|
||||||
|
sensor_data->event_sensor3_fall_stop_time_stamp = sts_o7_sensorData.event_sensor3_fall_stop_time_stamp;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sensor_data->fall_speed = 0;
|
sensor_data->fall_speed = 0;
|
||||||
|
@ -813,7 +817,9 @@ void STS_PRESENCE_SENSOR_Init(void)
|
||||||
sts_o7_sensorData.event_sensor3_motion_stop_time = 0;
|
sts_o7_sensorData.event_sensor3_motion_stop_time = 0;
|
||||||
sts_o7_sensorData.event_sensor3_motion_duration = 0;
|
sts_o7_sensorData.event_sensor3_motion_duration = 0;
|
||||||
sts_o7_sensorData.event_sensor3_fall_start_time = 0;
|
sts_o7_sensorData.event_sensor3_fall_start_time = 0;
|
||||||
|
sts_o7_sensorData.event_sensor3_fall_start_time_stamp = 0;
|
||||||
sts_o7_sensorData.event_sensor3_fall_stop_time = 0;
|
sts_o7_sensorData.event_sensor3_fall_stop_time = 0;
|
||||||
|
sts_o7_sensorData.event_sensor3_fall_stop_time_stamp = 0;
|
||||||
sts_o7_sensorData.event_sensor3_fall_duration = 0;
|
sts_o7_sensorData.event_sensor3_fall_duration = 0;
|
||||||
sts_o7_sensorData.event_sensor4_start_time = 0;
|
sts_o7_sensorData.event_sensor4_start_time = 0;
|
||||||
sts_o7_sensorData.event_sensor4_stop_time = 0;
|
sts_o7_sensorData.event_sensor4_stop_time = 0;
|
||||||
|
|
|
@ -987,6 +987,16 @@ static void SendTxData(void)
|
||||||
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_speed)&0xff; //18 fall detected speed
|
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
|
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_gravity)&0xff; //19 fall detected gravity
|
||||||
|
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>24)&0xff; //20 fall start time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>16)&0xff; //21 fall start time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp>>8)&0xff; //22 fall start time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_start_time_stamp)&0xff; //23 fall start time stamp
|
||||||
|
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>24)&0xff; //20 fall stop time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>16)&0xff; //21 fall stop time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp>>8)&0xff; //22 fall stop time stamp
|
||||||
|
AppData.Buffer[i++] = (uint8_t)(sensorData.event_sensor3_fall_stop_time_stamp)&0xff; //23 fall stop time stamp
|
||||||
|
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
@ -1254,6 +1264,9 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
||||||
STS_PRESENCE_UNCONSCIOUS,
|
STS_PRESENCE_UNCONSCIOUS,
|
||||||
STS_PRESENCE_STAYSTILL
|
STS_PRESENCE_STAYSTILL
|
||||||
*/
|
*/
|
||||||
|
uint32_t time_stamp=0; uint8_t datetimestamp[8]={0};
|
||||||
|
STS_Get_Date_Time_Stamp(&time_stamp, datetimestamp);
|
||||||
|
|
||||||
switch (sts_fall_rising_detected_result){
|
switch (sts_fall_rising_detected_result){
|
||||||
case STS_PRESENCE_NORMAL:
|
case STS_PRESENCE_NORMAL:
|
||||||
sts_o7_sensorData.fall_state = STS_PRESENCE_NORMAL;
|
sts_o7_sensorData.fall_state = STS_PRESENCE_NORMAL;
|
||||||
|
@ -1268,6 +1281,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.event_sensor3_fall_start_time_stamp = time_stamp;
|
||||||
sts_o7_sensorData.fall_state = sts_fall_rising_detected_result;
|
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;
|
||||||
over_threshold = TRUE;
|
over_threshold = TRUE;
|
||||||
|
@ -1280,6 +1294,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STS_PRESENCE_RISING:
|
case STS_PRESENCE_RISING:
|
||||||
|
sts_o7_sensorData.event_sensor3_fall_stop_time_stamp = time_stamp;
|
||||||
over_threshold = FALSE;
|
over_threshold = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2898,4 +2913,25 @@ void STS_SENSOR_Function_Test_Process(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void STS_Get_Date_Time_Stamp(uint32_t *time_stamp, uint8_t *datetimestamp)
|
||||||
|
{
|
||||||
|
struct tm localtime;
|
||||||
|
|
||||||
|
SysTime_t UnixEpoch = SysTimeGet();
|
||||||
|
UnixEpoch.Seconds -= 18; /*removing leap seconds*/
|
||||||
|
SysTimeLocalTime(UnixEpoch.Seconds, &localtime);
|
||||||
|
|
||||||
|
*time_stamp = UnixEpoch.Seconds;
|
||||||
|
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_L, "LTIME:%02dh%02dm%02ds on %02d/%02d/%04d\r\n",
|
||||||
|
localtime.tm_hour, localtime.tm_min, localtime.tm_sec,
|
||||||
|
localtime.tm_mday, localtime.tm_mon + 1, localtime.tm_year + 1900);
|
||||||
|
datetimestamp[0] = localtime.tm_hour;
|
||||||
|
datetimestamp[1] = localtime.tm_min;
|
||||||
|
datetimestamp[2] = localtime.tm_sec;
|
||||||
|
|
||||||
|
datetimestamp[3] = localtime.tm_mday;
|
||||||
|
datetimestamp[4] = localtime.tm_mon+1;
|
||||||
|
datetimestamp[5] = ((localtime.tm_year+1900)>>8)&0xff;
|
||||||
|
datetimestamp[6] = ((localtime.tm_year+1900))&0xff;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue