报警关阀
This commit is contained in:
parent
1a2a8c7660
commit
1ef1ac80e7
|
@ -345,7 +345,10 @@ int main(void)
|
||||||
Flash_Write_Record(kRecordAlarm); // 写入flash报警信息
|
Flash_Write_Record(kRecordAlarm); // 写入flash报警信息
|
||||||
if (Flash_Get_Valve_Num())
|
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)
|
if (rt_sem_take(&bt_ctr_sem, 10000) == RT_EOK)
|
||||||
{
|
{
|
||||||
LOG_D("电磁阀动作完成");
|
LOG_D("电磁阀动作完成");
|
||||||
|
|
|
@ -56,7 +56,7 @@ static void _CommonBtnEvtCb(void *arg)
|
||||||
{
|
{
|
||||||
Send_Laser_Alarm_Event(kSelfCheckEvent);
|
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("本地清除阀门信息");
|
LOG_I("本地清除阀门信息");
|
||||||
rt_uint8_t mac_addr[6] = {0};
|
rt_uint8_t mac_addr[6] = {0};
|
||||||
|
@ -85,7 +85,7 @@ static void _CommonBtnEvtCb(void *arg)
|
||||||
LOG_I("本地清除阀门信息成功");
|
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))
|
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++;
|
button_cnt++;
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
* @LastEditTime: 2025-01-05 13:12:43
|
* @LastEditTime: 2025-01-05 13:12:43
|
||||||
* @FilePath: \ble_bjq_ch303rct6_ml307\bsp\src\bsp_led.c
|
* @FilePath: \ble_bjq_ch303rct6_ml307\bsp\src\bsp_led.c
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
* Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
* Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
#include "bsp_led.h"
|
#include "bsp_led.h"
|
||||||
#include "rtthread.h"
|
#include "rtthread.h"
|
||||||
|
@ -22,7 +22,7 @@ ALIGN(4)
|
||||||
static char user_led_thread_stack[512];
|
static char user_led_thread_stack[512];
|
||||||
static struct rt_thread user_led_thread;
|
static struct rt_thread user_led_thread;
|
||||||
|
|
||||||
//用到了atoi
|
// 用到了atoi
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
agile_led_t *led_r = RT_NULL;
|
agile_led_t *led_r = RT_NULL;
|
||||||
|
@ -52,29 +52,42 @@ static void BSP_Led_thread_entry(void *param)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((SysControl.status == kNormalDetectionEvents)||(SysControl.status == KMuteEvent))
|
if (SysControl.status == kNormalDetectionEvents)
|
||||||
{
|
{
|
||||||
if ((ml307_conncet_tcp_flag))
|
if ((ml307_conncet_tcp_flag))
|
||||||
{
|
{
|
||||||
LED_G_NORMAL;
|
LED_G_NORMAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LED_G_INTERNET;
|
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);
|
rt_thread_mdelay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BSP_LED_Init(void)
|
int BSP_LED_Init(void)
|
||||||
{
|
{
|
||||||
led_r = agile_led_create(LED_R_PIN, PIN_LOW, "100,100", 0);
|
led_r = agile_led_create(LED_R_PIN, PIN_LOW, "100,100", 0);
|
||||||
led_g = agile_led_create(LED_G_PIN, PIN_LOW, "100,100", 0);
|
led_g = agile_led_create(LED_G_PIN, PIN_LOW, "100,100", 0);
|
||||||
led_y = agile_led_create(LED_Y_PIN, PIN_LOW, "100,100", 0);
|
led_y = agile_led_create(LED_Y_PIN, PIN_LOW, "100,100", 0);
|
||||||
|
|
||||||
rt_err_t ret = rt_thread_init(&user_led_thread,
|
rt_err_t ret = rt_thread_init(&user_led_thread,
|
||||||
"user_led_thread",
|
"user_led_thread",
|
||||||
BSP_Led_thread_entry,
|
BSP_Led_thread_entry,
|
||||||
RT_NULL,
|
RT_NULL,
|
||||||
|
@ -98,7 +111,7 @@ static void TEST_LED(int argc, char **argv)
|
||||||
if (argc == 4)
|
if (argc == 4)
|
||||||
{
|
{
|
||||||
char led_name = argv[1][0];
|
char led_name = argv[1][0];
|
||||||
int loop_cnt = atoi(argv[3]);
|
int loop_cnt = atoi(argv[3]);
|
||||||
switch (led_name)
|
switch (led_name)
|
||||||
{
|
{
|
||||||
case 'r':
|
case 'r':
|
||||||
|
|
Loading…
Reference in New Issue