Sat, 08 Jan 2022 20:12:37 +0100
MicroPython
- updated the list of known CircuitPython 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 | ], | |
74 | (0x1209, 0x805A): [ | |
75 | "BASTBLE", # Bast BLE | |
76 | ], | |
77 | (0x1209, 0xE3E2): [ | |
78 | "StackRduino", # StackRduino M0 PRO | |
79 | ], | |
80 | (0x1209, 0xF501): [ | |
81 | "M4SHIMBOOT", # M4-Shim | |
82 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
83 | (0x15BA, 0x28DC): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
84 | "OLMLIPOBOOT", # ESP32S2 DevKit Lipo |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
85 | ], |
8096 | 86 | (0x16D0, 0x0CDA): [ |
87 | "AUTOMAT", # automat | |
88 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
89 | (0x1B4F, 0x0022): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
90 | "SFMM852BOOT", # MicroMod nRF52840 |
8096 | 91 | ], |
92 | (0x1B4F, 0x0D22): [ | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
93 | "SPARKFUN", # SAMD21 Mini Breakout |
8096 | 94 | ], |
95 | (0x1B4F, 0x0D23): [ | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
96 | "SPARKFUN", # SAMD21 Dev Breakout |
8096 | 97 | ], |
98 | (0x1D50, 0x6110): [ | |
99 | "ROBOTICS", # Robotics | |
100 | ], | |
101 | (0x1D50, 0x6112): [ | |
102 | "RCBOOT", # Wattuino RC | |
103 | ], | |
104 | (0x1D50, 0x6160): [ | |
105 | "BLUEMICRO", # BlueMicro | |
106 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
107 | (0x1FC9, 0x0094): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
108 | "DblM33BOOT", # Double M33 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
109 | "LPC5528BOOT", # LPCXpresso 55s28 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
110 | "LPC5569BOOT", # LPCXpresso 55s69 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
111 | ], |
8096 | 112 | (0x230A, 0x00E9): [ |
113 | "TAU_BOOT", # Tau | |
114 | ], | |
115 | (0x2341, 0x0057): [ | |
116 | "NANOBOOT", # NANO 33 IoT | |
117 | ], | |
118 | (0x2341, 0x8053): [ | |
119 | "MKR1300", # MKR1300 | |
120 | ], | |
121 | (0x239A, 0x000F): [ | |
122 | "ITSYBOOT", # ItsyBitsy M0 Express | |
123 | ], | |
124 | (0x239A, 0x0013): [ | |
125 | "METROBOOT", # Metro M0 | |
126 | ], | |
127 | (0x239A, 0x0015): [ | |
128 | "FEATHERBOOT", # Feather M0 | |
129 | ], | |
130 | (0x239A, 0x0018): [ | |
131 | "CPLAYBOOT", # CPlay Express | |
132 | ], | |
133 | (0x239A, 0x001B): [ | |
134 | "FEATHERBOOT", # Feather M0 Express | |
135 | ], | |
136 | (0x239A, 0x001C): [ | |
137 | "GEMMABOOT", # Gemma M0 | |
138 | ], | |
139 | (0x239A, 0x001E): [ | |
140 | "TRINKETBOOT", # Trinket M0 | |
141 | ], | |
142 | (0x239A, 0x0021): [ | |
143 | "METROM4BOOT", # Metro M4 Express | |
144 | ], | |
145 | (0x239A, 0x0022): [ | |
146 | "ARCADE-D5", # Feather Arcade D51 | |
147 | "FEATHERBOOT", # Feather M4 Express | |
148 | ], | |
149 | (0x239A, 0x0024): [ | |
150 | "RADIOBOOT", # Radiofruit M0 | |
151 | ], | |
152 | (0x239A, 0x0027): [ | |
153 | "PIRKEYBOOT", # pIRKey M0 | |
154 | ], | |
155 | (0x239A, 0x0029): [ | |
156 | "ARGONBOOT ", # Argon | |
157 | "BORONBOOT ", # Boron | |
158 | "FTHR840BOOT", # Feather nRF52840 Express | |
159 | "MDK840DONGL", # MDK nRF52840 USB Dongle | |
160 | "WS52840EVK", # Waveshare nRF52840 Eval | |
161 | "XENONBOOT ", # Xenon | |
162 | ], | |
163 | (0x239A, 0x002B): [ | |
164 | "ARCADE-D5", # Itsy Arcade D51 | |
165 | "ITSYM4BOOT", # ItsyBitsy M4 Express | |
166 | ], | |
167 | (0x239A, 0x002D): [ | |
168 | "CRICKITBOOT", # crickit | |
169 | ], | |
170 | (0x239A, 0x002F): [ | |
171 | "TRELM4BOOT", # Trellis M4 Express | |
172 | ], | |
173 | (0x239A, 0x0031): [ | |
174 | "GCM4BOOT", # Grand Central M4 Express | |
175 | ], | |
176 | (0x239A, 0x0033): [ | |
177 | "PYBADGEBOOT", # PyBadge | |
178 | ], | |
179 | (0x239A, 0x0034): [ | |
180 | "BADGELCBOOT", # BadgeLC | |
181 | "PEWBOOT", # PewPew | |
182 | ], | |
183 | (0x239A, 0x0035): [ | |
184 | "MKRZEROBOOT", # MKRZero | |
185 | "PORTALBOOT", # PyPortal M4 Express | |
186 | ], | |
187 | (0x239A, 0x0037): [ | |
188 | "METROM4BOOT", # Metro M4 AirLift | |
189 | ], | |
190 | (0x239A, 0x003D): [ | |
191 | "PYGAMERBOOT", # PyGamer | |
192 | ], | |
193 | (0x239A, 0x003F): [ | |
194 | "METR840BOOT", # Metro nRF52840 Express | |
195 | ], | |
196 | (0x239A, 0x0045): [ | |
197 | "CPLAYBTBOOT", # Circuit Playground nRF52840 | |
198 | ], | |
199 | (0x239A, 0x0047): [ | |
200 | "MASKM4BOOT", # Hallowing Mask M4 | |
201 | ], | |
202 | (0x239A, 0x0049): [ | |
203 | "HALLOM4BOOT", # HalloWing M4 | |
204 | ], | |
205 | (0x239A, 0x004D): [ | |
206 | "SNEKBOOT", # snekboard | |
207 | ], | |
208 | (0x239A, 0x0051): [ | |
209 | "ITSY840BOOT", # ItsyBitsy nRF52840 Express | |
210 | ], | |
211 | (0x239A, 0x0057): [ | |
212 | "SERPENTBOOT", # Serpente | |
213 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
214 | (0x239A, 0x0059): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
215 | "FTHR405BOOT", # Feather STM32F405 Express |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
216 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
217 | (0x239A, 0x005D): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
218 | "BlackPill", # STM32F401CxUx |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
219 | "STMF411BOOT", # STM32F411 Discovery |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
220 | ], |
8096 | 221 | (0x239A, 0x0061): [ |
222 | "SOLBOOT", # Sol | |
223 | ], | |
224 | (0x239A, 0x0063): [ | |
225 | "NANO33BOOT", # Nano 33 BLE | |
226 | ], | |
227 | (0x239A, 0x0065): [ | |
228 | "ND6BOOT", # ndBit6 | |
229 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
230 | (0x239A, 0x0069): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
231 | "STMF411BOOT", # STM32F411 BlackPill |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
232 | ], |
8096 | 233 | (0x239A, 0x006B): [ |
234 | "shIRtty", # shIRtty | |
235 | ], | |
236 | (0x239A, 0x0071): [ | |
237 | "CLUEBOOT", # CLUE nRF52840 | |
238 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
239 | (0x239A, 0x0077): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
240 | "RT1010BOOT", # RT1010 EVK |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
241 | ], |
8096 | 242 | (0x239A, 0x0079): [ |
243 | "ARAMBOOT", # ARAMCON Badge 2019 | |
244 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
245 | (0x239A, 0x007B): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
246 | "ARAMBOOT", # ARAMCON2 Badge |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
247 | ], |
8096 | 248 | (0x239A, 0x007D): [ |
249 | "BOOKBOOT", # The Open Book Feather | |
250 | ], | |
251 | (0x239A, 0x007F): [ | |
252 | "BADGEBOOT", # OHS2020 Badge | |
253 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
254 | (0x239A, 0x0081): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
255 | "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
|
256 | "RT1024BOOT", # RT1024 EVK |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
257 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
258 | (0x239A, 0x0083): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
259 | "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
|
260 | "RT1064BOOT", # RT1064 EVK |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
261 | ], |
8096 | 262 | (0x239A, 0x0087): [ |
263 | "FTHRSNSBOOT", # Feather nRF52840 Sense | |
264 | ], | |
265 | (0x239A, 0x0093): [ | |
266 | "ISVITABoot", # IkigaiSense Vita nRF52840 | |
267 | ], | |
268 | (0x239A, 0x0095): [ | |
269 | "UARTLOGBOOT", # UARTLogger II | |
270 | ], | |
271 | (0x239A, 0x009F): [ | |
272 | "ADM840BOOT", # AtelierDuMaker NRF52840 Breakout | |
273 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
274 | (0x239A, 0x00A5): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
275 | "SAOLA1RBOOT", # Saola 1R WROVER |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
276 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
277 | (0x239A, 0x00A7): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
278 | "SAOLA1MBOOT", # Saola 1M WROOM |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
279 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
280 | (0x239A, 0x00AB): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
281 | "UFTHRS2BOOT", # FeatherS2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
282 | ], |
8096 | 283 | (0x239A, 0x00AF): [ |
284 | "FLUFFBOOT", # Fluff M0 | |
285 | ], | |
286 | (0x239A, 0x00B3): [ | |
287 | "NICENANO", # nice!nano | |
288 | ], | |
289 | (0x239A, 0x00B5): [ | |
290 | "E54XBOOT", # SAME54 Xplained | |
291 | ], | |
292 | (0x239A, 0x00B9): [ | |
293 | "ND7BOOT", # ndBit7 | |
294 | ], | |
295 | (0x239A, 0x00BF): [ | |
296 | "BADGEBOOT", # BLM Badge | |
297 | ], | |
298 | (0x239A, 0x00C3): [ | |
299 | "GEMINIBOOT", # Gemini | |
300 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
301 | (0x239A, 0x00C5): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
302 | "MICROS2BOOT", # microS2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
303 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
304 | (0x239A, 0x00C7): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
305 | "KALUGA1BOOT", # Kaluga 1 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
306 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
307 | (0x239A, 0x00C9): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
308 | "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
|
309 | ], |
8096 | 310 | (0x239A, 0x00CB): [ |
311 | "QTPY_BOOT", # QT Py M0 | |
312 | ], | |
313 | (0x239A, 0x00CD): [ | |
314 | "FTHRCANBOOT", # Feather M4 CAN Express | |
315 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
316 | (0x239A, 0x00DE): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
317 | "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
|
318 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
319 | (0x239A, 0x00DF): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
320 | "METROS2BOOT", # Metro ESP32-S2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
321 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
322 | (0x239A, 0x00E1): [ |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
323 | "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
|
324 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
325 | (0x239A, 0x00E5): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
326 | "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
|
327 | "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
|
328 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
329 | (0x239A, 0x00EB): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
330 | "FTHRS2BOOT", # Feather ESP32-S2 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
331 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
332 | (0x239A, 0x00ED): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
333 | "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
|
334 | ], |
8096 | 335 | (0x239A, 0x00EF): [ |
336 | "TRINKEYBOOT", # NeoPixel Trinkey M0 | |
337 | ], | |
338 | (0x239A, 0x00F5): [ | |
339 | "STARBOOT", # Binary Star | |
340 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
341 | (0x239A, 0x00F9): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
342 | "HOUSEBOOT", # FunHouse |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
343 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
344 | (0x239A, 0x00FB): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
345 | "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
|
346 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
347 | (0x239A, 0x00FF): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
348 | "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
|
349 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
350 | (0x239A, 0x0101): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
351 | "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
|
352 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
353 | (0x239A, 0x0103): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
354 | "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
|
355 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
356 | (0x239A, 0x010B): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
357 | "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
|
358 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
359 | (0x239A, 0x800B): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
360 | "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
|
361 | ], |
8096 | 362 | (0x239A, 0xB000): [ |
363 | "HALLOWBOOT", # Hallowing M0 | |
364 | ], | |
365 | (0x239A, 0xE005): [ | |
366 | "HONKBOOT", # Big Honking Button | |
367 | ], | |
368 | (0x2886, 0x000D): [ | |
369 | "Grove Zero", # Grove Zero | |
370 | ], | |
371 | (0x2886, 0x002F): [ | |
372 | "Seeed XIAO", # Seeeduino XIAO | |
373 | ], | |
374 | (0x2886, 0xF00E): [ | |
375 | "PITAYAGO", # Pitaya Go | |
376 | ], | |
377 | (0x2886, 0xF00F): [ | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
378 | "M60KEYBOARD", # MakerDiary M60 Mechanical Keyboard |
8096 | 379 | "nRF52840M2", # MakerDiary nRF52840 M.2 Module |
380 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
381 | (0x303A, 0x8005): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
382 | "TINYS2BOOT", # TinyS2 |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
383 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
384 | (0x303A, 0x8008): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
385 | "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
|
386 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
387 | (0x303A, 0x800E): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
388 | "CCMBRISBOOT", # CucumberRIS v1.1 |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
389 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
390 | (0x303A, 0x80B0): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
391 | "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
|
392 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
393 | (0x303A, 0x80B3): [ |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
394 | "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
|
395 | ], |
8096 | 396 | (0x3171, 0x0100): [ |
397 | "CMDBOOT", # COMMANDER | |
398 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
399 | (0xCAFE, 0xFFFF): [ |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
400 | "F303BOOT", # STM32F303 Discovery |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
401 | ], |
8096 | 402 | }, |
403 | "instructions": QCoreApplication.translate( | |
404 | "UF2FlashDialog", | |
405 | "<h3>CircuitPython Board</h3>" | |
406 | "<p>In order to prepare the board for flashing follow these" | |
407 | " steps:</p><ol>" | |
408 | "<li>Switch your device to 'bootloader' mode by double-pressing" | |
409 | " the reset button.</li>" | |
410 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
411 | "<li>(If this does not happen, then try shorter or longer" | |
412 | " pauses between presses.)</li>" | |
413 | "<li>Ensure the boot volume is available (this may require" | |
414 | " mounting it).</li>" | |
415 | "<li>Select the firmware file to be flashed and click the" | |
416 | " flash button.</li>" | |
417 | "</ol>" | |
418 | ), | |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
419 | "show_all": True, |
8096 | 420 | "firmware": "CircuitPython", |
421 | }, | |
422 | ||
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
423 | "circuitpython_rp2040": { |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
424 | "volumes": { |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
425 | (0x239A, 0x80F4): [ |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
426 | "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
|
427 | ], |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
428 | }, |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
429 | "instructions": QCoreApplication.translate( |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
430 | "UF2FlashDialog", |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
431 | "<h3>Pi Pico (RP2040) Board</h3>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
432 | "<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
|
433 | " steps:</p><ol>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
434 | "<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
|
435 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
436 | "<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
|
437 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
438 | "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
|
439 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
440 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
441 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
442 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
443 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
444 | "</ul></li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
445 | "<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
|
446 | "<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
|
447 | " mounting it).</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
448 | "<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
|
449 | " flash button.</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
450 | "</ol>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
451 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
452 | "show_all": False, |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
453 | "firmware": "CircuitPython", |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
454 | }, |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
455 | |
8096 | 456 | "rp2040": { |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
457 | "volumes": { |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
458 | (0x0000, 0x0000): [ |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
459 | "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
|
460 | ], |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
461 | }, |
8096 | 462 | "instructions": QCoreApplication.translate( |
463 | "UF2FlashDialog", | |
464 | "<h3>Pi Pico (RP2040) Board</h3>" | |
465 | "<p>In order to prepare the board for flashing follow these" | |
466 | " steps:</p><ol>" | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
467 | "<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
|
468 | "<ul>" |
8096 | 469 | "<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
|
470 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
471 | "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
|
472 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
473 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
474 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
475 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
476 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
477 | "</ul></li>" |
8096 | 478 | "<li>Wait until the device has entered 'bootloader' mode.</li>" |
479 | "<li>Ensure the boot volume is available (this may require" | |
480 | " mounting it).</li>" | |
481 | "<li>Select the firmware file to be flashed and click the" | |
482 | " flash button.</li>" | |
483 | "</ol>" | |
484 | ), | |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
485 | "show_all": True, |
8120
84928e9f446f
UF2FlashDialog: updated a string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8111
diff
changeset
|
486 | "firmware": "MicroPython / CircuitPython", |
8096 | 487 | }, |
488 | } | |
489 | ||
490 | ||
491 | def getFoundDevices(boardType=""): | |
492 | """ | |
493 | Function to get the list of known serial devices supporting UF2. | |
494 | ||
495 | @param boardType specific board type to search for | |
496 | @type str | |
497 | @return list of tuples with the board type, the port description, the | |
498 | VID and PID | |
499 | @rtype list of tuple of (str, str, int, int) | |
500 | """ | |
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
|
501 | from PyQt6.QtSerialPort import QSerialPortInfo |
8096 | 502 | |
503 | foundDevices = [] | |
504 | ||
505 | availablePorts = QSerialPortInfo.availablePorts() | |
506 | for port in availablePorts: | |
507 | vid = port.vendorIdentifier() | |
508 | pid = port.productIdentifier() | |
509 | ||
510 | if vid == 0 and pid == 0: | |
511 | # no device detected at port | |
512 | continue | |
513 | ||
514 | 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
|
515 | 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
|
516 | (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
|
517 | (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
|
518 | ): |
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
|
519 | 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
|
520 | 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
|
521 | 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
|
522 | (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
|
523 | )) |
8096 | 524 | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
525 | # 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
|
526 | for board in SupportedUF2Boards: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
527 | 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
|
528 | with contextlib.suppress(KeyError): |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
529 | # find mounted volume |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
530 | volumes = SupportedUF2Boards[board]["volumes"][(0, 0)] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
531 | foundVolumes = [] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
532 | for volume in volumes: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
533 | foundVolumes += Utilities.findVolume(volume, findAll=True) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
534 | if foundVolumes: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
535 | foundDevices.append(( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
536 | board, |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
537 | QCoreApplication.translate( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
538 | "UF2FlashDialog", "'{0}' Board").format(board), |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
539 | (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
|
540 | )) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
541 | |
8096 | 542 | return foundDevices |
543 | ||
544 | ||
545 | class UF2FlashDialog(QDialog, Ui_UF2FlashDialog): | |
546 | """ | |
547 | Class implementing a dialog to flash any UF2 capable device. | |
548 | """ | |
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
|
549 | 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
|
550 | DeviceVidPidRole = Qt.ItemDataRole.UserRole + 1 |
8096 | 551 | |
552 | def __init__(self, boardType="", parent=None): | |
553 | """ | |
554 | Constructor | |
555 | ||
556 | @param boardType specific board type to show the dialog for | |
557 | @type str | |
558 | @param parent reference to the parent widget (defaults to None) | |
559 | @type QWidget (optional) | |
560 | """ | |
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
|
561 | super().__init__(parent) |
8096 | 562 | self.setupUi(self) |
563 | ||
564 | self.refreshButton.setIcon(UI.PixmapCache.getIcon("rescan")) | |
565 | ||
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
|
566 | self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
8096 | 567 | self.firmwarePicker.setFilters( |
568 | self.tr("MicroPython/CircuitPython Files (*.uf2);;" | |
569 | "All Files (*)")) | |
570 | ||
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
|
571 | self.bootPicker.setMode(EricPathPickerModes.DIRECTORY_SHOW_FILES_MODE) |
8096 | 572 | self.bootPicker.setEnabled(False) |
573 | ||
574 | 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
|
575 | "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
|
576 | 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
|
577 | "QLineEdit {border: 2px solid; border-color: #800000}" |
8096 | 578 | ) |
579 | self.__manualType = "<manual>" | |
580 | ||
581 | self.__boardType = boardType | |
582 | ||
583 | self.__populate() | |
584 | ||
585 | self.__updateFlashButton() | |
586 | ||
587 | def __populate(self): | |
588 | """ | |
589 | Private method to (re-)populate the dialog. | |
590 | """ | |
591 | # save the currently selected device | |
592 | currentDevice = self.devicesComboBox.currentText() | |
593 | firmwareFile = self.firmwarePicker.text() | |
594 | ||
595 | # clear the entries first | |
596 | self.devicesComboBox.clear() | |
597 | self.firmwarePicker.clear() | |
598 | self.bootPicker.clear() | |
599 | self.infoLabel.clear() | |
600 | self.infoEdit.clear() | |
601 | ||
602 | # now populate the entries with data | |
603 | devices = getFoundDevices(boardType=self.__boardType) | |
604 | if len(devices) == 0: | |
605 | # no device detected | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
606 | devices = list(filter( |
8096 | 607 | lambda x: x[0] in SupportedUF2Boards, |
608 | MicroPythonDevices.getFoundDevices()[0] | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
609 | )) |
8096 | 610 | if devices: |
611 | self.__showSpecificInstructions(list(devices)) | |
612 | else: | |
613 | self.__showAllInstructions() | |
614 | self.devicesComboBox.addItem("") | |
615 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
616 | self.devicesComboBox.setItemData(1, self.__manualType, | |
617 | self.DeviceTypeRole) | |
618 | elif len(devices) == 1: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
619 | # 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
|
620 | self.__boardType = devices[0][0] |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
621 | |
8096 | 622 | self.devicesComboBox.addItem(devices[0][1]) |
623 | self.devicesComboBox.setItemData( | |
624 | 0, devices[0][0], self.DeviceTypeRole) | |
625 | self.devicesComboBox.setItemData( | |
626 | 0, devices[0][2], self.DeviceVidPidRole) | |
627 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
628 | self.devicesComboBox.setItemData(1, self.__manualType, | |
629 | self.DeviceTypeRole) | |
630 | self.on_devicesComboBox_currentIndexChanged(0) | |
631 | else: | |
632 | self.devicesComboBox.addItem("") | |
633 | for index, (boardType, description, | |
634 | vidpid) in enumerate(sorted(devices), 1): | |
635 | self.devicesComboBox.addItem(description) | |
636 | self.devicesComboBox.setItemData( | |
637 | index, boardType, self.DeviceTypeRole) | |
638 | self.devicesComboBox.setItemData( | |
639 | index, vidpid, self.DeviceVidPidRole) | |
640 | self.devicesComboBox.addItem(self.tr("Manual Select")) | |
641 | self.devicesComboBox.setItemData(index + 1, self.__manualType, | |
642 | self.DeviceTypeRole) | |
643 | ||
644 | # reselect the remembered device, if it is still there | |
645 | if currentDevice: | |
646 | self.devicesComboBox.setCurrentText(currentDevice) | |
647 | self.firmwarePicker.setText(firmwareFile) | |
648 | else: | |
649 | self.devicesComboBox.setCurrentIndex(0) | |
650 | ||
651 | def __updateFlashButton(self): | |
652 | """ | |
653 | Private method to update the state of the Flash button and the retest | |
654 | button. | |
655 | """ | |
656 | firmwareFile = self.firmwarePicker.text() | |
657 | if self.devicesComboBox.currentData(self.DeviceTypeRole) is not None: | |
658 | if bool(firmwareFile) and os.path.exists(firmwareFile): | |
659 | self.firmwarePicker.setStyleSheet("") | |
660 | else: | |
661 | self.firmwarePicker.setStyleSheet(self.__mandatoryStyleSheet) | |
662 | ||
663 | if bool(self.bootPicker.text()): | |
664 | self.bootPicker.setStyleSheet("") | |
665 | else: | |
666 | self.bootPicker.setStyleSheet(self.__mandatoryStyleSheet) | |
667 | else: | |
668 | self.firmwarePicker.setStyleSheet("") | |
669 | self.bootPicker.setStyleSheet("") | |
670 | ||
671 | enable = ( | |
672 | bool(self.bootPicker.text()) and | |
673 | bool(firmwareFile) and | |
674 | os.path.exists(firmwareFile) | |
675 | ) | |
676 | self.flashButton.setEnabled(enable) | |
677 | ||
678 | def __showAllInstructions(self): | |
679 | """ | |
680 | Private method to show instructions for resetting devices to bootloader | |
681 | mode. | |
682 | """ | |
683 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
684 | ||
685 | htmlText = self.tr( | |
686 | "<h4>No known devices detected.</h4>" | |
687 | "<p>Follow the appropriate instructions below to set <b>one</b>" | |
688 | " board into 'bootloader' mode. Press <b>Refresh</b> when ready." | |
689 | "</p>" | |
690 | ) | |
691 | 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
|
692 | 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
|
693 | htmlText += ( |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
694 | "<hr/>" + |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
695 | SupportedUF2Boards[boardType]["instructions"] |
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
696 | ) |
8096 | 697 | self.infoEdit.setHtml(htmlText) |
698 | ||
699 | def __showSpecificInstructions(self, devices): | |
700 | """ | |
701 | Private method to show instructions for resetting devices to bootloader | |
702 | mode for a list of detected devices. | |
703 | ||
704 | @param devices list of detected devices | |
705 | @type list of str | |
706 | """ | |
8099
522946e53835
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8097
diff
changeset
|
707 | boardTypes = {x[0] for x in devices} |
8096 | 708 | |
709 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
710 | ||
711 | if self.__boardType: | |
712 | htmlText = self.tr( | |
713 | "<h4>Flash {0} Firmware</h4>" | |
714 | "<p>Follow the instructions below to set <b>one</b> board into" | |
715 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
716 | "<hr/>{1}" | |
717 | ).format( | |
718 | SupportedUF2Boards[self.__boardType]["firmware"], | |
719 | SupportedUF2Boards[self.__boardType]["instructions"], | |
720 | ) | |
721 | else: | |
722 | htmlText = self.tr( | |
723 | "<h4>Potentially UF2 capable devices found</h4>" | |
724 | "<p>Found these potentially UF2 capable devices:</p>" | |
725 | "<ul><li>{0}</li></ul>" | |
726 | "<p>Follow the instructions below to set <b>one</b> board into" | |
727 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
728 | ).format( | |
729 | "</li><li>".join(sorted(x[1] for x in devices)) | |
730 | ) | |
731 | for boardType in sorted(boardTypes): | |
732 | htmlText += ( | |
733 | "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
734 | ) | |
735 | self.infoEdit.setHtml(htmlText) | |
736 | ||
737 | def __showTypedInstructions(self, boardType): | |
738 | """ | |
739 | Private method to show instructions for resetting devices to bootloader | |
740 | mode for a specific board type. | |
741 | ||
742 | @param boardType type of the board to show instructions for | |
743 | @type str | |
744 | """ | |
745 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
746 | ||
747 | htmlText = self.tr( | |
748 | "<h4>No known devices detected.</h4>" | |
749 | "<p>Follow the instructions below to set <b>one</b> board into" | |
750 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
751 | ) | |
752 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
753 | self.infoEdit.setHtml(htmlText) | |
754 | ||
755 | def __showManualInstructions(self): | |
756 | """ | |
757 | Private method to show instructions for flashing devices manually. | |
758 | """ | |
759 | self.infoLabel.setText(self.tr("Flash Instructions:")) | |
760 | ||
761 | htmlText = self.tr( | |
762 | "<h4>Flash method 'manual' selected.</h4>" | |
763 | "<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
|
764 | " the data manually.</p><ol>" |
8096 | 765 | "<li>Change the device to 'bootloader' mode.</li>" |
766 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
767 | "<li>Ensure the boot volume is available (this may require" | |
768 | " mounting it) and select its path.</li>" | |
769 | "<li>Select the firmware file to be flashed and click the" | |
770 | " flash button.</li>" | |
771 | "</ol>" | |
772 | ) | |
773 | for boardType in SupportedUF2Boards: | |
774 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
775 | self.infoEdit.setHtml(htmlText) | |
776 | ||
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
777 | def __showNoVolumeInformation(self, volumes, boardType): |
8096 | 778 | """ |
779 | Private method to show information about the expected boot volume(s). | |
780 | ||
781 | @param volumes list of expected volume names | |
782 | @type list of str | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
783 | @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
|
784 | @type str |
8096 | 785 | """ |
786 | self.infoLabel.setText(self.tr("Boot Volume not found:")) | |
787 | ||
788 | htmlText = self.tr( | |
789 | "<h4>No Boot Volume detected.</h4>" | |
790 | "<p>Please ensure that the boot volume of the device to be flashed" | |
791 | " is available. " | |
792 | ) | |
793 | if len(volumes) == 1: | |
794 | htmlText += self.tr( | |
795 | "This volume should be named <b>{0}</b>." | |
796 | " Press <b>Refresh</b> when ready.</p>" | |
797 | ).format(volumes[0]) | |
798 | else: | |
799 | htmlText += self.tr( | |
800 | "This volume should have one of these names.</p>" | |
801 | "<ul><li>{0}</li></ul>" | |
802 | "<p>Press <b>Refresh</b> when ready.</p>" | |
803 | ).format("</li><li>".join(sorted(volumes))) | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
804 | |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
805 | if boardType: |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
806 | htmlText += self.tr( |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
807 | "<h4>Reset Instructions</h4>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
808 | "<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
|
809 | " '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
|
810 | ) |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
811 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
812 | |
8096 | 813 | self.infoEdit.setHtml(htmlText) |
814 | ||
815 | def __showMultipleVolumesInformation(self, volumePaths): | |
816 | """ | |
817 | Private method to show information because multiple devices of the | |
818 | same type are ready for flashing. | |
819 | ||
820 | Note: This is a dangerous situation! | |
821 | ||
822 | @param volumePaths list of volume paths | |
823 | @type list of str | |
824 | """ | |
825 | self.infoLabel.setText(self.tr("Multiple Boot Volumes found:")) | |
826 | ||
827 | htmlText = self.tr( | |
828 | "<h4>Multiple Boot Volumes were found</h4>" | |
829 | "<p>These volume paths were found.</p><ul><li>{0}</li></ul>" | |
830 | "<p>Please ensure that only one device of a type is ready for" | |
831 | " flashing. Press <b>Refresh</b> when ready.</p>" | |
832 | ).format("</li><li>".join(sorted(volumePaths))) | |
833 | self.infoEdit.setHtml(htmlText) | |
834 | ||
835 | @pyqtSlot() | |
836 | def on_flashButton_clicked(self): | |
837 | """ | |
838 | Private slot to flash the selected MicroPython or CircuitPython | |
839 | firmware onto the device. | |
840 | """ | |
841 | boardType = self.devicesComboBox.currentData(self.DeviceTypeRole) | |
842 | firmwarePath = self.firmwarePicker.text() | |
843 | volumePath = self.bootPicker.text() | |
844 | 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
|
845 | if boardType == self.__manualType: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
846 | 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
|
847 | self.infoEdit.setHtml(self.tr( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
848 | "<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
|
849 | " 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
|
850 | ) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
851 | else: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
852 | firmwareType = SupportedUF2Boards[boardType]["firmware"] |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
853 | self.infoLabel.setText( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
854 | self.tr("Flashing {0}").format(firmwareType)) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
855 | self.infoEdit.setHtml(self.tr( |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
856 | "<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
|
857 | " until the device resets automatically.</p>" |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
858 | ).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
|
859 | 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
|
860 | QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) |
8096 | 861 | shutil.copy2(firmwarePath, volumePath) |
862 | QThread.sleep(1) | |
863 | self.on_refreshButton_clicked() | |
864 | ||
865 | @pyqtSlot() | |
866 | def on_refreshButton_clicked(self): | |
867 | """ | |
868 | Private slot to refresh the dialog. | |
869 | """ | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
870 | # special treatment for RPi Pico |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
871 | if self.__boardType == "circuitpython_rp2040": |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
872 | self.__boardType = "rp2040" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
873 | |
8096 | 874 | self.__populate() |
875 | ||
876 | @pyqtSlot(int) | |
877 | def on_devicesComboBox_currentIndexChanged(self, index): | |
878 | """ | |
879 | Private slot to handle the selection of a board. | |
880 | ||
881 | @param index selected index | |
882 | @type int | |
883 | """ | |
884 | vidpid = self.devicesComboBox.itemData(index, self.DeviceVidPidRole) | |
885 | boardType = self.devicesComboBox.itemData(index, self.DeviceTypeRole) | |
886 | ||
887 | self.bootPicker.setEnabled(boardType == self.__manualType) | |
888 | if boardType == self.__manualType: | |
889 | self.__showManualInstructions() | |
890 | ||
891 | if vidpid is None: | |
892 | if boardType is None: | |
893 | self.bootPicker.clear() | |
894 | else: | |
895 | volumes = SupportedUF2Boards[boardType]["volumes"][vidpid] | |
896 | foundVolumes = [] | |
897 | for volume in volumes: | |
898 | foundVolumes += Utilities.findVolume(volume, findAll=True) | |
899 | ||
900 | if len(foundVolumes) == 0: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
901 | self.__showNoVolumeInformation(volumes, boardType) |
8096 | 902 | self.bootPicker.clear() |
903 | elif len(foundVolumes) == 1: | |
904 | self.bootPicker.setText(foundVolumes[0]) | |
905 | else: | |
906 | self.__showMultipleVolumesInformation() | |
907 | self.bootPicker.clear() | |
908 | ||
909 | self.__updateFlashButton() | |
910 | ||
911 | @pyqtSlot(str) | |
912 | def on_firmwarePicker_textChanged(self, text): | |
913 | """ | |
914 | Private slot handling a change of the firmware file. | |
915 | ||
916 | @param text current text of the firmware edit | |
917 | @type str | |
918 | """ | |
919 | self.__updateFlashButton() | |
920 | ||
921 | @pyqtSlot(str) | |
922 | def on_bootPicker_textChanged(self, text): | |
923 | """ | |
924 | Private slot handling a change of the boot volume. | |
925 | ||
926 | @param text current text of the boot volume edit | |
927 | @type str | |
928 | """ | |
929 | self.__updateFlashButton() |