chore: 更改 MQTT 指示灯效。
This commit is contained in:
parent
596144d2c7
commit
dc568e9a21
38
main/light.c
38
main/light.c
@ -88,32 +88,38 @@ void led_strip_hsv2rgb(uint32_t h, uint32_t s, uint32_t v, uint32_t *r,
|
|||||||
void update_desktop_connection_state() {
|
void update_desktop_connection_state() {
|
||||||
static uint8_t tick = 0;
|
static uint8_t tick = 0;
|
||||||
|
|
||||||
uint8_t mask = tick / 10 % 2 ? 0xff : 0x00;
|
bool beat = tick / 10 % 2 ? 1 : 0;
|
||||||
|
|
||||||
switch (light_mode) {
|
switch (light_mode) {
|
||||||
case light_mode_desktop_online:
|
case light_mode_desktop_online:
|
||||||
ESP_ERROR_CHECK(light_led_strip->set_pixel(light_led_strip, 0, mask & 150,
|
if (beat) {
|
||||||
mask & 50, mask & 0));
|
ESP_ERROR_CHECK(
|
||||||
|
light_led_strip->set_pixel(light_led_strip, 0, 77, 77, 77));
|
||||||
|
}
|
||||||
ESP_ERROR_CHECK(
|
ESP_ERROR_CHECK(
|
||||||
light_led_strip->set_pixel(light_led_strip, 1, 30, 100, 0));
|
light_led_strip->set_pixel(light_led_strip, 1, 77, 77, 77));
|
||||||
ESP_ERROR_CHECK(
|
ESP_ERROR_CHECK(
|
||||||
light_led_strip->set_pixel(light_led_strip, 2, 30, 100, 0));
|
light_led_strip->set_pixel(light_led_strip, 2, 77, 77, 77));
|
||||||
break;
|
break;
|
||||||
case light_mode_mqtt_connected:
|
case light_mode_mqtt_connected:
|
||||||
ESP_ERROR_CHECK(light_led_strip->set_pixel(light_led_strip, 0, mask & 100,
|
if (beat) {
|
||||||
mask & 30, mask & 0));
|
ESP_ERROR_CHECK(
|
||||||
ESP_ERROR_CHECK(light_led_strip->set_pixel(light_led_strip, 1, mask & 100,
|
light_led_strip->set_pixel(light_led_strip, 0, 77, 77, 77));
|
||||||
mask & 30, mask & 0));
|
ESP_ERROR_CHECK(
|
||||||
|
light_led_strip->set_pixel(light_led_strip, 1, 77, 77, 77));
|
||||||
|
}
|
||||||
ESP_ERROR_CHECK(
|
ESP_ERROR_CHECK(
|
||||||
light_led_strip->set_pixel(light_led_strip, 2, 50, 150, 0));
|
light_led_strip->set_pixel(light_led_strip, 2, 77, 77, 77));
|
||||||
break;
|
break;
|
||||||
case light_mode_idle:
|
case light_mode_idle:
|
||||||
ESP_ERROR_CHECK(light_led_strip->set_pixel(light_led_strip, 0, mask & 100,
|
if (beat) {
|
||||||
mask & 30, mask & 0));
|
ESP_ERROR_CHECK(
|
||||||
ESP_ERROR_CHECK(light_led_strip->set_pixel(light_led_strip, 1, mask & 100,
|
light_led_strip->set_pixel(light_led_strip, 0, 77, 77, 77));
|
||||||
mask & 30, mask & 0));
|
ESP_ERROR_CHECK(
|
||||||
ESP_ERROR_CHECK(light_led_strip->set_pixel(light_led_strip, 2, mask & 100,
|
light_led_strip->set_pixel(light_led_strip, 1, 77, 77, 77));
|
||||||
mask & 30, mask & 0));
|
ESP_ERROR_CHECK(
|
||||||
|
light_led_strip->set_pixel(light_led_strip, 2, 77, 77, 77));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user