Sun, 16 Mar 2025 12:53:12 +0100
Added the Adafruit Feather nRF52840 to the list of known NRF52 boards and changed the list of known CircuitPython boards to be more explicit with respect to Adafruit boards (i.e. VID 0x239A).
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): [ | |
11167 | 541 | ("XIAO-SENSE", "XIAO nRF52840 Sense"), |
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 | ], | |
672 | (0x303A, 0x8160): [ | |
673 | ("ATOMS3BOOT", "AtomS3 Lite"), | |
674 | ], | |
675 | (0x303A, 0x8165): [ | |
676 | ("YDESP32S3", "YD-ESP32-S3"), | |
677 | ], | |
10840 | 678 | (0x303A, 0x8169): [ |
679 | ("LOLIN3MBOOT", "S3Mini"), | |
680 | ], | |
10626 | 681 | (0x303A, 0x817B): [ |
682 | ("NANOS3BOOT", "NanoS3"), | |
683 | ], | |
684 | (0x303A, 0x8181): [ | |
685 | ("BLINGBOOT", "Bling!"), | |
686 | ], | |
687 | (0x303A, 0x8188): [ | |
688 | ("ATOMS3UBOOT", "AtomS3U"), | |
689 | ], | |
690 | (0x303A, 0x8191): [ | |
691 | ("TWRBOOT", "T-TWR Plus"), | |
692 | ], | |
693 | (0x303A, 0x81A1): [ | |
694 | ("HTBOOT", "Wireless Tracker"), | |
695 | ], | |
696 | (0x303A, 0x81A2): [ | |
697 | ("S3DKC1BOOT", "ESP32-S3-Pico"), | |
698 | ], | |
699 | (0x303A, 0x81AC): [ | |
700 | ("MAGICS3BOOT", "MagiClick S3"), | |
701 | ], | |
10902 | 702 | (0x303A, 0x81B2): [ |
703 | ("TWS3BOOT", "TinyWATCHS3"), | |
704 | ], | |
11010 | 705 | (0x303A, 0x81B3): [ |
706 | ("WS3ZEROBOOT", "ESP32-S3-Zero"), | |
707 | ], | |
11122 | 708 | (0x303A, 0x81B7): [ |
709 | ("TDECKBOOT", "T-Deck"), | |
710 | ], | |
10626 | 711 | (0x303A, 0x81BA): [ |
712 | ("senseBox", "MCU-S2 ESP32S2"), | |
713 | ], | |
10840 | 714 | (0x303A, 0x81FD): [ |
715 | ("UFTHS3NBOOT", "FeatherS3 Neo"), | |
716 | ], | |
10902 | 717 | (0x303A, 0x8200): [ |
718 | ("RGBTMBOOT", "RGB Touch Mini"), | |
719 | ], | |
720 | (0x303A, 0x821D): [ | |
721 | ("TWS3BOOT", "T-Watch-S3"), | |
722 | ], | |
723 | (0x303A, 0x8220): [ | |
724 | ("WSS3BOOT", "ESP32-S3-Touch-LCD-1.69"), | |
725 | ], | |
726 | (0x303A, 0x8223): [ | |
727 | ("WSS3BOOT", "ESP32-S3-LCD-1.69"), | |
728 | ], | |
729 | (0x303A, 0x8226): [ | |
730 | ("OMGS3BOOT", "OMGS3"), | |
731 | ], | |
11122 | 732 | (0x303A, 0x8248): [ |
733 | ("SprMiniBoot", "ESP32-S3-Super-Mini"), | |
734 | ], | |
9248 | 735 | (0x30A4, 0x0002): [ |
9903 | 736 | ("SWANBOOT", "Swan R5"), |
9248 | 737 | ], |
8096 | 738 | (0x3171, 0x0100): [ |
9903 | 739 | ("CMDBOOT", "COMMANDER"), |
8096 | 740 | ], |
10626 | 741 | (0x3343, 0x83CF): [ |
742 | ("FIRE2BOOT", "FireBeetle 2 ESP32-S3"), | |
743 | ], | |
8956 | 744 | (0x80E7, 0x8111): [ |
9903 | 745 | ("IOTS2BOOT", "HiiBot IoTs2"), |
8956 | 746 | ], |
10840 | 747 | (0xCAFE, 0xBABE): [ |
748 | ("CH32V2BOOT", "Dummy"), | |
749 | ], | |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
750 | (0xCAFE, 0xFFFF): [ |
9903 | 751 | ("F303BOOT", "STM32F303 Discovery"), |
8101
dee984e05647
UF2FlashDialog: extended the list of known UF2 capable devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8099
diff
changeset
|
752 | ], |
8096 | 753 | }, |
754 | "instructions": QCoreApplication.translate( | |
755 | "UF2FlashDialog", | |
756 | "<h3>CircuitPython Board</h3>" | |
757 | "<p>In order to prepare the board for flashing follow these" | |
758 | " steps:</p><ol>" | |
759 | "<li>Switch your device to 'bootloader' mode by double-pressing" | |
760 | " the reset button.</li>" | |
761 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
762 | "<li>(If this does not happen, then try shorter or longer" | |
763 | " pauses between presses.)</li>" | |
764 | "<li>Ensure the boot volume is available (this may require" | |
765 | " mounting it).</li>" | |
766 | "<li>Select the firmware file to be flashed and click the" | |
767 | " flash button.</li>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
768 | "</ol>", |
8096 | 769 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
770 | "show_all": True, |
8096 | 771 | "firmware": "CircuitPython", |
772 | }, | |
11167 | 773 | "nrf52": { |
774 | "volumes": { | |
775 | (0x2886, 0x0045): [ | |
776 | ("XIAO-SENSE", "XIAO nRF52840 Sense"), | |
777 | ], | |
778 | }, | |
779 | "instructions": QCoreApplication.translate( | |
780 | "UF2FlashDialog", | |
781 | "<h3>NRF52 Board</h3>" | |
782 | "<p>In order to prepare the board for flashing follow these" | |
783 | " steps:</p><ol>" | |
784 | "<li>Switch your device to 'bootloader' mode by double-pressing" | |
785 | " the reset button.</li>" | |
786 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
787 | "<li>(If this does not happen, then try shorter or longer" | |
788 | " pauses between presses.)</li>" | |
789 | "<li>Ensure the boot volume is available (this may require" | |
790 | " mounting it).</li>" | |
791 | "<li>Select the firmware file to be flashed and click the" | |
792 | " flash button.</li>" | |
793 | "</ol>", | |
794 | ), | |
795 | "show_all": True, | |
796 | "firmware": "MicroPython / CircuitPython", | |
797 | }, | |
10897 | 798 | "rp2": { |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
799 | "volumes": { |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
800 | (0x0000, 0x0000): [ |
9903 | 801 | ("RPI-RP2", "Raspberry Pi Pico"), # we don't have valid VID/PID |
10897 | 802 | ("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
|
803 | ], |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
804 | }, |
8096 | 805 | "instructions": QCoreApplication.translate( |
806 | "UF2FlashDialog", | |
10897 | 807 | "<h3>Pi Pico (RP2040/RP2350) Board</h3>" |
8096 | 808 | "<p>In order to prepare the board for flashing follow these" |
809 | " steps:</p><ol>" | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
810 | "<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
|
811 | "<ul>" |
8096 | 812 | "<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
|
813 | "</ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
814 | "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
|
815 | "<ul>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
816 | "<li>hold down RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
817 | "<li>hold down BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
818 | "<li>release RESET</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
819 | "<li>release BOOTSEL</li>" |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
820 | "</ul></li>" |
8096 | 821 | "<li>Wait until the device has entered 'bootloader' mode.</li>" |
822 | "<li>Ensure the boot volume is available (this may require" | |
823 | " mounting it).</li>" | |
824 | "<li>Select the firmware file to be flashed and click the" | |
825 | " flash button.</li>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
826 | "</ol>", |
8096 | 827 | ), |
8170
fb77bff32621
MicroPython: corrected a glitch in the UF2 flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8167
diff
changeset
|
828 | "show_all": True, |
8120
84928e9f446f
UF2FlashDialog: updated a string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8111
diff
changeset
|
829 | "firmware": "MicroPython / CircuitPython", |
8096 | 830 | }, |
831 | } | |
832 | ||
833 | ||
834 | def getFoundDevices(boardType=""): | |
835 | """ | |
836 | 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
|
837 | |
8096 | 838 | @param boardType specific board type to search for |
839 | @type str | |
840 | @return list of tuples with the board type, the port description, the | |
841 | 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
|
842 | @rtype list of tuple of (str, str, (int, int)) |
8096 | 843 | """ |
9904
5d9a7d1afbd9
Changed the UF2 Dialog slightly to eliminate duplicate device entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9903
diff
changeset
|
844 | foundDevices = set() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
845 | |
9954 | 846 | # step 1: determine all known UF2 volumes that are mounted |
11053 | 847 | userMounts = ( |
848 | [] if OSUtilities.isWindowsPlatform() else FileSystemUtilities.getUserMounts() | |
849 | ) | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
850 | |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10370
diff
changeset
|
851 | boardTypes = [boardType] if boardType else list(SupportedUF2Boards) |
9954 | 852 | for board in boardTypes: |
853 | for vidpid, volumes in SupportedUF2Boards[board]["volumes"].items(): | |
854 | for volume, description in volumes: | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
855 | if OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
856 | if FileSystemUtilities.findVolume(volume, findAll=True): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
857 | foundDevices.add((board, description, vidpid)) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
858 | else: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
859 | # check only user mounted devices on non-Windows systems |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
860 | for userMount in userMounts: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
861 | if os.path.basename(userMount).startswith(volume): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
862 | foundDevices.add((board, description, vidpid)) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
863 | break |
11053 | 864 | if len(foundDevices) > 1: |
865 | # There are potentially different devices with same mount path/volume. | |
866 | # Check the USB bus for the VID/PID of found devices and remove all | |
867 | # those not found on the bus. | |
868 | with contextlib.suppress(NameError, IOError): | |
869 | for board, description, vidpid in foundDevices.copy(): | |
870 | if not usb.core.find(idVendor=vidpid[0], idProduct=vidpid[1]): | |
871 | foundDevices.discard((board, description, vidpid)) | |
9954 | 872 | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
873 | # step 2: determine all devices that have their UF2 volume not mounted |
8096 | 874 | availablePorts = QSerialPortInfo.availablePorts() |
875 | for port in availablePorts: | |
876 | vid = port.vendorIdentifier() | |
877 | pid = port.productIdentifier() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
878 | |
8096 | 879 | if vid == 0 and pid == 0: |
880 | # no device detected at port | |
881 | continue | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
882 | |
8096 | 883 | for board in SupportedUF2Boards: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
884 | 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
|
885 | vid, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
886 | pid, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
887 | ) in SupportedUF2Boards[board]["volumes"]: |
9954 | 888 | for device in foundDevices: |
889 | if (vid, pid) == device[2]: | |
890 | break | |
891 | else: | |
892 | foundDevices.add( | |
893 | ( | |
894 | board, | |
895 | port.description(), | |
896 | (vid, pid), | |
897 | ) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
898 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
899 | |
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
|
900 | return [*foundDevices] |
8096 | 901 | |
902 | ||
903 | class UF2FlashDialog(QDialog, Ui_UF2FlashDialog): | |
904 | """ | |
905 | Class implementing a dialog to flash any UF2 capable device. | |
906 | """ | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
907 | |
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
|
908 | 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
|
909 | 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
|
910 | |
8096 | 911 | def __init__(self, boardType="", parent=None): |
912 | """ | |
913 | Constructor | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
914 | |
8096 | 915 | @param boardType specific board type to show the dialog for |
916 | @type str | |
917 | @param parent reference to the parent widget (defaults to None) | |
918 | @type QWidget (optional) | |
919 | """ | |
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
|
920 | super().__init__(parent) |
8096 | 921 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
922 | |
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
|
923 | 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
|
924 | |
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
|
925 | self.firmwarePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
8096 | 926 | 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
|
927 | 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
|
928 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
929 | |
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
|
930 | self.bootPicker.setMode(EricPathPickerModes.DIRECTORY_SHOW_FILES_MODE) |
8096 | 931 | self.bootPicker.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
932 | |
9815 | 933 | self.searchBootButton.setIcon(EricPixmapCache.getIcon("question")) |
934 | self.searchBootButton.setEnabled(False) | |
935 | ||
8096 | 936 | 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
|
937 | "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
|
938 | if ericApp().usesDarkPalette() |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
939 | else "QLineEdit {border: 2px solid; border-color: #800000}" |
8096 | 940 | ) |
941 | self.__manualType = "<manual>" | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
942 | |
8096 | 943 | self.__boardType = boardType |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
944 | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
945 | self.on_refreshButton_clicked() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
946 | |
8096 | 947 | def __populate(self): |
948 | """ | |
949 | Private method to (re-)populate the dialog. | |
950 | """ | |
951 | # save the currently selected device | |
952 | currentDevice = self.devicesComboBox.currentText() | |
953 | firmwareFile = self.firmwarePicker.text() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
954 | |
8096 | 955 | # clear the entries first |
956 | self.devicesComboBox.clear() | |
957 | self.firmwarePicker.clear() | |
958 | self.bootPicker.clear() | |
959 | self.infoLabel.clear() | |
960 | self.infoEdit.clear() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
961 | |
8096 | 962 | # now populate the entries with data |
963 | devices = getFoundDevices(boardType=self.__boardType) | |
964 | 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
|
965 | # 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
|
966 | devices = [ |
10373
093dcebe5ecb
Corrected some uses of dict.keys(), dict.values() and dict.items().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10370
diff
changeset
|
967 | 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
|
968 | ] |
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
|
969 | 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
|
970 | 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
|
971 | 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
|
972 | 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
|
973 | ) |
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
|
974 | self.on_devicesComboBox_currentIndexChanged(0) |
8096 | 975 | 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
|
976 | self.__showSpecificInstructions(devices) |
8096 | 977 | else: |
978 | self.__showAllInstructions() | |
979 | elif len(devices) == 1: | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
980 | # 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
|
981 | 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
|
982 | |
8096 | 983 | 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
|
984 | 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
|
985 | self.devicesComboBox.setItemData(0, devices[0][2], self.DeviceVidPidRole) |
8096 | 986 | 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
|
987 | self.devicesComboBox.setItemData(1, self.__manualType, self.DeviceTypeRole) |
8096 | 988 | self.on_devicesComboBox_currentIndexChanged(0) |
989 | else: | |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
990 | for index, (boardType, description, vidpid) in enumerate(sorted(devices)): |
11167 | 991 | self.devicesComboBox.addItem( |
992 | self.tr("{0} ({1})", "board description, board type").format( | |
993 | description, boardType | |
994 | ) | |
995 | ) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
996 | 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
|
997 | self.devicesComboBox.setItemData(index, vidpid, self.DeviceVidPidRole) |
8096 | 998 | 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
|
999 | self.devicesComboBox.setItemData( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1000 | 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
|
1001 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1002 | |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
1003 | # select the remembered device, if it is still there |
8096 | 1004 | if currentDevice: |
1005 | self.devicesComboBox.setCurrentText(currentDevice) | |
9954 | 1006 | if self.devicesComboBox.currentIndex() == -1 and len(devices) == 1: |
1007 | # the device name has changed but only one is present; select it | |
1008 | self.devicesComboBox.setCurrentIndex(0) | |
8096 | 1009 | self.firmwarePicker.setText(firmwareFile) |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
1010 | elif len(devices) == 1: |
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
1011 | self.devicesComboBox.setCurrentIndex(0) |
8096 | 1012 | else: |
9953
1aa8517bc61f
Enhanced the UF2 flash dialog slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9904
diff
changeset
|
1013 | self.devicesComboBox.setCurrentIndex(-1) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1014 | |
8096 | 1015 | def __updateFlashButton(self): |
1016 | """ | |
1017 | Private method to update the state of the Flash button and the retest | |
1018 | button. | |
1019 | """ | |
1020 | firmwareFile = self.firmwarePicker.text() | |
1021 | if self.devicesComboBox.currentData(self.DeviceTypeRole) is not None: | |
1022 | if bool(firmwareFile) and os.path.exists(firmwareFile): | |
1023 | self.firmwarePicker.setStyleSheet("") | |
1024 | else: | |
1025 | 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
|
1026 | |
8096 | 1027 | if bool(self.bootPicker.text()): |
1028 | self.bootPicker.setStyleSheet("") | |
1029 | else: | |
1030 | self.bootPicker.setStyleSheet(self.__mandatoryStyleSheet) | |
1031 | else: | |
1032 | self.firmwarePicker.setStyleSheet("") | |
1033 | self.bootPicker.setStyleSheet("") | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1034 | |
8096 | 1035 | enable = ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1036 | bool(self.bootPicker.text()) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1037 | and bool(firmwareFile) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1038 | and os.path.exists(firmwareFile) |
8096 | 1039 | ) |
1040 | self.flashButton.setEnabled(enable) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1041 | |
8096 | 1042 | def __showAllInstructions(self): |
1043 | """ | |
1044 | Private method to show instructions for resetting devices to bootloader | |
1045 | mode. | |
1046 | """ | |
11167 | 1047 | 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
|
1048 | |
8096 | 1049 | htmlText = self.tr( |
1050 | "<h4>No known devices detected.</h4>" | |
1051 | "<p>Follow the appropriate instructions below to set <b>one</b>" | |
1052 | " board into 'bootloader' mode. Press <b>Refresh</b> when ready." | |
1053 | "</p>" | |
1054 | ) | |
1055 | 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
|
1056 | 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
|
1057 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
8096 | 1058 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1059 | |
8096 | 1060 | def __showSpecificInstructions(self, devices): |
1061 | """ | |
1062 | Private method to show instructions for resetting devices to bootloader | |
1063 | 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
|
1064 | |
8096 | 1065 | @param devices list of detected devices |
1066 | @type list of str | |
1067 | """ | |
8099
522946e53835
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8097
diff
changeset
|
1068 | 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
|
1069 | |
11167 | 1070 | 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
|
1071 | |
8096 | 1072 | if self.__boardType: |
1073 | htmlText = self.tr( | |
1074 | "<h4>Flash {0} Firmware</h4>" | |
1075 | "<p>Follow the instructions below to set <b>one</b> board into" | |
1076 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
1077 | "<hr/>{1}" | |
1078 | ).format( | |
1079 | SupportedUF2Boards[self.__boardType]["firmware"], | |
1080 | SupportedUF2Boards[self.__boardType]["instructions"], | |
1081 | ) | |
1082 | else: | |
1083 | htmlText = self.tr( | |
1084 | "<h4>Potentially UF2 capable devices found</h4>" | |
1085 | "<p>Found these potentially UF2 capable devices:</p>" | |
1086 | "<ul><li>{0}</li></ul>" | |
1087 | "<p>Follow the instructions below to set <b>one</b> board into" | |
1088 | " '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
|
1089 | ).format("</li><li>".join(sorted(x[1] for x in devices))) |
8096 | 1090 | 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
|
1091 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] |
8096 | 1092 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1093 | |
8096 | 1094 | def __showTypedInstructions(self, boardType): |
1095 | """ | |
1096 | Private method to show instructions for resetting devices to bootloader | |
1097 | 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
|
1098 | |
8096 | 1099 | @param boardType type of the board to show instructions for |
1100 | @type str | |
1101 | """ | |
11167 | 1102 | 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
|
1103 | |
8096 | 1104 | htmlText = self.tr( |
1105 | "<h4>No known devices detected.</h4>" | |
1106 | "<p>Follow the instructions below to set <b>one</b> board into" | |
1107 | " 'bootloader' mode. Press <b>Refresh</b> when ready.</p>" | |
1108 | ) | |
1109 | htmlText += "<hr/>" + SupportedUF2Boards[boardType]["instructions"] | |
1110 | self.infoEdit.setHtml(htmlText) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1111 | |
8096 | 1112 | def __showManualInstructions(self): |
1113 | """ | |
1114 | Private method to show instructions for flashing devices manually. | |
1115 | """ | |
1116 | 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
|
1117 | |
8096 | 1118 | htmlText = self.tr( |
1119 | "<h4>Flash method 'manual' selected.</h4>" | |
1120 | "<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
|
1121 | " the data manually.</p><ol>" |
8096 | 1122 | "<li>Change the device to 'bootloader' mode.</li>" |
1123 | "<li>Wait until the device has entered 'bootloader' mode.</li>" | |
1124 | "<li>Ensure the boot volume is available (this may require" | |
1125 | " mounting it) and select its path.</li>" | |
1126 | "<li>Select the firmware file to be flashed and click the" | |
1127 | " flash button.</li>" | |
1128 | "</ol>" | |
1129 | ) | |
1130 | for boardType in SupportedUF2Boards: | |
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 | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1134 | def __showNoVolumeInformation(self, volumes, boardType): |
8096 | 1135 | """ |
1136 | 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
|
1137 | |
8096 | 1138 | @param volumes list of expected volume names |
1139 | @type list of str | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1140 | @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
|
1141 | @type str |
8096 | 1142 | """ |
1143 | 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
|
1144 | |
8096 | 1145 | htmlText = self.tr( |
1146 | "<h4>No Boot Volume detected.</h4>" | |
1147 | "<p>Please ensure that the boot volume of the device to be flashed" | |
1148 | " is available. " | |
1149 | ) | |
1150 | if len(volumes) == 1: | |
1151 | htmlText += self.tr( | |
1152 | "This volume should be named <b>{0}</b>." | |
1153 | " Press <b>Refresh</b> when ready.</p>" | |
1154 | ).format(volumes[0]) | |
1155 | else: | |
1156 | htmlText += self.tr( | |
1157 | "This volume should have one of these names.</p>" | |
1158 | "<ul><li>{0}</li></ul>" | |
1159 | "<p>Press <b>Refresh</b> when ready.</p>" | |
1160 | ).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
|
1161 | |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1162 | if boardType: |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1163 | htmlText += self.tr( |
11167 | 1164 | "<h4>Flash Instructions</h4>" |
8167
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1165 | "<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
|
1166 | " '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
|
1167 | ) |
cdc1b6692766
MicroPython: improved the UF2 Flash dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
1168 | 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
|
1169 | |
8096 | 1170 | self.infoEdit.setHtml(htmlText) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1171 | |
8096 | 1172 | def __showMultipleVolumesInformation(self, volumePaths): |
1173 | """ | |
1174 | Private method to show information because multiple devices of the | |
1175 | 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
|
1176 | |
8096 | 1177 | 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
|
1178 | |
8096 | 1179 | @param volumePaths list of volume paths |
1180 | @type list of str | |
1181 | """ | |
1182 | 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
|
1183 | |
8096 | 1184 | htmlText = self.tr( |
1185 | "<h4>Multiple Boot Volumes were found</h4>" | |
1186 | "<p>These volume paths were found.</p><ul><li>{0}</li></ul>" | |
1187 | "<p>Please ensure that only one device of a type is ready for" | |
1188 | " flashing. Press <b>Refresh</b> when ready.</p>" | |
1189 | ).format("</li><li>".join(sorted(volumePaths))) | |
1190 | self.infoEdit.setHtml(htmlText) | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1191 | |
8096 | 1192 | @pyqtSlot() |
1193 | def on_flashButton_clicked(self): | |
1194 | """ | |
1195 | Private slot to flash the selected MicroPython or CircuitPython | |
1196 | firmware onto the device. | |
1197 | """ | |
1198 | boardType = self.devicesComboBox.currentData(self.DeviceTypeRole) | |
1199 | firmwarePath = self.firmwarePicker.text() | |
1200 | volumePath = self.bootPicker.text() | |
1201 | 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
|
1202 | if boardType == self.__manualType: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1203 | 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
|
1204 | self.infoEdit.setHtml( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1205 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1206 | "<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
|
1207 | " 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
|
1208 | ) |
8111
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1209 | ) |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1210 | else: |
a8e9b387f701
UF2FlashDialog: added support for Raspberry Pi Pico.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8101
diff
changeset
|
1211 | firmwareType = SupportedUF2Boards[boardType]["firmware"] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1212 | 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
|
1213 | self.infoEdit.setHtml( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1214 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1215 | "<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
|
1216 | " 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
|
1217 | ).format(firmwareType) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1218 | ) |
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
|
1219 | QCoreApplication.processEvents( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1220 | QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1221 | ) |
10172 | 1222 | with contextlib.suppress(FileNotFoundError): |
1223 | shutil.copy(firmwarePath, volumePath) | |
8096 | 1224 | QThread.sleep(1) |
1225 | self.on_refreshButton_clicked() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1226 | |
8096 | 1227 | @pyqtSlot() |
1228 | def on_refreshButton_clicked(self): | |
1229 | """ | |
1230 | Private slot to refresh the dialog. | |
1231 | """ | |
1232 | self.__populate() | |
9954 | 1233 | self.__updateFlashButton() |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1234 | 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
|
1235 | |
8096 | 1236 | @pyqtSlot(int) |
1237 | def on_devicesComboBox_currentIndexChanged(self, index): | |
1238 | """ | |
1239 | 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
|
1240 | |
8096 | 1241 | @param index selected index |
1242 | @type int | |
1243 | """ | |
1244 | vidpid = self.devicesComboBox.itemData(index, self.DeviceVidPidRole) | |
1245 | 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
|
1246 | |
9815 | 1247 | self.searchBootButton.setEnabled(boardType == self.__manualType) |
8096 | 1248 | self.bootPicker.setEnabled(boardType == self.__manualType) |
1249 | if boardType == self.__manualType: | |
1250 | self.__showManualInstructions() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1251 | |
8096 | 1252 | if vidpid is None: |
1253 | if boardType is None: | |
1254 | self.bootPicker.clear() | |
1255 | else: | |
1256 | volumes = SupportedUF2Boards[boardType]["volumes"][vidpid] | |
1257 | foundVolumes = [] | |
9903 | 1258 | for volume, _ in volumes: |
9624
b47dfa7a137d
Refactored the Utilities and Globals modules in order to enhance the maintainability.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9614
diff
changeset
|
1259 | foundVolumes += FileSystemUtilities.findVolume(volume, findAll=True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1260 | |
8096 | 1261 | if len(foundVolumes) == 0: |
9903 | 1262 | self.__showNoVolumeInformation([v[0] for v in volumes], boardType) |
8096 | 1263 | self.bootPicker.clear() |
1264 | elif len(foundVolumes) == 1: | |
1265 | self.bootPicker.setText(foundVolumes[0]) | |
1266 | else: | |
9954 | 1267 | self.__showMultipleVolumesInformation(foundVolumes) |
8096 | 1268 | self.bootPicker.clear() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1269 | |
8096 | 1270 | self.__updateFlashButton() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1271 | |
8096 | 1272 | @pyqtSlot(str) |
1273 | def on_firmwarePicker_textChanged(self, text): | |
1274 | """ | |
1275 | 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
|
1276 | |
8096 | 1277 | @param text current text of the firmware edit |
1278 | @type str | |
1279 | """ | |
1280 | self.__updateFlashButton() | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
1281 | |
8096 | 1282 | @pyqtSlot(str) |
1283 | def on_bootPicker_textChanged(self, text): | |
1284 | """ | |
1285 | 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
|
1286 | |
8096 | 1287 | @param text current text of the boot volume edit |
1288 | @type str | |
1289 | """ | |
1290 | self.__updateFlashButton() | |
9815 | 1291 | |
1292 | @pyqtSlot() | |
1293 | def on_searchBootButton_clicked(self): | |
1294 | """ | |
1295 | Private slot to look for all known boot paths and present a list to select from. | |
1296 | """ | |
1297 | foundBootVolumes = set() | |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1298 | if not OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1299 | userMounts = FileSystemUtilities.getUserMounts() |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1300 | |
9815 | 1301 | for boardType in SupportedUF2Boards: |
1302 | for volumes in SupportedUF2Boards[boardType]["volumes"].values(): | |
9903 | 1303 | for volume, _ in volumes: |
10253
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1304 | if OSUtilities.isWindowsPlatform(): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1305 | foundBootVolumes.update( |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1306 | FileSystemUtilities.findVolume(volume, findAll=True) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1307 | ) |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1308 | else: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1309 | # check only user mounted devices on non-Windows systems |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1310 | for userMount in userMounts: |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1311 | if os.path.basename(userMount).startswith(volume): |
f9a0704d16b2
MicroPython interface
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10208
diff
changeset
|
1312 | foundBootVolumes.add(userMount) |
9815 | 1313 | |
1314 | if len(foundBootVolumes) == 0: | |
1315 | selectedVolume = "" | |
9903 | 1316 | EricMessageBox.information( |
1317 | self, | |
1318 | self.tr("Flash UF2 Device"), | |
1319 | self.tr("""No UF2 device 'boot' volumes found."""), | |
1320 | ) | |
9815 | 1321 | 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
|
1322 | selectedVolume = [*foundBootVolumes][0] |
9815 | 1323 | else: |
1324 | result, ok = QInputDialog.getItem( | |
9903 | 1325 | self, |
11054
38ffc8fbc782
Changed two translate statements in the UF2 Flash dialog class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11053
diff
changeset
|
1326 | 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
|
1327 | 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
|
1328 | [*foundBootVolumes], |
9821
6b1b06d74532
Fixed some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9815
diff
changeset
|
1329 | 0, |
6b1b06d74532
Fixed some code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9815
diff
changeset
|
1330 | True, |
9815 | 1331 | ) |
1332 | selectedVolume = result if ok else "" | |
1333 | ||
1334 | self.bootPicker.setText(selectedVolume) |