Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/DeductionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ bool DeductionManager::begin() {
// Static allocation — honors the no-new-heap rule.
mutex_ = xSemaphoreCreateMutexStatic(&mutexBuffer_);
}
if (mutex_ != nullptr) {
// Create the namespace so read-only opens don't log NOT_FOUND (#358).
Preferences prefs;
if (prefs.begin("deductions", false)) {
prefs.end();
} else {
Serial.println("DeductionManager: could not create deductions NVS namespace");
}
}
#endif
return mutex_ != nullptr;
}
Expand Down
3 changes: 2 additions & 1 deletion src/DeductionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class DeductionManager {
public:
static DeductionManager& getInstance();

// One-time init: statically allocates the tracker mutex (no new heap).
// One-time init: statically allocates the tracker mutex (no new heap) and
// creates the "deductions" NVS namespace so read-only lookups find it.
// Must be called during setup() before NFC and HA tasks start. Returns
// false if the mutex could not be created — deduction is then disabled
// (every apply fails closed, NVS pending survives).
Expand Down
Loading