diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 679c1cb..c24b8dc 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -83,7 +83,7 @@ void MX_GPIO_Init(void) #ifdef STS_O7 GPIO_InitStruct.Pin = HALL1_Pin|HALL2_Pin; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; - GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); #else diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index 5ef68ef..b98aa0b 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -61,7 +61,7 @@ volatile uint8_t sts_lamp_bar_color = STS_GREEN; //puColor 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 =1, sts_emergency_button_pushed=1; // inital 1 = open +volatile uint8_t sts_reed_hall_result =0, sts_emergency_button_result=0; // inital 1 = closed 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; @@ -150,8 +150,9 @@ void STS_Reed_Hall_Presence_Detection(void) } #endif - sts_reed_hall_result = (STS_Reed_Hall_State==STS_Status_Door_Open)? 1:0; - sts_emergency_button_pushed = (STS_Emergency_Button_State==STS_Status_Door_Open)? 1:0; + sts_reed_hall_result = (sts_hall1_read==STS_Status_Door_Open)? 0:1; + + sts_emergency_button_result = (sts_hall2_read==STS_Status_Door_Open)? 0:1; //sts_reed_hall_result = ((STS_Reed_Hall_State)&STS_Status_Door_Open); diff --git a/Core/Src/yunhorn_sts_presence_sensor.c b/Core/Src/yunhorn_sts_presence_sensor.c index a2ed031..053784d 100644 --- a/Core/Src/yunhorn_sts_presence_sensor.c +++ b/Core/Src/yunhorn_sts_presence_sensor.c @@ -49,7 +49,7 @@ volatile uint32_t event_start_time, event_stop_time, sensor_data_ready; extern volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config; extern volatile sts_cfg_nvm_t sts_cfg_nvm; extern volatile uint8_t sts_fall_detection_acc_threshold, sts_fall_detection_depth_threshold, sts_occupancy_overtime_threshold; -extern volatile uint8_t sts_reed_hall_result, sts_rss_result, sts_rss_2nd_result,sts_tof_result, sts_status_color, sts_lamp_bar_color, sts_work_mode, sts_service_mask; +extern volatile uint8_t sts_reed_hall_result, sts_emergency_button_result, sts_rss_result, sts_rss_2nd_result,sts_tof_result, sts_status_color, sts_lamp_bar_color, sts_work_mode, sts_service_mask; extern volatile distance_measure_cfg_t distance_cfg; extern uint8_t sts_fall_rising_detected_result; extern volatile uint16_t sts_fall_rising_pattern_factor1; @@ -271,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_hall1_read; + sts_o7_sensorData.state_sensor1_on_off = sts_reed_hall_result; sts_o7_sensorData.state_sensor2_on_off = sts_rss_result; - sts_o7_sensorData.state_sensor3_on_off = sts_hall2_read; + sts_o7_sensorData.state_sensor3_on_off = sts_emergency_button_result; sts_o7_sensorData.state_sensor4_on_off = sts_rss_2nd_result; if (sts_rss_result == STS_RESULT_MOTION) { diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 014162c..0fc879d 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -592,7 +592,10 @@ void LoRaWAN_Init(void) STS_REBOOT_CONFIG_Init(); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process); +#ifdef STS_O7 UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_YunhornSTSEventP1_Process); +#endif +#if 0 UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), UTIL_SEQ_RFU, STS_YunhornSTSEventP2_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), UTIL_SEQ_RFU, STS_YunhornSTSEventP3_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), UTIL_SEQ_RFU, STS_YunhornSTSEventP4_Process); @@ -600,7 +603,7 @@ void LoRaWAN_Init(void) UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), UTIL_SEQ_RFU, STS_YunhornSTSEventP6_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP7), UTIL_SEQ_RFU, STS_YunhornSTSEventP7_Process); UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP8), UTIL_SEQ_RFU, STS_YunhornSTSEventP8_Process); - +#endif #ifdef YUNHORN_STS_O7_ENABLED UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer, YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, @@ -642,6 +645,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) case HALL2_Pin: sts_hall2_read = HALL2_STATE; + // UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); break; diff --git a/STM32CubeIDE/Release/STS_O7.bin b/STM32CubeIDE/Release/STS_O7.bin index 70d4951..d93d6c9 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