More comments
This commit is contained in:
+12
-2
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user