54 lines
1.1 KiB
C
54 lines
1.1 KiB
C
/* Hello World Example
|
|
|
|
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
|
|
|
Unless required by applicable law or agreed to in writing, this
|
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
CONDITIONS OF ANY KIND, either express or implied.
|
|
*/
|
|
|
|
#include "esp_system.h"
|
|
#include "esp_log.h"
|
|
|
|
#include "nvs_flash.h"
|
|
|
|
#include "app_bkp_ram.h"
|
|
#include "app_lvgl.h"
|
|
#include "app_mqtt.h"
|
|
#include "app_wifi.h"
|
|
|
|
#define APP_LOG_TAG "MAIN"
|
|
|
|
RTC_NOINIT_ATTR app_bkp_ram_t g_app_bkp;
|
|
|
|
int app_ui_weather_init(void);
|
|
|
|
void app_main(void) {
|
|
esp_err_t ret = nvs_flash_init();
|
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
|
|
|
ret = nvs_flash_init();
|
|
|
|
ESP_LOGW(APP_LOG_TAG, "NVS content corrupted or outdated, cleared.");
|
|
}
|
|
|
|
ESP_ERROR_CHECK(ret);
|
|
|
|
if(app_wifi_init() != 0) {
|
|
return;
|
|
}
|
|
|
|
if(app_mqtt_init() != 0) {
|
|
return;
|
|
}
|
|
|
|
if(app_lvgl_init() != 0) {
|
|
return;
|
|
}
|
|
|
|
if(app_ui_weather_init() != 0) {
|
|
return;
|
|
}
|
|
}
|