feat: Flash-HAL-Interface und Settings-Store mit A/B-Slots
Implementiert: - Flash HAL (nl_flash_read/write/erase_sector) Interfaces - Flash Layout mit A/B-Settings Slots und weiteren Regions - Test-Fake für Flash mit Fehlerinjection (Stromausfall-Simulation) - Settings-Store mit CRC32 Recovery und Slot-Alternierung - Vollständige Test-Suite mit Corruption/Power-Loss-Tests
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef NL_SETTINGS_H
|
||||
#define NL_SETTINGS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define NL_SSID_LEN 33
|
||||
#define NL_PASS_LEN 65
|
||||
#define NL_TOKEN_LEN 65
|
||||
#define NL_NAME_LEN 33
|
||||
|
||||
typedef struct {
|
||||
char wifi_ssid[NL_SSID_LEN];
|
||||
char wifi_pass[NL_PASS_LEN];
|
||||
char token[NL_TOKEN_LEN];
|
||||
char name[NL_NAME_LEN];
|
||||
uint8_t auth_all;
|
||||
uint8_t power_on_behaviour; /* nl_pob_t */
|
||||
uint16_t fade_in_ms;
|
||||
uint16_t fade_out_ms;
|
||||
} nl_settings_t;
|
||||
|
||||
void nl_settings_defaults(nl_settings_t *s);
|
||||
void nl_settings_init(uint32_t addr_a, uint32_t addr_b);
|
||||
/* Returns false (and fills defaults) when no valid record exists. */
|
||||
bool nl_settings_load(nl_settings_t *out);
|
||||
int nl_settings_save(const nl_settings_t *s);
|
||||
int nl_settings_erase(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user