报警关阀

This commit is contained in:
小马_666 2025-01-06 13:53:50 +08:00
parent 1a2a8c7660
commit 1ef1ac80e7
3 changed files with 28 additions and 12 deletions

View File

@ -345,7 +345,10 @@ int main(void)
Flash_Write_Record(kRecordAlarm); // 写入flash报警信息
if (Flash_Get_Valve_Num())
{
Bt_Valve_Handler(kValveCmdCtr, 0, RT_NULL);
// Bt_Valve_Handler(kValveCmdCtr, 0, RT_NULL);
rt_uint8_t mac_addr[6];
Flash_Get_Mac_Addr(mac_addr, 1);
Bt_Valve_Handler(kValveCmdCtr, 1, mac_addr);
if (rt_sem_take(&bt_ctr_sem, 10000) == RT_EOK)
{
LOG_D("电磁阀动作完成");

View File

@ -56,7 +56,7 @@ static void _CommonBtnEvtCb(void *arg)
{
Send_Laser_Alarm_Event(kSelfCheckEvent);
}
if ((flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_LONG_HOLD) || (flex_button_event_read(&user_button[USER_BUTTON_1]) == FLEX_BTN_PRESS_LONG_HOLD))
else if ((flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_LONG_HOLD) || (flex_button_event_read(&user_button[USER_BUTTON_1]) == FLEX_BTN_PRESS_LONG_HOLD))
{
LOG_I("本地清除阀门信息");
rt_uint8_t mac_addr[6] = {0};
@ -85,7 +85,7 @@ static void _CommonBtnEvtCb(void *arg)
LOG_I("本地清除阀门信息成功");
}
}
#if 1 // 测试LED灯状态用测试完成后关闭
#if 0 // 测试LED灯状态用测试完成后关闭
if ((flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_DOUBLE_CLICK) || (flex_button_event_read(&user_button[USER_BUTTON_1]) == FLEX_BTN_PRESS_DOUBLE_CLICK))
{
button_cnt++;

View File

@ -22,7 +22,7 @@ ALIGN(4)
static char user_led_thread_stack[512];
static struct rt_thread user_led_thread;
//用到了atoi
// 用到了atoi
#include <stdlib.h>
agile_led_t *led_r = RT_NULL;
@ -52,7 +52,7 @@ static void BSP_Led_thread_entry(void *param)
}
}
#endif
if ((SysControl.status == kNormalDetectionEvents)||(SysControl.status == KMuteEvent))
if (SysControl.status == kNormalDetectionEvents)
{
if ((ml307_conncet_tcp_flag))
{
@ -63,11 +63,24 @@ static void BSP_Led_thread_entry(void *param)
LED_G_INTERNET;
}
}
else if (SysControl.status == KMuteEvent)
{
if (SysControl.last_status == kNormalDetectionEvents)
{
if ((ml307_conncet_tcp_flag))
{
LED_G_NORMAL;
}
else
{
LED_G_INTERNET;
}
}
}
rt_thread_mdelay(1000);
}
}
int BSP_LED_Init(void)
{
led_r = agile_led_create(LED_R_PIN, PIN_LOW, "100,100", 0);