Public Access
Slow mode replaces the late-evening quarter hours
Slow mode (Home Assistant switch "FlipDot Display Slow mode", dropdown
"FlipDot Display Slow mode interval", web UI Settings) makes the display
change only every 1, 2, 5, 10, 15, 20, 30 or 60 minutes, on the clock, and
powers it off in between: less noise. Nothing else is drawn meanwhile, also
no page changes. It updates at once after boot, the night, the Power switch
and live mode, and when it is switched off. Rules can override it ("show at
once in slow mode"): while their page is shown the display works normally.
Settings layout 7 and schedule layout 4 (older records are converted; they
are stored again once the firmware is marked good, so a rollback still
finds the old ones). Pages in older formats are rewritten in the current
one, in time-boxed steps. /api/status reports old_data_left.
Version 2.15.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a904615c51
commit
968492ca35
39 files changed
+726
-126
No files matched your search
+84
-3
@@ -90,7 +90,7 @@ static void applyOffPage()
|
||||
|
||||
static void apply()
|
||||
{
|
||||
controller.setSettings(settings.schedule, settings.clock);
|
||||
controller.setSettings(settings.schedule, settings.clock, settings.slow_mode);
|
||||
controller.setEffectTime(effectTime(settings.drive));
|
||||
status.setDrive(settings.flip_time, settings.drive, settings.refresh.dots);
|
||||
frames.setDrive(settings.flip_time, settings.drive);
|
||||
@@ -109,6 +109,9 @@ static void reloadPage()
|
||||
controller.pageChanged();
|
||||
}
|
||||
|
||||
static bool settings_converted = false;
|
||||
static bool schedule_converted = false;
|
||||
|
||||
const Settings &appSettings()
|
||||
{
|
||||
return settings;
|
||||
@@ -116,8 +119,8 @@ const Settings &appSettings()
|
||||
|
||||
void appLoadSettings()
|
||||
{
|
||||
loadSettings(settings);
|
||||
loadSchedule(page_schedule);
|
||||
settings_converted = loadSettings(settings);
|
||||
schedule_converted = loadSchedule(page_schedule);
|
||||
selector.setSchedule(&page_schedule);
|
||||
selector.setChosen(settings.page);
|
||||
haApiWatchRules(&page_schedule);
|
||||
@@ -157,6 +160,27 @@ const char *appSaveSettings(const Settings &new_settings, bool &restart_needed)
|
||||
}
|
||||
|
||||
|
||||
void appSetSlowMode(bool enabled)
|
||||
{
|
||||
if (settings.slow_mode.enabled == enabled)
|
||||
return;
|
||||
settings.slow_mode.enabled = enabled;
|
||||
saveSettings(settings);
|
||||
controller.setSettings(settings.schedule, settings.clock, settings.slow_mode);
|
||||
}
|
||||
|
||||
const char *appSetSlowModeMinutes(int minutes)
|
||||
{
|
||||
if (!validSlowModeMinutes(minutes))
|
||||
return "Unknown slow mode interval";
|
||||
if (settings.slow_mode.minutes == minutes)
|
||||
return nullptr;
|
||||
settings.slow_mode.minutes = minutes;
|
||||
saveSettings(settings);
|
||||
controller.setSettings(settings.schedule, settings.clock, settings.slow_mode);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The chosen page, without overriding the schedule
|
||||
static void setChosen(const char *name)
|
||||
{
|
||||
@@ -256,6 +280,7 @@ void appPageLoop(bool time_valid, const LocalTime &time)
|
||||
if (!time_valid)
|
||||
return;
|
||||
shown_choice = selector.update(time.hour * 60 + time.minute, now);
|
||||
controller.setSlowModeOverride(shown_choice.over_slow_mode);
|
||||
if (!shown_choice.changed && sameName(shown, shown_choice.page))
|
||||
return;
|
||||
copyName(shown, shown_choice.page);
|
||||
@@ -534,6 +559,62 @@ void appMigrateIcons()
|
||||
reloadPage();
|
||||
}
|
||||
|
||||
// Same steps as the icon migration: one page per check, MIGRATION_STEP_MS per pass
|
||||
static bool data_listed = false;
|
||||
static bool data_done = false;
|
||||
static std::vector<String> data_pages;
|
||||
static size_t data_next = 0;
|
||||
static int data_left = -1;
|
||||
|
||||
void appMigrateData()
|
||||
{
|
||||
if (data_done || migration != Migration::Done)
|
||||
return;
|
||||
uint32_t pass = millis();
|
||||
if (settings_converted)
|
||||
{
|
||||
saveSettings(settings);
|
||||
settings_converted = false;
|
||||
Serial.println("Settings stored in the new layout");
|
||||
}
|
||||
if (schedule_converted)
|
||||
{
|
||||
saveSchedule(page_schedule);
|
||||
schedule_converted = false;
|
||||
Serial.println("Schedule stored in the new layout");
|
||||
}
|
||||
if (!data_listed)
|
||||
{
|
||||
data_pages = storedPageNames();
|
||||
data_listed = true;
|
||||
data_left = 0;
|
||||
return;
|
||||
}
|
||||
DynamicPage *page = new DynamicPage;
|
||||
while (data_next < data_pages.size() && millis() - pass < MIGRATION_STEP_MS)
|
||||
{
|
||||
const char *name = data_pages[data_next++].c_str();
|
||||
if (!pageInOldFormat(name))
|
||||
continue;
|
||||
const char *error = loadPage(name, *page) ? savePage(name, *page) : "unreadable";
|
||||
Serial.printf("Page \"%s\" in the new format: %s\n", name, error ? error : "ok");
|
||||
if (error)
|
||||
data_left++;
|
||||
}
|
||||
delete page;
|
||||
if (data_next < data_pages.size())
|
||||
return;
|
||||
data_pages.clear();
|
||||
data_done = true;
|
||||
}
|
||||
|
||||
int appOldDataLeft()
|
||||
{
|
||||
if (!data_done)
|
||||
return -1;
|
||||
return data_left + (settings_converted ? 1 : 0) + (schedule_converted ? 1 : 0);
|
||||
}
|
||||
|
||||
const char *appSaveFont(const char *name, const uint8_t *data, size_t size)
|
||||
{
|
||||
const char *error = saveFont(name, data, size);
|
||||
|
||||
Reference in new issue
Block a user