workable L8

This commit is contained in:
Yunhorn 2024-11-28 07:21:42 +08:00
parent 7806a9bf93
commit 51ac8859e4
5 changed files with 133 additions and 56 deletions

View File

@ -231,11 +231,11 @@ void STS_Lamp_Bar_Self_Test(void)
{
uint8_t color=0, lum_level=DEFAULT_LUMINANCE_LEVEL;
APP_LOG(TS_OFF, VLEVEL_M, "\r\n YunHorn STS Indicative Lamp Self Test\r\n");
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n YunHorn STS Indicative Lamp Self Test\r\n");
//STS_Lamp_Bar_Self_Test_Simple();
APP_LOG(TS_OFF, VLEVEL_M, "\r\n [#2] Scoller Testing\r\n");
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n [#2] Scoller Testing\r\n");
lum_level=50;
for (color = STS_GREEN; color < STS_COLOR_MAX; color++)
{
@ -243,7 +243,7 @@ void STS_Lamp_Bar_Self_Test(void)
}
APP_LOG(TS_OFF, VLEVEL_M, "\r\n [##] YunHorn STS Indicative Lamp Self Test Finished\r\n");
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n [##] YunHorn STS Indicative Lamp Self Test Finished\r\n");
if ((sts_work_mode == STS_WIRED_MODE) )
{
STS_Lamp_Bar_Set_Dark();

View File

@ -606,11 +606,13 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
case BUT1_Pin:
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
HAL_Delay(100);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
HAL_Delay(150);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
sts_hall1_read = HALL1_STATE;
printf("\r\n HALL 1 state =%d \r\n", sts_hall1_read);
//printf("\r\n HALL 1 state =%d \r\n", sts_hall1_read);
// 1) record event start/stop time
OnSensor1StateChanged();
@ -621,7 +623,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
sts_lamp_bar_color = STS_OCCUPY_COLOR;
//prev_color = sts_lamp_bar_color;
sts_status_color = STS_OCCUPY_COLOR;
printf("\r\n Door Closed sts status color =%d", sts_status_color);
//printf("\r\n Door Closed sts status color =%d", sts_status_color);
} else
{
@ -629,10 +631,10 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
//sts_lamp_bar_color = prev_color;
sts_status_color = STS_VACANT_COLOR;
sts_lamp_bar_color = STS_VACANT_COLOR;
printf("\r\n Door Open: sts status color =%d", sts_status_color);
//printf("\r\n Door Open: sts status color =%d", sts_status_color);
}
printf("\r\n sts status color =0x%02x \r\n", sts_status_color);
//printf("\r\n sts status color =0x%02x \r\n", sts_status_color);
// 3) combine states and colors
STS_YunhornSTSEventP1_Process();
@ -640,11 +642,11 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
// 4) upload state change messages
//if (EventType == TX_ON_EVENT)
//if (sts_hall1_read == STS_Status_Door_Close)
if (sts_hall1_read == STS_Status_Door_Close)
{
fhmos_occupancy = 1;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
}
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
last_sts_hall1_read = sts_hall1_read;
break;
@ -655,7 +657,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
sts_hall2_read = HALL2_STATE;
printf("\r\n HALL 2 state =%d \r\n", sts_hall2_read);
//printf("\r\n HALL 2 state =%d \r\n", sts_hall2_read);
// 1) record event start/stop time
OnSensor2StateChanged();
// 2) change lamp bar color
@ -664,13 +666,14 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
sts_lamp_bar_color = STS_SOS_COLOR;
sts_status_color = STS_SOS_COLOR;
fhmos_sos_alarm = 1;
}
printf("\r\n lamp bar color =0x%02x \r\n", sts_lamp_bar_color);
//printf("\r\n lamp bar color =0x%02x \r\n", sts_lamp_bar_color);
if (sts_hall2_read ==STS_Status_SOS_Release)
{
sts_lamp_bar_color = STS_VACANT_COLOR;
sts_status_color = STS_VACANT_COLOR;
fhmos_sos_alarm = 1;
fhmos_sos_alarm = 0;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
}
last_sts_hall2_read = sts_hall2_read;
@ -679,11 +682,12 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
STS_YunhornSTSEventP1_Process();
// 4) upload state change messages
//if (sts_hall2_read == STS_Status_SOS_Release)
if (sts_hall2_read == STS_Status_SOS_Release)
{
fhmos_occupancy = 0;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
fhmos_sos_alarm = 0;
}
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
last_sts_hall1_read = sts_hall1_read;
@ -1043,7 +1047,7 @@ static void SendTxData(void)
AppData.Buffer[i++] = (uint8_t) sts_hardware_ver;
AppData.Buffer[i++] = (uint8_t) 99*batteryLevel/254;
#if 1
#if 0
APP_LOG(TS_ON, VLEVEL_M, "VDDA: %d\r\n", batteryLevel);
APP_LOG(TS_ON, VLEVEL_M, "temp: %d\r\n", (int16_t)(sensor_data.temperature));
@ -1173,7 +1177,7 @@ static void SendTxData(void)
#if defined(L8)
//AppData.Buffer[i++] = 4;
AppData.Buffer[i++] = 14;
AppData.Buffer[i++] = 8;
AppData.Buffer[i++] = fhmos_data.state_fall;
AppData.Buffer[i++] = fhmos_data.state_human_movement;
AppData.Buffer[i++] = fhmos_data.state_occupancy;

View File

@ -61,7 +61,7 @@ volatile uint8_t sts_fall_detection_acc_threshold = 30, //0.3g
sts_fall_detection_depth_threshold=20,
sts_fall_confirm_threshold_in_10sec=1,
sts_occupancy_overtime_threshold_in_10min=2;
extern volatile sts_fhmos_sensor_ambient_height_t fhmos_bg, fhmos_gesture;
extern volatile uint8_t sts_status_color;
extern volatile uint8_t sts_lamp_bar_color; //puColor
extern volatile uint8_t last_lamp_bar_color;
@ -72,7 +72,8 @@ extern volatile sts_fhmos_sensor_config_t fhmos_cfg;
extern volatile uint8_t sts_status_color, sts_lamp_bar_color;//puColor
extern uint8_t luminance_level;
volatile uint8_t sts_fhmos_state_changed=0;
extern volatile uint8_t fhmos_gesture_bitmap[8];
extern volatile sts_fhmos_sensor_data_t fhmos_data;
extern volatile uint8_t sts_mask_bitmap[8];
#endif
volatile sts_cfg_nvm_t sts_cfg_nvm = {
@ -211,6 +212,7 @@ volatile uint8_t sts_water_leakage_changed_flag=0;
volatile uint8_t sts_reed_hall_1_result=STS_Status_Door_Open, sts_reed_hall_2_result=STS_Status_SOS_Release;
volatile uint8_t sts_reed_hall_3_result, sts_reed_hall_4_result;
volatile uint8_t sts_fhmos_result=STS_FHMOS_FALL_STATE_NO_OCCUPY;
volatile uint8_t sts_fhmos_bitmap_pending=0;
#endif
@ -355,10 +357,10 @@ void STS_YunhornSTSEventP1_Process(void)
STS_Reed_Hall_Presence_Detection();
if (sts_reed_hall_result == last_sts_reed_hall_result) {
APP_LOG(TS_OFF, VLEVEL_M, "\r\n CHANGE FLAG = 0 \n");
sts_reed_hall_changed_flag = 0;
} else {
APP_LOG(TS_OFF, VLEVEL_M, "\r\n CHANGE FLAG = 1 \n");
sts_reed_hall_changed_flag = 1;
STS_Combined_Status_Processing();
}
@ -515,10 +517,36 @@ void STS_YunhornSTSEventP5_Process(void)
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
}
if (sts_fhmos_bitmap_pending !=0)
{
sts_fhmos_bitmap_pending = 0;
uint8_t tstbuf[128] ={0x0}; uint8_t i=0;
tstbuf[i++] = (uint8_t) 'G';
tstbuf[i++] = (uint8_t) sts_mtmcode1;
tstbuf[i++] = (uint8_t) sts_mtmcode2;
tstbuf[i++] = (uint8_t) sts_version;
tstbuf[i++] = (uint8_t) sts_hardware_ver;
tstbuf[i++] = (uint8_t) (99*GetBatteryLevel()/254)&0xff;
tstbuf[i++] = (uint8_t) (10)&0xff; //length of following data
tstbuf[i++] = (uint8_t) (fhmos_gesture.head_level)&0xff; // head height in cm
tstbuf[i++] = (uint8_t) (fhmos_gesture.head_xy)&0xff;
// MASK OFF BITMAP
tstbuf[i++] = (uint8_t) (fhmos_gesture_bitmap[0]);
tstbuf[i++] = (uint8_t) (fhmos_gesture_bitmap[1]);
tstbuf[i++] = (uint8_t) (fhmos_gesture_bitmap[2]);
tstbuf[i++] = (uint8_t) (fhmos_gesture_bitmap[3]);
tstbuf[i++] = (uint8_t) (fhmos_gesture_bitmap[4]);
tstbuf[i++] = (uint8_t) (fhmos_gesture_bitmap[5]);
tstbuf[i++] = (uint8_t) (fhmos_gesture_bitmap[6]);
tstbuf[i++] = (uint8_t) (fhmos_gesture_bitmap[7]);
STS_SENSOR_Upload_Message(YUNHORN_STS_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)tstbuf);
}
//MX_TOF_Process();
//MX_TOF_Ranging_Process();
#endif
}
@ -1750,7 +1778,7 @@ void STS_REBOOT_CONFIG_Init(void)
}
}
STS_Show_STS_CFG_NVM((uint8_t*)nvm_store_value);
//STS_Show_STS_CFG_NVM((uint8_t*)nvm_store_value);
OnRestoreSTSCFGContextProcess();
/* USER CODE END OnRestoreContextRequest_Last */
@ -2167,7 +2195,8 @@ void YunhornSTSDurationCheckTimer(void)
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_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
if (sts_o7_sensorData.event_sensor1_duration > fhmos_cfg.th_occupancy_overstay_15sec*15)
{
sts_o7_sensorData.over_stay_state = 1;
sts_o7_sensorData.over_stay_duration = sts_o7_sensorData.event_sensor1_duration;
@ -2175,8 +2204,10 @@ void YunhornSTSDurationCheckTimer(void)
APP_LOG(TS_OFF, VLEVEL_L, "\r\nSensor 1 Over Stay State=%d, Duration= %d Sec, Threshold =%u \r\n",
sts_o7_sensorData.over_stay_state,
(sts_o7_sensorData.over_stay_duration),
(sts_occupancy_overtime_threshold_in_10min*60) );
sts_lamp_bar_color = STS_RED_DARK;
(fhmos_cfg.th_occupancy_overstay_15sec*15));
//(sts_occupancy_overtime_threshold_in_10min*60) );
sts_lamp_bar_color = STS_OCCUPANCY_OVERSTAY_COLOR;
//sts_lamp_bar_flashing_color = 0x20;
//volatile uint8_t sts_lamp_bar_color = STS_GREEN; //puColor
//volatile uint8_t sts_lamp_bar_flashing_color = 0x23; // RED_BLUE;
@ -2192,7 +2223,8 @@ void YunhornSTSDurationCheckTimer(void)
if (STS_Status_SOS_Pushdown==sts_hall2_read)
{
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_in_10min*60) //for debug
//if (sts_o7_sensorData.event_sensor2_duration > sts_occupancy_overtime_threshold_in_10min*60) //for debug
if (sts_o7_sensorData.event_sensor2_duration > fhmos_cfg.th_occupancy_overstay_15sec*15)
{
sts_o7_sensorData.over_stay_state = 1;
// 2024-07-15 update, no overwrite sensor1 duration value
@ -2303,13 +2335,32 @@ void YunhornSTSDurationCheckTimer(void)
sts_lamp_bar_color = STS_RED_DARK; //sts_lamp_bar_flashing_color;
}
fhmos_data.state_occupancy = 2;
sensor_data_ready = 1;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
over_threshold = FALSE;
}
}
void OnSensorRange1StateChanged(void)
{
SysTime_t sensor_event_time = SysTimeGetMcuTime();
if (fhmos_data.state_fall == 1)
{
sts_o7_sensorData.event_sensor3_fall_start_time = sensor_event_time.Seconds;
sts_o7_sensorData.event_sensor3_fall_duration = 0;
} else if (fhmos_data.state_fall == 0)
{
sts_o7_sensorData.event_sensor3_fall_start_time = 0;
sts_o7_sensorData.event_sensor3_fall_stop_time_stamp = sensor_event_time.Seconds;
}
}
/* reedswitch 1 on off */
void OnSensor1StateChanged(void)
{
@ -2318,7 +2369,7 @@ void OnSensor1StateChanged(void)
{
sts_o7_sensorData.event_sensor1_start_time = sensor_event_time.Seconds;
sts_o7_sensorData.event_sensor1_duration = 0;
APP_LOG(TS_OFF, VLEVEL_M, "Door Closed ---Timer start: %u\r\n",sts_o7_sensorData.event_sensor1_start_time );
//APP_LOG(TS_OFF, VLEVEL_M, "Door Closed ---Timer start: %u\r\n",sts_o7_sensorData.event_sensor1_start_time );
} else if (sts_hall1_read==STS_Status_Door_Open)
{
sts_o7_sensorData.event_sensor1_start_time = 0;
@ -2579,7 +2630,7 @@ void OnSensor4StateChanged(void)
void STS_Combined_Status_Processing(void)
{
printf("\r\n ********* combined process %d \r\n", sts_work_mode);
//printf("\r\n ********* combined process %d \r\n", sts_work_mode);
switch (sts_work_mode)
{
@ -2698,12 +2749,13 @@ void STS_Combined_Status_Processing(void)
&& (sts_fhmos_result == STS_FHMOS_FALL_STATE_NO_OCCUPY))
{
sts_status_color = STS_VACANT_COLOR;
//printf("\r\n ********* combined process Vacant color = %d \r\n", sts_status_color);
} else if ((sts_reed_hall_1_result == STS_Status_Door_Close )|| (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
|| (sts_fhmos_result != STS_FHMOS_FALL_STATE_NO_OCCUPY))
} else if ((sts_reed_hall_1_result == STS_Status_Door_Close )|| (sts_reed_hall_2_result == STS_Status_SOS_Pushdown ))
//|| (sts_fhmos_result != STS_FHMOS_FALL_STATE_NO_OCCUPY))
{
sts_status_color = STS_OCCUPY_COLOR;
printf("\r\n ********* combined process status color = %d \r\n", sts_status_color);
//printf("\r\n ********* combined process Occupy color = %d \r\n", sts_status_color);
if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
{
@ -2717,7 +2769,7 @@ void STS_Combined_Status_Processing(void)
{
sts_status_color = STS_RED;
}
printf("\r\n ********* combined process finished status color = %d \r\n", sts_status_color);
//printf("\r\n ********* combined process finished status color = %d \r\n", sts_status_color);
sts_lamp_bar_color = sts_status_color;
}

View File

@ -44,13 +44,15 @@ volatile sts_fhmos_sensor_data_t fhmos={0x0};
volatile sts_fhmos_sensor_config_t fhmos_cfg;
volatile sts_fhmos_sensor_ambient_height_t fhmos_bg={0x0}, fhmos_gesture={0x0};
volatile sts_fhmos_sensor_data_t fhmos_data;
extern volatile uint8_t sts_fhmos_result;
volatile uint8_t sts_mask_bitmap[8]={0x0}, fhmos_gesture_bitmap[8]={0x0};
extern volatile uint16_t sts_sensor_install_height; //in mm
extern volatile uint8_t sts_lamp_bar_color;
extern volatile uint8_t sts_status_color;
extern volatile uint8_t sts_hall1_read,sts_hall2_read; // Above hall1_read == reed_hall_result, hall2_read == emergency_button
extern volatile uint8_t sts_pir_result;
extern volatile uint8_t sts_fhmos_state_changed;
extern volatile uint8_t sts_fhmos_bitmap_pending;
#endif
#include "stm32wlxx_nucleo.h"
@ -149,7 +151,7 @@ void MX_TOF_Init(void)
/* USER CODE END TOF_Init_PreTreatment */
/* Initialize the peripherals and the TOF components */
APP_LOG(TS_OFF,VLEVEL_L,"\r\n###################### MX TOF Init... \r\n");
//APP_LOG(TS_OFF,VLEVEL_L,"\r\n###################### MX TOF Init... \r\n");
//MX_53L1A2_SimpleRanging_Init();
//STS_TOF_VL53LX_PeopleCounting_Process();
@ -272,8 +274,8 @@ void sts_generate_fall_gesture_map(void)
}
}
fhmos_gesture.head_level = sts_fall_head_position;
fhmos_gesture.head_xy = head_xy;
fhmos_gesture.head_level = 0xff&((sts_sensor_install_height - sts_fall_head_position)/10); // head level from floor in CM
fhmos_gesture.head_xy = head_xy&0xff;
#if 0
for (i=0; i<64; i++)
{
@ -527,16 +529,16 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
motion_power += motion_diff;
prev_distance[j] = (uint16_t)Result->ZoneResult[j].Distance[0];
}
motion_power /=64;
if (motion_power > fhmos_cfg.th_motion_power_level)
{
fhmos_human_movement =1;
} else {
fhmos_human_movement =0;
}
//printf("\r\n Motion Power =%d Average=%d Human Movement =%d\r\n", motion_power, motion_power/64, fhmos_human_movement);
#if 0
printf("\r\n Motion Power =%d Average=%d Human Movement =%d, th=%d \r\n", motion_power*64, motion_power, fhmos_human_movement, fhmos_cfg.th_motion_power_level);
#endif
zones_per_line = ((Profile.RangingProfile == RS_PROFILE_8x8_AUTONOMOUS) ||
(Profile.RangingProfile == RS_PROFILE_8x8_CONTINUOUS)) ? 8 : 4;
@ -558,12 +560,15 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
{
printf("\r\nThreshold: low =%d occupy=%d head level=%d high=%d\r\n", sts_low_threshold, sts_occupancy_threshold, fhmos_cfg.th_head_level_height_cm*10, sts_high_threshold);
printf("\r\n YELLOW OR RED Distance=%d \r\n", roi_distance);
fhmos_data.state_fall = 1;
fhmos_data.state_human_movement = 1;
fhmos_data.state_fall = STS_FHMOS_FALL_STATE_NORMAL;
fhmos_data.state_human_movement = STS_FHMOS_HUMAN_MOVEMENT_NORMAL;
fhmos_data.status_color = STS_OCCUPY_COLOR; // HOLD THIS COLOR BEFORE ENTER YELLOW STATUS
//OnSensorRange1StateChanged();
fhmos_fall_counter ++; // TODO XXX Timer for confirmation
if ((fhmos_fall_counter >= 15*fhmos_cfg.th_fall_duration_potential_15sec)&& (fhmos_fall_counter < 15*fhmos_cfg.th_fall_duration_confirm_15sec))
if ((fhmos_fall_counter >= 30*fhmos_cfg.th_fall_duration_potential_15sec)&& (fhmos_fall_counter < 30*fhmos_cfg.th_fall_duration_confirm_15sec))
{
#if 0
printf("\r\n [YELLOW **] Suspicious Fall: distance=%d [high - head level=[%d]] <= distance <= [high-100 =%d] \r\n",
@ -572,9 +577,13 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
printf("\r\n Fall state --- Yellow \r\n");
#endif
fhmos_fall =2;
fhmos_data.state_fall = STS_FHMOS_FALL_STATE_POTENTIAL;
fhmos_data.status_color = STS_FALL_SUSPICIOUS_COLOR;
fhmos_data.state_changed_fall = STS_FHMOS_FALL_STATE_POTENTIAL;
} else if (fhmos_fall_counter >= 15*fhmos_cfg.th_fall_duration_confirm_15sec)
fhmos_data.state_changed_fall = true;
sts_fhmos_state_changed |=1;
} else if (fhmos_fall_counter >= 30*fhmos_cfg.th_fall_duration_confirm_15sec)
{
#if 0
printf("\r\n [RED **] Configmed Fall: distance=%d [high - head level=[%d]] <= distance <= [high-100 =%d] \r\n",
@ -584,9 +593,12 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
printf("\r\n [RED ***] Confirmed Fall state: roi_distance =%d -----[high=%4d mm Head Level =%d mm\r\n", roi_distance, sts_high_threshold, 10*fhmos_cfg.th_head_level_height_cm);
#endif
fhmos_fall =3;
fhmos_data.state_fall = STS_FHMOS_FALL_STATE_CONFIRMED;
fhmos_data.status_color = STS_FALL_CONFIRMED_COLOR;
fhmos_data.state_changed_fall = STS_FHMOS_FALL_STATE_CONFIRMED;
fhmos_data.state_changed_fall = true;
sts_fhmos_state_changed |=1;
sts_generate_fall_gesture_map();
sts_fhmos_bitmap_pending = 1;
}
}
@ -601,10 +613,13 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
#endif
//fhmos_occupancy = STS_FHMOS_OCCUPANCY_NORMAL;
fhmos_data.state_occupancy = STS_FHMOS_OCCUPANCY_NORMAL;
//if (fhmos_data.prev_occupancy != fhmos_data.state_occupancy)
fhmos_data.state_human_movement = STS_FHMOS_HUMAN_MOVEMENT_NORMAL;
fhmos_data.state_changed_human_movemen = true;
if (fhmos_data.prev_occupancy != fhmos_data.state_occupancy)
{
fhmos_data.status_color = STS_OCCUPY_COLOR;
fhmos_data.status_color = STS_OCCUPY_COLOR;
sts_fhmos_state_changed |=1;
}
}else
@ -618,18 +633,24 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
fhmos_data.state_human_movement = fhmos_human_movement | STS_FHMOS_HUMAN_MOVEMENT_NO_OCCUPY;
fhmos_data.state_fall = STS_FHMOS_FALL_STATE_NO_OCCUPY;
//if (fhmos_data.prev_occupancy != fhmos_data.state_occupancy)
fhmos_data.status_color = STS_VACANT_COLOR;
if (fhmos_data.prev_occupancy != fhmos_data.state_occupancy)
{
fhmos_data.status_color = STS_VACANT_COLOR;
sts_fhmos_state_changed |=1;
}
}
fhmos_data.prev_occupancy = fhmos_data.state_occupancy;
sts_fhmos_result = fhmos_data.state_changed_fall||fhmos_data.state_changed_human_movemen||fhmos_data.state_changed_occupancy;
if (fhmos_data.status_color != fhmos_data.prev_status_color)
{
fhmos_data.prev_status_color = fhmos_data.status_color;
sts_lamp_bar_color = fhmos_data.status_color;
sts_status_color = sts_lamp_bar_color;
sts_fhmos_result = 1;
STS_Combined_Status_Processing();
}