|
|
|
@ -60,10 +60,14 @@ extern volatile uint8_t sts_lamp_bar_flashing_color;
|
|
|
|
|
volatile uint8_t last_sts_lamp_bar_color=STS_DARK;
|
|
|
|
|
extern volatile uint8_t sts_rss_result;
|
|
|
|
|
extern volatile uint8_t sts_rss_result_changed_flag, sts_hall1_changed_flag, sts_hall2_changed_flag, sts_reed_hall_changed_flag;
|
|
|
|
|
volatile uint8_t sts_fall_detection_acc_threshold = 10, sts_fall_detection_depth_threshold=20, sts_occupancy_overtime_threshold=2;
|
|
|
|
|
volatile uint8_t sts_fall_detection_acc_threshold = 10, sts_fall_detection_depth_threshold=20, sts_fall_confirm_threshold_in_10sec=1, sts_occupancy_overtime_threshold_in_10min=2;
|
|
|
|
|
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 uint16_t sts_unconscious_level_threshold=600;
|
|
|
|
|
volatile uint8_t sts_alarm_mute_reset_timer_in_10sec=6;
|
|
|
|
|
extern volatile uint8_t sts_fall_rising_detected_result;
|
|
|
|
|
extern volatile uint32_t event_start_time, event_stop_time;
|
|
|
|
|
extern volatile uint16_t sts_unconcious_threshold;
|
|
|
|
|
extern volatile uint16_t sts_unconscious_threshold;
|
|
|
|
|
volatile uint8_t sts_occupancy_overtime_state = 0;
|
|
|
|
|
volatile uint8_t sts_presence_fall_detection=1;
|
|
|
|
|
volatile uint32_t SamplingPeriodicity = 1000; //unit ms
|
|
|
|
@ -114,17 +118,19 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
|
|
|
|
|
0x00, //reserve2
|
|
|
|
|
0x00, //reserve3
|
|
|
|
|
0x00, //reserve4
|
|
|
|
|
0x00, //reserve5
|
|
|
|
|
0x3C, //reserve6 60(0x3C) sec alarm_mute_or_reset_expire_timer_in_sec
|
|
|
|
|
0x1E, //reserve7 0-60(0x3C) Sec, or 30(0x1E) sec default falldown_confirm_threshold_in_sec
|
|
|
|
|
0x78, //reserve8 120(0x78) Sec (2 min.) motionless_duration_threshold_in_Sec
|
|
|
|
|
// below 5 bytes
|
|
|
|
|
0x23, //Lamp Bar Flashing color define, 0x20, 2==STS_RED, 0 = STS_DARK, 0x23, 2=STS_RED, 3=STS_BLUE
|
|
|
|
|
|
|
|
|
|
0x00, //reserve5 alarm_parameter05
|
|
|
|
|
0x06, //reserve6 alarm_mute_or_reset_expire_timer_in_10sec, 60 seconds
|
|
|
|
|
0x23, //reserve7 alarm Lamp Bar Flashing color define, 0x20, 2==STS_RED, 0 = STS_DARK, 0x23, 2=STS_RED, 3=STS_BLUE
|
|
|
|
|
0x03, //reserve8 occupancy over time threshold 3*10 = 30 minutes
|
|
|
|
|
|
|
|
|
|
0x09, //reserve8 motionless_duration_threshold_in_min+1, normal: 10 min(0x0A) Minutes (2 min.) 1-9== 2-10min
|
|
|
|
|
0x09, //unconscious threshold * 128, 0-9, 9*128=1280 motion level
|
|
|
|
|
|
|
|
|
|
0x01, //fall_detection_acc_threshold = *10 acceleration measure
|
|
|
|
|
0x03, //fall detection_depth_threshold *10cm
|
|
|
|
|
0x08, //unconcious threshold * 128, 0-9, 9*128=1280 motion level
|
|
|
|
|
0x02, //occupancy over time threshold *10 minutes
|
|
|
|
|
// below 20 bytes
|
|
|
|
|
0x03, //falldown_confirm_threshold_in_10sec, 0x3=30 sec default
|
|
|
|
|
// below 20 bytes for RFAC code
|
|
|
|
|
{0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -908,7 +914,7 @@ static void SendTxData(void)
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_score>>8)&0xff; //09 MSB score
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.rss_presence_score)&0xff; //10 LSB score
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.unconcious_state)&0xff; //11 unconcious state detected or not
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.unconscious_state)&0xff; //11 unconscious state detected or not
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.fall_state)&0xff; //12 fall detected or not
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_state)&0xff; //13 occupancy over time or not
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sensorData.over_stay_duration>>8)&0xff; //14 occupancy over stay duration MSB
|
|
|
|
@ -924,11 +930,11 @@ static void SendTxData(void)
|
|
|
|
|
if (sts_work_mode == STS_UNI_MODE)
|
|
|
|
|
{
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_H,
|
|
|
|
|
"\r\n######| S1-DoorOpen | S2-Motion | S3-SOS | S4 |Distance(mm) | MotionScore| Unconcious | Over_Stay | Fall Detected|"
|
|
|
|
|
"\r\n######| S1-DoorOpen | S2-Motion | S3-SOS | S4 |Distance(mm) | MotionScore| Unconscious | Over_Stay | Fall Detected|"
|
|
|
|
|
"\r\n######| %1d | %1d | %1d | %1d | %04d | %04d | %1d | %1d | %1d |\r\n",
|
|
|
|
|
sensorData.state_sensor1_on_off, sensorData.state_sensor2_on_off,sensorData.state_sensor3_on_off, sensorData.state_sensor4_on_off,
|
|
|
|
|
(uint16_t)sensorData.rss_presence_distance,(uint16_t)sensorData.rss_presence_score,
|
|
|
|
|
sensorData.unconcious_state, sensorData.unconcious_duration, sensorData.fall_state );
|
|
|
|
|
sensorData.unconscious_state, sensorData.unconscious_duration, sensorData.fall_state );
|
|
|
|
|
} else if (sts_work_mode == STS_DUAL_MODE) {
|
|
|
|
|
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L,
|
|
|
|
@ -1096,7 +1102,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
|
|
|
|
|
|
if (sts_hall1_read==STS_Status_Door_Close)
|
|
|
|
|
sts_o7_sensorData.event_sensor1_duration = current_time.Seconds - sts_o7_sensorData.event_sensor1_start_time;
|
|
|
|
|
if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold)
|
|
|
|
|
if (sts_o7_sensorData.event_sensor1_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
|
{
|
|
|
|
|
sts_o7_sensorData.over_stay_state = 1;
|
|
|
|
|
sts_o7_sensorData.over_stay_duration = sts_o7_sensorData.event_sensor1_duration;
|
|
|
|
@ -1105,7 +1111,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
|
// to be defiend later for SOS threshold TODO XXXX
|
|
|
|
|
if (sts_hall2_read==STS_Status_SOS_Pushdown)
|
|
|
|
|
sts_o7_sensorData.event_sensor2_duration = current_time.Seconds - sts_o7_sensorData.event_sensor2_start_time;
|
|
|
|
|
if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold)
|
|
|
|
|
if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
|
{
|
|
|
|
|
sts_o7_sensorData.over_stay_state = 1;
|
|
|
|
|
sts_o7_sensorData.over_stay_duration = sts_o7_sensorData.event_sensor2_duration;
|
|
|
|
@ -1115,7 +1121,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
|
|
|
|
|
|
if (sts_rss_result==STS_RESULT_MOTION)
|
|
|
|
|
sts_o7_sensorData.event_sensor3_motion_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_motion_start_time;
|
|
|
|
|
if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold)
|
|
|
|
|
if (sts_o7_sensorData.event_sensor3_motion_duration > sts_occupancy_overtime_threshold_in_10min*600)
|
|
|
|
|
{
|
|
|
|
|
sts_o7_sensorData.occupancy_over_stay_state = 1;
|
|
|
|
|
sts_o7_sensorData.occupancy_duration =sts_o7_sensorData.event_sensor3_motion_duration;
|
|
|
|
@ -1126,19 +1132,19 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
|
STS_PRESENCE_FALL,
|
|
|
|
|
STS_PRESENCE_RISING,
|
|
|
|
|
STS_PRESENCE_LAYDOWN,
|
|
|
|
|
STS_PRESENCE_UNCONCIOUS,
|
|
|
|
|
STS_PRESENCE_UNCONSCIOUS,
|
|
|
|
|
STS_PRESENCE_STAYSTILL
|
|
|
|
|
*/
|
|
|
|
|
switch (sts_fall_rising_detected_result){
|
|
|
|
|
case STS_PRESENCE_NONE:
|
|
|
|
|
sts_o7_sensorData.fall_state = 0;
|
|
|
|
|
sts_o7_sensorData.fall_laydown_duration=0;
|
|
|
|
|
sts_o7_sensorData.unconcious_state =0;
|
|
|
|
|
sts_o7_sensorData.unconcious_duration =0;
|
|
|
|
|
sts_o7_sensorData.unconscious_state =0;
|
|
|
|
|
sts_o7_sensorData.unconscious_duration =0;
|
|
|
|
|
break;
|
|
|
|
|
case STS_PRESENCE_FALL:
|
|
|
|
|
sts_o7_sensorData.event_sensor3_fall_duration = current_time.Seconds - sts_o7_sensorData.event_sensor3_fall_start_time;
|
|
|
|
|
if (sts_o7_sensorData.event_sensor3_fall_duration > sts_cfg_nvm.falldown_confirm_threshold_in_Sec)
|
|
|
|
|
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.fall_state = 1;
|
|
|
|
@ -1150,7 +1156,7 @@ static void OnYunhornSTSDurationCheckTimerEvent(void *context)
|
|
|
|
|
break;
|
|
|
|
|
case STS_PRESENCE_LAYDOWN:
|
|
|
|
|
break;
|
|
|
|
|
case STS_PRESENCE_UNCONCIOUS:
|
|
|
|
|
case STS_PRESENCE_UNCONSCIOUS:
|
|
|
|
|
break;
|
|
|
|
|
case STS_PRESENCE_STAYSTILL:
|
|
|
|
|
break;
|
|
|
|
@ -2085,7 +2091,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD5];
|
|
|
|
|
|
|
|
|
|
STS_Combined_Status_Processing();
|
|
|
|
|
} else if (tlv_buf_size == 8 && tlv_buf[CFG_CMD4]=='F') // Change fall detection, occupancy overtime threshold
|
|
|
|
|
} else if (tlv_buf_size == 8 && tlv_buf[CFG_CMD4]=='F') // Change fall detection
|
|
|
|
|
{
|
|
|
|
|
invalid_flag = 0; // P 1 1 F A B C D
|
|
|
|
|
if (((tlv_buf[CFG_CMD5] >='0') && (tlv_buf[CFG_CMD5]<='9')) && ((tlv_buf[CFG_CMD6]<='9') && (tlv_buf[CFG_CMD6]>='0'))
|
|
|
|
@ -2093,12 +2099,15 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|
|
|
|
{
|
|
|
|
|
sts_fall_detection_acc_threshold = (uint8_t)(tlv_buf[CFG_CMD5] - 0x30)*10; //acc *10 mg/s2
|
|
|
|
|
sts_fall_detection_depth_threshold = (uint8_t)(tlv_buf[CFG_CMD6] - 0x30)*10; //depth *10 in cm
|
|
|
|
|
sts_unconcious_threshold = (uint8_t)(tlv_buf[CFG_CMD7] - 0x30+1)*128; //motion level less than 1280
|
|
|
|
|
sts_occupancy_overtime_threshold = (uint8_t)(tlv_buf[CFG_CMD8] - 0x30)*10; // overtime *10 min
|
|
|
|
|
sts_fall_confirm_threshold_in_10sec = (uint8_t)(tlv_buf[CFG_CMD7] - 0x30+1)*128; //fall_confirm_threshold_in_10sec
|
|
|
|
|
|
|
|
|
|
sts_occupancy_overtime_threshold_in_10min = (uint8_t)(tlv_buf[CFG_CMD8] - 0x30)*10; // overtime *10 min
|
|
|
|
|
|
|
|
|
|
sts_cfg_nvm.fall_detection_acc_threshold = (uint8_t)(tlv_buf[CFG_CMD5] - 0x30);
|
|
|
|
|
sts_cfg_nvm.fall_detection_depth_threshold = (uint8_t)(tlv_buf[CFG_CMD6] - 0x30);
|
|
|
|
|
sts_cfg_nvm.unconcious_threshold = (uint8_t)(tlv_buf[CFG_CMD7] - 0x30+1);
|
|
|
|
|
sts_cfg_nvm.occupancy_overtime_threshold = (uint8_t)(tlv_buf[CFG_CMD8] - 0x30);
|
|
|
|
|
sts_cfg_nvm.fall_confirm_threshold_in_10sec = (uint8_t)(tlv_buf[CFG_CMD7] - 0x30+1);
|
|
|
|
|
|
|
|
|
|
sts_cfg_nvm.occupancy_overtime_threshold_in_10min = (uint8_t)(tlv_buf[CFG_CMD8] - 0x30);
|
|
|
|
|
|
|
|
|
|
if (sts_work_mode == STS_UNI_MODE) // fall detection threshold only effective in Uni_mode
|
|
|
|
|
{
|
|
|
|
@ -2124,7 +2133,37 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (tlv_buf_size == 4 ) // P WORK mode switch
|
|
|
|
|
}else if (tlv_buf_size == 8 && tlv_buf[CFG_CMD4]=='O') // Change occupancy/motionless/ unconscious overtime threshold
|
|
|
|
|
{
|
|
|
|
|
invalid_flag = 0; // P 1 1 O A B C D
|
|
|
|
|
if (((tlv_buf[CFG_CMD5] >='0') && (tlv_buf[CFG_CMD5]<='9')) && ((tlv_buf[CFG_CMD6]<='9') && (tlv_buf[CFG_CMD6]>='0'))
|
|
|
|
|
&& ((tlv_buf[CFG_CMD7]<='9') && (tlv_buf[CFG_CMD7]>='0'))&& ((tlv_buf[CFG_CMD8]<='9') && (tlv_buf[CFG_CMD8]>='0')))
|
|
|
|
|
{
|
|
|
|
|
sts_motionless_duration_threshold_in_min = (uint8_t)(tlv_buf[CFG_CMD5] - 0x30); //Motionless duration in min
|
|
|
|
|
sts_occupancy_overtime_threshold_in_10min = (uint8_t)(tlv_buf[CFG_CMD6] - 0x30)*10; //Long occupation in min
|
|
|
|
|
sts_unconscious_level_threshold = (uint8_t)(tlv_buf[CFG_CMD7] - 0x30+1)*128; //motion level threshold less than 1280
|
|
|
|
|
sts_alarm_mute_reset_timer_in_10sec = (uint8_t)(tlv_buf[CFG_CMD8] - 0x30)*10; //alarm mute reset timer in 10 sec
|
|
|
|
|
|
|
|
|
|
sts_cfg_nvm.motionless_duration_threshold_in_min = (uint8_t)(tlv_buf[CFG_CMD5] - 0x30);
|
|
|
|
|
sts_cfg_nvm.occupancy_overtime_threshold_in_10min = (uint8_t)(tlv_buf[CFG_CMD6] - 0x30);
|
|
|
|
|
sts_cfg_nvm.unconscious_or_motionless_level_threshold = (uint8_t)(tlv_buf[CFG_CMD7] - 0x30+1);
|
|
|
|
|
sts_cfg_nvm.alarm_mute_reset_timer_in_10sec = (uint8_t)(tlv_buf[CFG_CMD8] - 0x30)*10;
|
|
|
|
|
|
|
|
|
|
OnStoreSTSCFGContextRequest();
|
|
|
|
|
|
|
|
|
|
i=0; // Step 1: Prepare status update message
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD1];
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD2];
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD3];
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD4];
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD5];
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD6];
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD7];
|
|
|
|
|
outbuf[i++] = (uint8_t) tlv_buf[CFG_CMD8];
|
|
|
|
|
STS_Combined_Status_Processing();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (tlv_buf_size == 4 ) // P WORK mode switch
|
|
|
|
|
{
|
|
|
|
|
invalid_flag = 0;
|
|
|
|
|
|
|
|
|
@ -2417,20 +2456,16 @@ void OnStoreSTSCFGContextRequest(void)
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.reserve02;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.reserve03;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.reserve04;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.reserve05;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.alarm_mute_or_reset_expire_timer_in_Sec;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.falldown_confirm_threshold_in_Sec;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.motionless_duration_threshold_in_Sec;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.lamp_bar_flashing_color;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.alarm_parameter05;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.alarm_mute_reset_timer_in_10sec;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.alarm_lamp_bar_flashing_color;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.occupancy_overtime_threshold_in_10min;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.motionless_duration_threshold_in_min;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.unconscious_or_motionless_level_threshold;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.fall_detection_acc_threshold;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.fall_detection_depth_threshold;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.unconcious_threshold;
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.occupancy_overtime_threshold;
|
|
|
|
|
if ((sts_cfg_nvm.fall_detection_acc_threshold ==0)&&(sts_cfg_nvm.fall_detection_depth_threshold==0)) {
|
|
|
|
|
sts_presence_fall_detection =0;
|
|
|
|
|
} else {
|
|
|
|
|
sts_presence_fall_detection =1;
|
|
|
|
|
}
|
|
|
|
|
nvm_store_value[i++] = sts_cfg_nvm.fall_confirm_threshold_in_10sec;
|
|
|
|
|
|
|
|
|
|
if ((sts_cfg_nvm.ac[0]!=0x0) && (sts_cfg_nvm.ac[19]!=0x0)) {
|
|
|
|
|
for (j = 0; j < YUNHORN_STS_AC_CODE_SIZE; j++) {
|
|
|
|
|
nvm_store_value[i++] = (sts_cfg_nvm.ac[j]);
|
|
|
|
@ -2508,16 +2543,17 @@ void STS_REBOOT_CONFIG_Init(void)
|
|
|
|
|
sts_cfg_nvm.reserve02 =(uint8_t)nvm_stored_value[NVM_RESERVE02];
|
|
|
|
|
sts_cfg_nvm.reserve03 =(uint8_t)nvm_stored_value[NVM_RESERVE03];
|
|
|
|
|
sts_cfg_nvm.reserve04 =(uint8_t)nvm_stored_value[NVM_RESERVE04];
|
|
|
|
|
sts_cfg_nvm.reserve05 =(uint8_t)nvm_stored_value[NVM_RESERVE05];
|
|
|
|
|
sts_cfg_nvm.alarm_mute_or_reset_expire_timer_in_Sec = (uint8_t)nvm_stored_value[NVM_ALARM_MUTE_RESET_TIMER];
|
|
|
|
|
sts_cfg_nvm.falldown_confirm_threshold_in_Sec = (uint8_t)nvm_stored_value[NVM_FALL_CONFIRM_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.motionless_duration_threshold_in_Sec = (uint8_t)nvm_stored_value[NVM_MOTIONLESS_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.motionless_duration_threshold_in_Sec= (uint8_t)nvm_stored_value[NVM_LAMP_BAR_FLASHING_COLOR];
|
|
|
|
|
sts_cfg_nvm.lamp_bar_flashing_color = (uint8_t)nvm_stored_value[NVM_LAMP_BAR_FLASHING_COLOR];
|
|
|
|
|
sts_cfg_nvm.alarm_parameter05 =(uint8_t)nvm_stored_value[NVM_ALARM_PARAMETER05];
|
|
|
|
|
sts_cfg_nvm.alarm_mute_reset_timer_in_10sec = (uint8_t)nvm_stored_value[NVM_ALARM_MUTE_RESET_TIMER];
|
|
|
|
|
sts_cfg_nvm.alarm_lamp_bar_flashing_color = (uint8_t)nvm_stored_value[NVM_ALARM_LAMP_BAR_FLASHING_COLOR];
|
|
|
|
|
sts_cfg_nvm.occupancy_overtime_threshold_in_10min = (uint8_t)nvm_stored_value[NVM_OCCUPANCY_OVERTIME_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.motionless_duration_threshold_in_min= (uint8_t)nvm_stored_value[NVM_MOTIONLESS_DURATION_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.unconscious_or_motionless_level_threshold = (uint8_t)nvm_stored_value[NVM_UNCONSCIOUS_LEVEL_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.fall_detection_acc_threshold = (uint8_t)nvm_stored_value[NVM_FALL_DETECTION_ACC_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.fall_detection_depth_threshold = (uint8_t)nvm_stored_value[NVM_FALL_DETECTION_DEPTH_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.unconcious_threshold = (uint8_t)nvm_stored_value[NVM_UNCONCIOUS_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.occupancy_overtime_threshold = (uint8_t)nvm_stored_value[NVM_OCCUPANCY_OVERTIME_THRESHOLD];
|
|
|
|
|
sts_cfg_nvm.fall_confirm_threshold_in_10sec = (uint8_t)nvm_stored_value[NVM_FALL_CONFIRM_THRESHOLD];
|
|
|
|
|
|
|
|
|
|
//sts_cfg_nvm.occupancy_overtime_threshold = (uint8_t)nvm_stored_value[NVM_OCCUPANCY_OVERTIME_THRESHOLD];
|
|
|
|
|
|
|
|
|
|
for (uint8_t j=0; j< YUNHORN_STS_AC_CODE_SIZE; j++) {
|
|
|
|
|
sts_cfg_nvm.ac[j] = (uint8_t)nvm_stored_value[NVM_AC_CODE_START +j];
|
|
|
|
@ -2581,7 +2617,7 @@ void OnRestoreSTSCFGContextProcess(void)
|
|
|
|
|
sts_work_mode = sts_cfg_nvm.work_mode;
|
|
|
|
|
sts_lamp_bar_color = STS_GREEN;
|
|
|
|
|
sts_service_mask = sts_cfg_nvm.sts_service_mask;
|
|
|
|
|
sts_lamp_bar_flashing_color = sts_cfg_nvm.lamp_bar_flashing_color;
|
|
|
|
|
sts_lamp_bar_flashing_color = sts_cfg_nvm.alarm_lamp_bar_flashing_color;
|
|
|
|
|
if (sts_work_mode == STS_UNI_MODE){
|
|
|
|
|
sts_presence_fall_detection =1;
|
|
|
|
|
} else {
|
|
|
|
@ -2590,8 +2626,11 @@ void OnRestoreSTSCFGContextProcess(void)
|
|
|
|
|
|
|
|
|
|
sts_fall_detection_acc_threshold = (uint8_t)sts_cfg_nvm.fall_detection_acc_threshold*10;
|
|
|
|
|
sts_fall_detection_depth_threshold = (uint8_t)sts_cfg_nvm.fall_detection_depth_threshold*10; //in cm
|
|
|
|
|
sts_unconcious_threshold = (uint8_t)(sts_cfg_nvm.unconcious_threshold+1)*128; // unconcious threshold
|
|
|
|
|
sts_occupancy_overtime_threshold = (uint8_t)sts_cfg_nvm.occupancy_overtime_threshold*10; // minutes
|
|
|
|
|
sts_fall_confirm_threshold_in_10sec = (uint8_t)sts_cfg_nvm.fall_confirm_threshold_in_10sec*10;
|
|
|
|
|
|
|
|
|
|
sts_unconscious_or_motionless_level_threshold = (uint8_t)(sts_cfg_nvm.unconscious_or_motionless_level_threshold+1)*128; // unconscious threshold
|
|
|
|
|
sts_motionless_duration_threshold_in_min = (uint8_t)sts_cfg_nvm.motionless_duration_threshold_in_min;
|
|
|
|
|
sts_occupancy_overtime_threshold_in_10min = (uint8_t)sts_cfg_nvm.occupancy_overtime_threshold_in_10min; // minutes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t j=0; j< YUNHORN_STS_AC_CODE_SIZE; j++)
|
|
|
|
|