9#include "freertos/FreeRTOS.h"
10#include "freertos/task.h"
26 LOGI(
"DMX Interface starting...");
34 esp_err_t err = nvs_flash_init();
35 if (err == ESP_ERR_NVS_NO_FREE_PAGES ||
36 err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
37 ESP_ERROR_CHECK(nvs_flash_erase());
38 err = nvs_flash_init();
46 LOGE(
"Failed to initialize button: %s", esp_err_to_name(err));
53 LOGW(
"Button detected as PRESSED on power-up! Waiting 3s for factory "
59 vTaskDelay(pdMS_TO_TICKS(100));
62 if (hold_time_ms % 500 == 0) {
63 LOGI(
"Button still held... (%dms)", hold_time_ms);
66 if (hold_time_ms >= 3000) {
67 LOGW(
"3000ms reached! Factory reset triggered.");
71 LOGI(
"Configuration reset to factory defaults in RAM.");
75 vTaskDelay(pdMS_TO_TICKS(2000));
79 LOGW(
"Factory defaults applied. PLEASE RELEASE BUTTON TO REBOOT.");
82 vTaskDelay(pdMS_TO_TICKS(100));
85 LOGI(
"Button released. Rebooting now...");
90 LOGI(
"Button released after %dms, continuing normal boot.", hold_time_ms);
93 LOGI(
"Button not pressed at startup.");
98 LOGE(
"Failed to start WiFi AP: %s", esp_err_to_name(err));
103 if (server == NULL) {
104 LOGE(
"Failed to start web server!");
108 LOGI(
"Web server started successfully");
109 LOGI(
"Open http://192.168.4.1 in your browser");
113 vTaskDelay(pdMS_TO_TICKS(5000));
121 vTaskDelay(pdMS_TO_TICKS(1000));
Thread-safe configuration component utilizing NVS for ESP32.
esp_err_t config_reset_defaults(void)
Resets all configuration settings back to factory defaults.
uint8_t config_get_led_brightness(void)
Gets the current status LED brightness level.
esp_err_t config_init(void)
Initializes the configuration component.
esp_err_t config_save(void)
Flushes all staged RAM changes permanently to the non-volatile storage.
void app_main(void)
Main entry point for the DMX Interface application.
LED control component with flexible blinking and breathing modes.
void led_set_brightness(uint8_t brightness)
Dynamically updates the LED maximum brightness.
@ LED_MODE_BOOT_BREATHING
void led_set_mode(led_mode_t mode)
Sets the current operational mode of the LED.
esp_err_t led_init(void)
Initializes the LEDC peripheral for the status LED.
Project-wide logging macros based on ESP-IDF's logging library.
#define LOGW(...)
Log a message at Warning level.
#define LOGI(...)
Log a message at Info level.
#define LOGE(...)
Log a message at Error level.
void storage_print_info(void)
Print storage information to the log.
esp_err_t system_init(void)
Initializes the system monitoring component. Sets up the internal temperature sensor and tracks initi...
void system_print_info(void)
Prints a complete, formatted overview of all system statistics to the console. Internally uses ESP_LO...
Simple HTTP web server component for ESP32 with async FreeRTOS support.
httpd_handle_t webserver_start(const webserver_config_t *config)
Initialize and start the HTTP web server.
esp_err_t wifi_start_ap(const char *ssid, const char *password, uint8_t channel, uint8_t max_connections)
Start WiFi Access Point (AP) mode.