diff --git a/Core/Inc/yunhorn_sts_prd_conf.h b/Core/Inc/yunhorn_sts_prd_conf.h index e2df994..3226c5f 100644 --- a/Core/Inc/yunhorn_sts_prd_conf.h +++ b/Core/Inc/yunhorn_sts_prd_conf.h @@ -44,7 +44,8 @@ //#define USE_TOF_VL53L1X #define STS_USE_TOF_VL53L0X 1U #define YUNHORN_STS_R5_ENABLED -#define YUNHORN_STS_O5_ENABLED + + // TOF VL53LX number //#define USE_MEMS_ADXL345 //#define USE_ACCONEER_A111 @@ -265,6 +266,23 @@ #define I2C_TIMING 0x20303E5D //DEFAULT FOR I2C TOF #endif + enum sts_oo_work_mode { + STS_NETWORK_MODE = 0, // 0 NETWORK MODE + STS_WIRED_MODE, // 1 WIRED MODE === WATER LEAKAGE, SOAP CAPACITY SENSOR MODE + STS_REEDSWITCH_MODE, // 2 REED SWITCH ONLY + STS_RSS_MODE, // 3 RSS ONLY + STS_DUAL_MODE, // 4 RSS + REED SWITCH IN ONE UNIT + STS_REMOTE_REED_RSS_MODE, // 5 REMOTE REED SWITCH + RSS MODE 2023-05-04 + STS_DUAL_RSS_MODE, // 6 RSS_1 + RSS_2 IN TWO UNITS + STS_TOF_RSS_MODE, // 7 TOF + RSS MODE + STS_TOF_DISTANCE_MODE, // 8 TOF DISTANCE + STS_TOF_PRESENCE_MODE, // 9 TOF PRESENCE OCCUPANCY + STS_TOF_IN_OUT_MODE, // A TOF IN OUT COUNT + STS_FALL_DETECTION_MODE, // B DUAL_MODE + FALL DETECTION + + STS_OTHER_MODE // ? OTHER MODE +}; + #ifdef YUNHORN_STS_O6_ENABLED #define STS_O6_NVM_CFG_SIZE 30U diff --git a/Core/Inc/yunhorn_sts_sensors.h b/Core/Inc/yunhorn_sts_sensors.h index 91728f8..e6f3d3f 100644 --- a/Core/Inc/yunhorn_sts_sensors.h +++ b/Core/Inc/yunhorn_sts_sensors.h @@ -589,6 +589,8 @@ void STS_YunhornSTSEventP7_Process(void); void STS_YunhornSTSEventRFAC_Process(void); void STS_YunhornAuthenticationCode_Process(void); +void STS_Reed_Hall_Presence_Detection(void); + void STS_SENSOR_Upload_Config_Invalid_Message(void); void STS_SENSOR_Upload_Message(uint8_t appDataPort, uint8_t appBufferSize, char *appDataBuffer); void STS_SENSOR_Auto_Responder_Process(uint8_t tlv_ver,uint8_t tlv_type, uint8_t tlv_length, uint8_t *tlv_content); diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index 1b94005..7c4fdf3 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -41,6 +41,8 @@ extern volatile uint8_t sts_ac_code[20]; volatile uint8_t sts_service_mask; volatile uint32_t rfac_timer; extern volatile uint8_t sensor_data_ready; +extern volatile uint8_t sts_work_mode; +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; #if (defined(YUNHORN_STS_O6_ENABLED) && defined(USE_ACCONEER_A111)) @@ -168,6 +170,7 @@ void STS_YunhornSTSEventRFAC_Process(void) void STS_YunhornSTSEventP1_Process(void) { + #if defined(YUNHORN_STS_O5_ENABLED) if ((sts_work_mode == STS_WIRED_MODE) || (sts_work_mode == STS_REEDSWITCH_MODE) || (sts_work_mode == STS_DUAL_MODE)) @@ -178,7 +181,9 @@ void STS_YunhornSTSEventP1_Process(void) sts_reed_hall_changed_flag = 0; } else { sts_reed_hall_changed_flag = 1; +#ifdef LED_ONBOARD STS_Combined_Status_Processing(); +#endif } last_sts_reed_hall_result = sts_reed_hall_result; diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index a6a5c4b..33f64e1 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -139,6 +139,7 @@