Mon, 04 Mar 2024 18:16:19 +0100
MicroPython
- Updated the list of known CircuitPython boards.
- Updated the list of known UF2 capable boards.
8096 | 1 | # -*- coding: utf-8 -*- |
2 | ||
10439
21c28b0f9e41
Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10373
diff
changeset
|
3 | # Copyright (c) 2021 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> |
8096 | 4 | # |
5 | ||
6 | """ | |
7 | Module implementing a dialog to flash any UF2 capable device. | |
8 | """ | |
9 | ||
10172 | 10 | import contextlib |
8096 | 11 | import os |
12 | import shutil | |
13 | ||
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
14 | from PyQt6.QtCore import QCoreApplication, QEventLoop, Qt, QThread, pyqtSlot |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
15 | from PyQt6.QtSerialPort import QSerialPortInfo |
9815 | 16 | from PyQt6.QtWidgets import QDialog, QInputDialog |
8096 | 17 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
18 | from eric7.EricGui import EricPixmapCache |
9903 | 19 | from eric7.EricWidgets import EricMessageBox |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9248
diff
changeset
|
20 | from eric7.EricWidgets.EricApplication import ericApp |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
21 | from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
22 | from eric7.SystemUtilities import FileSystemUtilities, OSUtilities |
8096 | 23 | |
9759
4543b7876047
Adapted some MicroPython modules to the new package layout.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9736
diff
changeset
|
24 | from . import Devices |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
25 | from .Ui_UF2FlashDialog import Ui_UF2FlashDialog |
8096 | 26 | |
27 | SupportedUF2Boards = { | |
28 | "circuitpython": { | |
29 | "volumes": { | |
30 | (0x03EB, 0x2402): [ | |
9903 | 31 | ("SAMD21", "SAMD21 Board"), |
32 | ("SAME54", "SAME54 Board"), | |
8096 | 33 | ], |
9248 | 34 | (0x04D8, 0xE799): [ |
10208 | 35 | ("ZEROBOOT", "Maker Zero SAMD21"), |
9248 | 36 | ], |
8096 | 37 | (0x04D8, 0xEC44): [ |
9903 | 38 | ("PYCUBEDBOOT", "PyCubedv04"), |
8096 | 39 | ], |
40 | (0x04D8, 0xEC63): [ | |
9903 | 41 | ("BOOT", "CircuitBrains Basic"), |
8096 | 42 | ], |
43 | (0x04D8, 0xEC64): [ | |
9903 | 44 | ("BOOT", "CircuitBrains Deluxe"), |
8096 | 45 | ], |
46 | (0x04D8, 0xED5F): [ | |
9903 | 47 | ("UCHIPYBOOT", "uChip CircuitPython"), |
8096 | 48 | ], |
49 | (0x04D8, 0xEDB3): [ | |
9903 | 50 | ("USBHUBBOOT", "Programmable USB Hub"), |
8096 | 51 | ], |
52 | (0x04D8, 0xEDBE): [ | |
9903 | 53 | ("SAM32BOOT", "SAM32"), |
8096 | 54 | ], |
55 | (0x04D8, 0xEF66): [ | |
9903 | 56 | ("SENSEBOX", "senseBox MCU"), |
8096 | 57 | ], |
58 | (0x1209, 0x2017): [ | |
9903 | 59 | ("MINISAMBOOT", "Mini SAM M4"), |
8096 | 60 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
61 | (0x1209, 0x3252): [ |
9903 | 62 | ("MCBS2OMBOOT", "Module Clip w/Wroom"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
63 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
64 | (0x1209, 0x3253): [ |
9903 | 65 | ("MCBS2ERBOOT", "Module Clip w/Wrover"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
66 | ], |
8096 | 67 | (0x1209, 0x4D44): [ |
9903 | 68 | ("ROBOM0BOOT", "Robo HAT MM1"), |
69 | ("ROBOM4BOOT", "Robo HAT MM1 M4"), | |
8096 | 70 | ], |
71 | (0x1209, 0x4DDD): [ | |
9903 | 72 | ("SapBOOT", "CP Sapling"), |
8096 | 73 | ], |
74 | (0x1209, 0x7102): [ | |
9903 | 75 | ("MINISAMBOOT", "Mini SAM M0"), |
8096 | 76 | ], |
9248 | 77 | (0x1209, 0x7380): [ |
9903 | 78 | ("CH840BOOT", "ILabs Challenger 840"), |
9248 | 79 | ], |
8919 | 80 | (0x1209, 0x7A01): [ |
9903 | 81 | ("MIKOTO-BOOT", "Mikoto nRF52840"), |
8919 | 82 | ], |
8096 | 83 | (0x1209, 0x805A): [ |
9903 | 84 | ("BASTBLE", "Bast BLE"), |
8096 | 85 | ], |
86 | (0x1209, 0xE3E2): [ | |
9903 | 87 | ("StackRduino", "StackRduino M0 PRO"), |
8096 | 88 | ], |
89 | (0x1209, 0xF501): [ | |
9903 | 90 | ("M4SHIMBOOT", "M4-Shim"), |
8096 | 91 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
92 | (0x15BA, 0x28DC): [ |
9903 | 93 | ("OLMLIPOBOOT", "ESP32S2 DevKit Lipo"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
94 | ], |
8096 | 95 | (0x16D0, 0x0CDA): [ |
9903 | 96 | ("AUTOMAT", "automat"), |
8096 | 97 | ], |
9614 | 98 | (0x16D0, 0x10ED): [ |
9903 | 99 | ("PillBug", "PillBug"), |
9614 | 100 | ], |
9248 | 101 | (0x1B4F, 0x0019): [ |
9903 | 102 | ("QwiicMicro", "Qwiic Micro SamD21"), |
9248 | 103 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
104 | (0x1B4F, 0x0022): [ |
9903 | 105 | ("SFMM852BOOT", "MicroMod nRF52840"), |
8096 | 106 | ], |
8956 | 107 | (0x1B4F, 0x002C): [ |
9903 | 108 | ("THNG+32BOOT", "Thing Plus - STM32"), |
8956 | 109 | ], |
10626 | 110 | (0x1B4F, 0x002D): [ |
111 | ("MM-F405BOOT", "MicroMod STM32F405"), | |
112 | ], | |
8096 | 113 | (0x1B4F, 0x0D22): [ |
9903 | 114 | ("SPARKFUN", "SAMD21 Mini Breakout"), |
8096 | 115 | ], |
116 | (0x1B4F, 0x0D23): [ | |
9903 | 117 | ("SPARKFUN", "SAMD21 Dev Breakout"), |
8096 | 118 | ], |
119 | (0x1D50, 0x6110): [ | |
9903 | 120 | ("ROBOTICS", "Robotics"), |
8096 | 121 | ], |
122 | (0x1D50, 0x6112): [ | |
9903 | 123 | ("RCBOOT", "Wattuino RC"), |
8096 | 124 | ], |
8919 | 125 | (0x1D50, 0x6157): [ |
9903 | 126 | ("BBOARDBOOT", "nRF52840 BBoard"), |
8919 | 127 | ], |
8096 | 128 | (0x1D50, 0x6160): [ |
9903 | 129 | ("BLUEMICRO", "BlueMicro"), |
8096 | 130 | ], |
8919 | 131 | (0x1D50, 0x616F): [ |
9903 | 132 | ("BLUEMICRO", "BlueMicro"), |
8919 | 133 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
134 | (0x1FC9, 0x0094): [ |
9903 | 135 | ("DblM33BOOT", "Double M33"), |
136 | ("LPC5528BOOT", "LPCXpresso 55s28"), | |
137 | ("LPC5569BOOT", "LPCXpresso 55s69"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
138 | ], |
8919 | 139 | (0x1FC9, 0x0154): [ |
9903 | 140 | ("K32L2BOOT", "FRDM-K32L2B3"), |
141 | ("K32L2BOOT", "KUIIC"), | |
8919 | 142 | ], |
8096 | 143 | (0x230A, 0x00E9): [ |
9903 | 144 | ("TAU_BOOT", "Tau"), |
8096 | 145 | ], |
146 | (0x2341, 0x0057): [ | |
9903 | 147 | ("NANOBOOT", "NANO 33 IoT"), |
8096 | 148 | ], |
149 | (0x2341, 0x8053): [ | |
9903 | 150 | ("MKR1300", "MKR1300"), |
151 | ], | |
152 | (0x2341, 0x8056): [ | |
153 | ("VIDOR4000", "MKR Vidor 4000"), | |
8096 | 154 | ], |
155 | (0x239A, 0x000F): [ | |
9903 | 156 | ("ITSYBOOT", "ItsyBitsy M0 Express"), |
8096 | 157 | ], |
158 | (0x239A, 0x0013): [ | |
9903 | 159 | ("METROBOOT", "Metro M0"), |
8096 | 160 | ], |
161 | (0x239A, 0x0015): [ | |
9903 | 162 | ("FEATHERBOOT", "Feather M0"), |
8096 | 163 | ], |
164 | (0x239A, 0x0018): [ | |
9903 | 165 | ("CPLAYBOOT", "CPlay Express"), |
8096 | 166 | ], |
167 | (0x239A, 0x001B): [ | |
9903 | 168 | ("FEATHERBOOT", "Feather M0 Express"), |
8096 | 169 | ], |
170 | (0x239A, 0x001C): [ | |
9903 | 171 | ("GEMMABOOT", "Gemma M0"), |
8096 | 172 | ], |
173 | (0x239A, 0x001E): [ | |
9903 | 174 | ("TRINKETBOOT", "Trinket M0"), |
8096 | 175 | ], |
176 | (0x239A, 0x0021): [ | |
10626 | 177 | ("METROM4BOOT", "Metro M4 Rev B"), |
8096 | 178 | ], |
179 | (0x239A, 0x0022): [ | |
9903 | 180 | ("ARCADE-D5", "Feather Arcade D51"), |
181 | ("FEATHERBOOT", "Feather M4 Express"), | |
8096 | 182 | ], |
183 | (0x239A, 0x0024): [ | |
9903 | 184 | ("RADIOBOOT", "Radiofruit M0"), |
8096 | 185 | ], |
186 | (0x239A, 0x0027): [ | |
9903 | 187 | ("PIRKEYBOOT", "pIRKey M0"), |
8096 | 188 | ], |
189 | (0x239A, 0x0029): [ | |
10208 | 190 | ("ARCADE-N4", "Feather nRF52840 Express"), |
9903 | 191 | ("ARGONBOOT ", "Argon"), |
192 | ("BORONBOOT ", "Boron"), | |
193 | ("FTHR833BOOT", "Feather nRF52833 Express"), | |
194 | ("FTHR840BOOT", "Feather nRF52840 Express"), | |
195 | ("MDK840DONGL", "MDK nRF52840 USB Dongle"), | |
196 | ("WS52840EVK", "Waveshare nRF52840 Eval"), | |
197 | ("XENONBOOT ", "Xenon"), | |
8096 | 198 | ], |
199 | (0x239A, 0x002B): [ | |
9903 | 200 | ("ARCADE-D5", "Itsy Arcade D51"), |
201 | ("ITSYM4BOOT", "ItsyBitsy M4 Express"), | |
8096 | 202 | ], |
203 | (0x239A, 0x002D): [ | |
9903 | 204 | ("CRICKITBOOT", "crickit"), |
8096 | 205 | ], |
206 | (0x239A, 0x002F): [ | |
9903 | 207 | ("TRELM4BOOT", "Trellis M4 Express"), |
8096 | 208 | ], |
209 | (0x239A, 0x0031): [ | |
9903 | 210 | ("GCM4BOOT", "Grand Central M4 Express"), |
8096 | 211 | ], |
212 | (0x239A, 0x0033): [ | |
9903 | 213 | ("PYBADGEBOOT", "PyBadge"), |
8096 | 214 | ], |
215 | (0x239A, 0x0034): [ | |
9903 | 216 | ("BADGELCBOOT", "BadgeLC"), |
217 | ("PEWBOOT", "PewPew"), | |
8096 | 218 | ], |
219 | (0x239A, 0x0035): [ | |
9903 | 220 | ("MKRZEROBOOT", "MKRZero"), |
221 | ("PORTALBOOT", "PyPortal M4 Express"), | |
8096 | 222 | ], |
223 | (0x239A, 0x0037): [ | |
9903 | 224 | ("METROM4BOOT", "Metro M4 AirLift"), |
8096 | 225 | ], |
226 | (0x239A, 0x003D): [ | |
9903 | 227 | ("PYGAMERBOOT", "PyGamer"), |
8096 | 228 | ], |
229 | (0x239A, 0x003F): [ | |
9903 | 230 | ("METR840BOOT", "Metro nRF52840 Express"), |
8096 | 231 | ], |
232 | (0x239A, 0x0045): [ | |
9903 | 233 | ("CPLAYBTBOOT", "Circuit Playground nRF52840"), |
8096 | 234 | ], |
235 | (0x239A, 0x0047): [ | |
9903 | 236 | ("MASKM4BOOT", "Hallowing Mask M4"), |
8096 | 237 | ], |
238 | (0x239A, 0x0049): [ | |
9903 | 239 | ("HALLOM4BOOT", "HalloWing M4"), |
8096 | 240 | ], |
241 | (0x239A, 0x004D): [ | |
9903 | 242 | ("SNEKBOOT", "snekboard"), |
8096 | 243 | ], |
244 | (0x239A, 0x0051): [ | |
9903 | 245 | ("ITSY840BOOT", "ItsyBitsy nRF52840 Express"), |
8096 | 246 | ], |
247 | (0x239A, 0x0057): [ | |
9903 | 248 | ("SERPENTBOOT", "Serpente"), |
8096 | 249 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
250 | (0x239A, 0x0059): [ |
9903 | 251 | ("FTHR405BOOT", "Feather STM32F405 Express"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
252 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
253 | (0x239A, 0x005D): [ |
9903 | 254 | ("BlackPill", "STM32F401CxUx"), |
10626 | 255 | ("MiniSTM32H7", "STM32FH750VBT6"), |
9903 | 256 | ("STMF411BOOT", "STM32F411 Discovery"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
257 | ], |
8096 | 258 | (0x239A, 0x0061): [ |
9903 | 259 | ("SOLBOOT", "Sol"), |
8096 | 260 | ], |
261 | (0x239A, 0x0063): [ | |
9903 | 262 | ("NANO33BOOT", "Nano 33 BLE"), |
8096 | 263 | ], |
264 | (0x239A, 0x0065): [ | |
9903 | 265 | ("ND6BOOT", "ndBit6"), |
8096 | 266 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
267 | (0x239A, 0x0069): [ |
9903 | 268 | ("STMF411BOOT", "STM32F411 BlackPill"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
269 | ], |
8096 | 270 | (0x239A, 0x006B): [ |
9903 | 271 | ("shIRtty", "shIRtty"), |
8096 | 272 | ], |
273 | (0x239A, 0x0071): [ | |
9903 | 274 | ("CLUEBOOT", "CLUE nRF52840"), |
8096 | 275 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
276 | (0x239A, 0x0077): [ |
9903 | 277 | ("RT1010BOOT", "RT1010 EVK"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
278 | ], |
8096 | 279 | (0x239A, 0x0079): [ |
9903 | 280 | ("ARAMBOOT", "ARAMCON Badge 2019"), |
8096 | 281 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
282 | (0x239A, 0x007B): [ |
9903 | 283 | ("ARAMBOOT", "ARAMCON2 Badge"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
284 | ], |
8096 | 285 | (0x239A, 0x007D): [ |
9903 | 286 | ("BOOKBOOT", "The Open Book Feather"), |
8096 | 287 | ], |
288 | (0x239A, 0x007F): [ | |
9903 | 289 | ("BADGEBOOT", "OHS2020 Badge"), |
8096 | 290 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
291 | (0x239A, 0x0081): [ |
9903 | 292 | ("RT1020BOOT", "RT1020 EVK"), |
293 | ("RT1024BOOT", "RT1024 EVK"), | |
8101
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, 0x0083): [ |
9903 | 296 | ("RT1060BOOT", "RT1060 EVK"), |
297 | ("RT1064BOOT", "RT1064 EVK"), | |
298 | ], | |
299 | (0x239A, 0x0085): [ | |
300 | ("TNSY40BOOT", "Teensy 4.0"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
301 | ], |
8096 | 302 | (0x239A, 0x0087): [ |
9903 | 303 | ("FTHRSNSBOOT", "Feather nRF52840 Sense"), |
10626 | 304 | ("SENSTFTBOOT", "Feather nRF52840 Sense TFT"), |
8096 | 305 | ], |
306 | (0x239A, 0x0093): [ | |
9903 | 307 | ("ISVITABoot", "IkigaiSense Vita nRF52840"), |
8096 | 308 | ], |
309 | (0x239A, 0x0095): [ | |
9903 | 310 | ("UARTLOGBOOT", "UARTLogger II"), |
8096 | 311 | ], |
312 | (0x239A, 0x009F): [ | |
9903 | 313 | ("ADM840BOOT", "AtelierDuMaker NRF52840 Breakout"), |
8096 | 314 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
315 | (0x239A, 0x00A5): [ |
9903 | 316 | ("S3DKC1BOOT", "ESP32S3 DevKitC 1"), |
317 | ("S3DKM1BOOT", "ESP32S3 DevKitM 1"), | |
318 | ("SAOLA1RBOOT", "Saola 1R WROVER"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
319 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
320 | (0x239A, 0x00A7): [ |
9903 | 321 | ("SAOLA1MBOOT", "Saola 1M WROOM"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
322 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
323 | (0x239A, 0x00AB): [ |
9903 | 324 | ("UFTHRS2BOOT", "FeatherS2"), |
325 | ], | |
326 | (0x239A, 0x00AD): [ | |
327 | ("TNSY41BOOT", "Teensy 4.1"), | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
328 | ], |
8096 | 329 | (0x239A, 0x00AF): [ |
9903 | 330 | ("FLUFFBOOT", "Fluff M0"), |
8096 | 331 | ], |
332 | (0x239A, 0x00B3): [ | |
9903 | 333 | ("NICENANO", "nice!nano"), |
8096 | 334 | ], |
335 | (0x239A, 0x00B5): [ | |
9903 | 336 | ("E54XBOOT", "SAME54 Xplained"), |
8096 | 337 | ], |
338 | (0x239A, 0x00B9): [ | |
9903 | 339 | ("ND7BOOT", "ndBit7"), |
8096 | 340 | ], |
8919 | 341 | (0x239A, 0x00BB): [ |
9903 | 342 | ("MDBT50QBOOT", "Raytac MDBT50Q Demo Board 40"), |
8919 | 343 | ], |
8096 | 344 | (0x239A, 0x00BF): [ |
9903 | 345 | ("BADGEBOOT", "BLM Badge"), |
8096 | 346 | ], |
347 | (0x239A, 0x00C3): [ | |
9903 | 348 | ("GEMINIBOOT", "Gemini"), |
8096 | 349 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
350 | (0x239A, 0x00C5): [ |
9903 | 351 | ("MICROS2BOOT", "microS2"), |
8101
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, 0x00C7): [ |
9903 | 354 | ("KALUGA1BOOT", "Kaluga 1"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
355 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
356 | (0x239A, 0x00C9): [ |
9903 | 357 | ("MATRIXBOOT", "Matrix Portal M4"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
358 | ], |
8096 | 359 | (0x239A, 0x00CB): [ |
9903 | 360 | ("QTPY_BOOT", "QT Py M0"), |
8096 | 361 | ], |
362 | (0x239A, 0x00CD): [ | |
9903 | 363 | ("FTHRCANBOOT", "Feather M4 CAN Express"), |
8096 | 364 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
365 | (0x239A, 0x00DE): [ |
9903 | 366 | ("NANOESPBOOT", "nanoESP32-S2 WROOM"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
367 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
368 | (0x239A, 0x00DF): [ |
9903 | 369 | ("METROS2BOOT", "Metro ESP32-S2"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
370 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
371 | (0x239A, 0x00E1): [ |
9903 | 372 | ("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
|
373 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
374 | (0x239A, 0x00E5): [ |
9903 | 375 | ("MAGTAGBOOT", "Metro MagTag 2.9 Grayscale"), |
376 | ("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
|
377 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
378 | (0x239A, 0x00EB): [ |
9903 | 379 | ("FTHRS2BOOT", "Feather ESP32-S2"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
380 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
381 | (0x239A, 0x00ED): [ |
9903 | 382 | ("FTHRS2BOOT", "Feather ESP32-S2 Reverse TFT"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
383 | ], |
8096 | 384 | (0x239A, 0x00EF): [ |
9903 | 385 | ("TRINKEYBOOT", "NeoPixel Trinkey M0"), |
8096 | 386 | ], |
387 | (0x239A, 0x00F5): [ | |
9903 | 388 | ("STARBOOT", "Binary Star"), |
8096 | 389 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
390 | (0x239A, 0x00F9): [ |
9903 | 391 | ("HOUSEBOOT", "FunHouse"), |
8462
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 | (0x239A, 0x00FB): [ |
9903 | 394 | ("TRINKEYBOOT", "Rotary Trinkey M0"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
395 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
396 | (0x239A, 0x00FF): [ |
9903 | 397 | ("TRINKEYBOOT", "NeoKey Trinkey M0"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
398 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
399 | (0x239A, 0x0101): [ |
9903 | 400 | ("TRINKEYBOOT", "Slide Trinkey M0"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
401 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
402 | (0x239A, 0x0103): [ |
9903 | 403 | ("TRINKEYBOOT", "ProxSense Trinkey M0"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
404 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
405 | (0x239A, 0x010B): [ |
9903 | 406 | ("MDBT50QBOOT", "Raytac MDBT50Q-RX"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
407 | ], |
8919 | 408 | (0x239A, 0x010D): [ |
9903 | 409 | ("GLASSESBOOT", "LED Glasses Driver nRF52840"), |
8919 | 410 | ], |
411 | (0x239A, 0x010F): [ | |
9903 | 412 | ("FTHRS2BOOT", "Feather ESP32-S2 TFT"), |
8919 | 413 | ], |
414 | (0x239A, 0x0111): [ | |
9903 | 415 | ("QTPYS2BOOT", "QT Py ESP32-S2"), |
8919 | 416 | ], |
417 | (0x239A, 0x0115): [ | |
9903 | 418 | ("FEATHERBOOT", "Feather M4 Adalogger"), |
8919 | 419 | ], |
420 | (0x239A, 0x0117): [ | |
9903 | 421 | ("CAMERABOOT", "Camera"), |
10626 | 422 | ("CAMERABOOT", "PyCamera"), |
8919 | 423 | ], |
8956 | 424 | (0x239A, 0x0119): [ |
9903 | 425 | ("QTPYS3BOOT", "QT Py ESP32-S3"), |
8956 | 426 | ], |
10626 | 427 | (0x239A, 0x011B): [ |
428 | ("FTHRS3BOOT", "Feather ESP32-S3"), | |
429 | ], | |
9248 | 430 | (0x239A, 0x011D): [ |
9903 | 431 | ("FTHRS3BOOT", "Feather ESP32-S3 TFT"), |
9248 | 432 | ], |
9614 | 433 | (0x239A, 0x0123): [ |
9903 | 434 | ("FTHRS3BOOT", "Feather ESP32-S3 Reverse TFT"), |
9614 | 435 | ], |
436 | (0x239A, 0x0125): [ | |
9903 | 437 | ("MATRIXBOOT", "MatrixPortal ESP32-S2"), |
10112 | 438 | ("MATRXS3BOOT", "MatrixPortal S3"), |
439 | ], | |
440 | (0x239A, 0x0133): [ | |
441 | ("RT1050BOOT", "RT1050 EVK"), | |
442 | ], | |
443 | (0x239A, 0x0135): [ | |
444 | ("RT1040BOOT", "RT1040 EVK"), | |
445 | ], | |
446 | (0x239A, 0x0137): [ | |
447 | ("RT1015BOOT", "RT1015 EVK"), | |
448 | ], | |
449 | (0x239A, 0x013F): [ | |
450 | ("TOYS2BOOT", "My Little Hacker ESP32-S2"), | |
451 | ], | |
10626 | 452 | (0x239A, 0x0141): [ |
453 | ("METROM7BOOT", "Metro M7 iMX RT1011 SD"), | |
454 | ], | |
10112 | 455 | (0x239A, 0x0143): [ |
456 | ("QTPYS3BOOT", "QT Py ESP32-S3 (4M Flash, 2M PSRAM)"), | |
9614 | 457 | ], |
10626 | 458 | (0x239A, 0x0145): [ |
459 | ("METROS3BOOT", "Metro ESP32-S3"), | |
460 | ], | |
461 | (0x239A, 0x0147): [ | |
462 | ("TFT_S3BOOT", "Qualia ESP32-S3 RGB666"), | |
463 | ], | |
9614 | 464 | (0x239A, 0x2030): [ |
9903 | 465 | ("MBBOOT", "Maker badge"), |
9614 | 466 | ], |
10626 | 467 | (0x239A, 0x2031): [ |
468 | ("ES3inkBOOT", "ES3ink"), | |
469 | ], | |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
470 | (0x239A, 0x800B): [ |
9903 | 471 | ("ATMZBOOT", "ATMegaZero ESP32-S2"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
472 | ], |
8096 | 473 | (0x239A, 0xB000): [ |
9903 | 474 | ("HALLOWBOOT", "Hallowing M0"), |
8096 | 475 | ], |
476 | (0x239A, 0xE005): [ | |
9903 | 477 | ("HONKBOOT", "Big Honking Button"), |
8096 | 478 | ], |
479 | (0x2886, 0x000D): [ | |
9903 | 480 | ("Grove Zero", "Grove Zero"), |
8096 | 481 | ], |
482 | (0x2886, 0x002F): [ | |
9903 | 483 | ("Seeed XIAO", "Seeeduino XIAO"), |
484 | ], | |
485 | (0x2886, 0x0044): [ | |
486 | ("XIAO-BOOT", "XIAO nRF52840"), | |
487 | ], | |
488 | (0x2886, 0x0045): [ | |
489 | ("XIAO-SENSE", "XIAO nRF52840"), | |
8096 | 490 | ], |
10112 | 491 | (0x2886, 0x8056): [ |
492 | ("XIAOS3BOOT", "XIAO ESP32-S3"), | |
493 | ], | |
8096 | 494 | (0x2886, 0xF00E): [ |
9903 | 495 | ("PITAYAGO", "Pitaya Go"), |
8096 | 496 | ], |
497 | (0x2886, 0xF00F): [ | |
10626 | 498 | ("CONNECTKIT", "nRF52840 Connect Kit"), |
9903 | 499 | ("M60KEYBOARD", "MakerDiary M60 Mechanical Keyboard"), |
500 | ("nRF52840M2", "MakerDiary nRF52840 M.2 Module"), | |
8096 | 501 | ], |
8919 | 502 | (0x303A, 0x7000): [ |
9903 | 503 | ("ESPHMI1BOOT", "HMI 1"), |
8919 | 504 | ], |
9614 | 505 | (0x303A, 0x7004): [ |
9903 | 506 | ("S3BOXBOOT", "ESP32S3 Box 2.5"), |
9614 | 507 | ], |
10626 | 508 | (0x303A, 0x7008): [ |
509 | ("S2DKC1BOOT", "ESP32S2 DevKitC 1"), | |
510 | ], | |
9614 | 511 | (0x303A, 0x700E): [ |
9903 | 512 | ("S3EYEBOOT", "ESP32S3 EYE"), |
9614 | 513 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
514 | (0x303A, 0x8005): [ |
9903 | 515 | ("TINYS2BOOT", "TinyS2"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
516 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
517 | (0x303A, 0x8008): [ |
9903 | 518 | ("TTGOS2BOOT", "TTGO_T8_S2_Display"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
519 | ], |
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
520 | (0x303A, 0x800E): [ |
9903 | 521 | ("CCMBRISBOOT", "CucumberRIS v1.1"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
522 | ], |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
523 | (0x303A, 0x80B0): [ |
9903 | 524 | ("RD00RBOOT", "Reference Design RD00"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
525 | ], |
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
526 | (0x303A, 0x80B3): [ |
9903 | 527 | ("NANOESPBOOT", "nanoESP32-S2 WROVER"), |
8462
34bb10914b21
Extended the list of known CircuitPython and UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
528 | ], |
8919 | 529 | (0x303A, 0x80B5): [ |
9903 | 530 | ("FS2NEOBOOT", "FeatherS2 Neo"), |
8919 | 531 | ], |
532 | (0x303A, 0x80B6): [ | |
9903 | 533 | ("MORPHBOOT", "MORPHESP-240"), |
8919 | 534 | ], |
535 | (0x303A, 0x80C4): [ | |
9903 | 536 | ("S2MINIBOOT", "S2 Mini"), |
8919 | 537 | ], |
538 | (0x303A, 0x80C7): [ | |
9903 | 539 | ("S2PICOBOOT", "S2 Pico"), |
8919 | 540 | ], |
8956 | 541 | (0x303A, 0x80D2): [ |
9903 | 542 | ("TINYS3BOOT", "TinyS3"), |
8956 | 543 | ], |
544 | (0x303A, 0x80D5): [ | |
9903 | 545 | ("PROS3BOOT", "ProS3"), |
8956 | 546 | ], |
547 | (0x303A, 0x80D8): [ | |
9903 | 548 | ("UFTHRS3BOOT", "FeatherS3"), |
8956 | 549 | ], |
8919 | 550 | (0x303A, 0x80DA): [ |
9903 | 551 | ("HEXKYBOOT", "HexKy-S2"), |
8919 | 552 | ], |
10112 | 553 | (0x303A, 0x80DC): [ |
554 | ("ZEROS3BOOT", "ZeroS3"), | |
555 | ], | |
9051 | 556 | (0x303A, 0x80DE): [ |
9903 | 557 | ("LEAFS3BOOT", "BPI-Leaf-S3"), |
9051 | 558 | ], |
559 | (0x303A, 0x80E1): [ | |
9903 | 560 | ("LEAFS2BOOT", "BPI-Leaf-S2"), |
9051 | 561 | ], |
562 | (0x303A, 0x80E4): [ | |
9903 | 563 | ("BITS2BOOT", "BPI-BIT-S2"), |
9051 | 564 | ], |
565 | (0x303A, 0x80EB): [ | |
9903 | 566 | ("TTGOS2BOOT", "TTGO_T8_S2_WROOM"), |
9051 | 567 | ], |
568 | (0x303A, 0x80EE): [ | |
9903 | 569 | ("TTGOS2BOOT", "TTGO_T8_S2"), |
9051 | 570 | ], |
9614 | 571 | (0x303A, 0x80FA): [ |
9903 | 572 | ("MFAS3BOOT", "Maker Feather AIoT S3"), |
9614 | 573 | ], |
9248 | 574 | (0x303A, 0x8101): [ |
9903 | 575 | ("MMAINS2BOOT", "MiniMain ESP32-S2"), |
9248 | 576 | ], |
9614 | 577 | (0x303A, 0x8109): [ |
9903 | 578 | ("ESP32S2PICO", "ESP32-S2-Pico"), |
9614 | 579 | ], |
580 | (0x303A, 0x810B): [ | |
9903 | 581 | ("ESP32S2PICO", "ESP32-S2-Pico-LCD"), |
9614 | 582 | ], |
583 | (0x303A, 0x8112): [ | |
9903 | 584 | ("BEES3BOOT", "Bee S3"), |
9614 | 585 | ], |
586 | (0x303A, 0x8115): [ | |
9903 | 587 | ("BMS3BOOT", "Bee Motion S3"), |
9614 | 588 | ], |
589 | (0x303A, 0x8118): [ | |
9903 | 590 | ("LOLIN3BOOT", "S3"), |
9614 | 591 | ], |
10626 | 592 | (0x303A, 0x811A): [ |
593 | ("M5S3BOOT", "Stamp S3"), | |
594 | ], | |
10112 | 595 | (0x303A, 0x8121): [ |
596 | ("ATOMS3BOOT", "AtomS3"), | |
597 | ], | |
9614 | 598 | (0x303A, 0x812D): [ |
9903 | 599 | ("UF2BOOT", "BPI-PicoW-S3"), |
9614 | 600 | ], |
601 | (0x303A, 0x8134): [ | |
9903 | 602 | ("TBEAMBOOT", "T-Beam Supreme"), |
9614 | 603 | ], |
10112 | 604 | (0x303A, 0x8143): [ |
605 | ("DYMBOOT", "Deneyap Mini"), | |
606 | ], | |
607 | (0x303A, 0x8146): [ | |
608 | ("DYM2BOOT", "Deneyap Mini v2"), | |
609 | ], | |
610 | (0x303A, 0x8149): [ | |
611 | ("DY1A2BOOT", "Deneyap Kart 1A v2"), | |
612 | ], | |
613 | (0x303A, 0x8160): [ | |
614 | ("ATOMS3BOOT", "AtomS3 Lite"), | |
615 | ], | |
616 | (0x303A, 0x8165): [ | |
617 | ("YDESP32S3", "YD-ESP32-S3"), | |
618 | ], | |
10626 | 619 | (0x303A, 0x817B): [ |
620 | ("NANOS3BOOT", "NanoS3"), | |
621 | ], | |
622 | (0x303A, 0x8181): [ | |
623 | ("BLINGBOOT", "Bling!"), | |
624 | ], | |
625 | (0x303A, 0x8188): [ | |
626 | ("ATOMS3UBOOT", "AtomS3U"), | |
627 | ], | |
628 | (0x303A, 0x8191): [ | |
629 | ("TWRBOOT", "T-TWR Plus"), | |
630 | ], | |
631 | (0x303A, 0x81A1): [ | |
632 | ("HTBOOT", "Wireless Tracker"), | |
633 | ], | |
634 | (0x303A, 0x81A2): [ | |
635 | ("S3DKC1BOOT", "ESP32-S3-Pico"), | |
636 | ], | |
637 | (0x303A, 0x81AC): [ | |
638 | ("MAGICS3BOOT", "MagiClick S3"), | |
639 | ], | |
640 | (0x303A, 0x81BA): [ | |
641 | ("senseBox", "MCU-S2 ESP32S2"), | |
642 | ], | |
9248 | 643 | (0x30A4, 0x0002): [ |
9903 | 644 | ("SWANBOOT", "Swan R5"), |
9248 | 645 | ], |
8096 | 646 | (0x3171, 0x0100): [ |
9903 | 647 | ("CMDBOOT", "COMMANDER"), |
8096 | 648 | ], |
10626 | 649 | (0x3343, 0x83CF): [ |
650 | ("FIRE2BOOT", "FireBeetle 2 ESP32-S3"), | |
651 | ], | |
8956 | 652 | (0x80E7, 0x8111): [ |
9903 | 653 | ("IOTS2BOOT", "HiiBot IoTs2"), |
8956 | 654 | ], |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
655 | (0xCAFE, 0xFFFF): [ |
9903 | 656 | ("F303BOOT", "STM32F303 Discovery"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
657 | ], |
8096 | 658 | }, |
659 | "instructions": QCoreApplication.translate( | |
660 | "UF2FlashDialog", | |
661 | "<h3>CircuitPython Board</h3>" | |
662 | "<p>In order to prepare the board for flashing follow these" | |
663 | " steps:</p><ol>" | |
664 | "<li>Switch your device to 'bootloader' mode by double-pressing" | |
665 | " the reset button.</li>" | |
666 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
667 | "<li>(If this does not happen, then try shorter or longer" | |
668 | " pauses between presses.)</li>" | |
669 | "<li>Ensure the boot volume is available (this may require" | |
670 | " mounting it).</li>" | |
671 | "<li>Select the firmware file to be flashed and click the" | |
672 | " flash button.</li>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
673 | "</ol>", |
8096 | 674 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
675 | "show_all": True, |
8096 | 676 | "firmware": "CircuitPython", |
677 | }, | |
678 | "rp2040": { | |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
679 | "volumes": { |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
680 | (0x0000, 0x0000): [ |
9903 | 681 | ("RPI-RP2", "Raspberry Pi Pico"), # we don't have valid VID/PID |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
682 | ], |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
683 | }, |
8096 | 684 | "instructions": QCoreApplication.translate( |
685 | "UF2FlashDialog", | |
686 | "<h3>Pi Pico (RP2040) Board</h3>" | |
687 | "<p>In order to prepare the board for flashing follow these" | |
688 | " steps:</p><ol>" | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
689 | "<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
|
690 | "<ul>" |
8096 | 691 | "<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
|
692 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
693 | "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
|
694 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
695 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
696 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
697 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
698 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
699 | "</ul></li>" |
8096 | 700 | "<li>Wait until the device has entered 'bootloader' mode.</li>" |
701 | "<li>Ensure the boot volume is available (this may require" | |
702 | " mounting it).</li>" | |
703 | "<li>Select the firmware file to be flashed and click the" | |
704 | " flash button.</li>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
705 | "</ol>", |
8096 | 706 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
707 | "show_all": True, |
8120
84928e9f446f
UF2FlashDialog: updated a string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8111
diff
changeset
|
708 | "firmware": "MicroPython / CircuitPython", |
8096 | 709 | }, |
710 | } | |
711 | ||
712 | ||
713 | def getFoundDevices(boardType=""): | |
714 | """ | |
715 | Function to get the list of known serial devices supporting UF2. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
716 | |
8096 | 717 | @param boardType specific board type to search for |
718 | @type str | |
719 | @return list of tuples with the board type, the port description, the | |
720 | VID and PID | |
9904
5d9a7d1afbd9
Changed the UF2 Dialog slightly to eliminate duplicate device entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9903
diff
changeset
|
721 | @rtype list of tuple of (str, str, (int, int)) |
8096 | 722 | """ |
9904
5d9a7d1afbd9
Changed the UF2 Dialog slightly to eliminate duplicate device entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9903
diff
changeset
|
723 | foundDevices = set() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
724 | |
9954 | 725 | # step 1: determine all known UF2 volumes that are mounted |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
726 | if not OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
727 | userMounts = FileSystemUtilities.getUserMounts() |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
728 | |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10370
diff
changeset
|
729 | boardTypes = [boardType] if boardType else list(SupportedUF2Boards) |
9954 | 730 | for board in boardTypes: |
731 | for vidpid, volumes in SupportedUF2Boards[board]["volumes"].items(): | |
732 | for volume, description in volumes: | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
733 | if OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
734 | if FileSystemUtilities.findVolume(volume, findAll=True): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
735 | foundDevices.add((board, description, vidpid)) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
736 | else: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
737 | # check only user mounted devices on non-Windows systems |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
738 | for userMount in userMounts: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
739 | if os.path.basename(userMount).startswith(volume): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
740 | foundDevices.add((board, description, vidpid)) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
741 | break |
9954 | 742 | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
743 | # step 2: determine all devices that have their UF2 volume not mounted |
8096 | 744 | availablePorts = QSerialPortInfo.availablePorts() |
745 | for port in availablePorts: | |
746 | vid = port.vendorIdentifier() | |
747 | pid = port.productIdentifier() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
748 | |
8096 | 749 | if vid == 0 and pid == 0: |
750 | # no device detected at port | |
751 | continue | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
752 | |
8096 | 753 | for board in SupportedUF2Boards: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
754 | if (not boardType or (board.startswith(boardType))) and ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
755 | vid, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
756 | pid, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
757 | ) in SupportedUF2Boards[board]["volumes"]: |
9954 | 758 | for device in foundDevices: |
759 | if (vid, pid) == device[2]: | |
760 | break | |
761 | else: | |
762 | foundDevices.add( | |
763 | ( | |
764 | board, | |
765 | port.description(), | |
766 | (vid, pid), | |
767 | ) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
768 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
769 | |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
770 | return [*foundDevices] |
8096 | 771 | |
772 | ||
773 | class UF2FlashDialog(QDialog, Ui_UF2FlashDialog): | |
774 | """ | |
775 | Class implementing a dialog to flash any UF2 capable device. | |
776 | """ | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
777 | |
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
|
778 | 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
|
779 | DeviceVidPidRole = Qt.ItemDataRole.UserRole + 1 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
780 | |
8096 | 781 | def __init__(self, boardType="", parent=None): |
782 | """ | |
783 | Constructor | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
784 | |
8096 | 785 | @param boardType specific board type to show the dialog for |
786 | @type str | |
787 | @param parent reference to the parent widget (defaults to None) | |
788 | @type QWidget (optional) | |
789 | """ | |
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
|
790 | super().__init__(parent) |
8096 | 791 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
792 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9248
diff
changeset
|
793 | self.refreshButton.setIcon(EricPixmapCache.getIcon("rescan")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
794 | |
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
|
795 | self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
8096 | 796 | self.firmwarePicker.setFilters( |
9576
be9f8e7e42e0
Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9482
diff
changeset
|
797 | self.tr("MicroPython/CircuitPython Files (*.uf2);;All Files (*)") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
798 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
799 | |
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
|
800 | self.bootPicker.setMode(EricPathPickerModes.DIRECTORY_SHOW_FILES_MODE) |
8096 | 801 | self.bootPicker.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
802 | |
9815 | 803 | self.searchBootButton.setIcon(EricPixmapCache.getIcon("question")) |
804 | self.searchBootButton.setEnabled(False) | |
805 | ||
8096 | 806 | 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
|
807 | "QLineEdit {border: 2px solid; border-color: #dd8888}" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
808 | if ericApp().usesDarkPalette() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
809 | else "QLineEdit {border: 2px solid; border-color: #800000}" |
8096 | 810 | ) |
811 | self.__manualType = "<manual>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
812 | |
8096 | 813 | self.__boardType = boardType |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
814 | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
815 | self.on_refreshButton_clicked() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
816 | |
8096 | 817 | def __populate(self): |
818 | """ | |
819 | Private method to (re-)populate the dialog. | |
820 | """ | |
821 | # save the currently selected device | |
822 | currentDevice = self.devicesComboBox.currentText() | |
823 | firmwareFile = self.firmwarePicker.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
824 | |
8096 | 825 | # clear the entries first |
826 | self.devicesComboBox.clear() | |
827 | self.firmwarePicker.clear() | |
828 | self.bootPicker.clear() | |
829 | self.infoLabel.clear() | |
830 | self.infoEdit.clear() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
831 | |
8096 | 832 | # now populate the entries with data |
833 | devices = getFoundDevices(boardType=self.__boardType) | |
834 | if len(devices) == 0: | |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
835 | # no device set yet |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
836 | devices = [ |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10370
diff
changeset
|
837 | d for d in Devices.getFoundDevices()[0] if d[0] in SupportedUF2Boards |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
838 | ] |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
839 | self.devicesComboBox.addItem("") |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
840 | self.devicesComboBox.addItem(self.tr("Manual Select")) |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
841 | self.devicesComboBox.setItemData( |
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
842 | self.devicesComboBox.count() - 1, self.__manualType, self.DeviceTypeRole |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
843 | ) |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
844 | self.on_devicesComboBox_currentIndexChanged(0) |
8096 | 845 | if devices: |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
846 | self.__showSpecificInstructions(devices) |
8096 | 847 | else: |
848 | self.__showAllInstructions() | |
849 | elif len(devices) == 1: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
850 | # 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
|
851 | self.__boardType = devices[0][0] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
852 | |
8096 | 853 | self.devicesComboBox.addItem(devices[0][1]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
854 | self.devicesComboBox.setItemData(0, devices[0][0], self.DeviceTypeRole) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
855 | self.devicesComboBox.setItemData(0, devices[0][2], self.DeviceVidPidRole) |
8096 | 856 | self.devicesComboBox.addItem(self.tr("Manual Select")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
857 | self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole) |
8096 | 858 | self.on_devicesComboBox_currentIndexChanged(0) |
859 | else: | |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
860 | for index, (boardType, description, vidpid) in enumerate(sorted(devices)): |
8096 | 861 | self.devicesComboBox.addItem(description) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
862 | self.devicesComboBox.setItemData(index, boardType, self.DeviceTypeRole) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
863 | self.devicesComboBox.setItemData(index, vidpid, self.DeviceVidPidRole) |
8096 | 864 | self.devicesComboBox.addItem(self.tr("Manual Select")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
865 | self.devicesComboBox.setItemData( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
866 | index + 1, self.__manualType, self.DeviceTypeRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
867 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
868 | |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
869 | # select the remembered device, if it is still there |
8096 | 870 | if currentDevice: |
871 | self.devicesComboBox.setCurrentText(currentDevice) | |
9954 | 872 | if self.devicesComboBox.currentIndex() == -1 and len(devices) == 1: |
873 | # the device name has changed but only one is present; select it | |
874 | self.devicesComboBox.setCurrentIndex(0) | |
8096 | 875 | self.firmwarePicker.setText(firmwareFile) |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
876 | elif len(devices) == 1: |
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
877 | self.devicesComboBox.setCurrentIndex(0) |
8096 | 878 | else: |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
879 | self.devicesComboBox.setCurrentIndex(-1) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
880 | |
8096 | 881 | def __updateFlashButton(self): |
882 | """ | |
883 | Private method to update the state of the Flash button and the retest | |
884 | button. | |
885 | """ | |
886 | firmwareFile = self.firmwarePicker.text() | |
887 | if self.devicesComboBox.currentData(self.DeviceTypeRole) is not None: | |
888 | if bool(firmwareFile) and os.path.exists(firmwareFile): | |
889 | self.firmwarePicker.setStyleSheet("") | |
890 | else: | |
891 | self.firmwarePicker.setStyleSheet(self.__mandatoryStyleSheet) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
892 | |
8096 | 893 | if bool(self.bootPicker.text()): |
894 | self.bootPicker.setStyleSheet("") | |
895 | else: | |
896 | self.bootPicker.setStyleSheet(self.__mandatoryStyleSheet) | |
897 | else: | |
898 | self.firmwarePicker.setStyleSheet("") | |
899 | self.bootPicker.setStyleSheet("") | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
900 | |
8096 | 901 | enable = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
902 | bool(self.bootPicker.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
903 | and bool(firmwareFile) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
904 | and os.path.exists(firmwareFile) |
8096 | 905 | ) |
906 | self.flashButton.setEnabled(enable) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
907 | |
8096 | 908 | def __showAllInstructions(self): |
909 | """ | |
910 | Private method to show instructions for resetting devices to bootloader | |
911 | mode. | |
912 | """ | |
913 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
914 | |
8096 | 915 | htmlText = self.tr( |
916 | "<h4>No known devices detected.</h4>" | |
917 | "<p>Follow the appropriate instructions below to set <b>one</b>" | |
918 | " board into 'bootloader' mode. Press <b>Refresh</b> when ready." | |
919 | "</p>" | |
920 | ) | |
921 | 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
|
922 | if SupportedUF2Boards[boardType]["show_all"]: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
923 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
8096 | 924 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
925 | |
8096 | 926 | def __showSpecificInstructions(self, devices): |
927 | """ | |
928 | Private method to show instructions for resetting devices to bootloader | |
929 | mode for a list of detected devices. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
930 | |
8096 | 931 | @param devices list of detected devices |
932 | @type list of str | |
933 | """ | |
8099
522946e53835
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8097
diff
changeset
|
934 | boardTypes = {x[0] for x in devices} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
935 | |
8096 | 936 | self.infoLabel.setText(self.tr("Reset Instructions:")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
937 | |
8096 | 938 | if self.__boardType: |
939 | htmlText = self.tr( | |
940 | "<h4>Flash {0} Firmware</h4>" | |
941 | "<p>Follow the instructions below to set <b>one</b> board into" | |
942 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
943 | "<hr/>{1}" | |
944 | ).format( | |
945 | SupportedUF2Boards[self.__boardType]["firmware"], | |
946 | SupportedUF2Boards[self.__boardType]["instructions"], | |
947 | ) | |
948 | else: | |
949 | htmlText = self.tr( | |
950 | "<h4>Potentially UF2 capable devices found</h4>" | |
951 | "<p>Found these potentially UF2 capable devices:</p>" | |
952 | "<ul><li>{0}</li></ul>" | |
953 | "<p>Follow the instructions below to set <b>one</b> board into" | |
954 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
955 | ).format("</li><li>".join(sorted(x[1] for x in devices))) |
8096 | 956 | for boardType in sorted(boardTypes): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
957 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
8096 | 958 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
959 | |
8096 | 960 | def __showTypedInstructions(self, boardType): |
961 | """ | |
962 | Private method to show instructions for resetting devices to bootloader | |
963 | mode for a specific board type. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
964 | |
8096 | 965 | @param boardType type of the board to show instructions for |
966 | @type str | |
967 | """ | |
968 | self.infoLabel.setText(self.tr("Reset Instructions:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
969 | |
8096 | 970 | htmlText = self.tr( |
971 | "<h4>No known devices detected.</h4>" | |
972 | "<p>Follow the instructions below to set <b>one</b> board into" | |
973 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
974 | ) | |
975 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
976 | self.infoEdit.setHtml(htmlText) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
977 | |
8096 | 978 | def __showManualInstructions(self): |
979 | """ | |
980 | Private method to show instructions for flashing devices manually. | |
981 | """ | |
982 | self.infoLabel.setText(self.tr("Flash Instructions:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
983 | |
8096 | 984 | htmlText = self.tr( |
985 | "<h4>Flash method 'manual' selected.</h4>" | |
986 | "<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
|
987 | " the data manually.</p><ol>" |
8096 | 988 | "<li>Change the device to 'bootloader' mode.</li>" |
989 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
990 | "<li>Ensure the boot volume is available (this may require" | |
991 | " mounting it) and select its path.</li>" | |
992 | "<li>Select the firmware file to be flashed and click the" | |
993 | " flash button.</li>" | |
994 | "</ol>" | |
995 | ) | |
996 | for boardType in SupportedUF2Boards: | |
997 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
998 | self.infoEdit.setHtml(htmlText) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
999 | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1000 | def __showNoVolumeInformation(self, volumes, boardType): |
8096 | 1001 | """ |
1002 | Private method to show information about the expected boot volume(s). | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1003 | |
8096 | 1004 | @param volumes list of expected volume names |
1005 | @type list of str | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1006 | @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
|
1007 | @type str |
8096 | 1008 | """ |
1009 | self.infoLabel.setText(self.tr("Boot Volume not found:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1010 | |
8096 | 1011 | htmlText = self.tr( |
1012 | "<h4>No Boot Volume detected.</h4>" | |
1013 | "<p>Please ensure that the boot volume of the device to be flashed" | |
1014 | " is available. " | |
1015 | ) | |
1016 | if len(volumes) == 1: | |
1017 | htmlText += self.tr( | |
1018 | "This volume should be named <b>{0}</b>." | |
1019 | " Press <b>Refresh</b> when ready.</p>" | |
1020 | ).format(volumes[0]) | |
1021 | else: | |
1022 | htmlText += self.tr( | |
1023 | "This volume should have one of these names.</p>" | |
1024 | "<ul><li>{0}</li></ul>" | |
1025 | "<p>Press <b>Refresh</b> when ready.</p>" | |
1026 | ).format("</li><li>".join(sorted(volumes))) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1027 | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1028 | if boardType: |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1029 | htmlText += self.tr( |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1030 | "<h4>Reset Instructions</h4>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1031 | "<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
|
1032 | " '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
|
1033 | ) |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1034 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1035 | |
8096 | 1036 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1037 | |
8096 | 1038 | def __showMultipleVolumesInformation(self, volumePaths): |
1039 | """ | |
1040 | Private method to show information because multiple devices of the | |
1041 | same type are ready for flashing. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1042 | |
8096 | 1043 | Note: This is a dangerous situation! |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1044 | |
8096 | 1045 | @param volumePaths list of volume paths |
1046 | @type list of str | |
1047 | """ | |
1048 | self.infoLabel.setText(self.tr("Multiple Boot Volumes found:")) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1049 | |
8096 | 1050 | htmlText = self.tr( |
1051 | "<h4>Multiple Boot Volumes were found</h4>" | |
1052 | "<p>These volume paths were found.</p><ul><li>{0}</li></ul>" | |
1053 | "<p>Please ensure that only one device of a type is ready for" | |
1054 | " flashing. Press <b>Refresh</b> when ready.</p>" | |
1055 | ).format("</li><li>".join(sorted(volumePaths))) | |
1056 | self.infoEdit.setHtml(htmlText) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1057 | |
8096 | 1058 | @pyqtSlot() |
1059 | def on_flashButton_clicked(self): | |
1060 | """ | |
1061 | Private slot to flash the selected MicroPython or CircuitPython | |
1062 | firmware onto the device. | |
1063 | """ | |
1064 | boardType = self.devicesComboBox.currentData(self.DeviceTypeRole) | |
1065 | firmwarePath = self.firmwarePicker.text() | |
1066 | volumePath = self.bootPicker.text() | |
1067 | 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
|
1068 | if boardType == self.__manualType: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1069 | self.infoLabel.setText(self.tr("Flashing Firmware")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1070 | self.infoEdit.setHtml( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1071 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1072 | "<p>Flashing the selected firmware to the device. Please" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1073 | " wait until the device resets automatically.</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1074 | ) |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1075 | ) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1076 | else: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1077 | firmwareType = SupportedUF2Boards[boardType]["firmware"] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1078 | self.infoLabel.setText(self.tr("Flashing {0}").format(firmwareType)) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1079 | self.infoEdit.setHtml( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1080 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1081 | "<p>Flashing the {0} firmware to the device. Please wait" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1082 | " until the device resets automatically.</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1083 | ).format(firmwareType) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1084 | ) |
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
|
1085 | QCoreApplication.processEvents( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1086 | QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1087 | ) |
10172 | 1088 | with contextlib.suppress(FileNotFoundError): |
1089 | shutil.copy(firmwarePath, volumePath) | |
8096 | 1090 | QThread.sleep(1) |
1091 | self.on_refreshButton_clicked() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1092 | |
8096 | 1093 | @pyqtSlot() |
1094 | def on_refreshButton_clicked(self): | |
1095 | """ | |
1096 | Private slot to refresh the dialog. | |
1097 | """ | |
1098 | self.__populate() | |
9954 | 1099 | self.__updateFlashButton() |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1100 | self.on_devicesComboBox_currentIndexChanged(0) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1101 | |
8096 | 1102 | @pyqtSlot(int) |
1103 | def on_devicesComboBox_currentIndexChanged(self, index): | |
1104 | """ | |
1105 | Private slot to handle the selection of a board. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1106 | |
8096 | 1107 | @param index selected index |
1108 | @type int | |
1109 | """ | |
1110 | vidpid = self.devicesComboBox.itemData(index, self.DeviceVidPidRole) | |
1111 | boardType = self.devicesComboBox.itemData(index, self.DeviceTypeRole) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1112 | |
9815 | 1113 | self.searchBootButton.setEnabled(boardType == self.__manualType) |
8096 | 1114 | self.bootPicker.setEnabled(boardType == self.__manualType) |
1115 | if boardType == self.__manualType: | |
1116 | self.__showManualInstructions() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1117 | |
8096 | 1118 | if vidpid is None: |
1119 | if boardType is None: | |
1120 | self.bootPicker.clear() | |
1121 | else: | |
1122 | volumes = SupportedUF2Boards[boardType]["volumes"][vidpid] | |
1123 | foundVolumes = [] | |
9903 | 1124 | for volume, _ in volumes: |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9614
diff
changeset
|
1125 | foundVolumes += FileSystemUtilities.findVolume(volume, findAll=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1126 | |
8096 | 1127 | if len(foundVolumes) == 0: |
9903 | 1128 | self.__showNoVolumeInformation([v[0] for v in volumes], boardType) |
8096 | 1129 | self.bootPicker.clear() |
1130 | elif len(foundVolumes) == 1: | |
1131 | self.bootPicker.setText(foundVolumes[0]) | |
1132 | else: | |
9954 | 1133 | self.__showMultipleVolumesInformation(foundVolumes) |
8096 | 1134 | self.bootPicker.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1135 | |
8096 | 1136 | self.__updateFlashButton() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1137 | |
8096 | 1138 | @pyqtSlot(str) |
1139 | def on_firmwarePicker_textChanged(self, text): | |
1140 | """ | |
1141 | Private slot handling a change of the firmware file. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1142 | |
8096 | 1143 | @param text current text of the firmware edit |
1144 | @type str | |
1145 | """ | |
1146 | self.__updateFlashButton() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1147 | |
8096 | 1148 | @pyqtSlot(str) |
1149 | def on_bootPicker_textChanged(self, text): | |
1150 | """ | |
1151 | Private slot handling a change of the boot volume. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1152 | |
8096 | 1153 | @param text current text of the boot volume edit |
1154 | @type str | |
1155 | """ | |
1156 | self.__updateFlashButton() | |
9815 | 1157 | |
1158 | @pyqtSlot() | |
1159 | def on_searchBootButton_clicked(self): | |
1160 | """ | |
1161 | Private slot to look for all known boot paths and present a list to select from. | |
1162 | """ | |
1163 | foundBootVolumes = set() | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1164 | if not OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1165 | userMounts = FileSystemUtilities.getUserMounts() |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1166 | |
9815 | 1167 | for boardType in SupportedUF2Boards: |
1168 | for volumes in SupportedUF2Boards[boardType]["volumes"].values(): | |
9903 | 1169 | for volume, _ in volumes: |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1170 | if OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1171 | foundBootVolumes.update( |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1172 | FileSystemUtilities.findVolume(volume, findAll=True) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1173 | ) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1174 | else: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1175 | # check only user mounted devices on non-Windows systems |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1176 | for userMount in userMounts: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1177 | if os.path.basename(userMount).startswith(volume): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1178 | foundBootVolumes.add(userMount) |
9815 | 1179 | |
1180 | if len(foundBootVolumes) == 0: | |
1181 | selectedVolume = "" | |
9903 | 1182 | EricMessageBox.information( |
1183 | self, | |
1184 | self.tr("Flash UF2 Device"), | |
1185 | self.tr("""No UF2 device 'boot' volumes found."""), | |
1186 | ) | |
9815 | 1187 | elif len(foundBootVolumes) == 1: |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
1188 | selectedVolume = [*foundBootVolumes][0] |
9815 | 1189 | else: |
1190 | result, ok = QInputDialog.getItem( | |
9903 | 1191 | self, |
9815 | 1192 | QCoreApplication.translate("UF2FlashDialog", "Flash UF2 Device"), |
1193 | QCoreApplication.translate( | |
1194 | "UF2FlashDialog", "Select the Boot Volume of the device:" | |
1195 | ), | |
10370
d84b074f772c
Fixed an issue in the MicroPython UF2 Flash dialog causing the wrong instructions being show in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10253
diff
changeset
|
1196 | [*foundBootVolumes], |
9821
6b1b06d74532
Fixed some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9815
diff
changeset
|
1197 | 0, |
6b1b06d74532
Fixed some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9815
diff
changeset
|
1198 | True, |
9815 | 1199 | ) |
1200 | selectedVolume = result if ok else "" | |
1201 | ||
1202 | self.bootPicker.setText(selectedVolume) |