From 259b29f4b3e11f4395db269438066e34d95c3a05 Mon Sep 17 00:00:00 2001 From: Ivan Li Date: Wed, 23 Nov 2022 21:42:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E4=BC=A0=E8=BE=93?= =?UTF-8?q?=E5=8D=A1=E9=A1=BF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/light.c | 12 ------------ main/mqtt.c | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/main/light.c b/main/light.c index 9e367f7..d8e0498 100644 --- a/main/light.c +++ b/main/light.c @@ -244,23 +244,11 @@ void light_play_colors(uint16_t len, uint8_t *buffer) { light_mode = light_mode_desktop_sending_colors; printf("COLORS=%.*s\r\n", len, buffer); - ESP_ERROR_CHECK(light_led_strip->clear(light_led_strip, 100)); for (uint16_t led_index = 0, buffer_cursor = 0; led_index < STRIP_LED_NUMBER && buffer_cursor < len; led_index++, buffer_cursor += 3) { uint8_t r = buffer[buffer_cursor], g = buffer[buffer_cursor + 1], b = buffer[buffer_cursor + 2]; - ESP_LOGI(LIGHT_TAG, "RGB: %d %d %d", r, g, b); - ESP_ERROR_CHECK( - light_led_strip->set_pixel(light_led_strip, led_index, r, g, b)); - } - ESP_ERROR_CHECK(light_led_strip->refresh(light_led_strip, 100)); - vTaskDelay(pdMS_TO_TICKS(10)); - for (uint16_t led_index = 0, buffer_cursor = 0; - led_index < STRIP_LED_NUMBER && buffer_cursor < len; - led_index++, buffer_cursor += 3) { - uint8_t r = buffer[buffer_cursor], g = buffer[buffer_cursor + 1], b = 0; - ESP_LOGI(LIGHT_TAG, "RGB: %d %d %d", r, g, b); ESP_ERROR_CHECK( light_led_strip->set_pixel(light_led_strip, led_index, r, g, b)); } diff --git a/main/mqtt.c b/main/mqtt.c index e55a785..e07717c 100644 --- a/main/mqtt.c +++ b/main/mqtt.c @@ -66,7 +66,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, msg_id = esp_mqtt_client_publish(client, MQTT_KEY_BOARD_ONLINE, "ONLINE", 0, 1, 0); ESP_LOGI(MQTT_TAG, "sent publish successful, msg_id=%d", msg_id); - esp_mqtt_client_subscribe(client, MQTT_KEY_DESKTOP_ALL, 0); + esp_mqtt_client_subscribe(client, MQTT_KEY_DESKTOP_ALL, 1); break; case MQTT_EVENT_DISCONNECTED: ESP_LOGI(MQTT_TAG, "MQTT_EVENT_DISCONNECTED");