wip good color for hall-1, hall-2

This commit is contained in:
Yunhorn 2024-11-28 01:40:17 +08:00
parent 7a779177d7
commit 7806a9bf93
12 changed files with 494 additions and 54 deletions

View File

@ -104,7 +104,7 @@ void Error_Handler(void);
#define PIR_Pin GPIO_PIN_6 // PIR SENSOR PIN
#define PIR_GPIO_Port GPIOB
#define PIR_EXTI_IRQn EXTI9_5_IRQn
#if 0
#define HALL3_Pin GPIO_PIN_9 // ALARM MUTE PIN
#define HALL3_GPIO_Port GPIOA
#define HALL3_EXTI_IRQn EXTI9_5_IRQn
@ -115,7 +115,7 @@ void Error_Handler(void);
#define ALARM_MUTE_Pin HALL3_Pin // ALARM MUTE BUTTON
#define ALARM_RESET_Pin HALL4_Pin // ALARM RESET BUTTON
#endif
#define HALL1_STATE HAL_GPIO_ReadPin(HALL1_GPIO_Port, HALL1_Pin) //DOOR CONTACT
#define HALL2_STATE HAL_GPIO_ReadPin(HALL2_GPIO_Port, HALL2_Pin) //SOS BUTTON
#define HALL3_STATE HAL_GPIO_ReadPin(HALL3_GPIO_Port, HALL3_Pin) //ALARM MUTE BUTTON

View File

@ -67,6 +67,8 @@ enum sts_lamp_color {
#define STS_VACANT_COLOR STS_BLUE
#define STS_OCCUPY_COLOR STS_GREEN
#define STS_SOS_COLOR STS_RED_BLUE
#define STS_FALL_SUSPICIOUS_COLOR STS_YELLOW
#define STS_FALL_CONFIRMED_COLOR STS_RED
#define STS_HUMAN_MOVEMENT_MOTIONLESS_COLOR STS_YELLOW

View File

@ -65,7 +65,7 @@ void MX_GPIO_Init(void)
/*Configure GPIO pins : PAPin PAPin */
GPIO_InitStruct.Pin = BUT1_Pin|BUT2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
@ -97,7 +97,7 @@ void MX_GPIO_Init(void)
/*Configure GPIO pins : PAPin PAPin */
GPIO_InitStruct.Pin = TOF_INT_EXTI_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(TOF_INT_EXTI_PORT, &GPIO_InitStruct);
/*Configure GPIO pins : VL53L8A1_PWR_EN_C_PIN */
@ -166,7 +166,7 @@ void MX_GPIO_Init(void)
#if defined(PIR)
/*Configure GPIO pins : PIR_Pin PIR_Pin */
GPIO_InitStruct.Pin = PIR_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL; //GPIO_NOPULL;
HAL_GPIO_Init(PIR_GPIO_Port, &GPIO_InitStruct);
HAL_NVIC_SetPriority(PIR_EXTI_IRQn, 15, 0);

View File

@ -65,6 +65,7 @@ extern DMA_HandleTypeDef hdma_i2c2_rx;
extern DMA_HandleTypeDef hdma_i2c2_tx;
extern DMA_HandleTypeDef hdma_usart2_tx;
extern DMA_HandleTypeDef hdma_usart2_rx;
#ifdef O1L
//extern DMA_HandleTypeDef hdma_tim1_ch2;
extern DMA_HandleTypeDef hdma_tim1_ch1;
@ -387,6 +388,20 @@ void DMA1_Channel7_IRQHandler(void)
/* USER CODE END DMA1_Channel7_IRQn 1 */
}
/**
* @brief This function handles SPI1 Interrupt.
*/
void SPI1_IRQHandler(void)
{
/* USER CODE BEGIN SPI1_IRQn 0 */
/* USER CODE END SPI1_IRQn 0 */
//HAL_SPI_IRQHandler(&hspi1);
/* USER CODE BEGIN SPI1_IRQn 1 */
/* USER CODE END SPI1_IRQn 1 */
}
/**
* @brief This function handles EXTI Lines [9:5] Interrupt.
*/
@ -396,7 +411,7 @@ void EXTI9_5_IRQHandler(void)
/* USER CODE END EXTI9_5_IRQn 0 */
HAL_GPIO_EXTI_IRQHandler(TOF_INT_EXTI_PIN);
//HAL_GPIO_EXTI_IRQHandler(TOF_INT_EXTI_PIN);
HAL_GPIO_EXTI_IRQHandler(PIR_Pin);

View File

@ -57,6 +57,7 @@ extern volatile uint8_t sts_work_mode;
volatile uint8_t sts_reed_hall_ext_int = 0;
volatile uint8_t sts_status_color = STS_BLUE;
volatile uint8_t sts_lamp_bar_color = STS_BLUE; //puColor
volatile uint8_t sts_lamp_bar_flashing_color = STS_RED_DARK; //0x23; RED_BLUE;
extern volatile uint8_t sts_cloud_netcolor; //netColor
extern volatile uint8_t sts_occupancy_status;

