降低了报警的敏感度,防止误报警
This commit is contained in:
parent
07805ed850
commit
6c735b637d
|
@ -17,7 +17,7 @@
|
|||
|
||||
#define TSET_BSP_H308
|
||||
|
||||
#define H308_SAMPLING_TIMS (6U)
|
||||
#define H308_SAMPLING_TIMS (8U)
|
||||
/*浓度异常采样周期*/
|
||||
#define H308_SAMPLING_ABNORMAL (60U)
|
||||
#define H308_PWR_PIN GET_PIN(B, 9)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: mbw
|
||||
* @Date: 2024-11-14 10:21:04
|
||||
* @LastEditors: mbw && 1600520629@qq.com
|
||||
* @LastEditTime: 2025-01-15 10:15:25
|
||||
* @LastEditTime: 2025-01-17 10:46:51
|
||||
* @FilePath: \JT-DT-YD4N02A_RTT_MRS-NT26K\bsp\src\bsp_h308.c
|
||||
* @Description:
|
||||
*
|
||||
|
@ -165,7 +165,7 @@ static uint8_t H308_Count(const rt_uint8_t *buffer, uint8_t value, uint8_t size)
|
|||
|
||||
static void H308_HandleAlarm(uint8_t count, uint8_t *flag, uint8_t threshold)
|
||||
{
|
||||
if (count > threshold && *flag == 0)
|
||||
if (count >= threshold && *flag == 0)
|
||||
{
|
||||
H308.detection_flag = kH308Alarm;
|
||||
Send_Laser_Alarm_Event(kAlarmEvent);
|
||||
|
@ -181,7 +181,7 @@ static void H308_HandleAlarm(uint8_t count, uint8_t *flag, uint8_t threshold)
|
|||
|
||||
static void H308_HandleFault(uint8_t count, uint8_t *flag, uint8_t threshold)
|
||||
{
|
||||
if (count > threshold && *flag != 1)
|
||||
if (count >= threshold && *flag != 1)
|
||||
{
|
||||
*flag = 1;
|
||||
H308.detection_flag = kH308Fault;
|
||||
|
@ -213,8 +213,8 @@ static uint8_t H308_CheckData(void)
|
|||
|
||||
alarm_count = H308_Count(alarm_status_buffer, kH308Alarm, H308_SAMPLING_TIMS);
|
||||
fault_count = H308_Count(fault_buf, kH308Fault, H308_SAMPLING_TIMS);
|
||||
H308_HandleAlarm(alarm_count, &alarm_flag, H308_SAMPLING_TIMS / 2);
|
||||
H308_HandleFault(fault_count, &fault_flag, H308_SAMPLING_TIMS / 2);
|
||||
H308_HandleAlarm(alarm_count, &alarm_flag, H308_SAMPLING_TIMS);
|
||||
H308_HandleFault(fault_count, &fault_flag, H308_SAMPLING_TIMS);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -222,15 +222,17 @@ static uint8_t H308_CheckData(void)
|
|||
// TODO: 寿命检测
|
||||
uint8_t IS_H308_EndOfLife(void)
|
||||
{
|
||||
if (RTC_GetCounter() >= H308.expiration_seconds)
|
||||
RTC_GetTime();
|
||||
if (RtcDateTime.year > 2035)//至少大于2035年再检测
|
||||
{
|
||||
H308.end_of_life = 1;
|
||||
if (RTC_GetCounter() >= H308.expiration_seconds)
|
||||
{
|
||||
H308.end_of_life = 1;
|
||||
}
|
||||
}
|
||||
return H308.end_of_life;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UART4_Init(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||
|
|
|
@ -23,27 +23,8 @@ static struct rt_thread user_led_thread;
|
|||
|
||||
static void BSP_Led_thread_entry(void *param)
|
||||
{
|
||||
// static rt_bool_t led_state_flag = RT_FALSE;
|
||||
while (1)
|
||||
{
|
||||
#if 0
|
||||
if (nt26k_conncet_tcp_flag)
|
||||
{
|
||||
if ((SysControl.status == kNormalDetectionEvents) && (led_state_flag != RT_TRUE))
|
||||
{
|
||||
LED_G_INTERNET;
|
||||
led_state_flag = RT_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((SysControl.status == kNormalDetectionEvents) && (led_state_flag != RT_FALSE))
|
||||
{
|
||||
LED_G_NORMAL;
|
||||
led_state_flag = RT_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (SysControl.status == kNormalDetectionEvents)
|
||||
{
|
||||
if ((nt26k_conncet_tcp_flag))
|
||||
|
@ -69,7 +50,7 @@ static void BSP_Led_thread_entry(void *param)
|
|||
}
|
||||
}
|
||||
}
|
||||
rt_thread_mdelay(1000);
|
||||
rt_thread_mdelay(1500);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue