blob: e3117a2e088e2f6d971b8fb5aa7132b646356565 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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));
}
}
|