View File

@ -74,6 +74,7 @@ extern volatile sts_fhmos_sensor_ambient_height_t fhmos_bg;
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_hall3_read, sts_hall4_read;
extern volatile uint8_t sts_pir_state;
extern volatile uint8_t last_sts_hall1_read, last_sts_hall2_read, last_sts_hall3_read, last_sts_hall4_read;
volatile uint8_t sts_PIR_read = 0;
volatile bool locklow = true;
volatile uint32_t lowin=0;
@ -600,7 +601,7 @@ void LoRaWAN_Init(void)
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
static uint8_t prev_color =0;
static uint8_t prev_color =STS_BLUE;
switch (GPIO_Pin)
{
case BUT1_Pin:
@ -611,24 +612,40 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
sts_hall1_read = HALL1_STATE;
printf("\r\n HALL 1 state =%d \r\n", sts_hall1_read);
// 1) record event start/stop time
OnSensor1StateChanged();
if (sts_hall1_read == 0)
// 2) change lamp bar color
if (sts_hall1_read == STS_Status_Door_Close)
{
prev_color = sts_lamp_bar_color;
sts_lamp_bar_color = STS_RED_DARK;
} else {
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);
sts_lamp_bar_color = prev_color;
} else
{
//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 lamp bar color =0x%02x \r\n", sts_lamp_bar_color);
printf("\r\n sts status color =0x%02x \r\n", sts_status_color);
// 3) combine states and colors
STS_YunhornSTSEventP1_Process();
//STS_Combined_Status_Processing();
// 4) upload state change messages
//if (EventType == TX_ON_EVENT)
if (sts_hall1_read == 0)
//if (sts_hall1_read == STS_Status_Door_Close)
{
fhmos_occupancy = 1;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
}
last_sts_hall1_read = sts_hall1_read;
break;
#ifndef STS_R4
@ -639,15 +656,37 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
sts_hall2_read = HALL2_STATE;
printf("\r\n HALL 2 state =%d \r\n", sts_hall2_read);
if (sts_hall2_read == 0) sts_lamp_bar_color = STS_RED_BLUE;
// 1) record event start/stop time
OnSensor2StateChanged();
// 2) change lamp bar color
if (sts_hall2_read == STS_Status_SOS_Pushdown)
{
sts_lamp_bar_color = STS_SOS_COLOR;
sts_status_color = STS_SOS_COLOR;
}
printf("\r\n lamp bar color =0x%02x \r\n", sts_lamp_bar_color);
if (sts_hall2_read ==0)
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;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
}
last_sts_hall2_read = sts_hall2_read;
// 3) combine states and colors
STS_YunhornSTSEventP1_Process();
// 4) upload state change messages
//if (sts_hall2_read == STS_Status_SOS_Release)
{
fhmos_occupancy = 0;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
}
last_sts_hall1_read = sts_hall1_read;
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaStopJoinEvent), CFG_SEQ_Prio_0);
break;
#endif
#endif
@ -656,6 +695,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaStoreContextEvent), CFG_SEQ_Prio_0);
break;
#endif
#if 0
case PIR_Pin:
sts_pir_state = PIR_STATE;
printf("\r\n pir state =%u \r\n", sts_pir_state);
@ -689,6 +729,12 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
}
}
#endif
//OnSensor3StateChanged();
//OnSensorPIR1StateChanged();
//STS_YunhornSTSEventP1_Process();
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
//last_sts_hall3_read = sts_hall3_read;
#if 0
HAL_Delay(100);
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
@ -705,6 +751,25 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
#endif
break;
#if 0
case HALL4_Pin:
sts_hall4_read = HALL4_STATE;
HAL_Delay(30); //de-bouncing
if (sts_hall4_read == HALL4_STATE)
{
//APP_LOG(TS_OFF, VLEVEL_L, "\n\n ALARM RESET Button Read = %02x --%s\r\n", sts_hall4_read, sts_sos_status_code[sts_hall4_read]);
OnSensor4StateChanged();
//sensor_data_ready =1;
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
{
STS_YunhornSTSEventP1_Process();
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
}
last_sts_hall4_read = sts_hall4_read;
}
break;
#endif
#if (defined(VL53L0)||defined(VL53LX)||defined(L8))
case TOF_INT_EXTI_PIN:
ToF_EventDetected = 1;
@ -1107,13 +1172,34 @@ static void SendTxData(void)
#endif //STS_T6
#if defined(L8)
AppData.Buffer[i++] = 4;
//AppData.Buffer[i++] = 4;
AppData.Buffer[i++] = 14;
AppData.Buffer[i++] = fhmos_data.state_fall;
AppData.Buffer[i++] = fhmos_data.state_human_movement;
AppData.Buffer[i++] = fhmos_data.state_occupancy;
AppData.Buffer[i++] = fhmos_data.state_sos_alarm;
AppData.Buffer[i++] = fhmos_data.lamp_bar_color;
AppData.Buffer[i++] = fhmos_data.state_hall_1;
AppData.Buffer[i++] = fhmos_data.state_hall_2;
AppData.Buffer[i++] = fhmos_data.state_PIR;
#elif defined(L8)
sts_data->lamp_bar_color = sts_lamp_bar_color;
sts_data->state_hall_1 = sts_hall1_read;
sts_data->state_hall_2 = sts_hall2_read;
sts_data->state_PIR = sts_pir_result;;
AppData.Buffer[i++] = 8;
AppData.Buffer[i++] = fhmos_data.state_fall;
AppData.Buffer[i++] = fhmos_data.state_human_movement;
AppData.Buffer[i++] = fhmos_data.occupancy;
AppData.Buffer[i++] = fhmos_data.state_sos_alarm;
AppData.Buffer[i++] = fhmos_data.lamp_bar_color;
AppData.Buffer[i++] = fhmos_data.batteryLevel;
//(uint8_t)((sts_l8_sensor_data.tof_range_presence_state & 0xFF));
#endif //STS_T6

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="962004915065611908" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1581009204476899933" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="962004915065611908" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1581009204476899933" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -142,11 +142,11 @@
#endif
#ifdef L8
#define YUNHORN_STS_L8_LORA_APP_DATA_PORT 16U
#define YUNHORN_STS_L8_LORA_APP_HTBT_PORT 17U
#define YUNHORN_STS_L8_LORA_APP_DATA_PORT 19U
#define YUNHORN_STS_L8_LORA_APP_HTBT_PORT 20U
#define YUNHORN_STS_PRD_STRING "STS_L8"
#define sts_mtmcode1 0U
#define sts_mtmcode2 16U
#define sts_mtmcode2 07U
#define sts_senddataport (YUNHORN_STS_L8_LORA_APP_DATA_PORT)
#define sts_sendhtbtport (YUNHORN_STS_L8_LORA_APP_HTBT_PORT)
#endif
@ -186,8 +186,8 @@
/* General Settings */
#define MajorVer 24U
#define MinorVer 10U
#define SubMinorVer 15U
#define MinorVer 11U
#define SubMinorVer 27U
#define FirmwareVersion 3U
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U
#define YUNHORN_STS_AC_CODE_SIZE 20U
@ -233,12 +233,11 @@ enum sts_lamp_color {
STS_UNI_MODE, // 5 DUAL_MODE + FALL DETECTION
STS_REMOTE_REED_RSS_MODE, // 6 REMOTE REED SWITCH + RSS MODE 2023-05-04
STS_DUAL_RSS_MODE, // 7 RSS_1 + RSS_2 IN TWO UNITS
STS_TOF_RSS_MODE, // 8 TOF + RSS MODE
STS_TOF_LMZ_RSS_MODE, // 8 TOF LMZ DISTANCE/MOTION/CNH(Compact Normalized Histogram) + RSS
STS_TOF_DISTANCE_MODE, // 9 TOF DISTANCE
STS_TOF_PRESENCE_MODE, // A TOF PRESENCE OCCUPANCY
STS_TOF_IN_OUT_MODE, // B TOF IN OUT COUNT
STS_FALL_DETECTION_MODE, // C FALL DETECTION
STS_OTHER_MODE // ? OTHER MODE
};

