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) {
+4 -1
View File
@@ -118,6 +118,7 @@ void HomeActivity::rebuildMenuEntries() {
menuEntries.push_back({MenuAction::Weather, StrId::STR_WEATHER, Weather});
}
menuEntries.push_back({MenuAction::Settings, StrId::STR_SETTINGS_TITLE, Settings});
menuEntriesDirty = false;
}
void HomeActivity::loadRecentBooks(int maxBooks) {
@@ -265,7 +266,9 @@ void HomeActivity::freeCoverBuffer() {
}
void HomeActivity::loop() {
rebuildMenuEntries();
if (menuEntriesDirty) {
rebuildMenuEntries();
}
const int totalItems = static_cast<int>(recentBooks.size() + menuEntries.size());
if (firstRenderDone && !recentsLoaded && !recentsLoading) {