Add persistent OLED UI settings and recovery

This commit is contained in:
2026-08-29 20:18:08 +02:00
parent 16c0c02389
commit 276559536b
14 changed files with 538 additions and 38 deletions
+30
View File
@@ -0,0 +1,30 @@
/* SPDX-License-Identifier: GPL-3.0-only */
/* Versioned persistent configuration for the optional local OLED UI. */
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "esp_err.h"
#define LOCAL_UI_CONFIG_VERSION 1U
#define LOCAL_UI_CONFIG_DEFAULT_DIM_SECONDS 300U
#define LOCAL_UI_CONFIG_DEFAULT_OFF_SECONDS 600U
#define LOCAL_UI_CONFIG_MAX_TIMEOUT_SECONDS 86400U
#define LOCAL_UI_CONFIG_NVS_NAMESPACE "local_ui"
#define LOCAL_UI_CONFIG_NVS_BLOB_KEY "config"
typedef struct {
uint32_t version;
/* Zero disables the corresponding inactivity transition. */
uint32_t dim_timeout_seconds;
uint32_t off_timeout_seconds;
} local_ui_config_t;
void local_ui_config_defaults(local_ui_config_t *config);
esp_err_t local_ui_config_validate(const local_ui_config_t *config);
esp_err_t local_ui_config_load(local_ui_config_t *config, bool *used_stored_config);
esp_err_t local_ui_config_save(const local_ui_config_t *config);
esp_err_t local_ui_config_reset_storage(void);