View File

@ -284,6 +284,7 @@ typedef struct sts_fhmos_sensor_data
uint16_t install_height_mm; /* Default distance sensor measured distance */
uint16_t battery_mV; /* mV, 1000mv-5000mv, regular 3300mV - 3600mV --4200mV */
uint8_t lamp_bar_color; /* lamp bar LED color */
uint8_t status_color;
uint8_t state_fall; /* 0/blue: no occupy, 1/green:occupy yet normal, 2/yellow: suspicious state, 3/red: fall confirmed */
uint8_t state_human_movement; /* 0/blue: no occupy, 1/green:occupy yet normal, 2/yellow: suspicious state, 3/red: fall confirmed */
uint8_t state_occupancy; /* 0/blue: no occupy, 1/green:occupy yet normal, 3/red: over stay */
@ -316,7 +317,7 @@ typedef struct sts_fhmos_sensor_data
uint8_t prev_PIR;
uint8_t prev_hall_3;
uint8_t prev_hall_4;
uint8_t prev_status_color;
} sts_fhmos_sensor_data_t;
@ -342,10 +343,13 @@ typedef struct sts_fhmos_sensor_config
} sts_fhmos_sensor_config_t;
// volatile uint8_t sts_hall1_read=STS_Status_Door_Open,sts_hall2_read=STS_Status_SOS_Release; // Above hall1_read == reed_hall_result, hall2_read == emergency_button
typedef struct sts_fhmos_sensor_ambient_height
{
uint32_t h2cm[64]; //height in 2cm scan data, ensure it less than 250*2=500cm, 5meter
uint16_t h2cm[64]; //height in 2cm scan data, ensure it less than 250*2=500cm, 5meter
uint8_t maskoff[64];
uint16_t head_level;
uint8_t head_xy;
} sts_fhmos_sensor_ambient_height_t;
@ -477,6 +481,8 @@ void OnSensorRSS3AStateChanged(void);
void OnSensorRSS3BStateChanged(void);
void OnSensorRSS3CStateChanged(void);
void OnSensorPIR1StateChanged(void);
uint32_t STS_Get_Date_Time_Stamp(void);//uint32_t *time_stamp, uint8_t *datetimestamp);
void STS_Reed_Hall_Presence_Detection(void);
@ -503,6 +509,7 @@ void STS_LMZ_Ambient_Height_Scan_Process(void);
void STS_FHMOS_sensor_read(sts_fhmos_sensor_data_t *sts_fhmos_data);
void STS_FHMOS_sensor_config_init(void);
void STS_FHMOS_sensor_config_update(void);
void sts_generate_fall_gesture_map(void);
void STSWakeupScanTimerStop(void);
void STSWakeupScanTimerStart(void);

