修改亮灯逻辑

This commit is contained in:
OPTOC
2025-08-29 11:09:37 +08:00
parent aa9347e37c
commit 5e9b0a51cb
2 changed files with 15 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ rmt_transmit_config_t tx_config = {
static uint8_t led_strip_pixels[EXAMPLE_LED_NUMBERS * 3];
uint16_t toggle_cycle = 1000;
bool toggle_flag = true;
static uint8_t rgb_color_index = RGB_COLOR_RAD;
rgb_color_t rgb_color_rad = {0,255,0,0,0,1,0};
@@ -113,6 +114,8 @@ void _work_rgb_led(void *arg)
void rgb_update_cyle(uint16_t cyle)
{
toggle_flag = (cyle == 888 ? false : true);
toggle_cycle = cyle;
}
uint8_t breathing_dispose(rgb_color_t* rgb_color,int16_t* vel, uint8_t color_min, uint8_t color_max)
@@ -195,6 +198,7 @@ void rgb_toggle(rgb_color_t* rgb_color)
else
led_strip_set_pixel(0,rgb_color->index,0,0,0);
if(toggle_flag == true)
rgb_color->toggle_flag = !rgb_color->toggle_flag;
}

View File

@@ -57,7 +57,7 @@ void embedded_thread(void* arg)
}
void pc_link_rgb_color(device_t* device)
{
static uint8_t last_connect = 0, last_wifi_mode = 0;
static uint8_t last_connect = 255, last_wifi_mode = 0;
if(device->connect_pc != last_connect || last_wifi_mode != device->init_device.wifi_mode)
{
switch (device->connect_pc)
@@ -65,9 +65,9 @@ void pc_link_rgb_color(device_t* device)
case DISCONNECT:
{
if(device->init_device.wifi_mode == WIFI_NETIF_MODE_AP)
rgb_color_change(0, RGB_COLOR_BLUE);
rgb_color_change(0, RGB_COLOR_GREEN_WHITE);
else
rgb_color_change(0, RGB_COLOR_ORANGE);
rgb_color_change(0, RGB_COLOR_GREEN_PURPLE);
break;
}
@@ -96,8 +96,12 @@ void pc_link_rgb_color(device_t* device)
last_connect = device->connect_pc;
last_wifi_mode = device->init_device.wifi_mode;
}
if(device->connect_pc){
rgb_update_cyle(0);
if(device->connect_pc == DISCONNECT)
{
rgb_update_cyle(50);
}
else if(device->connect_pc){
rgb_update_cyle(888);
}else{
rgb_update_cyle(500);
}