Sat, 26 Feb 2022 17:48:58 +0100
MicroPython
- updated the list of known UF2 capable boards
8096 | 1 | # -*- coding: utf-8 -*- |
2 | ||
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8862
diff
changeset
|
3 | # Copyright (c) 2021 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
8096 | 4 | # |
5 | ||
6 | """ | |
7 | Module implementing a dialog to flash any UF2 capable device. | |
8 | """ | |
9 | ||
10 | import os | |
11 | import shutil | |
8243
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8222
diff
changeset
|
12 | import contextlib |
8096 | 13 | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
14 | from PyQt6.QtCore import pyqtSlot, Qt, QCoreApplication, QThread, QEventLoop |
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
15 | from PyQt6.QtWidgets import QDialog |
8096 | 16 | |
8358
144a6b854f70
Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8356
diff
changeset
|
17 | from EricWidgets.EricPathPicker import EricPathPickerModes |
8862
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8462
diff
changeset
|
18 | from EricWidgets.EricApplication import ericApp |
8096 | 19 | |
20 | from .Ui_UF2FlashDialog import Ui_UF2FlashDialog | |
21 | ||
22 | import UI.PixmapCache | |
23 | import Utilities | |
24 | ||
25 | from . import MicroPythonDevices | |
26 | ||
27 | SupportedUF2Boards = { | |
28 | "circuitpython": { | |
29 | "volumes": { | |
30 | (0x03EB, 0x2402): [ | |
31 | "SAMD21", # SAMD21 Board | |
32 | "SAME54", # SAME54 Board | |
33 | ], | |
34 | (0x04D8, 0xEC44): [ | |
35 | "PYCUBEDBOOT", # PyCubedv04 | |
36 | ], | |
37 | (0x04D8, 0xEC63): [ | |
38 | "BOOT", # CircuitBrains Basic | |
39 | ], | |
40 | (0x04D8, 0xEC64): [ | |
41 | "BOOT", # CircuitBrains Deluxe | |
42 | ], | |
43 | (0x04D8, 0xED5F): [ | |
44 | "UCHIPYBOOT", # uChip CircuitPython | |
45 | ], | |
46 | (0x04D8, 0xEDB3): [ | |
47 | "USBHUBBOOT", # Programmable USB Hub | |
48 | ], | |
49 | (0x04D8, 0xEDBE): [ | |
50 | "SAM32BOOT", # SAM32 | |
51 | ], | |
52 | (0x04D8, 0xEF66): [ | |
53 | "SENSEBOX", # senseBox MCU | |
54 | ], | |
55 | (0x1209, 0x2017): [ | |
56 | "MINISAMBOOT", # Mini SAM M4 | |
57 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
58 | (0x1209, 0x3252): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
59 | "MCBS2OMBOOT", # Module Clip w/Wroom |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
60 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
61 | (0x1209, 0x3253): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
62 | "MCBS2ERBOOT", # Module Clip w/Wrover |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
63 | ], |
8096 | 64 | (0x1209, 0x4D44): [ |
65 | "ROBOM0BOOT", # Robo HAT MM1 | |
66 | "ROBOM4BOOT", # Robo HAT MM1 M4 | |
67 | ], | |
68 | (0x1209, 0x4DDD): [ | |
69 | "SapBOOT", # CP Sapling | |
70 | ], | |
71 | (0x1209, 0x7102): [ | |
72 | "MINISAMBOOT", # Mini SAM M0 | |
73 | ], | |
8919 | 74 | (0x1209, 0x7A01): [ |
75 | "MIKOTO-BOOT", # Mikoto nRF52840 | |
76 | ], | |
8096 | 77 | (0x1209, 0x805A): [ |
78 | "BASTBLE", # Bast BLE | |
79 | ], | |
80 | (0x1209, 0xE3E2): [ | |
81 | "StackRduino", # StackRduino M0 PRO | |
82 | ], | |
83 | (0x1209, 0xF501): [ | |
84 | "M4SHIMBOOT", # M4-Shim | |
85 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
86 | (0x15BA, 0x28DC): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
87 | "OLMLIPOBOOT", # ESP32S2 DevKit Lipo |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
88 | ], |
8096 | 89 | (0x16D0, 0x0CDA): [ |
90 | "AUTOMAT", # automat | |
91 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
92 | (0x1B4F, 0x0022): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
93 | "SFMM852BOOT", # MicroMod nRF52840 |
8096 | 94 | ], |
8956 | 95 | (0x1B4F, 0x002C): [ |
96 | "THNG+32BOOT", # Thing Plus - STM32 | |
97 | ], | |
8096 | 98 | (0x1B4F, 0x0D22): [ |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
99 | "SPARKFUN", # SAMD21 Mini Breakout |
8096 | 100 | ], |
101 | (0x1B4F, 0x0D23): [ | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
102 | "SPARKFUN", # SAMD21 Dev Breakout |
8096 | 103 | ], |
104 | (0x1D50, 0x6110): [ | |
105 | "ROBOTICS", # Robotics | |
106 | ], | |
107 | (0x1D50, 0x6112): [ | |
108 | "RCBOOT", # Wattuino RC | |
109 | ], | |
8919 | 110 | (0x1D50, 0x6157): [ |
111 | "BBOARDBOOT", # nRF52840 BBoard | |
112 | ], | |
8096 | 113 | (0x1D50, 0x6160): [ |
114 | "BLUEMICRO", # BlueMicro | |
115 | ], | |
8919 | 116 | (0x1D50, 0x616F): [ |
117 | "BLUEMICRO", # BlueMicro | |
118 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
119 | (0x1FC9, 0x0094): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
120 | "DblM33BOOT", # Double M33 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
121 | "LPC5528BOOT", # LPCXpresso 55s28 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
122 | "LPC5569BOOT", # LPCXpresso 55s69 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
123 | ], |
8919 | 124 | (0x1FC9, 0x0154): [ |
125 | "K32L2BOOT", # FRDM-K32L2B3 | |
126 | "K32L2BOOT", # KUIIC | |
127 | ], | |
8096 | 128 | (0x230A, 0x00E9): [ |
129 | "TAU_BOOT", # Tau | |
130 | ], | |
131 | (0x2341, 0x0057): [ | |
132 | "NANOBOOT", # NANO 33 IoT | |
133 | ], | |
134 | (0x2341, 0x8053): [ | |
135 | "MKR1300", # MKR1300 | |
136 | ], | |
137 | (0x239A, 0x000F): [ | |
138 | "ITSYBOOT", # ItsyBitsy M0 Express | |
139 | ], | |
140 | (0x239A, 0x0013): [ | |
141 | "METROBOOT", # Metro M0 | |
142 | ], | |
143 | (0x239A, 0x0015): [ | |
144 | "FEATHERBOOT", # Feather M0 | |
145 | ], | |
146 | (0x239A, 0x0018): [ | |
147 | "CPLAYBOOT", # CPlay Express | |
148 | ], | |
149 | (0x239A, 0x001B): [ | |
150 | "FEATHERBOOT", # Feather M0 Express | |
151 | ], | |
152 | (0x239A, 0x001C): [ | |
153 | "GEMMABOOT", # Gemma M0 | |
154 | ], | |
155 | (0x239A, 0x001E): [ | |
156 | "TRINKETBOOT", # Trinket M0 | |
157 | ], | |
158 | (0x239A, 0x0021): [ | |
159 | "METROM4BOOT", # Metro M4 Express | |
160 | ], | |
161 | (0x239A, 0x0022): [ | |
162 | "ARCADE-D5", # Feather Arcade D51 | |
163 | "FEATHERBOOT", # Feather M4 Express | |
164 | ], | |
165 | (0x239A, 0x0024): [ | |
166 | "RADIOBOOT", # Radiofruit M0 | |
167 | ], | |
168 | (0x239A, 0x0027): [ | |
169 | "PIRKEYBOOT", # pIRKey M0 | |
170 | ], | |
171 | (0x239A, 0x0029): [ | |
172 | "ARGONBOOT ", # Argon | |
173 | "BORONBOOT ", # Boron | |
174 | "FTHR840BOOT", # Feather nRF52840 Express | |
175 | "MDK840DONGL", # MDK nRF52840 USB Dongle | |
176 | "WS52840EVK", # Waveshare nRF52840 Eval | |
177 | "XENONBOOT ", # Xenon | |
178 | ], | |
179 | (0x239A, 0x002B): [ | |
180 | "ARCADE-D5", # Itsy Arcade D51 | |
181 | "ITSYM4BOOT", # ItsyBitsy M4 Express | |
182 | ], | |
183 | (0x239A, 0x002D): [ | |
184 | "CRICKITBOOT", # crickit | |
185 | ], | |
186 | (0x239A, 0x002F): [ | |
187 | "TRELM4BOOT", # Trellis M4 Express | |
188 | ], | |
189 | (0x239A, 0x0031): [ | |
190 | "GCM4BOOT", # Grand Central M4 Express | |
191 | ], | |
192 | (0x239A, 0x0033): [ | |
193 | "PYBADGEBOOT", # PyBadge | |
194 | ], | |
195 | (0x239A, 0x0034): [ | |
196 | "BADGELCBOOT", # BadgeLC | |
197 | "PEWBOOT", # PewPew | |
198 | ], | |
199 | (0x239A, 0x0035): [ | |
200 | "MKRZEROBOOT", # MKRZero | |
201 | "PORTALBOOT", # PyPortal M4 Express | |
202 | ], | |
203 | (0x239A, 0x0037): [ | |
204 | "METROM4BOOT", # Metro M4 AirLift | |
205 | ], | |
206 | (0x239A, 0x003D): [ | |
207 | "PYGAMERBOOT", # PyGamer | |
208 | ], | |
209 | (0x239A, 0x003F): [ | |
210 | "METR840BOOT", # Metro nRF52840 Express | |
211 | ], | |
212 | (0x239A, 0x0045): [ | |
213 | "CPLAYBTBOOT", # Circuit Playground nRF52840 | |
214 | ], | |
215 | (0x239A, 0x0047): [ | |
216 | "MASKM4BOOT", # Hallowing Mask M4 | |
217 | ], | |
218 | (0x239A, 0x0049): [ | |
219 | "HALLOM4BOOT", # HalloWing M4 | |
220 | ], | |
221 | (0x239A, 0x004D): [ | |
222 | "SNEKBOOT", # snekboard | |
223 | ], | |
224 | (0x239A, 0x0051): [ | |
225 | "ITSY840BOOT", # ItsyBitsy nRF52840 Express | |
226 | ], | |
227 | (0x239A, 0x0057): [ | |
228 | "SERPENTBOOT", # Serpente | |
229 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
230 | (0x239A, 0x0059): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
231 | "FTHR405BOOT", # Feather STM32F405 Express |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
232 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
233 | (0x239A, 0x005D): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
234 | "BlackPill", # STM32F401CxUx |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
235 | "STMF411BOOT", # STM32F411 Discovery |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
236 | ], |
8096 | 237 | (0x239A, 0x0061): [ |
238 | "SOLBOOT", # Sol | |
239 | ], | |
240 | (0x239A, 0x0063): [ | |
241 | "NANO33BOOT", # Nano 33 BLE | |
242 | ], | |
243 | (0x239A, 0x0065): [ | |
244 | "ND6BOOT", # ndBit6 | |
245 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
246 | (0x239A, 0x0069): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
247 | "STMF411BOOT", # STM32F411 BlackPill |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
248 | ], |
8096 | 249 | (0x239A, 0x006B): [ |
250 | "shIRtty", # shIRtty | |
251 | ], | |
252 | (0x239A, 0x0071): [ | |
253 | "CLUEBOOT", # CLUE nRF52840 | |
254 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
255 | (0x239A, 0x0077): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
256 | "RT1010BOOT", # RT1010 EVK |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
257 | ], |
8096 | 258 | (0x239A, 0x0079): [ |
259 | "ARAMBOOT", # ARAMCON Badge 2019 | |
260 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
261 | (0x239A, 0x007B): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
262 | "ARAMBOOT", # ARAMCON2 Badge |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
263 | ], |
8096 | 264 | (0x239A, 0x007D): [ |
265 | "BOOKBOOT", # The Open Book Feather | |
266 | ], | |
267 | (0x239A, 0x007F): [ | |
268 | "BADGEBOOT", # OHS2020 Badge | |
269 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
270 | (0x239A, 0x0081): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
271 | "RT1020BOOT", # RT1020 EVK |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
272 | "RT1024BOOT", # RT1024 EVK |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
273 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
274 | (0x239A, 0x0083): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
275 | "RT1060BOOT", # RT1060 EVK |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
276 | "RT1064BOOT", # RT1064 EVK |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
277 | ], |
8096 | 278 | (0x239A, 0x0087): [ |
279 | "FTHRSNSBOOT", # Feather nRF52840 Sense | |
280 | ], | |
281 | (0x239A, 0x0093): [ | |
282 | "ISVITABoot", # IkigaiSense Vita nRF52840 | |
283 | ], | |
284 | (0x239A, 0x0095): [ | |
285 | "UARTLOGBOOT", # UARTLogger II | |
286 | ], | |
287 | (0x239A, 0x009F): [ | |
288 | "ADM840BOOT", # AtelierDuMaker NRF52840 Breakout | |
289 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
290 | (0x239A, 0x00A5): [ |
8919 | 291 | "S3DKC1BOOT", # ESP32S3 DevKitC 1 |
292 | "S3DKM1BOOT", # ESP32S3 DevKitM 1 | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
293 | "SAOLA1RBOOT", # Saola 1R WROVER |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
294 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
295 | (0x239A, 0x00A7): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
296 | "SAOLA1MBOOT", # Saola 1M WROOM |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
297 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
298 | (0x239A, 0x00AB): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
299 | "UFTHRS2BOOT", # FeatherS2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
300 | ], |
8096 | 301 | (0x239A, 0x00AF): [ |
302 | "FLUFFBOOT", # Fluff M0 | |
303 | ], | |
304 | (0x239A, 0x00B3): [ | |
305 | "NICENANO", # nice!nano | |
306 | ], | |
307 | (0x239A, 0x00B5): [ | |
308 | "E54XBOOT", # SAME54 Xplained | |
309 | ], | |
310 | (0x239A, 0x00B9): [ | |
311 | "ND7BOOT", # ndBit7 | |
312 | ], | |
8919 | 313 | (0x239A, 0x00BB): [ |
314 | "MDBT50QBOOT", # Raytac MDBT50Q Demo Board 40 | |
315 | ], | |
8096 | 316 | (0x239A, 0x00BF): [ |
317 | "BADGEBOOT", # BLM Badge | |
318 | ], | |
319 | (0x239A, 0x00C3): [ | |
320 | "GEMINIBOOT", # Gemini | |
321 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
322 | (0x239A, 0x00C5): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
323 | "MICROS2BOOT", # microS2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
324 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
325 | (0x239A, 0x00C7): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
326 | "KALUGA1BOOT", # Kaluga 1 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
327 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
328 | (0x239A, 0x00C9): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
329 | "MATRIXBOOT", # Matrix Portal M4 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
330 | ], |
8096 | 331 | (0x239A, 0x00CB): [ |
332 | "QTPY_BOOT", # QT Py M0 | |
333 | ], | |
334 | (0x239A, 0x00CD): [ | |
335 | "FTHRCANBOOT", # Feather M4 CAN Express | |
336 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
337 | (0x239A, 0x00DE): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
338 | "NANOESPBOOT", # nanoESP32-S2 WROOM |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
339 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
340 | (0x239A, 0x00DF): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
341 | "METROS2BOOT", # Metro ESP32-S2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
342 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
343 | (0x239A, 0x00E1): [ |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
344 | "METROM7BOOT", # Metro M7 iMX RT1011 |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
345 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
346 | (0x239A, 0x00E5): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
347 | "MAGTAGBOOT", # Metro MagTag 2.9 Grayscale |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
348 | "MAGTAGBOOT", # MagTag 2.9 Grayscale |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
349 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
350 | (0x239A, 0x00EB): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
351 | "FTHRS2BOOT", # Feather ESP32-S2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
352 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
353 | (0x239A, 0x00ED): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
354 | "FTHRS2BOOT", # Feather ESP32-S2 Reverse TFT |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
355 | ], |
8096 | 356 | (0x239A, 0x00EF): [ |
357 | "TRINKEYBOOT", # NeoPixel Trinkey M0 | |
358 | ], | |
359 | (0x239A, 0x00F5): [ | |
360 | "STARBOOT", # Binary Star | |
361 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
362 | (0x239A, 0x00F9): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
363 | "HOUSEBOOT", # FunHouse |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
364 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
365 | (0x239A, 0x00FB): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
366 | "TRINKEYBOOT", # Rotary Trinkey M0 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
367 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
368 | (0x239A, 0x00FF): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
369 | "TRINKEYBOOT", # NeoKey Trinkey M0 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
370 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
371 | (0x239A, 0x0101): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
372 | "TRINKEYBOOT", # Slide Trinkey M0 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
373 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
374 | (0x239A, 0x0103): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
375 | "TRINKEYBOOT", # ProxSense Trinkey M0 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
376 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
377 | (0x239A, 0x010B): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
378 | "MDBT50QBOOT", # Raytac MDBT50Q-RX |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
379 | ], |
8919 | 380 | (0x239A, 0x010D): [ |
381 | "GLASSESBOOT", # LED Glasses Driver nRF52840 | |
382 | ], | |
383 | (0x239A, 0x010F): [ | |
384 | "FTHRS2BOOT", # Feather ESP32-S2 TFT | |
385 | ], | |
386 | (0x239A, 0x0111): [ | |
387 | "QTPYS2BOOT", # QT Py ESP32-S2 | |
388 | ], | |
389 | (0x239A, 0x0115): [ | |
390 | "FEATHERBOOT", # Feather M4 Adalogger | |
391 | ], | |
392 | (0x239A, 0x0117): [ | |
393 | "CAMERABOOT", # Camera | |
394 | ], | |
8956 | 395 | (0x239A, 0x0119): [ |
396 | "QTPYS3BOOT", # QT Py ESP32-S3 | |
397 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
398 | (0x239A, 0x800B): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
399 | "ATMZBOOT", # ATMegaZero ESP32-S2 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
400 | ], |
8096 | 401 | (0x239A, 0xB000): [ |
402 | "HALLOWBOOT", # Hallowing M0 | |
403 | ], | |
404 | (0x239A, 0xE005): [ | |
405 | "HONKBOOT", # Big Honking Button | |
406 | ], | |
407 | (0x2886, 0x000D): [ | |
408 | "Grove Zero", # Grove Zero | |
409 | ], | |
410 | (0x2886, 0x002F): [ | |
411 | "Seeed XIAO", # Seeeduino XIAO | |
412 | ], | |
413 | (0x2886, 0xF00E): [ | |
414 | "PITAYAGO", # Pitaya Go | |
415 | ], | |
416 | (0x2886, 0xF00F): [ | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
417 | "M60KEYBOARD", # MakerDiary M60 Mechanical Keyboard |
8096 | 418 | "nRF52840M2", # MakerDiary nRF52840 M.2 Module |
419 | ], | |
8919 | 420 | (0x303A, 0x7000): [ |
421 | "ESPHMI1BOOT", # HMI 1 | |
422 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
423 | (0x303A, 0x8005): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
424 | "TINYS2BOOT", # TinyS2 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
425 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
426 | (0x303A, 0x8008): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
427 | "TTGOS2BOOT", # TTGO_T8_S2_Display |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
428 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
429 | (0x303A, 0x800E): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
430 | "CCMBRISBOOT", # CucumberRIS v1.1 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
431 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
432 | (0x303A, 0x80B0): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
433 | "RD00RBOOT", # Reference Design RD00 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
434 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
435 | (0x303A, 0x80B3): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
436 | "NANOESPBOOT", # nanoESP32-S2 WROVER |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
437 | ], |
8919 | 438 | (0x303A, 0x80B5): [ |
439 | "FS2NEOBOOT", # FeatherS2 Neo | |
440 | ], | |
441 | (0x303A, 0x80B6): [ | |
442 | "MORPHBOOT", # MORPHESP-240 | |
443 | ], | |
444 | (0x303A, 0x80C4): [ | |
445 | "S2MINIBOOT", # S2 Mini | |
446 | ], | |
447 | (0x303A, 0x80C7): [ | |
448 | "S2PICOBOOT", # S2 Pico | |
449 | ], | |
8956 | 450 | (0x303A, 0x80D2): [ |
451 | "TINYS3BOOT", # TinyS3 | |
452 | ], | |
453 | (0x303A, 0x80D5): [ | |
454 | "PROS3BOOT", # ProS3 | |
455 | ], | |
456 | (0x303A, 0x80D8): [ | |
457 | "UFTHRS3BOOT", # FeatherS3 | |
458 | ], | |
8919 | 459 | (0x303A, 0x80DA): [ |
460 | "HEXKYBOOT", # HexKy-S2 | |
461 | ], | |
8096 | 462 | (0x3171, 0x0100): [ |
463 | "CMDBOOT", # COMMANDER | |
464 | ], | |
8956 | 465 | (0x80E7, 0x8111): [ |
466 | "IOTS2BOOT", # HiiBot IoTs2 | |
467 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
468 | (0xCAFE, 0xFFFF): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
469 | "F303BOOT", # STM32F303 Discovery |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
470 | ], |
8096 | 471 | }, |
472 | "instructions": QCoreApplication.translate( | |
473 | "UF2FlashDialog", | |
474 | "<h3>CircuitPython Board</h3>" | |
475 | "<p>In order to prepare the board for flashing follow these" | |
476 | " steps:</p><ol>" | |
477 | "<li>Switch your device to 'bootloader' mode by double-pressing" | |
478 | " the reset button.</li>" | |
479 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
480 | "<li>(If this does not happen, then try shorter or longer" | |
481 | " pauses between presses.)</li>" | |
482 | "<li>Ensure the boot volume is available (this may require" | |
483 | " mounting it).</li>" | |
484 | "<li>Select the firmware file to be flashed and click the" | |
485 | " flash button.</li>" | |
486 | "</ol>" | |
487 | ), | |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
488 | "show_all": True, |
8096 | 489 | "firmware": "CircuitPython", |
490 | }, | |
491 | ||
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
492 | "circuitpython_rp2040": { |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
493 | "volumes": { |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
494 | (0x239A, 0x80F4): [ |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
495 | "RPI-RP2", # Raspberry Pi Pico loaded with CircuitPython |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
496 | ], |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
497 | }, |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
498 | "instructions": QCoreApplication.translate( |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
499 | "UF2FlashDialog", |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
500 | "<h3>Pi Pico (RP2040) Board</h3>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
501 | "<p>In order to prepare the board for flashing follow these" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
502 | " steps:</p><ol>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
503 | "<li>Enter 'bootloader' mode (board <b>without</b> RESET button):" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
504 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
505 | "<li>Plug in your board while holding the BOOTSEL button.</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
506 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
507 | "Enter 'bootloader' mode (board <b>with</b> RESET button):" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
508 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
509 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
510 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
511 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
512 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
513 | "</ul></li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
514 | "<li>Wait until the device has entered 'bootloader' mode.</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
515 | "<li>Ensure the boot volume is available (this may require" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
516 | " mounting it).</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
517 | "<li>Select the firmware file to be flashed and click the" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
518 | " flash button.</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
519 | "</ol>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
520 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
521 | "show_all": False, |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
522 | "firmware": "CircuitPython", |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
523 | }, |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
524 | |
8096 | 525 | "rp2040": { |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
526 | "volumes": { |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
527 | (0x0000, 0x0000): [ |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
528 | "RPI-RP2", # Raspberry Pi Pico does not present a TTY |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
529 | ], |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
530 | }, |
8096 | 531 | "instructions": QCoreApplication.translate( |
532 | "UF2FlashDialog", | |
533 | "<h3>Pi Pico (RP2040) Board</h3>" | |
534 | "<p>In order to prepare the board for flashing follow these" | |
535 | " steps:</p><ol>" | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
536 | "<li>Enter 'bootloader' mode (board <b>without</b> RESET button):" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
537 | "<ul>" |
8096 | 538 | "<li>Plug in your board while holding the BOOTSEL button.</li>" |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
539 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
540 | "Enter 'bootloader' mode (board <b>with</b> RESET button):" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
541 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
542 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
543 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
544 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
545 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
546 | "</ul></li>" |
8096 | 547 | "<li>Wait until the device has entered 'bootloader' mode.</li>" |
548 | "<li>Ensure the boot volume is available (this may require" | |
549 | " mounting it).</li>" | |
550 | "<li>Select the firmware file to be flashed and click the" | |
551 | " flash button.</li>" | |
552 | "</ol>" | |
553 | ), | |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
554 | "show_all": True, |
8120
84928e9f446f
UF2FlashDialog: updated a string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8111
diff
changeset
|
555 | "firmware": "MicroPython / CircuitPython", |
8096 | 556 | }, |
557 | } | |
558 | ||
559 | ||
560 | def getFoundDevices(boardType=""): | |
561 | """ | |
562 | Function to get the list of known serial devices supporting UF2. | |
563 | ||
564 | @param boardType specific board type to search for | |
565 | @type str | |
566 | @return list of tuples with the board type, the port description, the | |
567 | VID and PID | |
568 | @rtype list of tuple of (str, str, int, int) | |
569 | """ | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
570 | from PyQt6.QtSerialPort import QSerialPortInfo |
8096 | 571 | |
572 | foundDevices = [] | |
573 | ||
574 | availablePorts = QSerialPortInfo.availablePorts() | |
575 | for port in availablePorts: | |
576 | vid = port.vendorIdentifier() | |
577 | pid = port.productIdentifier() | |
578 | ||
579 | if vid == 0 and pid == 0: | |
580 | # no device detected at port | |
581 | continue | |
582 | ||
583 | for board in SupportedUF2Boards: | |
8222
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
584 | if ( |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
585 | (not boardType or (board.startswith(boardType))) and |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
586 | (vid, pid) in SupportedUF2Boards[board]["volumes"] |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
587 | ): |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
588 | foundDevices.append(( |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
589 | board, |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
590 | port.description(), |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
591 | (vid, pid), |
5994b80b8760
Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
592 | )) |
8096 | 593 | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
594 | # second run for boards needing special treatment (e.g. RP2040) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
595 | for board in SupportedUF2Boards: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
596 | if not boardType or (board == boardType): |
8243
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8222
diff
changeset
|
597 | with contextlib.suppress(KeyError): |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
598 | # find mounted volume |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
599 | volumes = SupportedUF2Boards[board]["volumes"][(0, 0)] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
600 | foundVolumes = [] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
601 | for volume in volumes: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
602 | foundVolumes += Utilities.findVolume(volume, findAll=True) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
603 | if foundVolumes: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
604 | foundDevices.append(( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
605 | board, |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
606 | QCoreApplication.translate( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
607 | "UF2FlashDialog", "'{0}' Board").format(board), |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
608 | (0, 0), # VID/PID of (0, 0) is special |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
609 | )) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
610 | |
8096 | 611 | return foundDevices |
612 | ||
613 | ||
614 | class UF2FlashDialog(QDialog, Ui_UF2FlashDialog): | |
615 | """ | |
616 | Class implementing a dialog to flash any UF2 capable device. | |
617 | """ | |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8120
diff
changeset
|
618 | DeviceTypeRole = Qt.ItemDataRole.UserRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8120
diff
changeset
|
619 | DeviceVidPidRole = Qt.ItemDataRole.UserRole + 1 |
8096 | 620 | |
621 | def __init__(self, boardType="", parent=None): | |
622 | """ | |
623 | Constructor | |
624 | ||
625 | @param boardType specific board type to show the dialog for | |
626 | @type str | |
627 | @param parent reference to the parent widget (defaults to None) | |
628 | @type QWidget (optional) | |
629 | """ | |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8170
diff
changeset
|
630 | super().__init__(parent) |
8096 | 631 | self.setupUi(self) |
632 | ||
633 | self.refreshButton.setIcon(UI.PixmapCache.getIcon("rescan")) | |
634 | ||
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8327
diff
changeset
|
635 | self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
8096 | 636 | self.firmwarePicker.setFilters( |
637 | self.tr("MicroPython/CircuitPython Files (*.uf2);;" | |
638 | "All Files (*)")) | |
639 | ||
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8327
diff
changeset
|
640 | self.bootPicker.setMode(EricPathPickerModes.DIRECTORY_SHOW_FILES_MODE) |
8096 | 641 | self.bootPicker.setEnabled(False) |
642 | ||
643 | self.__mandatoryStyleSheet = ( | |
8862
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8462
diff
changeset
|
644 | "QLineEdit {border: 2px solid; border-color: #dd8888}" |
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8462
diff
changeset
|
645 | if ericApp().usesDarkPalette() else |
99459beb81b1
Adapted some style sheet usages to observe the palette lightness (dark/light).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8462
diff
changeset
|
646 | "QLineEdit {border: 2px solid; border-color: #800000}" |
8096 | 647 | ) |
648 | self.__manualType = "<manual>" | |
649 | ||
650 | self.__boardType = boardType | |
651 | ||
652 | self.__populate() | |
653 | ||
654 | self.__updateFlashButton() | |
655 | ||
656 | def __populate(self): | |
657 | """ | |
658 | Private method to (re-)populate the dialog. | |
659 | """ | |
660 | # save the currently selected device | |
661 | currentDevice = self.devicesComboBox.currentText() | |
662 | firmwareFile = self.firmwarePicker.text() | |
663 | ||
664 | # clear the entries first | |
665 | self.devicesComboBox.clear() | |
666 | self.firmwarePicker.clear() | |
667 | self.bootPicker.clear() | |
668 | self.infoLabel.clear() | |
669 | self.infoEdit.clear() | |
670 | ||
671 | # now populate the entries with data | |
672 | devices = getFoundDevices(boardType=self.__boardType) | |
673 | if len(devices) == 0: | |
674 | # no device detected | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
675 | devices = list(filter( |
8096 | 676 | lambda x: x[0] in SupportedUF2Boards, |
677 | MicroPythonDevices.getFoundDevices()[0] | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
678 | )) |
8096 | 679 | if devices: |
680 | self.__showSpecificInstructions(list(devices)) | |
681 | else: | |
682 | self.__showAllInstructions() | |
683 | self.devicesComboBox.addItem("") | |
684 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
685 | self.devicesComboBox.setItemData(1, self.__manualType, | |
686 | self.DeviceTypeRole) | |
687 | elif len(devices) == 1: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
688 | # set the board type to the found one |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
689 | self.__boardType = devices[0][0] |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
690 | |
8096 | 691 | self.devicesComboBox.addItem(devices[0][1]) |
692 | self.devicesComboBox.setItemData( | |
693 | 0, devices[0][0], self.DeviceTypeRole) | |
694 | self.devicesComboBox.setItemData( | |
695 | 0, devices[0][2], self.DeviceVidPidRole) | |
696 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
697 | self.devicesComboBox.setItemData(1, self.__manualType, | |
698 | self.DeviceTypeRole) | |
699 | self.on_devicesComboBox_currentIndexChanged(0) | |
700 | else: | |
701 | self.devicesComboBox.addItem("") | |
702 | for index, (boardType, description, | |
703 | vidpid) in enumerate(sorted(devices), 1): | |
704 | self.devicesComboBox.addItem(description) | |
705 | self.devicesComboBox.setItemData( | |
706 | index, boardType, self.DeviceTypeRole) | |
707 | self.devicesComboBox.setItemData( | |
708 | index, vidpid, self.DeviceVidPidRole) | |
709 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
710 | self.devicesComboBox.setItemData(index + 1, self.__manualType, | |
711 | self.DeviceTypeRole) | |
712 | ||
713 | # reselect the remembered device, if it is still there | |
714 | if currentDevice: | |
715 | self.devicesComboBox.setCurrentText(currentDevice) | |
716 | self.firmwarePicker.setText(firmwareFile) | |
717 | else: | |
718 | self.devicesComboBox.setCurrentIndex(0) | |
719 | ||
720 | def __updateFlashButton(self): | |
721 | """ | |
722 | Private method to update the state of the Flash button and the retest | |
723 | button. | |
724 | """ | |
725 | firmwareFile = self.firmwarePicker.text() | |
726 | if self.devicesComboBox.currentData(self.DeviceTypeRole) is not None: | |
727 | if bool(firmwareFile) and os.path.exists(firmwareFile): | |
728 | self.firmwarePicker.setStyleSheet("") | |
729 | else: | |
730 | self.firmwarePicker.setStyleSheet(self.__mandatoryStyleSheet) | |
731 | ||
732 | if bool(self.bootPicker.text()): | |
733 | self.bootPicker.setStyleSheet("") | |
734 | else: | |
735 | self.bootPicker.setStyleSheet(self.__mandatoryStyleSheet) | |
736 | else: | |
737 | self.firmwarePicker.setStyleSheet("") | |
738 | self.bootPicker.setStyleSheet("") | |
739 | ||
740 | enable = ( | |
741 | bool(self.bootPicker.text()) and | |
742 | bool(firmwareFile) and | |
743 | os.path.exists(firmwareFile) | |
744 | ) | |
745 | self.flashButton.setEnabled(enable) | |
746 | ||
747 | def __showAllInstructions(self): | |
748 | """ | |
749 | Private method to show instructions for resetting devices to bootloader | |
750 | mode. | |
751 | """ | |
752 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
753 | ||
754 | htmlText = self.tr( | |
755 | "<h4>No known devices detected.</h4>" | |
756 | "<p>Follow the appropriate instructions below to set <b>one</b>" | |
757 | " board into 'bootloader' mode. Press <b>Refresh</b> when ready." | |
758 | "</p>" | |
759 | ) | |
760 | for boardType in SupportedUF2Boards: | |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
761 | if SupportedUF2Boards[boardType]["show_all"]: |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
762 | htmlText += ( |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
763 | "<hr/>" + |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
764 | SupportedUF2Boards[boardType]["instructions"] |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
765 | ) |
8096 | 766 | self.infoEdit.setHtml(htmlText) |
767 | ||
768 | def __showSpecificInstructions(self, devices): | |
769 | """ | |
770 | Private method to show instructions for resetting devices to bootloader | |
771 | mode for a list of detected devices. | |
772 | ||
773 | @param devices list of detected devices | |
774 | @type list of str | |
775 | """ | |
8099
522946e53835
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8097
diff
changeset
|
776 | boardTypes = {x[0] for x in devices} |
8096 | 777 | |
778 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
779 | ||
780 | if self.__boardType: | |
781 | htmlText = self.tr( | |
782 | "<h4>Flash {0} Firmware</h4>" | |
783 | "<p>Follow the instructions below to set <b>one</b> board into" | |
784 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
785 | "<hr/>{1}" | |
786 | ).format( | |
787 | SupportedUF2Boards[self.__boardType]["firmware"], | |
788 | SupportedUF2Boards[self.__boardType]["instructions"], | |
789 | ) | |
790 | else: | |
791 | htmlText = self.tr( | |
792 | "<h4>Potentially UF2 capable devices found</h4>" | |
793 | "<p>Found these potentially UF2 capable devices:</p>" | |
794 | "<ul><li>{0}</li></ul>" | |
795 | "<p>Follow the instructions below to set <b>one</b> board into" | |
796 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
797 | ).format( | |
798 | "</li><li>".join(sorted(x[1] for x in devices)) | |
799 | ) | |
800 | for boardType in sorted(boardTypes): | |
801 | htmlText += ( | |
802 | "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
803 | ) | |
804 | self.infoEdit.setHtml(htmlText) | |
805 | ||
806 | def __showTypedInstructions(self, boardType): | |
807 | """ | |
808 | Private method to show instructions for resetting devices to bootloader | |
809 | mode for a specific board type. | |
810 | ||
811 | @param boardType type of the board to show instructions for | |
812 | @type str | |
813 | """ | |
814 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
815 | ||
816 | htmlText = self.tr( | |
817 | "<h4>No known devices detected.</h4>" | |
818 | "<p>Follow the instructions below to set <b>one</b> board into" | |
819 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
820 | ) | |
821 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
822 | self.infoEdit.setHtml(htmlText) | |
823 | ||
824 | def __showManualInstructions(self): | |
825 | """ | |
826 | Private method to show instructions for flashing devices manually. | |
827 | """ | |
828 | self.infoLabel.setText(self.tr("Flash Instructions:")) | |
829 | ||
830 | htmlText = self.tr( | |
831 | "<h4>Flash method 'manual' selected.</h4>" | |
832 | "<p>Follow the instructions below to flash a device by entering" | |
8097
5af9c426c46b
Updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8096
diff
changeset
|
833 | " the data manually.</p><ol>" |
8096 | 834 | "<li>Change the device to 'bootloader' mode.</li>" |
835 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
836 | "<li>Ensure the boot volume is available (this may require" | |
837 | " mounting it) and select its path.</li>" | |
838 | "<li>Select the firmware file to be flashed and click the" | |
839 | " flash button.</li>" | |
840 | "</ol>" | |
841 | ) | |
842 | for boardType in SupportedUF2Boards: | |
843 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
844 | self.infoEdit.setHtml(htmlText) | |
845 | ||
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
846 | def __showNoVolumeInformation(self, volumes, boardType): |
8096 | 847 | """ |
848 | Private method to show information about the expected boot volume(s). | |
849 | ||
850 | @param volumes list of expected volume names | |
851 | @type list of str | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
852 | @param boardType type of the board to show instructions for |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
853 | @type str |
8096 | 854 | """ |
855 | self.infoLabel.setText(self.tr("Boot Volume not found:")) | |
856 | ||
857 | htmlText = self.tr( | |
858 | "<h4>No Boot Volume detected.</h4>" | |
859 | "<p>Please ensure that the boot volume of the device to be flashed" | |
860 | " is available. " | |
861 | ) | |
862 | if len(volumes) == 1: | |
863 | htmlText += self.tr( | |
864 | "This volume should be named <b>{0}</b>." | |
865 | " Press <b>Refresh</b> when ready.</p>" | |
866 | ).format(volumes[0]) | |
867 | else: | |
868 | htmlText += self.tr( | |
869 | "This volume should have one of these names.</p>" | |
870 | "<ul><li>{0}</li></ul>" | |
871 | "<p>Press <b>Refresh</b> when ready.</p>" | |
872 | ).format("</li><li>".join(sorted(volumes))) | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
873 | |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
874 | if boardType: |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
875 | htmlText += self.tr( |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
876 | "<h4>Reset Instructions</h4>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
877 | "<p>Follow the instructions below to set the board into" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
878 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
879 | ) |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
880 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
881 | |
8096 | 882 | self.infoEdit.setHtml(htmlText) |
883 | ||
884 | def __showMultipleVolumesInformation(self, volumePaths): | |
885 | """ | |
886 | Private method to show information because multiple devices of the | |
887 | same type are ready for flashing. | |
888 | ||
889 | Note: This is a dangerous situation! | |
890 | ||
891 | @param volumePaths list of volume paths | |
892 | @type list of str | |
893 | """ | |
894 | self.infoLabel.setText(self.tr("Multiple Boot Volumes found:")) | |
895 | ||
896 | htmlText = self.tr( | |
897 | "<h4>Multiple Boot Volumes were found</h4>" | |
898 | "<p>These volume paths were found.</p><ul><li>{0}</li></ul>" | |
899 | "<p>Please ensure that only one device of a type is ready for" | |
900 | " flashing. Press <b>Refresh</b> when ready.</p>" | |
901 | ).format("</li><li>".join(sorted(volumePaths))) | |
902 | self.infoEdit.setHtml(htmlText) | |
903 | ||
904 | @pyqtSlot() | |
905 | def on_flashButton_clicked(self): | |
906 | """ | |
907 | Private slot to flash the selected MicroPython or CircuitPython | |
908 | firmware onto the device. | |
909 | """ | |
910 | boardType = self.devicesComboBox.currentData(self.DeviceTypeRole) | |
911 | firmwarePath = self.firmwarePicker.text() | |
912 | volumePath = self.bootPicker.text() | |
913 | if os.path.exists(firmwarePath) and os.path.exists(volumePath): | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
914 | if boardType == self.__manualType: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
915 | self.infoLabel.setText(self.tr("Flashing Firmware")) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
916 | self.infoEdit.setHtml(self.tr( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
917 | "<p>Flashing the selected firmware to the device. Please" |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
918 | " wait until the device resets automatically.</p>") |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
919 | ) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
920 | else: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
921 | firmwareType = SupportedUF2Boards[boardType]["firmware"] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
922 | self.infoLabel.setText( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
923 | self.tr("Flashing {0}").format(firmwareType)) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
924 | self.infoEdit.setHtml(self.tr( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
925 | "<p>Flashing the {0} firmware to the device. Please wait" |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
926 | " until the device resets automatically.</p>" |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
927 | ).format(firmwareType)) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8120
diff
changeset
|
928 | QCoreApplication.processEvents( |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8120
diff
changeset
|
929 | QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) |
8096 | 930 | shutil.copy2(firmwarePath, volumePath) |
931 | QThread.sleep(1) | |
932 | self.on_refreshButton_clicked() | |
933 | ||
934 | @pyqtSlot() | |
935 | def on_refreshButton_clicked(self): | |
936 | """ | |
937 | Private slot to refresh the dialog. | |
938 | """ | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
939 | # special treatment for RPi Pico |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
940 | if self.__boardType == "circuitpython_rp2040": |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
941 | self.__boardType = "rp2040" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
942 | |
8096 | 943 | self.__populate() |
944 | ||
945 | @pyqtSlot(int) | |
946 | def on_devicesComboBox_currentIndexChanged(self, index): | |
947 | """ | |
948 | Private slot to handle the selection of a board. | |
949 | ||
950 | @param index selected index | |
951 | @type int | |
952 | """ | |
953 | vidpid = self.devicesComboBox.itemData(index, self.DeviceVidPidRole) | |
954 | boardType = self.devicesComboBox.itemData(index, self.DeviceTypeRole) | |
955 | ||
956 | self.bootPicker.setEnabled(boardType == self.__manualType) | |
957 | if boardType == self.__manualType: | |
958 | self.__showManualInstructions() | |
959 | ||
960 | if vidpid is None: | |
961 | if boardType is None: | |
962 | self.bootPicker.clear() | |
963 | else: | |
964 | volumes = SupportedUF2Boards[boardType]["volumes"][vidpid] | |
965 | foundVolumes = [] | |
966 | for volume in volumes: | |
967 | foundVolumes += Utilities.findVolume(volume, findAll=True) | |
968 | ||
969 | if len(foundVolumes) == 0: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
970 | self.__showNoVolumeInformation(volumes, boardType) |
8096 | 971 | self.bootPicker.clear() |
972 | elif len(foundVolumes) == 1: | |
973 | self.bootPicker.setText(foundVolumes[0]) | |
974 | else: | |
975 | self.__showMultipleVolumesInformation() | |
976 | self.bootPicker.clear() | |
977 | ||
978 | self.__updateFlashButton() | |
979 | ||
980 | @pyqtSlot(str) | |
981 | def on_firmwarePicker_textChanged(self, text): | |
982 | """ | |
983 | Private slot handling a change of the firmware file. | |
984 | ||
985 | @param text current text of the firmware edit | |
986 | @type str | |
987 | """ | |
988 | self.__updateFlashButton() | |
989 | ||
990 | @pyqtSlot(str) | |
991 | def on_bootPicker_textChanged(self, text): | |
992 | """ | |
993 | Private slot handling a change of the boot volume. | |
994 | ||
995 | @param text current text of the boot volume edit | |
996 | @type str | |
997 | """ | |
998 | self.__updateFlashButton() |