SHA2017-badge / micropython-esp32

MicroPython ported to the SHA2017 badge
https://micropython.org/
MIT License
12 stars 16 forks source link

NVS: boot/splash resets upon crash #227

Open sebastius opened 7 years ago

sebastius commented 7 years ago

I want to autoload an app (wiki_infotag) so i set:

badge.nvs_set_str('boot', 'splash', 'wiki_infotag')

Whenever the app crashes the NVS apparently clears too. That is part of the boot.py behavior:

if splash == badge.nvs_get_str('boot', 'splash', 'splash') and splash != 'splash': badge.nvs_erase_key('boot', 'splash')

Any advice on how to cope with this? Do we still need this auto-reset function since we have safe-mode?

An ugly work-around would be to add in a service to the app that adds this NVS string and reboots the system. I'd really like to avoid such hackery ;)

sebastius commented 7 years ago

I did the ugly work-around which i'd have liked to avoid:

Service.py ` def setup():

import machine, badge, easydraw

easydraw.msg("Hacking myself")

badge.nvs_set_str('boot', 'splash', 'wiki_infotag')

easydraw.msg("Hacking done!")

machine.deepsleep(1)`

and

Service.json {"apiVersion":2, "wifi": {"setup":false, "loop":false}, "rtc": false, "loop": false, "draw": false}