board/main/main.c

49 lines
1.2 KiB
C
Raw Normal View History

#include "ambient_light.c"
2023-02-24 21:29:15 +08:00
#include "ci_03t.c"
#include "embedded_display.c"
2022-11-12 22:33:03 +08:00
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "i2c.c"
2022-11-13 17:05:41 +08:00
#include "light.c"
#include "mqtt.c"
2023-03-04 16:24:35 +08:00
#include "pca9555.c"
2022-11-12 22:33:03 +08:00
#include "sdkconfig.h"
#include "temperature.c"
#include "ui_input.c"
2022-11-12 22:42:03 +08:00
#include "wifi.c"
2022-11-12 22:33:03 +08:00
static const char *TAG = "DisplayAmbientLight";
2022-11-12 22:33:03 +08:00
void app_main(void) {
light_init_strip();
init_i2c();
2023-03-04 16:24:35 +08:00
i2c_check_slaves();
init_display();
display_print8_str(0, 0, "Ambient Light");
2023-02-24 21:29:15 +08:00
ci_03t_init();
ambient_light_init();
ambient_light_auto_fetch();
auto_fetch_temperature();
2023-03-04 16:24:35 +08:00
pca9555_init();
ui_input_init();
2023-02-24 21:29:15 +08:00
xTaskCreate(mqtt_publish_ui_input, "mqtt_publish_ui_input", 2048, NULL, 10,
NULL);
2022-11-13 17:05:41 +08:00
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
}
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-12 22:33:03 +08:00
}