Creation of a protection system against unintentional updates to Epsilon 16 (foundation) + Recovery Improvement (#37)

This commit is contained in:
devdl11
2021-11-11 18:20:16 +01:00
committed by GitHub
parent b304a2ff7d
commit e8a1bc6149
63 changed files with 1893 additions and 565 deletions

View File

@@ -138,7 +138,7 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) {
Ion::LED::updateColorWithPlugAndCharge();
}
if (event == Ion::Events::USBEnumeration) {
if (Ion::USB::isPlugged()) {
if (Ion::USB::isPlugged() && GlobalPreferences::sharedGlobalPreferences()->getDfuLevel() != 3) {
App::Snapshot * activeSnapshot = (s_activeApp == nullptr ? appSnapshotAtIndex(0) : s_activeApp->snapshot());
/* Just after a software update, the battery timer does not have time to
* fire before the calculator enters DFU mode. As the DFU mode blocks the
@@ -147,7 +147,9 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) {
* pictogram. */
updateBatteryState();
if (switchTo(usbConnectedAppSnapshot())) {
Ion::USB::DFU();
Ion::USB::DFU(true, GlobalPreferences::sharedGlobalPreferences()->dfuStatus(), GlobalPreferences::sharedGlobalPreferences()->getDfuLevel());
GlobalPreferences::sharedGlobalPreferences()->dfuResetStep();
GlobalPreferences::sharedGlobalPreferences()->setDfuStatus(false);
// Update LED when exiting DFU mode
Ion::LED::updateColorWithPlugAndCharge();
bool switched = switchTo(activeSnapshot);