This commit is contained in:
helloyifa 2025-06-13 18:13:25 +08:00
commit 0f0c273d07
3 changed files with 37 additions and 6 deletions

View File

@ -719,6 +719,18 @@ static int32_t wifi_boarding_gatts_cb(bk_gatts_cb_event_t event, bk_gatt_if_t ga
wifi_boarding_notify(str_respone, strlen((char *)&str_respone));
}
}
else if (NULL != (ptr = strstr((char *)recv, "AT+SOU_DEVICE")))
{
wboard_loge("AT+SOU_DEVICE!!");
ws2812_led_start_ota();
rtos_delay_milliseconds(10000);
ws2812_stop_led_start_ota();
}
/**
* OTA

View File

@ -67,11 +67,19 @@ static uint8_t led_data[WS2812_LED_NUM *24*sizeof(uint8_t)];
static int ws2812_start = 0;
//static beken_timer_t timer_led_ota_handle;
static int ota_led_state = 0;
static beken_thread_t ota_led_thread_hdl = NULL;
static void ws2812_led_ota_task(void *arg){
while(ws2812_start){
@ -84,9 +92,15 @@ static void ws2812_led_ota_task(void *arg){
}
rtos_delay_milliseconds(100);
}
if(ota_led_thread_hdl) {
rtos_delete_thread(&ota_led_thread_hdl);
ota_led_thread_hdl = NULL;
}
}
void ws2812_led_start_ota(){
ws2812_start = 1;
bk_err_t ret = BK_OK;
ret = rtos_create_thread(&ota_led_thread_hdl,
4,
@ -169,15 +183,15 @@ static void spi_led_task(void *arg)
//唤醒词 灯效果
case TYPE_WAKEUP:
ws2812_set_all_led(current_color,0);
ws2812_set_all_led(current_color,current_brightness);
ws2812_set_all_led(current_color,1);
rtos_delay_milliseconds(100);
ws2812_set_all_led(current_color,0);
rtos_delay_milliseconds(100);
ws2812_set_all_led(current_color,current_brightness);
ws2812_set_all_led(current_color,1);
rtos_delay_milliseconds(100);
ws2812_set_all_led(current_color,0);
rtos_delay_milliseconds(100);
ws2812_set_all_led(current_color,current_brightness);
ws2812_set_all_led(current_color,1);
break;
case TYPE_OFF:
ws2812_set_all_led(current_color,0);
@ -319,9 +333,9 @@ void ws2812_led_asr_wakeup(){
if (spi_led_msg_que != NULL)
{
//ws2812_msg_t msg;
//msg.type = TYPE_WAKEUP;
//rtos_push_to_queue(&spi_led_msg_que, &msg, BEKEN_NO_WAIT);
ws2812_msg_t msg;
msg.type = TYPE_WAKEUP;
rtos_push_to_queue(&spi_led_msg_que, &msg, BEKEN_NO_WAIT);
}
}
@ -371,3 +385,7 @@ void ws2812_led_clear_all(){
ws2812_set_all_led(0x000000,0);
}
void ws2812_stop_led_start_ota(){
ws2812_start = 0;
}

View File

@ -37,6 +37,7 @@ void ws2812_set_all_led_brightness(int brightness);
void ws2812_led_asr_wakeup();
void ws2812_led_change_color();
void ws2812_led_start_ota();
void ws2812_stop_led_start_ota();
#ifdef __cplusplus
}
#endif