aboutsummaryrefslogtreecommitdiff
path: root/main/main.c
diff options
context:
space:
mode:
authorNick Moore <nicholasvmoore@gmail.com>2026-04-22 07:42:03 -0500
committerNick Moore <nicholasvmoore@gmail.com>2026-04-22 07:42:03 -0500
commit7fc0485f8e5bdcaf069d0cb833c51b010b9e0816 (patch)
treee7030b32025f88d2a62bb137dd3593df8600bf2a /main/main.c
parent8f5ed4b452deddfc285a9e3e5bd5ce2ccce6c74b (diff)
Initialize ESP32 project scaffold, tests, docs, and gitignoreHEADmaster
Diffstat (limited to 'main/main.c')
-rw-r--r--main/main.c44
1 files changed, 44 insertions, 0 deletions
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));
+ }
+}