2022-11-12 22:33:03 +08:00
|
|
|
#include "esp_log.h"
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/task.h"
|
2022-11-13 17:05:41 +08:00
|
|
|
#include "light.c"
|
2022-11-21 00:22:37 +08:00
|
|
|
#include "mqtt.c"
|
2022-11-12 22:33:03 +08:00
|
|
|
#include "sdkconfig.h"
|
2022-11-12 22:42:03 +08:00
|
|
|
#include "wifi.c"
|
2022-11-12 22:33:03 +08:00
|
|
|
|
2022-11-12 22:42:03 +08:00
|
|
|
static const char *TAG = "ScreenBgLight";
|
2022-11-12 22:33:03 +08:00
|
|
|
|
|
|
|
void app_main(void) {
|
2022-11-13 17:05:41 +08:00
|
|
|
light_init_strip();
|
|
|
|
vTaskDelay(pdMS_TO_TICKS(10));
|
|
|
|
light_play(light_mode_connection_wifi);
|
|
|
|
if (connect_wifi()) {
|
|
|
|
light_play(light_mode_idle);
|
2022-11-12 22:33:03 +08:00
|
|
|
}
|
2022-11-21 00:22:37 +08:00
|
|
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
|
|
mqtt_app_start();
|
|
|
|
if (waiting_for_mqtt_connected()) {
|
|
|
|
light_play(light_mode_mqtt_connected);
|
|
|
|
}
|
|
|
|
if (waiting_for_desktop_online()) {
|
|
|
|
light_play(light_mode_desktop_online);
|
|
|
|
}
|
2022-11-22 20:08:11 +08:00
|
|
|
while (waiting_and_get_colors()) {
|
|
|
|
light_play_colors(NUMBER_OF_LEDS * 3, mqtt_colors_buffer);
|
2022-11-21 00:22:37 +08:00
|
|
|
}
|
2022-11-12 22:33:03 +08:00
|
|
|
}
|