src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/nvs_config.h
diff options
context:
space:
mode:
Diffstat (limited to 'main/nvs_config.h')
-rw-r--r--main/nvs_config.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/main/nvs_config.h b/main/nvs_config.h
new file mode 100644
index 0000000..7688d81
--- /dev/null
+++ b/main/nvs_config.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "esp_err.h"
+
+// Read the persisted config into viewport_state. Safe to call on a fresh
+// device: missing keys keep their first-boot defaults from viewport_state_init.
+// Sets state = ASLEEP and configured = true if a viewport name + scrypted URL
+// are both present.
+esp_err_t nvs_config_load(void);
+
+// Persist the current viewport_state to NVS atomically. The caller is expected
+// to have already mutated viewport_state under viewport_state_lock().
+esp_err_t nvs_config_save(void);
+
+// Clear all persisted config. Caller is responsible for rebooting.
+esp_err_t nvs_config_reset(void);