diff options
| author | Nick Moore <nicholasvmoore@gmail.com> | 2026-04-22 07:42:03 -0500 |
|---|---|---|
| committer | Nick Moore <nicholasvmoore@gmail.com> | 2026-04-22 07:42:03 -0500 |
| commit | 7fc0485f8e5bdcaf069d0cb833c51b010b9e0816 (patch) | |
| tree | e7030b32025f88d2a62bb137dd3593df8600bf2a /main | |
| parent | 8f5ed4b452deddfc285a9e3e5bd5ce2ccce6c74b (diff) | |
Diffstat (limited to 'main')
| -rw-r--r-- | main/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | main/main.c | 44 |
2 files changed, 48 insertions, 0 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt new file mode 100644 index 0000000..e476bb3 --- /dev/null +++ b/main/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register( + SRCS "main.c" + REQUIRES bt nvs_flash sign_logic +) diff --git a/main/main.c b/main/main.c new file mode 100644 index 0000000..e3117a2 --- /dev/null +++ b/main/main.c @@ -0,0 +1,44 @@ +#include <stdbool.h> +#include <stdint.h> + +#include "esp_err.h" +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "nvs_flash.h" +#include "sign_logic.h" + +static const char *TAG = "onair_main"; + +static esp_err_t init_storage(void) { + esp_err_t err = nvs_flash_init(); + if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { + ESP_ERROR_CHECK(nvs_flash_erase()); + err = nvs_flash_init(); + } + return err; +} + +static void init_ble(void) { + // TODO: Add BLE controller + Bluedroid/NimBLE initialization. + // TODO: Register GATT service + characteristics for sign control. + ESP_LOGI(TAG, "BLE initialization placeholder"); +} + +void app_main(void) { + ESP_ERROR_CHECK(init_storage()); + + sign_state_t state = { + .is_on_air = false, + .brightness = SIGN_BRIGHTNESS_DEFAULT, + }; + + ESP_LOGI(TAG, "Boot state: on_air=%d brightness=%u", state.is_on_air, state.brightness); + + init_ble(); + + while (true) { + // TODO: Main runtime tasks and event loop hooks. + vTaskDelay(pdMS_TO_TICKS(1000)); + } +} |