View File

@ -53,6 +53,7 @@ extern volatile uint8_t sts_tof_presence_state_changed;
#include "app_tof.h"
#include "sts_lamp_bar.h"
volatile uint8_t sts_hall1_read=STS_Status_Door_Open,sts_hall2_read=STS_Status_SOS_Release; // Above hall1_read == reed_hall_result, hall2_read == emergency_button
volatile uint8_t last_sts_hall1_read, last_sts_hall2_read, last_sts_hall3_read, last_sts_hall4_read;
volatile uint8_t sts_hall3_read=STS_Status_Alarm_Mute_Release,sts_hall4_read=STS_Status_Alarm_Reset_Release;
volatile uint8_t sts_pir_state=0;
volatile STS_OO_SensorStatusDataTypeDef sts_o7_sensorData;
@ -60,9 +61,10 @@ 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 uint8_t sts_reed_hall_ext_int;
extern volatile uint8_t sts_status_color;
extern volatile uint8_t sts_lamp_bar_color; //puColor
extern volatile uint8_t last_lamp_bar_color;
extern volatile uint8_t sts_lamp_bar_flashing_color; //0x23; RED_BLUE;
volatile uint8_t sts_cloud_netcolor = STS_BLUE; //netColor
extern volatile uint8_t sts_occupancy_status;
@ -87,7 +89,7 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
0x3C, //Heart-beat interval , for heart-beat uplink
'M', //Heart-beat interval unit
#endif
0x04, // dual mode=4, uni_mode =5
0x08, // dual mode=4, uni_mode =5
0x00, // sts service mask
0x00, //sts_ioc_mask
0x20, //32 bytes, below start of p[0] 20 BYTES AND 12 BYTES FALL DOWN CFG
@ -155,7 +157,7 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
volatile uint8_t nvm_store_value[YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
volatile uint8_t sts_ac_code[20]={0x0};
volatile uint8_t sts_service_mask=STS_SERVICE_MASK_L0;
volatile uint8_t sts_work_mode=4;
volatile uint8_t sts_work_mode=STS_TOF_LMZ_RSS_MODE;
volatile uint32_t rfac_timer=0;
volatile uint16_t sts_sensor_install_height=3000;
volatile uint8_t sensor_data_ready=0;
@ -165,7 +167,9 @@ volatile uint32_t STS_TOFScanPeriod_msec=50, STS_TxPeriod_sec=30, STS_HeartBeatT
#elif defined(STS_L8)||defined(STS_P2)||defined(STS_O6T)||defined(STS_T6)||defined(O1L)
volatile uint32_t STS_TOFScanPeriod_msec=500, STS_TxPeriod_sec=300, STS_HeartBeatTimerPeriod_sec=3600;
#endif
volatile uint8_t sts_pir_result = 0;
volatile uint8_t last_sts_pir_result=0;
volatile uint32_t last_sts_pir_time_stamp;
volatile uint8_t sts_rss_result_changed_flag = 0;
volatile uint8_t sts_rss_result = STS_RESULT_NO_MOTION;
volatile uint8_t sts_rss_2nd_result = STS_RESULT_NO_MOTION; //2nd RSS sensor status
@ -193,17 +197,20 @@ void STS_R4_sensor_read(sts_r_sensor_data_t *sts_r_sensor_data);
#ifdef STS_M1
volatile uint8_t sts_water_leakage_state=0;
#endif
#if 0
#if 1
volatile uint8_t sts_reed_hall_result, last_sts_reed_hall_result,sts_reed_hall_changed_flag;
volatile uint32_t event_start_time, event_stop_time;
volatile uint8_t sts_soap_level_state;
extern volatile uint8_t sts_reed_hall_result, sts_work_mode, sts_service_mask;
volatile uint8_t sts_reed_hall_ext_int = 0;
extern volatile uint8_t sts_reed_hall_ext_int;
volatile uint8_t sts_occupancy_status;
volatile uint8_t sts_reed_hall_changed_flag = 0;
volatile uint8_t sts_reed_hall_result =0;
volatile uint8_t sts_water_leakage_result=0;
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;
#endif
@ -217,7 +224,8 @@ extern uint8_t luminance_level;
extern volatile uint8_t sts_status_color;
extern volatile uint8_t sts_lamp_bar_color; //puColor
extern volatile uint8_t sts_cloud_netcolor; //netColor
#endif
#if 0
volatile uint8_t sts_tof_result_changed_flag = 0;
volatile uint8_t sts_rss_result_changed_flag = 0;
@ -341,21 +349,23 @@ void STS_YunhornSTSEventP1_Process(void)
}
#endif
#if (defined(YUNHORN_STS_O6_ENABLED) && defined(USE_ACCONEER_A111))
if ((sts_work_mode == STS_WIRED_MODE) || (sts_work_mode == STS_REEDSWITCH_MODE) || (sts_work_mode == STS_DUAL_MODE))
//#if (defined(YUNHORN_STS_O6_ENABLED) && defined(USE_ACCONEER_A111))
if ((sts_work_mode == STS_WIRED_MODE) || (sts_work_mode == STS_REEDSWITCH_MODE) || (sts_work_mode == STS_DUAL_MODE) || (sts_work_mode == STS_TOF_LMZ_RSS_MODE))
{
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();
}
last_sts_reed_hall_result = sts_reed_hall_result;
}
#endif
//#endif
/* STS-M1 Water leakage sensor */
@ -403,7 +413,7 @@ void STS_YunhornSTSEventP2_Process(void)
void STS_Reed_Hall_Presence_Detection(void)
{
#if (defined(YUNHORN_STS_O5_ENABLED) || defined(YUNHORN_STS_O6_ENABLED) || defined(USE_ACCONEER_A111))
//#if (defined(YUNHORN_STS_O5_ENABLED) || defined(YUNHORN_STS_O6_ENABLED) || defined(USE_ACCONEER_A111))
HAL_Delay(50); // BOUNCING ELIMIATION
if (STS_Reed_Hall_State == STS_Status_Door_Open)
{
@ -417,7 +427,7 @@ void STS_Reed_Hall_Presence_Detection(void)
HAL_Delay(20); // BOUNCING ELIMIATION
sts_reed_hall_changed_flag = 0;
sts_reed_hall_ext_int = 0;
#endif
//#endif
}
void STS_RSS_Smart_Presence_Detection(void)
@ -674,7 +684,7 @@ void USER_APP_Parse_CMD_P(uint8_t *parse_buffer, uint8_t parse_buffer_size)
break;
case STS_DUAL_RSS_MODE:
break;
case STS_TOF_RSS_MODE: // STS-O7T
case STS_TOF_LMZ_RSS_MODE: // STS-O7T
break;
case STS_TOF_DISTANCE_MODE: // STS-R1/R2/R5/R1D
break;
@ -2308,7 +2318,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_L, "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;
@ -2476,6 +2486,31 @@ void OnSensorRSS3CStateChanged(void)
}
/* PIR sensor: Motion detection */
void OnSensorPIR1StateChanged(void)
{
SysTime_t sensor_event_time = SysTimeGetMcuTime();
#if 0
if ((sensor_event_time.Seconds - last_sts_rss_time_stamp) < 3 ) //less than 3 seconds ... return for flipping filter
{
return ;
}
#endif
if (sts_pir_result == STS_RESULT_MOTION)
{
sts_o7_sensorData.event_sensor3_motion_start_time = sensor_event_time.Seconds;
sts_o7_sensorData.event_sensor3_motion_duration = 0;
} else if (sts_pir_result == STS_RESULT_NO_MOTION)
{
sts_o7_sensorData.event_sensor3_motion_stop_time = sensor_event_time.Seconds;
//sts_o7_sensorData.event_sensor3_motion_duration = 0;
}
last_sts_pir_time_stamp = sensor_event_time.Seconds;
}
void OnSensor3StateChanged(void)
{
@ -2541,6 +2576,226 @@ void OnSensor4StateChanged(void)
}
}
void STS_Combined_Status_Processing(void)
{
printf("\r\n ********* combined process %d \r\n", sts_work_mode);
switch (sts_work_mode)
{
case STS_NETWORK_MODE:
sts_status_color = sts_cloud_netcolor;
sts_lamp_bar_color = sts_cloud_netcolor;
break;
case STS_WIRED_MODE: // NO LAMP BAR FOR THOSE WATER LEAKAGE SENSOR OR SOAP CAPACITY SENSORS
sts_status_color = STS_DARK;
#ifdef STS_M1
sts_water_leakage_result = (sts_reed_hall_result == STS_Status_Door_Open )?STS_RESULT_WATER_LEAKAGE_YES:STS_RESULT_WATER_LEAKAGE_NO;
sts_water_leakage_changed_flag = 1;
#endif
break;
case STS_REEDSWITCH_MODE:
sts_status_color = (sts_reed_hall_1_result == STS_Status_Door_Open )? STS_GREEN: STS_RED;
if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
{
sts_status_color = STS_RED_BLUE;
}
break;
case STS_RSS_MODE:
if (sts_rss_result == STS_RESULT_NO_MOTION){
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_rss_result == STS_RESULT_MOTION))
{
sts_status_color = STS_OCCUPY_COLOR;
}
break;
case STS_DUAL_MODE: // FOR STS_O6
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_reed_hall_1_result == STS_Status_Door_Open )&& (sts_reed_hall_2_result == STS_Status_SOS_Release ))
{
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_reed_hall_1_result == STS_Status_Door_Close )||(sts_reed_hall_2_result == STS_Status_SOS_Pushdown ))
{
sts_status_color = STS_OCCUPY_COLOR;
if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
{
sts_status_color = STS_RED_BLUE;
}
}
break;
case STS_UNI_MODE: //FOR STS-O7
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_reed_hall_1_result == STS_Status_Door_Open )&& (sts_reed_hall_2_result == STS_Status_SOS_Release )
&& (sts_reed_hall_3_result == STS_Status_Alarm_Mute_Release )&& (sts_reed_hall_4_result == STS_Status_Alarm_Reset_Release ))
{
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_reed_hall_1_result == STS_Status_Door_Close )||(sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
|| (sts_reed_hall_3_result == STS_Status_Alarm_Mute_Pushdown )|| (sts_reed_hall_4_result == STS_Status_Alarm_Reset_Pushdown ))
{
sts_status_color = STS_OCCUPY_COLOR;
if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
{
sts_status_color = STS_RED_BLUE;
}
}
switch(sts_fall_rising_detected_result)
{
case STS_PRESENCE_NORMAL:
//do nothing
break;
case STS_PRESENCE_LAYDOWN:
sts_lamp_bar_color = STS_YELLOW;
sts_status_color = STS_YELLOW;
break;
case STS_PRESENCE_FALL: //RED_BLUE FLASH
sts_lamp_bar_color = STS_RED_BLUE;
sts_status_color = STS_RED_BLUE;
break;
case STS_PRESENCE_RISING: //NORMAL OCCUPANCY STATUS
sts_lamp_bar_color = STS_RED;
sts_status_color = STS_RED;
break;
default:
// sts_lamp_bar_color = STS_RED;
// sts_status_color = STS_RED;
break;
}
break;
case STS_REMOTE_REED_RSS_MODE:
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_reed_hall_result == STS_Status_Door_Open ))
{
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_reed_hall_result == STS_Status_Door_Close ))
{
sts_status_color = STS_OCCUPY_COLOR;
}
break;
case STS_DUAL_RSS_MODE:
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_rss_2nd_result == STS_RESULT_NO_MOTION))
{
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_rss_2nd_result == STS_RESULT_MOTION))
{
sts_status_color = STS_OCCUPY_COLOR;
}
break;
case STS_TOF_LMZ_RSS_MODE: // FOR STS-L8
if ((sts_reed_hall_1_result == STS_Status_Door_Open )&& (sts_reed_hall_2_result == STS_Status_SOS_Release )
&& (sts_fhmos_result == STS_FHMOS_FALL_STATE_NO_OCCUPY))
{
sts_status_color = STS_VACANT_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))
{
sts_status_color = STS_OCCUPY_COLOR;
printf("\r\n ********* combined process status color = %d \r\n", sts_status_color);
if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
{
sts_status_color = STS_RED_BLUE;
}
if ((sts_fhmos_result == STS_FHMOS_FALL_STATE_POTENTIAL) || (sts_fhmos_result == STS_FHMOS_HUMAN_MOVEMENT_MOTIONLESS_SHORT))
{
sts_status_color = STS_YELLOW;
}
if ((sts_fhmos_result == STS_FHMOS_FALL_STATE_CONFIRMED) || (sts_fhmos_result == STS_FHMOS_HUMAN_MOVEMENT_MOTIONLESS_LONG) || (sts_fhmos_result == STS_FHMOS_OCCUPANCY_OVERSTAY))
{
sts_status_color = STS_RED;
}
printf("\r\n ********* combined process finished status color = %d \r\n", sts_status_color);
sts_lamp_bar_color = sts_status_color;
}
break;
#if 0
case STS_TOF_RSS_MODE:
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_tof_result == STS_RESULT_NO_PRESENCE)){
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_tof_result == STS_RESULT_PRESENCE))
{
sts_status_color = STS_OCCUPY_COLOR;
}
break;
#endif
// TO-DO LIST ***********************************************************
case STS_TOF_DISTANCE_MODE:
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
sts_status_color = STS_OCCUPY_COLOR;
}
break;
case STS_TOF_PRESENCE_MODE:
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
sts_status_color = STS_OCCUPY_COLOR;
}
break;
case STS_TOF_IN_OUT_MODE:
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
sts_status_color = STS_VACANT_COLOR;
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
sts_status_color = STS_OCCUPY_COLOR;
}
break;
// TO-DO LIST ***********************************************************
default:
break;
}
if ((sts_work_mode == STS_WIRED_MODE) || (sts_service_mask > STS_SERVICE_MASK_L0))
{
sts_status_color = STS_DARK;
sts_lamp_bar_color = STS_DARK;
last_lamp_bar_color = STS_DARK;
STS_Lamp_Bar_Set_Dark();
}
else
{
if ((last_lamp_bar_color != sts_status_color))
{
sts_lamp_bar_color = sts_status_color;
//STS_Lamp_Bar_Set_STS_RGB_Color(sts_lamp_bar_color, luminance_level);
last_lamp_bar_color = sts_lamp_bar_color;
}
}
//if ((sts_rss_result_changed_flag)|| (sts_reed_hall_changed_flag)||(sts_fall_rising_detected_result_changed_flag))
{
//sts_rss_result_changed_flag =0;
//sts_reed_hall_changed_flag =0;
//sts_fall_rising_detected_result_changed_flag =0;
//sts_tof_result_changed_flag =0;
sensor_data_ready = 1;
//STS_PRESENCE_SENSOR_Prepare_Send_Data();
}
}
/* USER CODE BEGIN EF */
/* USER CODE END EF */

