File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
internal_filesystem/lib/mpos Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ from mpos .apps import Activity
2+ import lvgl as lv
3+
4+ class ResetIntoBootloader (Activity ):
5+ message = "Bootloader mode activated.\n You can now install firmware over USB.\n \n Reset the device to cancel."
6+
7+ def onCreate (self ):
8+ print (self .message )
9+ screen = lv .obj ()
10+ label = lv .label (screen )
11+ label .set_text (self .message )
12+ label .center ()
13+ self .setContentView (screen )
14+
15+ def onResume (self , screen ):
16+ # Use a timer, otherwise the UI won't have time to update:
17+ timer = lv .timer_create (self .start_bootloader , 1000 , None ) # give it some time (at least 500ms) for the new screen animation
18+ timer .set_repeat_count (1 )
19+
20+ def start_bootloader (self , timer ):
21+ try :
22+ import machine
23+ machine .bootloader ()
24+ except Exception as e :
25+ print (f"Could not reset into bootloader because: { e } " )
You can’t perform that action at this time.
0 commit comments