44 lines
1.3 KiB
C
44 lines
1.3 KiB
C
#include <stdio.h>
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "esp_log.h"
|
|
#include "spi_bus_manager.h"
|
|
#include "storage_manager.h"
|
|
#include "rfid_manager.h"
|
|
#include "display_manager.h"
|
|
#include "ui_task.h"
|
|
#include "wifi_manager.h"
|
|
#include "scryfall_client.h"
|
|
#include "web_server.h"
|
|
|
|
static const char *TAG = "MAIN";
|
|
|
|
void app_main(void)
|
|
{
|
|
ESP_LOGI(TAG, "MTG RFID Companion booting...");
|
|
|
|
ESP_ERROR_CHECK(spi_bus_manager_init());
|
|
ESP_ERROR_CHECK(storage_manager_init());
|
|
ESP_ERROR_CHECK(display_manager_init());
|
|
|
|
/* RFID is not fatal: the reader may be unpowered, unwired, or a clone
|
|
* that needs a slower SPI clock. Continue booting so the display, SoftAP
|
|
* and web pairing all stay usable; scanning is simply unavailable. */
|
|
esp_err_t ret = rfid_manager_init();
|
|
if (ret != ESP_OK || rfid_manager_start() != ESP_OK) {
|
|
ESP_LOGW(TAG, "RFID unavailable (%s) - continuing without card scanning", esp_err_to_name(ret));
|
|
}
|
|
|
|
ESP_ERROR_CHECK(wifi_manager_init());
|
|
ESP_ERROR_CHECK(wifi_manager_start());
|
|
ESP_ERROR_CHECK(scryfall_client_start());
|
|
ESP_ERROR_CHECK(web_server_start());
|
|
|
|
ESP_ERROR_CHECK(ui_task_start());
|
|
|
|
ESP_LOGI(TAG, "Boot sequence complete.");
|
|
|
|
while (1) {
|
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
}
|
|
} |