--- a/src/eric7/MicroPython/RP2040Devices.py Thu Feb 09 09:55:57 2023 +0100 +++ b/src/eric7/MicroPython/RP2040Devices.py Sat Feb 11 16:59:50 2023 +0100 @@ -175,41 +175,33 @@ available firmware version. """ if self.microPython.isConnected(): - interface = self.microPython.commandsInterface() - if interface is not None: - impInfo = interface.getImplementation() - if impInfo["name"] != "micropython": - EricMessageBox.critical( - None, - self.tr("Show MicroPython Versions"), - self.tr( - """The firmware of the connected device cannot be""" - """ determined or the board does not run MicroPython.""" - """ Aborting...""" - ), - ) + if self._deviceData["mpy_name"] != "micropython": + EricMessageBox.critical( + None, + self.tr("Show MicroPython Versions"), + self.tr( + """The firmware of the connected device cannot be""" + """ determined or the board does not run MicroPython.""" + """ Aborting...""" + ), + ) + else: + if self._deviceData["mpy_variant"] == "Pimoroni": + # MicroPython with Pimoroni add-on libraries + url = QUrl(FirmwareGithubUrls["pimoroni_pico"]) else: - if impInfo["variant"] == "Pimoroni": - # MicroPython with Pimoroni add-on libraries - url = QUrl(FirmwareGithubUrls["pimoroni_pico"]) - else: - url = QUrl(FirmwareGithubUrls["micropython"]) - ui = ericApp().getObject("UserInterface") - request = QNetworkRequest(url) - reply = ui.networkAccessManager().head(request) - reply.finished.connect( - lambda: self.__firmwareVersionResponse(reply, impInfo) - ) + url = QUrl(FirmwareGithubUrls["micropython"]) + ui = ericApp().getObject("UserInterface") + request = QNetworkRequest(url) + reply = ui.networkAccessManager().head(request) + reply.finished.connect(lambda: self.__firmwareVersionResponse(reply)) - def __firmwareVersionResponse(self, reply, implementation): + def __firmwareVersionResponse(self, reply): """ Private method handling the response of the latest version request. @param reply reference to the reply object @type QNetworkReply - @param implementation dictionary containing the implementation data of the - connected device - @type dict """ latestUrl = reply.url().toString() tag = latestUrl.rsplit("/", 1)[-1] @@ -218,11 +210,11 @@ tag = tag[1:] latestVersion = Globals.versionToTuple(tag) - if implementation["version"] == "unknown": + if self._deviceData["mpy_version"] == "unknown": currentVersionStr = self.tr("unknown") currentVersion = (0, 0, 0) else: - currentVersionStr = implementation["version"] + currentVersionStr = self._deviceData["mpy_version"] currentVersion = Globals.versionToTuple(currentVersionStr) msg = self.tr( @@ -234,12 +226,12 @@ ).format( currentVersionStr, tag, - self.tr("({0})").format(implementation["variant"]) - if implementation["variant"] + self.tr("({0})").format(self._deviceData["mpy_variant"]) + if self._deviceData["mpy_variant"] else "", ) if ( - implementation["variant"] not in ["Pimoroni"] + self._deviceData["mpy_variant"] not in ["Pimoroni"] and currentVersion < latestVersion ): # cannot derive that info for 'Pimoroni' variant @@ -287,7 +279,7 @@ ] -def createDevice(microPythonWidget, deviceType, vid, pid, boardName): +def createDevice(microPythonWidget, deviceType, vid, pid, boardName, serialNumber): """ Function to instantiate a MicroPython device object. @@ -301,6 +293,8 @@ @type int @param boardName name of the board @type str + @param serialNumber serial number of the board + @type str @return reference to the instantiated device object @rtype RP2040Device """