2023-03-06 20:57:25 +08:00
|
|
|
#include "apds_9960.c"
|
2023-02-24 21:29:15 +08:00
|
|
|
#include "ci_03t.c"
|
2023-02-26 23:43:17 +08:00
|
|
|
#include "embedded_display.c"
|
2022-11-12 22:33:03 +08:00
|
|
|
#include "esp_log.h"
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/task.h"
|
2023-04-02 19:29:12 +08:00
|
|
|
#include "hw-ms03.c"
|
2023-02-26 23:43:17 +08:00
|
|
|
#include "i2c.c"
|
2022-11-13 17:05:41 +08:00
|
|
|
#include "light.c"
|
2022-11-21 00:22:37 +08:00
|
|
|
#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"
|
2023-02-26 23:43:17 +08:00
|
|
|
#include "temperature.c"
|
2023-02-18 15:19:26 +08:00
|
|
|
#include "ui_input.c"
|
2022-11-12 22:42:03 +08:00
|
|
|
#include "wifi.c"
|
2022-11-12 22:33:03 +08:00
|
|
|
|
2022-11-23 21:46:36 +08:00
|
|
|
static const char *TAG = "DisplayAmbientLight";
|
2022-11-12 22:33:03 +08:00
|
|
|
|
|
|
|
void app_main(void) {
|
2023-02-25 23:13:56 +08:00
|
|
|
light_init_strip();
|
2023-03-08 14:19:35 +08:00
|
|
|
|
|
|
|
gpio_install_isr_service(0);
|
2023-02-04 21:47:58 +08:00
|
|
|
init_i2c();
|
2023-03-04 16:24:35 +08:00
|
|
|
i2c_check_slaves();
|
2023-03-08 14:19:35 +08:00
|
|
|
|
2023-02-04 21:47:58 +08:00
|
|
|
init_display();
|
|
|
|
display_print8_str(0, 0, "Ambient Light");
|
2023-04-02 19:29:12 +08:00
|
|
|
// hw_ms03_init();
|
2023-03-08 14:19:35 +08:00
|
|
|
// ci_03t_init();
|
|
|
|
apds_9960_init();
|
|
|
|
apds_9960_auto_fetch();
|
2023-04-02 19:29:12 +08:00
|
|
|
auto_fetch_temperature();
|
|
|
|
pca9555_init();
|
|
|
|
ui_input_init();
|
|
|
|
xTaskCreate(mqtt_publish_ui_input, "mqtt_publish_ui_input", 2048, NULL, 10,
|
|
|
|
NULL);
|
|
|
|
vTaskDelay(pdMS_TO_TICKS(10));
|
2022-11-13 17:05:41 +08:00
|
|
|
light_play(light_mode_connection_wifi);
|
2023-04-02 19:29:12 +08:00
|
|
|
if (connect_wifi()) {
|
|
|
|
light_play(light_mode_idle);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
while (waiting_and_get_colors()) {
|
|
|
|
light_play_colors(NUMBER_OF_LEDS * 3, mqtt_colors_buffer);
|
|
|
|
}
|
2022-11-12 22:33:03 +08:00
|
|
|
}
|