Closed surfdado closed 2 years ago
In case the appeal of this feature isn't clear: people with sealed up boards are pretty screwed if they try a firmware that causes a boot loop due to WDT. Now they will be able to load different firmware without messing with their build. No need for ST-Link
The problem with this change is that the reset command uses the watchdog to reset, which would disable the app on the next boot. Other things like an undervoltage in the wrong moment or a current spike on hardware with bad layout can also cause watchdog resets. In those cases it is better that the next boot picks the previous app as it can leave you stranded until you have a phone or computer to change the config.
If there is an issue where certain configurations in an app cause boot loops those issues should be solved in the app.
To prevent bootloops, we automatically switch to the UART app to when we're booting from a WDT reset. The first commit is the main one, keeping the switch to UART app temporary, i.e. a hard restart or power cycle will load the original settings. The second commit makes the change to UART permanent. I've left it as a separate optional commit as I'm not sure if there might be use cases where an automatic permanent switch to the UART app is not desirable.