More comments

This commit is contained in:
jpirnay
2026-04-17 16:25:29 +02:00
parent a8816b2964
commit e0fb3e0160
2 changed files with 16 additions and 3 deletions
+12 -2
View File
@@ -100,9 +100,19 @@ bool JsonSettingsIO::saveState(const CrossPointState& s, const char* path) {
return false;
}
if (doc.overflowed()) {
LOG_ERR("CPS", "JSON document overflowed while building state");
file.close();
return false;
}
const size_t expected = measureJson(doc);
const size_t written = serializeJson(doc, file);
file.close();
return written > 0;
file.flush();
if (!file.close()) {
return false;
}
return written == expected;
}
bool JsonSettingsIO::loadState(CrossPointState& s, const char* json) {