src/eric7/MicroPython/CircuitPythonDevices.py

branch
eric7
changeset 9751
606ac0e26533
parent 9749
5d409223cf3f
child 9752
2b9546c0cbd9
equal deleted inserted replaced
9750:4958dd72c937 9751:606ac0e26533
361 if os.path.exists(bootFile): 361 if os.path.exists(bootFile):
362 with open(bootFile, "r") as f: 362 with open(bootFile, "r") as f:
363 line = f.readline() 363 line = f.readline()
364 cpyVersionStr = line.split(";")[0].split()[2] 364 cpyVersionStr = line.split(";")[0].split()[2]
365 cpyVersion = Globals.versionToTuple(cpyVersionStr) 365 cpyVersion = Globals.versionToTuple(cpyVersionStr)
366 if cpyVersion == (0, 0, 0) and self.microPython.isConnected(): 366 if (
367 cpyVersion == (0, 0, 0)
368 and self._deviceData
369 and self._deviceData["mpy_version"] != "unknown"
370 ):
367 # drive is not mounted or 'boot_out.txt' is missing but the device 371 # drive is not mounted or 'boot_out.txt' is missing but the device
368 # is connected via the serial console 372 # is connected via the serial console
369 interface = self.microPython.commandsInterface() 373 cpyVersionStr = self._deviceData["mpy_version"]
370 if interface is not None: 374 cpyVersion = Globals.versionToTuple(cpyVersionStr)
371 impInfo = interface.getImplementation()
372 if impInfo["version"] != "unknown":
373 cpyVersionStr = impInfo["version"]
374 cpyVersion = Globals.versionToTuple(cpyVersionStr)
375 375
376 msg = self.tr( 376 msg = self.tr(
377 "<h4>CircuitPython Version Information</h4>" 377 "<h4>CircuitPython Version Information</h4>"
378 "<table>" 378 "<table>"
379 "<tr><td>Installed:</td><td>{0}</td></tr>" 379 "<tr><td>Installed:</td><td>{0}</td></tr>"
473 Preferences.getMicroPython("CircuitPythonLibrariesUrl"), 473 Preferences.getMicroPython("CircuitPythonLibrariesUrl"),
474 ), 474 ),
475 ] 475 ]
476 476
477 477
478 def createDevice(microPythonWidget, deviceType, vid, pid, boardName): 478 def createDevice(microPythonWidget, deviceType, vid, pid, boardName, serialNumber):
479 """ 479 """
480 Function to instantiate a MicroPython device object. 480 Function to instantiate a MicroPython device object.
481 481
482 @param microPythonWidget reference to the main MicroPython widget 482 @param microPythonWidget reference to the main MicroPython widget
483 @type MicroPythonWidget 483 @type MicroPythonWidget
487 @type int 487 @type int
488 @param pid product ID 488 @param pid product ID
489 @type int 489 @type int
490 @param boardName name of the board 490 @param boardName name of the board
491 @type str 491 @type str
492 @param serialNumber serial number of the board
493 @type str
492 @return reference to the instantiated device object 494 @return reference to the instantiated device object
493 @rtype CircuitPythonDevice 495 @rtype CircuitPythonDevice
494 """ 496 """
495 return CircuitPythonDevice(microPythonWidget, deviceType, boardName) 497 return CircuitPythonDevice(microPythonWidget, deviceType, boardName)

eric ide

mercurial