#include #include #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_log.h" #include "lcd_st7701.h" #include "gui_guider.h" #include "beep.h" #include "sht30.h" lv_ui guider_ui; void app_main() { // 初始化NVS esp_err_t err = nvs_flash_init(); //nvs初始化 if (err == ESP_ERR_NVS_NO_FREE_PAGES) { ESP_ERROR_CHECK(nvs_flash_erase()); //擦除nvs nvs_flash_init(); //重新初始化 } modbus_master_init(); // 初始化 modbus master ESP_ERROR_CHECK(esp_netif_init()); //read_system_setting(&system_setting); // 读取nvs中存储的系统设置 // 空调逻辑控制器初始化 //ac_controller_init(&system_setting); // iotx_event_regist_cb(&iot_event_monitor); // 注册网关事件 beep_init(); // 蜂鸣器初始化 ESP_ERROR_CHECK(lcd_st7701_init()); // 如果上次为熄屏状态 // uint8_t *s_on_off = nvs_get_uint8(NVS_SCREEN_ON_OFF); // if (s_on_off != NULL) { // if (*s_on_off == 1) { // ESP_ERROR_CHECK(lcd_st7701_backlight_off()); // 关闭背光 // } else { ESP_ERROR_CHECK(lcd_st7701_backlight_on()); // } // } else { // ESP_ERROR_CHECK(lcd_st7701_backlight_on()); // } setup_ui(&guider_ui); // 初始化UI //app_wifi_init(on_wifi_connected); sht30_init(); // 初始化温湿度传感器 // 初始化OTA功能 //ota_init(); // 熄屏定时器初始化 //screen_off_timer_init(&system_setting); for (;;) { vTaskDelay(10 / portTICK_PERIOD_MS); } }