Files
odroid-power-mate/main/app/odroid-power-mate.c
2025-08-29 09:46:24 +09:00

50 lines
1.1 KiB
C

#include <stdio.h>
#include <string.h>
#include <sys/param.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "esp_netif.h"
#include "driver/uart.h"
#include "esp_http_server.h"
#include "indicator.h"
#include "nconfig.h"
#include "system.h"
#include "wifi.h"
#include "lwip/err.h"
#include "lwip/sockets.h"
#include "lwip/sys.h"
static const char *TAG = "odroid-remote";
void app_main(void) {
init_led();
led_set(LED_BLU, BLINK_TRIPLE);
led_off(LED_BLU);
// NVS 초기화
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_ERROR_CHECK(ret);
// 네트워크 초기화
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
ESP_ERROR_CHECK(init_nconfig());
// WiFi 연결
wifi_connect();
sync_time();
start_webserver();
}