mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-27 04:02:05 +00:00
Added "Saving Changes" screen when reboot is needed
This commit is contained in:
@@ -155,6 +155,18 @@ void InkHUD::LogoApplet::onShutdown()
|
||||
// This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete
|
||||
}
|
||||
|
||||
void InkHUD::LogoApplet::onApplyingChanges()
|
||||
{
|
||||
bringToForeground();
|
||||
|
||||
textLeft = "";
|
||||
textRight = "";
|
||||
textTitle = "Applying changes";
|
||||
fontTitle = fontSmall;
|
||||
|
||||
inkhud->forceUpdate(Drivers::EInk::FAST, false);
|
||||
}
|
||||
|
||||
void InkHUD::LogoApplet::onReboot()
|
||||
{
|
||||
bringToForeground();
|
||||
|
||||
@@ -26,6 +26,7 @@ class LogoApplet : public SystemApplet, public concurrency::OSThread
|
||||
void onBackground() override;
|
||||
void onShutdown() override;
|
||||
void onReboot() override;
|
||||
void onApplyingChanges();
|
||||
|
||||
protected:
|
||||
int32_t runOnce() override;
|
||||
|
||||
@@ -210,7 +210,8 @@ static void applyLoRaRegion(meshtastic_Config_LoRaConfig_RegionCode region)
|
||||
sprintf(moduleConfig.mqtt.root, "%s/%s", default_mqtt_root, myRegion->name);
|
||||
changes |= SEGMENT_MODULECONFIG;
|
||||
}
|
||||
|
||||
// Notify UI that changes are being applied
|
||||
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
|
||||
service->reloadConfig(changes);
|
||||
|
||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||
@@ -227,6 +228,9 @@ static void applyDeviceRole(meshtastic_Config_DeviceConfig_Role role)
|
||||
|
||||
service->reloadConfig(SEGMENT_CONFIG);
|
||||
|
||||
// Notify UI that changes are being applied
|
||||
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
|
||||
|
||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||
}
|
||||
|
||||
@@ -241,6 +245,9 @@ static void applyLoRaPreset(meshtastic_Config_LoRaConfig_ModemPreset preset)
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
service->reloadConfig(SEGMENT_CONFIG);
|
||||
|
||||
// Notify UI that changes are being applied
|
||||
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
|
||||
|
||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||
}
|
||||
|
||||
@@ -442,6 +449,7 @@ void InkHUD::MenuApplet::execute(MenuItem item)
|
||||
config.network.wifi_enabled = false;
|
||||
config.bluetooth.enabled = true;
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
|
||||
rebootAtMsec = millis() + 2000;
|
||||
break;
|
||||
|
||||
@@ -450,6 +458,7 @@ void InkHUD::MenuApplet::execute(MenuItem item)
|
||||
case TOGGLE_POWER_SAVE:
|
||||
config.power.is_power_saving = !config.power.is_power_saving;
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
|
||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||
break;
|
||||
|
||||
@@ -462,6 +471,7 @@ void InkHUD::MenuApplet::execute(MenuItem item)
|
||||
}
|
||||
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
|
||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||
break;
|
||||
#endif
|
||||
@@ -486,6 +496,7 @@ void InkHUD::MenuApplet::execute(MenuItem item)
|
||||
}
|
||||
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
InkHUD::InkHUD::getInstance()->notifyApplyingChanges();
|
||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user