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