修改了因报警关闭LED灯的情况

This commit is contained in:
小马_666 2025-01-17 21:31:52 +08:00
parent 71cbb44efd
commit bf398932c6
1 changed files with 11 additions and 39 deletions

View File

@ -4,12 +4,11 @@
#include "bsp_nt26k.h" #include "bsp_nt26k.h"
#include "user_sys.h" #include "user_sys.h"
#define LOG_TAG "bsp.led" #define LOG_TAG "bsp.led"
#define LOG_LVL LOG_LVL_DBG #define LOG_LVL LOG_LVL_DBG
#include <ulog.h> #include <ulog.h>
//用到了atoi // 用到了atoi
#include <stdlib.h> #include <stdlib.h>
agile_led_t *led_r = RT_NULL; agile_led_t *led_r = RT_NULL;
@ -20,49 +19,22 @@ 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;
static void BSP_Led_thread_entry(void *param) static void BSP_Led_thread_entry(void *param)
{ {
while (1) while (1)
{ {
if (SysControl.status == kNormalDetectionEvents) if (SysControl.status == kNormalDetectionEvents)
{ {
if ((nt26k_conncet_tcp_flag == 1) && nt26k_connect_sever_flag == 1) if (nt26k_connect_sever_flag)
{
LED_G_NORMAL;
}
else
{
LED_STOP(r);
LED_STOP(g);
LED_STOP(y);
rt_pin_write(LED_G_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED_G_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
}
else if (SysControl.status == KMuteEvent)
{
if (SysControl.last_status == kNormalDetectionEvents)
{ {
if ((nt26k_conncet_tcp_flag == 1) && nt26k_connect_sever_flag == 1) LED_G_NORMAL;
{ }
LED_G_NORMAL; else
} {
else LED_G_INTERNET;
{
LED_STOP(r);
LED_STOP(g);
LED_STOP(y);
rt_pin_write(LED_G_PIN, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(LED_G_PIN, PIN_LOW);
rt_thread_mdelay(500);
}
} }
} }
rt_thread_mdelay(1); rt_thread_mdelay(1000);
} }
} }
int BSP_LED_Init(void) int BSP_LED_Init(void)
@ -71,7 +43,7 @@ int BSP_LED_Init(void)
led_g = agile_led_create(LED_G_PIN, PIN_HIGH, "100,0", 0); led_g = agile_led_create(LED_G_PIN, PIN_HIGH, "100,0", 0);
led_y = agile_led_create(LED_Y_PIN, PIN_HIGH, "100,0", 0); led_y = agile_led_create(LED_Y_PIN, PIN_HIGH, "100,0", 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,