修改亮灯逻辑
This commit is contained in:
@@ -8,6 +8,7 @@ rmt_transmit_config_t tx_config = {
|
|||||||
|
|
||||||
static uint8_t led_strip_pixels[EXAMPLE_LED_NUMBERS * 3];
|
static uint8_t led_strip_pixels[EXAMPLE_LED_NUMBERS * 3];
|
||||||
uint16_t toggle_cycle = 1000;
|
uint16_t toggle_cycle = 1000;
|
||||||
|
bool toggle_flag = true;
|
||||||
static uint8_t rgb_color_index = RGB_COLOR_RAD;
|
static uint8_t rgb_color_index = RGB_COLOR_RAD;
|
||||||
|
|
||||||
rgb_color_t rgb_color_rad = {0,255,0,0,0,1,0};
|
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)
|
void rgb_update_cyle(uint16_t cyle)
|
||||||
{
|
{
|
||||||
|
toggle_flag = (cyle == 888 ? false : true);
|
||||||
|
|
||||||
toggle_cycle = cyle;
|
toggle_cycle = cyle;
|
||||||
}
|
}
|
||||||
uint8_t breathing_dispose(rgb_color_t* rgb_color,int16_t* vel, uint8_t color_min, uint8_t color_max)
|
uint8_t breathing_dispose(rgb_color_t* rgb_color,int16_t* vel, uint8_t color_min, uint8_t color_max)
|
||||||
@@ -194,8 +197,9 @@ void rgb_toggle(rgb_color_t* rgb_color)
|
|||||||
led_strip_set_pixel(0,rgb_color->index,rgb_color->green,rgb_color->blue,rgb_color->red);
|
led_strip_set_pixel(0,rgb_color->index,rgb_color->green,rgb_color->blue,rgb_color->red);
|
||||||
else
|
else
|
||||||
led_strip_set_pixel(0,rgb_color->index,0,0,0);
|
led_strip_set_pixel(0,rgb_color->index,0,0,0);
|
||||||
|
|
||||||
rgb_color->toggle_flag = !rgb_color->toggle_flag;
|
if(toggle_flag == true)
|
||||||
|
rgb_color->toggle_flag = !rgb_color->toggle_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_color_change(uint8_t index, uint8_t color)
|
void rgb_color_change(uint8_t index, uint8_t color)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void embedded_thread(void* arg)
|
|||||||
}
|
}
|
||||||
void pc_link_rgb_color(device_t* device)
|
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)
|
if(device->connect_pc != last_connect || last_wifi_mode != device->init_device.wifi_mode)
|
||||||
{
|
{
|
||||||
switch (device->connect_pc)
|
switch (device->connect_pc)
|
||||||
@@ -65,9 +65,9 @@ void pc_link_rgb_color(device_t* device)
|
|||||||
case DISCONNECT:
|
case DISCONNECT:
|
||||||
{
|
{
|
||||||
if(device->init_device.wifi_mode == WIFI_NETIF_MODE_AP)
|
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
|
else
|
||||||
rgb_color_change(0, RGB_COLOR_ORANGE);
|
rgb_color_change(0, RGB_COLOR_GREEN_PURPLE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -96,8 +96,12 @@ void pc_link_rgb_color(device_t* device)
|
|||||||
last_connect = device->connect_pc;
|
last_connect = device->connect_pc;
|
||||||
last_wifi_mode = device->init_device.wifi_mode;
|
last_wifi_mode = device->init_device.wifi_mode;
|
||||||
}
|
}
|
||||||
if(device->connect_pc){
|
if(device->connect_pc == DISCONNECT)
|
||||||
rgb_update_cyle(0);
|
{
|
||||||
|
rgb_update_cyle(50);
|
||||||
|
}
|
||||||
|
else if(device->connect_pc){
|
||||||
|
rgb_update_cyle(888);
|
||||||
}else{
|
}else{
|
||||||
rgb_update_cyle(500);
|
rgb_update_cyle(500);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user