eric6/MicroPython/EspDevices.py

changeset 7353
caa2ccd5677c
parent 7352
5f69f55b919f
child 7355
c7146f7e06aa
equal deleted inserted replaced
7352:5f69f55b919f 7353:caa2ccd5677c
9 """ 9 """
10 10
11 11
12 import sys 12 import sys
13 13
14 from PyQt5.QtCore import pyqtSlot 14 from PyQt5.QtCore import pyqtSlot, QProcess
15 from PyQt5.QtWidgets import QDialog 15 from PyQt5.QtWidgets import QDialog
16 16
17 from E5Gui import E5MessageBox 17 from E5Gui import E5MessageBox
18 from E5Gui.E5ProcessDialog import E5ProcessDialog 18 from E5Gui.E5ProcessDialog import E5ProcessDialog
19 from E5Gui.E5Application import e5App 19 from E5Gui.E5Application import e5App
350 @pyqtSlot() 350 @pyqtSlot()
351 def __resetDevice(self): 351 def __resetDevice(self):
352 """ 352 """
353 Private slot to reset the connected device. 353 Private slot to reset the connected device.
354 """ 354 """
355 self.microPython.commandsInterface().execute([ 355 if self.microPython.isConnected():
356 "import machine", 356 self.microPython.commandsInterface().execute([
357 "machine.reset()", 357 "import machine",
358 ]) 358 "machine.reset()",
359 ])
360 else:
361 # perform a reset via esptool using flash_id command ignoring
362 # the output
363 args = [
364 "-u",
365 "-m", "esptool",
366 "--port", self.microPython.getCurrentPort(),
367 "flash_id"
368 ]
369 proc = QProcess()
370 proc.start(sys.executable, args)
371 procStarted = proc.waitForStarted(10000)
372 if procStarted:
373 proc.waitForFinished(10000)
359 374
360 @pyqtSlot() 375 @pyqtSlot()
361 def __installEspTool(self): 376 def __installEspTool(self):
362 """ 377 """
363 Private slot to install the esptool package via pip. 378 Private slot to install the esptool package via pip.

eric ide

mercurial