1、低电 3.7V 只闪红灯不再 1 分钟后关机;电量低于约 5% 自动关机,未充电开机先闪 5 下红灯再睡回,只能充电后才能开机
2、自动/手动互相切换都闪 2 下灯;APP 发停止后再发自动模式可正常启动,手动残留停止不再挡住自动 3、自动模式 1~6 单次最长跑 10 分钟后回待机;关机时长按 12 秒进 OTA,OTA 期间红绿交替闪
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* @date 2026.08.25
|
||||
* @version V1.0.0
|
||||
* @history
|
||||
* - V1.0.0, 2026.08.25, cyWu, 从天誉 MJ-1.0 充电板移植到杰理 BR28
|
||||
* - V1.0.0, 2026.08.25, cyWu, 首次发布,实现红绿独立通道灯事件表
|
||||
******************************************************************************/
|
||||
|
||||
#include "led_manager.h"
|
||||
@@ -19,6 +19,7 @@ static uint8_t led_pairing_handler(LED_Config_t *led_config);
|
||||
static uint8_t led_mode_handler(LED_Config_t *led_config);
|
||||
static uint8_t led_pair_ok_handler(LED_Config_t *led_config);
|
||||
static uint8_t led_pair_fail_handler(LED_Config_t *led_config);
|
||||
static uint8_t led_ota_handler(LED_Config_t *led_config);
|
||||
|
||||
/**
|
||||
* @brief 只改掩码里的通道,其它灯保持原样
|
||||
@@ -44,7 +45,7 @@ static void set_led_multi(uint16_t led, uint8_t state)
|
||||
static uint8_t led_keep_handler(LED_Config_t *led_config)
|
||||
{
|
||||
(void)LED_Update(led_config);
|
||||
return 0;
|
||||
return 0; /* 返回 0:不独占,其它通道的事件还能继续跑 */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +56,7 @@ static uint8_t led_keep_handler(LED_Config_t *led_config)
|
||||
static uint8_t led_standby_handler(LED_Config_t *led_config)
|
||||
{
|
||||
if (LED_Update(led_config) == 0) {
|
||||
LED_EventDelete(LED_EVENT_STANDBY);
|
||||
LED_EventDelete(LED_EVENT_STANDBY); /* runNum 到点(限时待机绿)后删事件 */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -79,7 +80,7 @@ static uint8_t led_pairing_handler(LED_Config_t *led_config)
|
||||
static uint8_t led_mode_handler(LED_Config_t *led_config)
|
||||
{
|
||||
if (LED_Update(led_config) == 0) {
|
||||
LED_EventDelete(LED_EVENT_MODE);
|
||||
LED_EventDelete(LED_EVENT_MODE); /* 闪完两下后删,绿灯还给待机/配对 */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -112,6 +113,17 @@ static uint8_t led_pair_fail_handler(LED_Config_t *led_config)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief OTA 红绿交替(无限):拦住其它灯,升级期间只剩这一种提示
|
||||
* @param led_config 配置
|
||||
* @return 1=拦住更低优先级
|
||||
*/
|
||||
static uint8_t led_ota_handler(LED_Config_t *led_config)
|
||||
{
|
||||
(void)LED_Update(led_config);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 注册回调并装载 CBC2 事件表(GPIO 已在 bsp_hw_init)
|
||||
* @return 无
|
||||
@@ -208,6 +220,18 @@ void user_led_init(void)
|
||||
/ (BOARD_LED_ALT_MS * 2u)),
|
||||
.ledEventHandler = led_pair_fail_handler,
|
||||
},
|
||||
[LED_EVENT_OTA] = {
|
||||
/* OTA:红绿交替一直闪,直到升级结束或 60s 复位 */
|
||||
.event = LED_EVENT_OTA,
|
||||
.priority = PRIORITY_4,
|
||||
.config.ledMask = (uint16_t)(LED_CHANNEL(LED_CH_RED) | LED_CHANNEL(LED_CH_GREEN)),
|
||||
.config.state = LED_ALTERNATING_BLINK,
|
||||
.config.alternatingBlinkParams.Group[0] = LED_CHANNEL(LED_CH_RED),
|
||||
.config.alternatingBlinkParams.Group[1] = LED_CHANNEL(LED_CH_GREEN),
|
||||
.config.alternatingBlinkParams.Cycle = (uint32_t)(BOARD_LED_ALT_MS * 2u),
|
||||
.config.runNum = 0, /* 0=无限 */
|
||||
.ledEventHandler = led_ota_handler,
|
||||
},
|
||||
};
|
||||
|
||||
LED_SetStateInit(set_led_multi);
|
||||
|
||||
Reference in New Issue
Block a user