Scope preference saves to changed settings
This commit is contained in:
1 parent
63e7b2ce8e
commit
df2dd41512
11 files changed
+1491
-1390
No files matched your search
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Keep runtime preference writes scoped to the file that owns the changed
|
||||
// value. Observer builds have two independently durable images:
|
||||
//
|
||||
// Common -> /com_prefs (radio, identity-facing settings, admin password)
|
||||
// Observer -> /mqtt_prefs (WiFi, MQTT, timezone, SNMP, alerts)
|
||||
//
|
||||
// Cross-file migration and the mixed-owner bridge.source setter need Both.
|
||||
// Rewriting both images for every other CLI setter adds a second verified
|
||||
// write/rename transaction and can exceed config.meshcore.io's five-second
|
||||
// serial command deadline.
|
||||
namespace PrefsSaveRouting {
|
||||
|
||||
enum class Scope : uint8_t {
|
||||
Common = 0,
|
||||
Observer,
|
||||
Both,
|
||||
};
|
||||
|
||||
struct Plan {
|
||||
bool common;
|
||||
bool observer;
|
||||
};
|
||||
|
||||
constexpr Plan planFor(Scope scope) {
|
||||
return scope == Scope::Common ? Plan{true, false}
|
||||
: scope == Scope::Observer ? Plan{false, true}
|
||||
: Plan{true, true};
|
||||
}
|
||||
|
||||
} // namespace PrefsSaveRouting
|
||||
Reference in new issue
Block a user