eric6/MicroPython/UF2FlashDialog.py

Fri, 12 Feb 2021 16:15:18 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 12 Feb 2021 16:15:18 +0100
changeset 8096
5425a9072300
child 8097
5af9c426c46b
permissions
-rw-r--r--

MicroPython
- added a generic dialog for flashing UF2 capable devices (with device detection)

8096
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de>
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to flash any UF2 capable device.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import shutil
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt5.QtCore import pyqtSlot, Qt, QCoreApplication, QThread, QEventLoop
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from PyQt5.QtWidgets import QDialog
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from E5Gui.E5PathPicker import E5PathPickerModes
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .Ui_UF2FlashDialog import Ui_UF2FlashDialog
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 import UI.PixmapCache
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 import Utilities
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 from . import MicroPythonDevices
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 SupportedUF2Boards = {
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 "circuitpython": {
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 "volumes": {
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 (0x03EB, 0x2402): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 "SAMD21", # SAMD21 Board
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 "SAME54", # SAME54 Board
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 (0x04D8, 0xEC44): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 "PYCUBEDBOOT", # PyCubedv04
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 (0x04D8, 0xEC63): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 "BOOT", # CircuitBrains Basic
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 (0x04D8, 0xEC64): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 "BOOT", # CircuitBrains Deluxe
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 (0x04D8, 0xED5F): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 "UCHIPYBOOT", # uChip CircuitPython
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 (0x04D8, 0xEDB3): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 "USBHUBBOOT", # Programmable USB Hub
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 (0x04D8, 0xEDBE): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 "SAM32BOOT", # SAM32
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 (0x04D8, 0xEF66): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 "SENSEBOX", # senseBox MCU
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 (0x1209, 0x2017): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 "MINISAMBOOT", # Mini SAM M4
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 (0x1209, 0x4D44): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 "ROBOM0BOOT", # Robo HAT MM1
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 "ROBOM4BOOT", # Robo HAT MM1 M4
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 (0x1209, 0x4DDD): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 "SapBOOT", # CP Sapling
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 (0x1209, 0x7102): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 "MINISAMBOOT", # Mini SAM M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 (0x1209, 0x805A): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 "BASTBLE", # Bast BLE
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 (0x1209, 0xE3E2): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 "StackRduino", # StackRduino M0 PRO
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 (0x1209, 0xF501): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 "M4SHIMBOOT", # M4-Shim
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 (0x16D0, 0x0CDA): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 "AUTOMAT", # automat
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 (0x1B4F, 0x0019): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 "QwiicMicro", # Sparkfun Qwiic Micro
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 (0x1B4F, 0x0D22): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 "SPARKFUN", # Sparkfun SAMD21 Mini Breakout
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 (0x1B4F, 0x0D23): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 "SPARKFUN", # Sparkfun SAMD21 Dev Breakout
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 (0x1D50, 0x6110): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 "ROBOTICS", # Robotics
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 (0x1D50, 0x6112): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 "RCBOOT", # Wattuino RC
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 (0x1D50, 0x6160): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 "BLUEMICRO", # BlueMicro
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 (0x230A, 0x00E9): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 "TAU_BOOT", # Tau
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 (0x2341, 0x0057): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 "NANOBOOT", # NANO 33 IoT
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 (0x2341, 0x8053): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 "MKR1300", # MKR1300
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 (0x239A, 0x000F): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 "ITSYBOOT", # ItsyBitsy M0 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 (0x239A, 0x0013): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 "METROBOOT", # Metro M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 (0x239A, 0x0015): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 "FEATHERBOOT", # Feather M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 (0x239A, 0x0018): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 "CPLAYBOOT", # CPlay Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 (0x239A, 0x001B): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 "FEATHERBOOT", # Feather M0 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 (0x239A, 0x001C): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 "GEMMABOOT", # Gemma M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 (0x239A, 0x001E): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 "TRINKETBOOT", # Trinket M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 (0x239A, 0x0021): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 "METROM4BOOT", # Metro M4 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 (0x239A, 0x0022): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 "ARCADE-D5", # Feather Arcade D51
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 "FEATHERBOOT", # Feather M4 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 (0x239A, 0x0024): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 "RADIOBOOT", # Radiofruit M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 (0x239A, 0x0027): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 "PIRKEYBOOT", # pIRKey M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 (0x239A, 0x0029): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 "ARGONBOOT ", # Argon
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 "BORONBOOT ", # Boron
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 "FTHR840BOOT", # Feather nRF52840 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 "MDBT50QBOOT", # Raytac MDBT50Q-RX
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 "MDK840DONGL", # MDK nRF52840 USB Dongle
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 "WS52840EVK", # Waveshare nRF52840 Eval
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 "XENONBOOT ", # Xenon
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 (0x239A, 0x002B): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 "ARCADE-D5", # Itsy Arcade D51
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 "ITSYM4BOOT", # ItsyBitsy M4 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 (0x239A, 0x002D): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 "CRICKITBOOT", # crickit
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 (0x239A, 0x002F): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 "TRELM4BOOT", # Trellis M4 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 (0x239A, 0x0031): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 "GCM4BOOT", # Grand Central M4 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 (0x239A, 0x0033): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 "PYBADGEBOOT", # PyBadge
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 (0x239A, 0x0034): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 "BADGELCBOOT", # BadgeLC
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 "PEWBOOT", # PewPew
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 (0x239A, 0x0035): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 "MKRZEROBOOT", # MKRZero
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 "PORTALBOOT", # PyPortal M4 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 (0x239A, 0x0037): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 "METROM4BOOT", # Metro M4 AirLift
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 (0x239A, 0x003D): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 "PYGAMERBOOT", # PyGamer
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 (0x239A, 0x003F): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 "METR840BOOT", # Metro nRF52840 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 (0x239A, 0x0045): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 "CPLAYBTBOOT", # Circuit Playground nRF52840
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 (0x239A, 0x0047): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 "MASKM4BOOT", # Hallowing Mask M4
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 (0x239A, 0x0049): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 "HALLOM4BOOT", # HalloWing M4
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 (0x239A, 0x004D): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 "SNEKBOOT", # snekboard
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 (0x239A, 0x0051): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 "ITSY840BOOT", # ItsyBitsy nRF52840 Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 (0x239A, 0x0057): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 "SERPENTBOOT", # Serpente
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 (0x239A, 0x0061): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 "SOLBOOT", # Sol
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 (0x239A, 0x0063): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 "NANO33BOOT", # Nano 33 BLE
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 (0x239A, 0x0065): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 "ND6BOOT", # ndBit6
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 (0x239A, 0x006B): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 "shIRtty", # shIRtty
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 (0x239A, 0x0071): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 "CLUEBOOT", # CLUE nRF52840
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 (0x239A, 0x0079): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 "ARAMBOOT", # ARAMCON Badge 2019
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 (0x239A, 0x007D): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 "BOOKBOOT", # The Open Book Feather
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 (0x239A, 0x007F): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 "BADGEBOOT", # OHS2020 Badge
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 (0x239A, 0x0087): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 "FTHRSNSBOOT", # Feather nRF52840 Sense
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 (0x239A, 0x0093): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 "ISVITABoot", # IkigaiSense Vita nRF52840
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 (0x239A, 0x0095): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 "UARTLOGBOOT", # UARTLogger II
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 (0x239A, 0x009F): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 "ADM840BOOT", # AtelierDuMaker NRF52840 Breakout
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 (0x239A, 0x00AF): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 "FLUFFBOOT", # Fluff M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 (0x239A, 0x00B3): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 "NICENANO", # nice!nano
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 (0x239A, 0x00B5): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 "E54XBOOT", # SAME54 Xplained
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 (0x239A, 0x00B9): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 "ND7BOOT", # ndBit7
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 (0x239A, 0x00BF): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 "BADGEBOOT", # BLM Badge
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 (0x239A, 0x00C3): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 "GEMINIBOOT", # Gemini
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 (0x239A, 0x00CB): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 "QTPY_BOOT", # QT Py M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 (0x239A, 0x00CD): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 "FTHRCANBOOT", # Feather M4 CAN Express
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 (0x239A, 0x00EF): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 "TRINKEYBOOT", # NeoPixel Trinkey M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 (0x239A, 0x00F5): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 "STARBOOT", # Binary Star
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 (0x239A, 0xB000): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 "HALLOWBOOT", # Hallowing M0
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 (0x239A, 0xE005): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 "HONKBOOT", # Big Honking Button
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 (0x2886, 0x000D): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 "Grove Zero", # Grove Zero
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 (0x2886, 0x002F): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 "Seeed XIAO", # Seeeduino XIAO
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 "Arduino", # Seeeduino XIAO
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 (0x2886, 0xF00E): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 "PITAYAGO", # Pitaya Go
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 (0x2886, 0xF00F): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 "nRF52840M2", # MakerDiary nRF52840 M.2 Module
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 (0x3171, 0x0100): [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 "CMDBOOT", # COMMANDER
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 },
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 "instructions": QCoreApplication.translate(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 "UF2FlashDialog",
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 "<h3>CircuitPython Board</h3>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 "<p>In order to prepare the board for flashing follow these"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 " steps:</p><ol>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 "<li>Switch your device to 'bootloader' mode by double-pressing"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 " the reset button.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 "<li>Wait until the device has entered 'bootloader' mode.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 "<li>(If this does not happen, then try shorter or longer"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 " pauses between presses.)</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 "<li>Ensure the boot volume is available (this may require"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 " mounting it).</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 "<li>Select the firmware file to be flashed and click the"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 " flash button.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 "</ol>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 ),
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 "firmware": "CircuitPython",
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 },
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 "rp2040": {
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 "volumes": [
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 ],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 "instructions": QCoreApplication.translate(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 "UF2FlashDialog",
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 "<h3>Pi Pico (RP2040) Board</h3>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 "<p>In order to prepare the board for flashing follow these"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 " steps:</p><ol>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 "<li>Plug in your board while holding the BOOTSEL button.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 "<li>Wait until the device has entered 'bootloader' mode.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 "<li>Ensure the boot volume is available (this may require"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 " mounting it).</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 "<li>Select the firmware file to be flashed and click the"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 " flash button.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 "</ol>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 ),
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 "firmware": "MicroPython",
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 },
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 }
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 def getFoundDevices(boardType=""):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 Function to get the list of known serial devices supporting UF2.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 @param boardType specific board type to search for
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 @type str
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 @return list of tuples with the board type, the port description, the
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 VID and PID
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 @rtype list of tuple of (str, str, int, int)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 from PyQt5.QtSerialPort import QSerialPortInfo
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 foundDevices = []
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 availablePorts = QSerialPortInfo.availablePorts()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 for port in availablePorts:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 vid = port.vendorIdentifier()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 pid = port.productIdentifier()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 if vid == 0 and pid == 0:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 # no device detected at port
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 continue
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 for board in SupportedUF2Boards:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 if not boardType or (board == boardType):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 if (vid, pid) in SupportedUF2Boards[board]["volumes"]:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 foundDevices.append((
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 board,
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 port.description(),
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 (vid, pid),
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 ))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 return foundDevices
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 class UF2FlashDialog(QDialog, Ui_UF2FlashDialog):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 Class implementing a dialog to flash any UF2 capable device.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 DeviceTypeRole = Qt.UserRole
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 DeviceVidPidRole = Qt.UserRole + 1
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 def __init__(self, boardType="", parent=None):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 Constructor
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 @param boardType specific board type to show the dialog for
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 @type str
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 @param parent reference to the parent widget (defaults to None)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 @type QWidget (optional)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 super(UF2FlashDialog, self).__init__(parent)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 self.setupUi(self)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 self.refreshButton.setIcon(UI.PixmapCache.getIcon("rescan"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 self.firmwarePicker.setMode(E5PathPickerModes.OpenFileMode)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 self.firmwarePicker.setFilters(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 self.tr("MicroPython/CircuitPython Files (*.uf2);;"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 "All Files (*)"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 self.bootPicker.setMode(E5PathPickerModes.DirectoryShowFilesMode)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 self.bootPicker.setEnabled(False)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 self.__mandatoryStyleSheet = (
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 "QLineEdit {border: 2px solid;border-color: #800000}"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 self.__manualType = "<manual>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 self.__boardType = boardType
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 self.__populate()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 self.__updateFlashButton()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 def __populate(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 Private method to (re-)populate the dialog.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 # save the currently selected device
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 currentDevice = self.devicesComboBox.currentText()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 firmwareFile = self.firmwarePicker.text()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 # clear the entries first
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 self.devicesComboBox.clear()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 self.firmwarePicker.clear()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 self.bootPicker.clear()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 self.infoLabel.clear()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 self.infoEdit.clear()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 # now populate the entries with data
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 devices = getFoundDevices(boardType=self.__boardType)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 if len(devices) == 0:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 # no device detected
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 devices = filter(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 lambda x: x[0] in SupportedUF2Boards,
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 MicroPythonDevices.getFoundDevices()[0]
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 if devices:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 self.__showSpecificInstructions(list(devices))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 self.__showAllInstructions()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 self.devicesComboBox.addItem("")
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 self.devicesComboBox.addItem(self.tr("Manual Select"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 self.devicesComboBox.setItemData(1, self.__manualType,
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 self.DeviceTypeRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 elif len(devices) == 1:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 self.devicesComboBox.addItem(devices[0][1])
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 self.devicesComboBox.setItemData(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 0, devices[0][0], self.DeviceTypeRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 self.devicesComboBox.setItemData(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 0, devices[0][2], self.DeviceVidPidRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 self.devicesComboBox.addItem(self.tr("Manual Select"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 self.devicesComboBox.setItemData(1, self.__manualType,
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 self.DeviceTypeRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 self.on_devicesComboBox_currentIndexChanged(0)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 self.devicesComboBox.addItem("")
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 for index, (boardType, description,
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 vidpid) in enumerate(sorted(devices), 1):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 self.devicesComboBox.addItem(description)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 self.devicesComboBox.setItemData(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 index, boardType, self.DeviceTypeRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 self.devicesComboBox.setItemData(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 index, vidpid, self.DeviceVidPidRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 self.devicesComboBox.addItem(self.tr("Manual Select"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 self.devicesComboBox.setItemData(index + 1, self.__manualType,
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 self.DeviceTypeRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 # reselect the remembered device, if it is still there
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 if currentDevice:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 self.devicesComboBox.setCurrentText(currentDevice)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 self.firmwarePicker.setText(firmwareFile)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 self.devicesComboBox.setCurrentIndex(0)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 def __updateFlashButton(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 Private method to update the state of the Flash button and the retest
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 button.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 firmwareFile = self.firmwarePicker.text()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471 if self.devicesComboBox.currentData(self.DeviceTypeRole) is not None:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 if bool(firmwareFile) and os.path.exists(firmwareFile):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 self.firmwarePicker.setStyleSheet("")
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 self.firmwarePicker.setStyleSheet(self.__mandatoryStyleSheet)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 if bool(self.bootPicker.text()):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 self.bootPicker.setStyleSheet("")
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 self.bootPicker.setStyleSheet(self.__mandatoryStyleSheet)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 self.firmwarePicker.setStyleSheet("")
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 self.bootPicker.setStyleSheet("")
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 enable = (
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 bool(self.bootPicker.text()) and
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 bool(firmwareFile) and
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 os.path.exists(firmwareFile)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 self.flashButton.setEnabled(enable)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 def __showAllInstructions(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 Private method to show instructions for resetting devices to bootloader
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 mode.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 self.infoLabel.setText(self.tr("Reset Instructions:"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 htmlText = self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 "<h4>No known devices detected.</h4>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 "<p>Follow the appropriate instructions below to set <b>one</b>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 " board into 'bootloader' mode. Press <b>Refresh</b> when ready."
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 "</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 for boardType in SupportedUF2Boards:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"]
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 self.infoEdit.setHtml(htmlText)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 def __showSpecificInstructions(self, devices):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 Private method to show instructions for resetting devices to bootloader
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 mode for a list of detected devices.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 @param devices list of detected devices
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 @type list of str
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 boardTypes = set(x[0] for x in devices)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 self.infoLabel.setText(self.tr("Reset Instructions:"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 if self.__boardType:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 htmlText = self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 "<h4>Flash {0} Firmware</h4>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 "<p>Follow the instructions below to set <b>one</b> board into"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 "<hr/>{1}"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 ).format(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 SupportedUF2Boards[self.__boardType]["firmware"],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 SupportedUF2Boards[self.__boardType]["instructions"],
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 htmlText = self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 "<h4>Potentially UF2 capable devices found</h4>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 "<p>Found these potentially UF2 capable devices:</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535 "<ul><li>{0}</li></ul>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536 "<p>Follow the instructions below to set <b>one</b> board into"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 ).format(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 "</li><li>".join(sorted(x[1] for x in devices))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 for boardType in sorted(boardTypes):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 htmlText += (
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 "<hr/>" + SupportedUF2Boards[boardType]["instructions"]
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 self.infoEdit.setHtml(htmlText)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 def __showTypedInstructions(self, boardType):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 Private method to show instructions for resetting devices to bootloader
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 mode for a specific board type.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 @param boardType type of the board to show instructions for
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 @type str
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 self.infoLabel.setText(self.tr("Reset Instructions:"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 htmlText = self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 "<h4>No known devices detected.</h4>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 "<p>Follow the instructions below to set <b>one</b> board into"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"]
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 self.infoEdit.setHtml(htmlText)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 def __showManualInstructions(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 Private method to show instructions for flashing devices manually.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 self.infoLabel.setText(self.tr("Flash Instructions:"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571 htmlText = self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572 "<h4>Flash method 'manual' selected.</h4>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 "<p>Follow the instructions below to flash a device by entering"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574 "the data manually.</p><ol>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 "<li>Change the device to 'bootloader' mode.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 "<li>Wait until the device has entered 'bootloader' mode.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 "<li>Ensure the boot volume is available (this may require"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 " mounting it) and select its path.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 "<li>Select the firmware file to be flashed and click the"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 " flash button.</li>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 "</ol>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 for boardType in SupportedUF2Boards:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"]
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 self.infoEdit.setHtml(htmlText)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 def __showNoVolumeInformation(self, volumes):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 Private method to show information about the expected boot volume(s).
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591 @param volumes list of expected volume names
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592 @type list of str
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594 self.infoLabel.setText(self.tr("Boot Volume not found:"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596 htmlText = self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 "<h4>No Boot Volume detected.</h4>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 "<p>Please ensure that the boot volume of the device to be flashed"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
599 " is available. "
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 )
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 if len(volumes) == 1:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
602 htmlText += self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603 "This volume should be named <b>{0}</b>."
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 " Press <b>Refresh</b> when ready.</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 ).format(volumes[0])
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 htmlText += self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 "This volume should have one of these names.</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 "<ul><li>{0}</li></ul>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 "<p>Press <b>Refresh</b> when ready.</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 ).format("</li><li>".join(sorted(volumes)))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 self.infoEdit.setHtml(htmlText)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 def __showMultipleVolumesInformation(self, volumePaths):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 Private method to show information because multiple devices of the
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 same type are ready for flashing.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
618
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 Note: This is a dangerous situation!
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 @param volumePaths list of volume paths
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 @type list of str
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 self.infoLabel.setText(self.tr("Multiple Boot Volumes found:"))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 htmlText = self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 "<h4>Multiple Boot Volumes were found</h4>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 "<p>These volume paths were found.</p><ul><li>{0}</li></ul>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 "<p>Please ensure that only one device of a type is ready for"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 " flashing. Press <b>Refresh</b> when ready.</p>"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 ).format("</li><li>".join(sorted(volumePaths)))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 self.infoEdit.setHtml(htmlText)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 @pyqtSlot()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 def on_flashButton_clicked(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 Private slot to flash the selected MicroPython or CircuitPython
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 firmware onto the device.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 boardType = self.devicesComboBox.currentData(self.DeviceTypeRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 firmwarePath = self.firmwarePicker.text()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 volumePath = self.bootPicker.text()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 if os.path.exists(firmwarePath) and os.path.exists(volumePath):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 firmwareType = SupportedUF2Boards[boardType]["firmware"]
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 self.infoLabel.setText(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 self.tr("Flashing {0}").format(firmwareType))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 self.infoEdit.setHtml(self.tr(
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 "<p>Flashing the {0} firmware to the device. Please wait"
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 " until the device resets automatically</p>."
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650 ).format(firmwareType))
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 QCoreApplication.processEvents(QEventLoop.ExcludeUserInputEvents)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 shutil.copy2(firmwarePath, volumePath)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 QThread.sleep(1)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 self.on_refreshButton_clicked()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 @pyqtSlot()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 def on_refreshButton_clicked(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 Private slot to refresh the dialog.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 self.__populate()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 @pyqtSlot(int)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 def on_devicesComboBox_currentIndexChanged(self, index):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 Private slot to handle the selection of a board.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 @param index selected index
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 @type int
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 vidpid = self.devicesComboBox.itemData(index, self.DeviceVidPidRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 boardType = self.devicesComboBox.itemData(index, self.DeviceTypeRole)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 self.bootPicker.setEnabled(boardType == self.__manualType)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 if boardType == self.__manualType:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 self.__showManualInstructions()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 if vidpid is None:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 if boardType is None:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 self.bootPicker.clear()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682 volumes = SupportedUF2Boards[boardType]["volumes"][vidpid]
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 foundVolumes = []
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 for volume in volumes:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 foundVolumes += Utilities.findVolume(volume, findAll=True)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687 if len(foundVolumes) == 0:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 self.__showNoVolumeInformation(volumes)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 self.bootPicker.clear()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 elif len(foundVolumes) == 1:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 self.bootPicker.setText(foundVolumes[0])
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 else:
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 self.__showMultipleVolumesInformation()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 self.bootPicker.clear()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 self.__updateFlashButton()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 @pyqtSlot(str)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 def on_firmwarePicker_textChanged(self, text):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 Private slot handling a change of the firmware file.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 @param text current text of the firmware edit
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 @type str
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706 self.__updateFlashButton()
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
708 @pyqtSlot(str)
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 def on_bootPicker_textChanged(self, text):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 Private slot handling a change of the boot volume.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 @param text current text of the boot volume edit
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 @type str
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 self.__updateFlashButton()

eric ide

mercurial