mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: give every NVS user its own Preferences handle
loop() and the async web server task shared one global Preferences. A begin() from one task failed while the other had a namespace open, and the clear() or remove() after it then hit the other task's namespace: saving the radio settings while a command committed its rolling code could erase every rolling code. Each function now opens NVS with a local Preferences. NVS serializes access internally and the destructor closes the handle, so no lock is added (see docs/adr/0001). No new tests: nothing here builds natively, and deleting the global makes any missed use a compile error. The read-then-commit races on rolling codes across tasks remain and are tracked in docs/KNOWN_ISSUES.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4135f21ee7
commit
c1b47f898c
6 changed files with 94 additions and 27 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef SOMFY_H
|
||||
#define SOMFY_H
|
||||
#include <Preferences.h>
|
||||
#include "ConfigSettings.h"
|
||||
#include "WResp.h"
|
||||
|
||||
|
|
@ -421,7 +422,8 @@ struct transceiver_config_t {
|
|||
void save();
|
||||
void load();
|
||||
void apply();
|
||||
void removeNVSKey(const char *key);
|
||||
// Removes a key no longer used from the open CC1101 namespace.
|
||||
void removeNVSKey(Preferences &pref, const char *key);
|
||||
};
|
||||
class Transceiver {
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue