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