View File

@ -42,12 +42,15 @@ volatile uint32_t sts_low_threshold=1500, sts_high_threshold=2800, sts_occupancy
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};
volatile sts_fhmos_sensor_ambient_height_t fhmos_bg={0x0}, fhmos_gesture={0x0};
volatile sts_fhmos_sensor_data_t fhmos_data;
volatile uint8_t sts_mask_bitmap[8]={0x0};
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;
#endif
#include "stm32wlxx_nucleo.h"
@ -119,7 +122,7 @@ static RANGING_SENSOR_Result_t Result;
static void MX_53L8A1_ThresholdDetection_Init(void);
static void MX_53L8A1_ThresholdDetection_Process(void);
static void print_result(RANGING_SENSOR_Result_t *Result);
//static void sts_generate_fall_gesture_map(void);
#endif
static int32_t status = 0;
@ -169,6 +172,7 @@ void MX_TOF_Init(void)
void STS_LMZ_Ambient_Height_Scan_Process(void)
{
#if 1
uint8_t i=0, repeat=1;
uint32_t range_distance =0;
@ -225,9 +229,62 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
}
for (i=0; i<8; i++)
printf("%02X\r\n",sts_mask_bitmap[i]);
#endif
}
void sts_generate_fall_gesture_map(void)
{
uint8_t i=0,head_xy=0;
uint32_t range_distance =0, sts_fall_head_position=8000; // assume max range 8000 mm, actual 4500mm
for (i=0; i<64; i++)
{
fhmos_gesture.h2cm[i] = 0;
fhmos_gesture.maskoff[i] = 0;
}
fhmos_gesture.head_level =1000; // 1000 mm
fhmos_gesture.head_xy = 31; //center of FOV
for (i=0;i<8;i++)
fhmos_gesture_bitmap[i]=0;
for (uint8_t i = 0; i < 64; i++)
{
if ((Result.ZoneResult[i].NumberOfTargets > 0))
{
range_distance = (uint32_t)Result.ZoneResult[i].Distance[0];
if (range_distance < sts_fall_head_position)
{
sts_fall_head_position = range_distance; // simply find out the head level
head_xy = i; // head x, y coordination in 8x8 matrix
}
fhmos_gesture.h2cm[i] += ((uint32_t)sts_sensor_install_height - range_distance);
fhmos_gesture.maskoff[i]= (abs(fhmos_gesture.h2cm[i])<100)? 0:1;
fhmos_gesture_bitmap[(uint8_t)(i/8)] |= (fhmos_gesture.maskoff[i])<<(7-i%8);
// debug
if (i%8==0) printf("\r\n");
printf("|%4d %4d ", range_distance, fhmos_gesture.h2cm[i]);
}
else {
fhmos_gesture.h2cm[i] += 0;
}
}
fhmos_gesture.head_level = sts_fall_head_position;
fhmos_gesture.head_xy = head_xy;
#if 0
for (i=0; i<64; i++)
{
if (i%8==0) printf("\r\n");
printf("|%d ", (uint8_t)fhmos_gesture.maskoff[i]);
}
for (i=0; i<8; i++)
printf("%02X\r\n",fhmos_gesture_bitmap[i]);
#endif
}
uint16_t MX_TOF_Ranging_Process(void)
{
@ -503,28 +560,33 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
printf("\r\n YELLOW OR RED Distance=%d \r\n", roi_distance);
fhmos_data.state_fall = 1;
fhmos_data.state_human_movement = 1;
sts_lamp_bar_color = STS_OCCUPY_COLOR; // HOLD THIS COLOR BEFORE ENTER YELLOW STATUS
fhmos_data.status_color = STS_OCCUPY_COLOR; // HOLD THIS COLOR BEFORE ENTER YELLOW STATUS
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 0
printf("\r\n [YELLOW **] Suspicious Fall: distance=%d [high - head level=[%d]] <= distance <= [high-100 =%d] \r\n",
roi_distance, (sts_high_threshold - 10*fhmos_cfg.th_head_level_height_cm), (sts_high_threshold - 100));
printf("\r\n duration =%d sec, threshold=%d sec\r\n", fhmos_fall_counter, 15*fhmos_cfg.th_fall_duration_potential_15sec);
printf("\r\n Fall state --- Yellow \r\n");
#endif
fhmos_fall =2;
sts_lamp_bar_color = STS_FALL_SUSPICIOUS_COLOR;
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)
{
#if 0
printf("\r\n [RED **] Configmed Fall: distance=%d [high - head level=[%d]] <= distance <= [high-100 =%d] \r\n",
roi_distance, (sts_high_threshold - 10*fhmos_cfg.th_head_level_height_cm), (sts_high_threshold - 100));
printf("\r\n duration =%d sec, threshold=%d sec\r\n", fhmos_fall_counter, 15*fhmos_cfg.th_fall_duration_confirm_15sec);
printf("\r\n Fall state --- Red \r\n");
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;
sts_lamp_bar_color = STS_FALL_CONFIRMED_COLOR;
fhmos_data.status_color = STS_FALL_CONFIRMED_COLOR;
fhmos_data.state_changed_fall = STS_FHMOS_FALL_STATE_CONFIRMED;
sts_generate_fall_gesture_map();
}
}
@ -533,35 +595,43 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
fhmos_fall_counter = 0;
fhmos_fall = 0;
fhmos_human_movement = 1;
#if 0
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 [GREEN ** ]Normal Occupy state: rio distance =%d, low =%d occupy=%d head level=%d high=%d\r\n", roi_distance, sts_low_threshold, sts_occupancy_threshold, fhmos_cfg.th_head_level_height_cm*10, sts_high_threshold);
#endif
//fhmos_occupancy = STS_FHMOS_OCCUPANCY_NORMAL;
fhmos_data.state_occupancy = STS_FHMOS_OCCUPANCY_NORMAL;
//if (fhmos_data.prev_occupancy != fhmos_data.state_occupancy)
{
sts_lamp_bar_color = STS_OCCUPY_COLOR;
fhmos_data.status_color = STS_OCCUPY_COLOR;
}
}else
{
#if 0
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 [BLUE *] No occupy status , distance=%d \r\n", roi_distance);
#endif
fhmos_data.state_occupancy = STS_FHMOS_OCCUPANCY_NO_OCCUPY;
fhmos_fall_counter =0;
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)
sts_lamp_bar_color = STS_VACANT_COLOR;
fhmos_data.status_color = STS_VACANT_COLOR;
}
fhmos_data.prev_occupancy = fhmos_data.state_occupancy;
fhmos_data.lamp_bar_color = sts_lamp_bar_color;
if (fhmos_data.status_color != fhmos_data.prev_status_color)
{
fhmos_data.prev_status_color = fhmos_data.status_color;
STS_Combined_Status_Processing();
}
#if 0
printf("53L8A1 Threshold Detection demo application\n\r");
@ -747,6 +817,11 @@ void STS_FHMOS_sensor_read(sts_fhmos_sensor_data_t *sts_data)
sts_data->state_fall = fhmos_data.state_fall;
sts_data->state_human_movement = fhmos_data.state_human_movement;
sts_data->state_sos_alarm = fhmos_data.state_sos_alarm;
sts_data->lamp_bar_color = sts_lamp_bar_color;
sts_data->state_hall_1 = sts_hall1_read;
sts_data->state_hall_2 = sts_hall2_read;
sts_data->state_PIR = sts_pir_result;;
}