fix: 数据传输卡顿。
This commit is contained in:
parent
cd16a29389
commit
259b29f4b3
12
main/light.c
12
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));
|
||||
}
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user