revised for hall1/hall2 read

This commit is contained in:
Yunhorn 2024-04-15 11:21:29 +08:00
parent 1df8c3bcf2
commit 2c7b8f1cca
4 changed files with 9 additions and 3 deletions

View File

@ -62,6 +62,7 @@ volatile uint8_t sts_cloud_netcolor = STS_GREEN; //netColor
volatile uint8_t sts_occupancy_status;
volatile uint8_t sts_reed_hall_changed_flag = 1;
volatile uint8_t sts_reed_hall_result =0;
volatile uint8_t sts_hall1_read=0,sts_hall2_read=0;
volatile uint8_t sts_tof_result_changed_flag = 0;
volatile uint8_t sts_water_leakage_result=0;
volatile uint8_t sts_water_leakage_changed_flag=0;

View File

@ -42,6 +42,7 @@ volatile STS_OO_SensorStatusDataTypeDef sts_o7_sensorData;
volatile STS_PRESENCE_SENSOR_Event_Status_t sts_o7_event_status;
volatile float sts_distance_rss_distance;
extern volatile float sts_presence_rss_distance, sts_presence_rss_score;
extern volatile uint8_t sts_hall1_read,sts_hall2_read;
volatile uint8_t sts_rss_config_updated_flag = 0;
extern volatile uint8_t mems_int1_detected, link_wakeup, link_sleep;
volatile uint32_t event_start_time, event_stop_time, sensor_data_ready;
@ -270,9 +271,9 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(void)
{
sts_o7_sensorData.lamp_bar_color = sts_lamp_bar_color;
sts_o7_sensorData.workmode = sts_work_mode;
sts_o7_sensorData.state_sensor1_on_off = ((STS_Reed_Hall_State == STS_Status_Door_Open)? 0U:1U);
sts_o7_sensorData.state_sensor1_on_off = sts_hall1_read;
sts_o7_sensorData.state_sensor2_on_off = sts_rss_result;
sts_o7_sensorData.state_sensor3_on_off = sts_tof_result;
sts_o7_sensorData.state_sensor3_on_off = sts_hall2_read;
sts_o7_sensorData.state_sensor4_on_off = sts_rss_2nd_result;
if (sts_rss_result == STS_RESULT_MOTION)
{

View File

@ -50,6 +50,7 @@ extern volatile uint32_t rfac_timer;
volatile uint8_t sts_ac_code[YUNHORN_STS_AC_CODE_SIZE]={0x0};
extern hmac_result_t hmac_result;
extern volatile uint8_t sts_reed_hall_ext_int;
extern volatile uint8_t sts_hall1_read, sts_hall2_read;
extern volatile uint8_t sts_work_mode, sts_cloud_netcolor, sts_lamp_bar_color, sts_status_color;
volatile uint8_t sts_fall_detection_acc_threshold = 10, sts_fall_detection_depth_threshold=30, sts_occupancy_overtime_threshold=20;
@ -630,6 +631,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
#ifdef STS_O7
case HALL1_Pin:
//sts_reed_hall_ext_int = 1;
sts_hall1_read = HALL1_STATE;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
// if (EventType == TX_ON_EVENT)
@ -639,6 +641,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
break;
case HALL2_Pin:
sts_hall2_read = HALL2_STATE;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
break;
@ -780,7 +783,8 @@ static uint8_t PrepareSendTxData(void)
//sensor_t sensor_data;
STS_OO_SensorStatusDataTypeDef o7_data;
STS_PRESENCE_SENSOR_Read(&o7_data);
STS_PRESENCE_SENSOR_Prepare_Send_Data();
//STS_PRESENCE_SENSOR_Read(&o7_data);
o7_data.battery_Pct = (uint8_t)(99*batteryLevel/254);

Binary file not shown.