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