Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf5c5b1d

Browse files
Add bootloader.py
1 parent5e81bf2 commitf5c5b1d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
frommpos.appsimportActivity
2+
importlvglaslv
3+
4+
classResetIntoBootloader(Activity):
5+
message="Bootloader mode activated.\nYou can now install firmware over USB.\n\nReset the device to cancel."
6+
7+
defonCreate(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+
defonResume(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+
defstart_bootloader(self,timer):
21+
try:
22+
importmachine
23+
machine.bootloader()
24+
exceptExceptionase:
25+
print(f"Could not reset into bootloader because:{e}")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp