177 dlg = E5ProcessDialog(self.tr("'esptool erase_flash' Output"), |
177 dlg = E5ProcessDialog(self.tr("'esptool erase_flash' Output"), |
178 self.tr("Erase Flash"), |
178 self.tr("Erase Flash"), |
179 showProgress=True) |
179 showProgress=True) |
180 res = dlg.startProcess(sys.executable, flashArgs) |
180 res = dlg.startProcess(sys.executable, flashArgs) |
181 if res: |
181 if res: |
182 dlg.exec_() |
182 dlg.exec() |
183 |
183 |
184 @pyqtSlot() |
184 @pyqtSlot() |
185 def __flashMicroPython(self): |
185 def __flashMicroPython(self): |
186 """ |
186 """ |
187 Private slot to flash a MicroPython firmware to the device. |
187 Private slot to flash a MicroPython firmware to the device. |
188 |
188 |
189 @exception ValueError raised to indicate an unsupported chip type |
189 @exception ValueError raised to indicate an unsupported chip type |
190 """ |
190 """ |
191 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog |
191 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog |
192 dlg = EspFirmwareSelectionDialog() |
192 dlg = EspFirmwareSelectionDialog() |
193 if dlg.exec_() == QDialog.Accepted: |
193 if dlg.exec() == QDialog.Accepted: |
194 chip, firmware, flashMode, _ = dlg.getData() |
194 chip, firmware, flashMode, _ = dlg.getData() |
195 if chip == "esp8266": |
195 if chip == "esp8266": |
196 flashAddress = "0x0000" |
196 flashAddress = "0x0000" |
197 elif chip == "esp32": |
197 elif chip == "esp32": |
198 flashAddress = "0x1000" |
198 flashAddress = "0x1000" |
217 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"), |
217 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"), |
218 self.tr("Flash MicroPython Firmware"), |
218 self.tr("Flash MicroPython Firmware"), |
219 showProgress=True) |
219 showProgress=True) |
220 res = dlg.startProcess(sys.executable, flashArgs) |
220 res = dlg.startProcess(sys.executable, flashArgs) |
221 if res: |
221 if res: |
222 dlg.exec_() |
222 dlg.exec() |
223 |
223 |
224 @pyqtSlot() |
224 @pyqtSlot() |
225 def __flashAddons(self): |
225 def __flashAddons(self): |
226 """ |
226 """ |
227 Private slot to flash some additional firmware images. |
227 Private slot to flash some additional firmware images. |
228 """ |
228 """ |
229 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog |
229 from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog |
230 dlg = EspFirmwareSelectionDialog(addon=True) |
230 dlg = EspFirmwareSelectionDialog(addon=True) |
231 if dlg.exec_() == QDialog.Accepted: |
231 if dlg.exec() == QDialog.Accepted: |
232 chip, firmware, flashMode, flashAddress = dlg.getData() |
232 chip, firmware, flashMode, flashAddress = dlg.getData() |
233 flashArgs = [ |
233 flashArgs = [ |
234 "-u", |
234 "-u", |
235 "-m", "esptool", |
235 "-m", "esptool", |
236 "--chip", chip, |
236 "--chip", chip, |
248 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"), |
248 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"), |
249 self.tr("Flash Additional Firmware"), |
249 self.tr("Flash Additional Firmware"), |
250 showProgress=True) |
250 showProgress=True) |
251 res = dlg.startProcess(sys.executable, flashArgs) |
251 res = dlg.startProcess(sys.executable, flashArgs) |
252 if res: |
252 if res: |
253 dlg.exec_() |
253 dlg.exec() |
254 |
254 |
255 @pyqtSlot() |
255 @pyqtSlot() |
256 def __backupFlash(self): |
256 def __backupFlash(self): |
257 """ |
257 """ |
258 Private slot to backup the currently flashed firmware. |
258 Private slot to backup the currently flashed firmware. |
259 """ |
259 """ |
260 from .EspBackupRestoreFirmwareDialog import ( |
260 from .EspBackupRestoreFirmwareDialog import ( |
261 EspBackupRestoreFirmwareDialog |
261 EspBackupRestoreFirmwareDialog |
262 ) |
262 ) |
263 dlg = EspBackupRestoreFirmwareDialog(backupMode=True) |
263 dlg = EspBackupRestoreFirmwareDialog(backupMode=True) |
264 if dlg.exec_() == QDialog.Accepted: |
264 if dlg.exec() == QDialog.Accepted: |
265 chip, flashSize, flashMode, firmware = dlg.getData() |
265 chip, flashSize, flashMode, firmware = dlg.getData() |
266 flashArgs = [ |
266 flashArgs = [ |
267 "-u", |
267 "-u", |
268 "-m", "esptool", |
268 "-m", "esptool", |
269 "--chip", chip, |
269 "--chip", chip, |
275 dlg = E5ProcessDialog(self.tr("'esptool read_flash' Output"), |
275 dlg = E5ProcessDialog(self.tr("'esptool read_flash' Output"), |
276 self.tr("Backup Firmware"), |
276 self.tr("Backup Firmware"), |
277 showProgress=True) |
277 showProgress=True) |
278 res = dlg.startProcess(sys.executable, flashArgs) |
278 res = dlg.startProcess(sys.executable, flashArgs) |
279 if res: |
279 if res: |
280 dlg.exec_() |
280 dlg.exec() |
281 |
281 |
282 @pyqtSlot() |
282 @pyqtSlot() |
283 def __restoreFlash(self): |
283 def __restoreFlash(self): |
284 """ |
284 """ |
285 Private slot to restore a previously saved firmware. |
285 Private slot to restore a previously saved firmware. |
286 """ |
286 """ |
287 from .EspBackupRestoreFirmwareDialog import ( |
287 from .EspBackupRestoreFirmwareDialog import ( |
288 EspBackupRestoreFirmwareDialog |
288 EspBackupRestoreFirmwareDialog |
289 ) |
289 ) |
290 dlg = EspBackupRestoreFirmwareDialog(backupMode=False) |
290 dlg = EspBackupRestoreFirmwareDialog(backupMode=False) |
291 if dlg.exec_() == QDialog.Accepted: |
291 if dlg.exec() == QDialog.Accepted: |
292 chip, flashSize, flashMode, firmware = dlg.getData() |
292 chip, flashSize, flashMode, firmware = dlg.getData() |
293 flashArgs = [ |
293 flashArgs = [ |
294 "-u", |
294 "-u", |
295 "-m", "esptool", |
295 "-m", "esptool", |
296 "--chip", chip, |
296 "--chip", chip, |
309 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"), |
309 dlg = E5ProcessDialog(self.tr("'esptool write_flash' Output"), |
310 self.tr("Restore Firmware"), |
310 self.tr("Restore Firmware"), |
311 showProgress=True) |
311 showProgress=True) |
312 res = dlg.startProcess(sys.executable, flashArgs) |
312 res = dlg.startProcess(sys.executable, flashArgs) |
313 if res: |
313 if res: |
314 dlg.exec_() |
314 dlg.exec() |
315 |
315 |
316 @pyqtSlot() |
316 @pyqtSlot() |
317 def __showChipID(self): |
317 def __showChipID(self): |
318 """ |
318 """ |
319 Private slot to show the ID of the ESP chip. |
319 Private slot to show the ID of the ESP chip. |
326 ] |
326 ] |
327 dlg = E5ProcessDialog(self.tr("'esptool chip_id' Output"), |
327 dlg = E5ProcessDialog(self.tr("'esptool chip_id' Output"), |
328 self.tr("Show Chip ID")) |
328 self.tr("Show Chip ID")) |
329 res = dlg.startProcess(sys.executable, args) |
329 res = dlg.startProcess(sys.executable, args) |
330 if res: |
330 if res: |
331 dlg.exec_() |
331 dlg.exec() |
332 |
332 |
333 @pyqtSlot() |
333 @pyqtSlot() |
334 def __showFlashID(self): |
334 def __showFlashID(self): |
335 """ |
335 """ |
336 Private slot to show the ID of the ESP flash chip. |
336 Private slot to show the ID of the ESP flash chip. |
343 ] |
343 ] |
344 dlg = E5ProcessDialog(self.tr("'esptool flash_id' Output"), |
344 dlg = E5ProcessDialog(self.tr("'esptool flash_id' Output"), |
345 self.tr("Show Flash ID")) |
345 self.tr("Show Flash ID")) |
346 res = dlg.startProcess(sys.executable, args) |
346 res = dlg.startProcess(sys.executable, args) |
347 if res: |
347 if res: |
348 dlg.exec_() |
348 dlg.exec() |
349 |
349 |
350 @pyqtSlot() |
350 @pyqtSlot() |
351 def __showMACAddress(self): |
351 def __showMACAddress(self): |
352 """ |
352 """ |
353 Private slot to show the MAC address of the ESP chip. |
353 Private slot to show the MAC address of the ESP chip. |
360 ] |
360 ] |
361 dlg = E5ProcessDialog(self.tr("'esptool read_mac' Output"), |
361 dlg = E5ProcessDialog(self.tr("'esptool read_mac' Output"), |
362 self.tr("Show MAC Address")) |
362 self.tr("Show MAC Address")) |
363 res = dlg.startProcess(sys.executable, args) |
363 res = dlg.startProcess(sys.executable, args) |
364 if res: |
364 if res: |
365 dlg.exec_() |
365 dlg.exec() |
366 |
366 |
367 @pyqtSlot() |
367 @pyqtSlot() |
368 def __resetDevice(self): |
368 def __resetDevice(self): |
369 """ |
369 """ |
370 Private slot to reset the connected device. |
370 Private slot to reset the connected device. |