Sat, 31 Aug 2024 15:54:24 +0200
MicroPython
- Added MicroPython support for RP2350 based controllers.
--- a/docs/changelog.md Sat Aug 31 15:49:16 2024 +0200 +++ b/docs/changelog.md Sat Aug 31 15:54:24 2024 +0200 @@ -2,6 +2,8 @@ ### Version 24.10 - bug fixes +- MicroPython + - Added MicroPython support for RP2350 based controllers. ### Version 24.9 - bug fixes
--- a/eric7.epj Sat Aug 31 15:49:16 2024 +0200 +++ b/eric7.epj Sat Aug 31 15:54:24 2024 +0200 @@ -1350,7 +1350,7 @@ "src/eric7/MicroPython/Devices/MCUScripts/pimoroniWiFiConnect.py", "src/eric7/MicroPython/Devices/MicrobitDevices.py", "src/eric7/MicroPython/Devices/PyBoardDevices.py", - "src/eric7/MicroPython/Devices/RP2040Devices.py", + "src/eric7/MicroPython/Devices/RP2Devices.py", "src/eric7/MicroPython/Devices/STLinkDevices.py", "src/eric7/MicroPython/Devices/TeensyDevices.py", "src/eric7/MicroPython/Devices/__init__.py",
--- a/src/eric7/APIs/Python3/eric7.api Sat Aug 31 15:49:16 2024 +0200 +++ b/src/eric7/APIs/Python3/eric7.api Sat Aug 31 15:54:24 2024 +0200 @@ -2977,55 +2977,55 @@ eric7.MicroPython.Devices.PyBoardDevices.PyBoardDevice.supportsLocalFileAccess?4() eric7.MicroPython.Devices.PyBoardDevices.PyBoardDevice?1(microPythonWidget, deviceType, parent=None) eric7.MicroPython.Devices.PyBoardDevices.createDevice?4(microPythonWidget, deviceType, _vid, _pid, _boardName, _serialNumber) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device._getSetTimeCode?5() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.activateBluetoothInterface?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.addDeviceMenuEntries?4(menu) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.addDeviceWifiEntries?4(menu) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.canRunScript?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.canStartFileManager?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.canStartPlotter?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.canStartRepl?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.checkInternet?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.checkInternetViaLan?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.connectToLan?4(config, hostname) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.connectWifi?4(ssid, password, hostname) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.deactivateBluetoothInterface?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.deactivateEthernet?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.deactivateInterface?4(interface) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.deviceName?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.disableWebrepl?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.disconnectFromLan?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.disconnectWifi?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.enableWebrepl?4(password) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.forceInterrupt?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.getBluetoothStatus?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.getConnectedClients?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.getDeviceScan?4(timeout=10) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.getDocumentationUrl?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.getDownloadMenuEntries?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.getEthernetStatus?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.getWifiData?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.hasBluetooth?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.hasEthernet?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.hasFlashMenuEntry?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.hasNetworkTime?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.hasWifi?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.hasWifiCountry?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.isLanConnected?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.isWifiApConnected?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.isWifiClientConnected?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.removeCredentials?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.removeLanAutoConnect?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.runScript?4(script) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.scanNetworks?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.setButtons?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.setNetworkTime?4(server="pool.ntp.org", tzOffset=0, timeout=10) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.startAccessPoint?4(ssid, security=None, password=None, hostname=None, ifconfig=None, ) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.stopAccessPoint?4() -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.writeCredentials?4(ssid, password, hostname, country) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device.writeLanAutoConnect?4(config, hostname) -eric7.MicroPython.Devices.RP2040Devices.RP2040Device?1(microPythonWidget, deviceType, parent=None) -eric7.MicroPython.Devices.RP2040Devices.createDevice?4(microPythonWidget, deviceType, _vid, _pid, _boardName, _serialNumber) +eric7.MicroPython.Devices.RP2Devices.RP2Device._getSetTimeCode?5() +eric7.MicroPython.Devices.RP2Devices.RP2Device.activateBluetoothInterface?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.addDeviceMenuEntries?4(menu) +eric7.MicroPython.Devices.RP2Devices.RP2Device.addDeviceWifiEntries?4(menu) +eric7.MicroPython.Devices.RP2Devices.RP2Device.canRunScript?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.canStartFileManager?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.canStartPlotter?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.canStartRepl?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.checkInternet?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.checkInternetViaLan?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.connectToLan?4(config, hostname) +eric7.MicroPython.Devices.RP2Devices.RP2Device.connectWifi?4(ssid, password, hostname) +eric7.MicroPython.Devices.RP2Devices.RP2Device.deactivateBluetoothInterface?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.deactivateEthernet?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.deactivateInterface?4(interface) +eric7.MicroPython.Devices.RP2Devices.RP2Device.deviceName?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.disableWebrepl?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.disconnectFromLan?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.disconnectWifi?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.enableWebrepl?4(password) +eric7.MicroPython.Devices.RP2Devices.RP2Device.forceInterrupt?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.getBluetoothStatus?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.getConnectedClients?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.getDeviceScan?4(timeout=10) +eric7.MicroPython.Devices.RP2Devices.RP2Device.getDocumentationUrl?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.getDownloadMenuEntries?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.getEthernetStatus?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.getWifiData?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.hasBluetooth?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.hasEthernet?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.hasFlashMenuEntry?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.hasNetworkTime?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.hasWifi?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.hasWifiCountry?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.isLanConnected?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.isWifiApConnected?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.isWifiClientConnected?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.removeCredentials?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.removeLanAutoConnect?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.runScript?4(script) +eric7.MicroPython.Devices.RP2Devices.RP2Device.scanNetworks?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.setButtons?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.setNetworkTime?4(server="pool.ntp.org", tzOffset=0, timeout=10) +eric7.MicroPython.Devices.RP2Devices.RP2Device.startAccessPoint?4(ssid, security=None, password=None, hostname=None, ifconfig=None, ) +eric7.MicroPython.Devices.RP2Devices.RP2Device.stopAccessPoint?4() +eric7.MicroPython.Devices.RP2Devices.RP2Device.writeCredentials?4(ssid, password, hostname, country) +eric7.MicroPython.Devices.RP2Devices.RP2Device.writeLanAutoConnect?4(config, hostname) +eric7.MicroPython.Devices.RP2Devices.RP2Device?1(microPythonWidget, deviceType, parent=None) +eric7.MicroPython.Devices.RP2Devices.createDevice?4(microPythonWidget, deviceType, _vid, _pid, _boardName, _serialNumber) eric7.MicroPython.Devices.STLinkDevices.STLinkDevice.DeviceVolumeName?7 eric7.MicroPython.Devices.STLinkDevices.STLinkDevice.addDeviceMenuEntries?4(menu) eric7.MicroPython.Devices.STLinkDevices.STLinkDevice.canRunScript?4() @@ -3963,6 +3963,7 @@ eric7.PipInterface.piplicenses.get_pkg_included_file?4(pkg, file_names_rgx: str) eric7.PipInterface.piplicenses.get_pkg_info?4(pkg) eric7.PipInterface.piplicenses.get_python_sys_path?4(executable: str) +eric7.PipInterface.piplicenses.get_value_from_enum?4(enum_cls: Type[NoValueEnum], value: str) eric7.PipInterface.piplicenses.importlib_metadata?7 eric7.PipInterface.piplicenses.main?4() eric7.PipInterface.piplicenses.normalize_pkg_name?4(pkg_name: str) @@ -4888,6 +4889,7 @@ eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.USER_CONFIG?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.WHITESPACE?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.WHITESPACE_AFTER_COMMA_REGEX?7 +eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.WHITESPACE_AFTER_DECORATOR_REGEX?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.WS_NEEDED_OPERATORS?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle.WS_OPTIONAL_OPERATORS?7 eric7.Plugins.CheckerPlugins.CodeStyleChecker.pycodestyle._SYMBOLIC_OPS?8
--- a/src/eric7/APIs/Python3/eric7.bas Sat Aug 31 15:49:16 2024 +0200 +++ b/src/eric7/APIs/Python3/eric7.bas Sat Aug 31 15:54:24 2024 +0200 @@ -943,7 +943,7 @@ Queues HgExtension QueuesProjectHelper HgExtensionProjectHelper QuickFindFileDialog QWidget Ui_QuickFindFile -RP2040Device BaseDevice +RP2Device BaseDevice RbModule Class RccCompilerOptionsDialog QDialog Ui_RccCompilerOptionsDialog Rebase HgExtension
--- a/src/eric7/Documentation/Help/source.qhp Sat Aug 31 15:49:16 2024 +0200 +++ b/src/eric7/Documentation/Help/source.qhp Sat Aug 31 15:54:24 2024 +0200 @@ -289,7 +289,7 @@ <section title="eric7.MicroPython.Devices.GenericMicroPythonDevices" ref="eric7.MicroPython.Devices.GenericMicroPythonDevices.html" /> <section title="eric7.MicroPython.Devices.MicrobitDevices" ref="eric7.MicroPython.Devices.MicrobitDevices.html" /> <section title="eric7.MicroPython.Devices.PyBoardDevices" ref="eric7.MicroPython.Devices.PyBoardDevices.html" /> - <section title="eric7.MicroPython.Devices.RP2040Devices" ref="eric7.MicroPython.Devices.RP2040Devices.html" /> + <section title="eric7.MicroPython.Devices.RP2Devices" ref="eric7.MicroPython.Devices.RP2Devices.html" /> <section title="eric7.MicroPython.Devices.STLinkDevices" ref="eric7.MicroPython.Devices.STLinkDevices.html" /> <section title="eric7.MicroPython.Devices.TeensyDevices" ref="eric7.MicroPython.Devices.TeensyDevices.html" /> <section title="eric7.MicroPython.Devices.__init__" ref="eric7.MicroPython.Devices.__init__.html" /> @@ -14745,64 +14745,64 @@ <keyword name="QuickFindFileDialog.on_fileNameEdit_returnPressed" id="QuickFindFileDialog.on_fileNameEdit_returnPressed" ref="eric7.Project.QuickFindFileDialog.html#QuickFindFileDialog.on_fileNameEdit_returnPressed" /> <keyword name="QuickFindFileDialog.on_fileNameEdit_textChanged" id="QuickFindFileDialog.on_fileNameEdit_textChanged" ref="eric7.Project.QuickFindFileDialog.html#QuickFindFileDialog.on_fileNameEdit_textChanged" /> <keyword name="QuickFindFileDialog.show" id="QuickFindFileDialog.show" ref="eric7.Project.QuickFindFileDialog.html#QuickFindFileDialog.show" /> - <keyword name="RP2040Device" id="RP2040Device" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device" /> - <keyword name="RP2040Device (Constructor)" id="RP2040Device (Constructor)" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__init__" /> - <keyword name="RP2040Device.__activateBootloader" id="RP2040Device.__activateBootloader" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__activateBootloader" /> - <keyword name="RP2040Device.__createRP2040Menu" id="RP2040Device.__createRP2040Menu" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__createRP2040Menu" /> - <keyword name="RP2040Device.__firmwareVersionResponse" id="RP2040Device.__firmwareVersionResponse" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__firmwareVersionResponse" /> - <keyword name="RP2040Device.__flashPython" id="RP2040Device.__flashPython" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__flashPython" /> - <keyword name="RP2040Device.__resetCountry" id="RP2040Device.__resetCountry" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__resetCountry" /> - <keyword name="RP2040Device.__resetDevice" id="RP2040Device.__resetDevice" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__resetDevice" /> - <keyword name="RP2040Device.__setCountry" id="RP2040Device.__setCountry" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__setCountry" /> - <keyword name="RP2040Device.__showFirmwareVersions" id="RP2040Device.__showFirmwareVersions" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.__showFirmwareVersions" /> - <keyword name="RP2040Device._getSetTimeCode" id="RP2040Device._getSetTimeCode" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device._getSetTimeCode" /> - <keyword name="RP2040Device.activateBluetoothInterface" id="RP2040Device.activateBluetoothInterface" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.activateBluetoothInterface" /> - <keyword name="RP2040Device.addDeviceMenuEntries" id="RP2040Device.addDeviceMenuEntries" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.addDeviceMenuEntries" /> - <keyword name="RP2040Device.addDeviceWifiEntries" id="RP2040Device.addDeviceWifiEntries" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.addDeviceWifiEntries" /> - <keyword name="RP2040Device.canRunScript" id="RP2040Device.canRunScript" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.canRunScript" /> - <keyword name="RP2040Device.canStartFileManager" id="RP2040Device.canStartFileManager" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.canStartFileManager" /> - <keyword name="RP2040Device.canStartPlotter" id="RP2040Device.canStartPlotter" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.canStartPlotter" /> - <keyword name="RP2040Device.canStartRepl" id="RP2040Device.canStartRepl" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.canStartRepl" /> - <keyword name="RP2040Device.checkInternet" id="RP2040Device.checkInternet" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.checkInternet" /> - <keyword name="RP2040Device.checkInternetViaLan" id="RP2040Device.checkInternetViaLan" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.checkInternetViaLan" /> - <keyword name="RP2040Device.connectToLan" id="RP2040Device.connectToLan" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.connectToLan" /> - <keyword name="RP2040Device.connectWifi" id="RP2040Device.connectWifi" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.connectWifi" /> - <keyword name="RP2040Device.deactivateBluetoothInterface" id="RP2040Device.deactivateBluetoothInterface" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.deactivateBluetoothInterface" /> - <keyword name="RP2040Device.deactivateEthernet" id="RP2040Device.deactivateEthernet" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.deactivateEthernet" /> - <keyword name="RP2040Device.deactivateInterface" id="RP2040Device.deactivateInterface" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.deactivateInterface" /> - <keyword name="RP2040Device.deviceName" id="RP2040Device.deviceName" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.deviceName" /> - <keyword name="RP2040Device.disableWebrepl" id="RP2040Device.disableWebrepl" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.disableWebrepl" /> - <keyword name="RP2040Device.disconnectFromLan" id="RP2040Device.disconnectFromLan" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.disconnectFromLan" /> - <keyword name="RP2040Device.disconnectWifi" id="RP2040Device.disconnectWifi" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.disconnectWifi" /> - <keyword name="RP2040Device.enableWebrepl" id="RP2040Device.enableWebrepl" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.enableWebrepl" /> - <keyword name="RP2040Device.forceInterrupt" id="RP2040Device.forceInterrupt" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.forceInterrupt" /> - <keyword name="RP2040Device.getBluetoothStatus" id="RP2040Device.getBluetoothStatus" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.getBluetoothStatus" /> - <keyword name="RP2040Device.getConnectedClients" id="RP2040Device.getConnectedClients" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.getConnectedClients" /> - <keyword name="RP2040Device.getDeviceScan" id="RP2040Device.getDeviceScan" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.getDeviceScan" /> - <keyword name="RP2040Device.getDocumentationUrl" id="RP2040Device.getDocumentationUrl" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.getDocumentationUrl" /> - <keyword name="RP2040Device.getDownloadMenuEntries" id="RP2040Device.getDownloadMenuEntries" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.getDownloadMenuEntries" /> - <keyword name="RP2040Device.getEthernetStatus" id="RP2040Device.getEthernetStatus" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.getEthernetStatus" /> - <keyword name="RP2040Device.getWifiData" id="RP2040Device.getWifiData" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.getWifiData" /> - <keyword name="RP2040Device.hasBluetooth" id="RP2040Device.hasBluetooth" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.hasBluetooth" /> - <keyword name="RP2040Device.hasEthernet" id="RP2040Device.hasEthernet" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.hasEthernet" /> - <keyword name="RP2040Device.hasFlashMenuEntry" id="RP2040Device.hasFlashMenuEntry" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.hasFlashMenuEntry" /> - <keyword name="RP2040Device.hasNetworkTime" id="RP2040Device.hasNetworkTime" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.hasNetworkTime" /> - <keyword name="RP2040Device.hasWifi" id="RP2040Device.hasWifi" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.hasWifi" /> - <keyword name="RP2040Device.hasWifiCountry" id="RP2040Device.hasWifiCountry" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.hasWifiCountry" /> - <keyword name="RP2040Device.isLanConnected" id="RP2040Device.isLanConnected" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.isLanConnected" /> - <keyword name="RP2040Device.isWifiApConnected" id="RP2040Device.isWifiApConnected" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.isWifiApConnected" /> - <keyword name="RP2040Device.isWifiClientConnected" id="RP2040Device.isWifiClientConnected" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.isWifiClientConnected" /> - <keyword name="RP2040Device.removeCredentials" id="RP2040Device.removeCredentials" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.removeCredentials" /> - <keyword name="RP2040Device.removeLanAutoConnect" id="RP2040Device.removeLanAutoConnect" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.removeLanAutoConnect" /> - <keyword name="RP2040Device.runScript" id="RP2040Device.runScript" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.runScript" /> - <keyword name="RP2040Device.scanNetworks" id="RP2040Device.scanNetworks" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.scanNetworks" /> - <keyword name="RP2040Device.setButtons" id="RP2040Device.setButtons" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.setButtons" /> - <keyword name="RP2040Device.setNetworkTime" id="RP2040Device.setNetworkTime" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.setNetworkTime" /> - <keyword name="RP2040Device.startAccessPoint" id="RP2040Device.startAccessPoint" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.startAccessPoint" /> - <keyword name="RP2040Device.stopAccessPoint" id="RP2040Device.stopAccessPoint" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.stopAccessPoint" /> - <keyword name="RP2040Device.writeCredentials" id="RP2040Device.writeCredentials" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.writeCredentials" /> - <keyword name="RP2040Device.writeLanAutoConnect" id="RP2040Device.writeLanAutoConnect" ref="eric7.MicroPython.Devices.RP2040Devices.html#RP2040Device.writeLanAutoConnect" /> - <keyword name="RP2040Devices (Module)" id="RP2040Devices (Module)" ref="eric7.MicroPython.Devices.RP2040Devices.html" /> + <keyword name="RP2Device" id="RP2Device" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device" /> + <keyword name="RP2Device (Constructor)" id="RP2Device (Constructor)" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__init__" /> + <keyword name="RP2Device.__activateBootloader" id="RP2Device.__activateBootloader" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__activateBootloader" /> + <keyword name="RP2Device.__createRP2Menu" id="RP2Device.__createRP2Menu" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__createRP2Menu" /> + <keyword name="RP2Device.__firmwareVersionResponse" id="RP2Device.__firmwareVersionResponse" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__firmwareVersionResponse" /> + <keyword name="RP2Device.__flashPython" id="RP2Device.__flashPython" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__flashPython" /> + <keyword name="RP2Device.__resetCountry" id="RP2Device.__resetCountry" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__resetCountry" /> + <keyword name="RP2Device.__resetDevice" id="RP2Device.__resetDevice" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__resetDevice" /> + <keyword name="RP2Device.__setCountry" id="RP2Device.__setCountry" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__setCountry" /> + <keyword name="RP2Device.__showFirmwareVersions" id="RP2Device.__showFirmwareVersions" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.__showFirmwareVersions" /> + <keyword name="RP2Device._getSetTimeCode" id="RP2Device._getSetTimeCode" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device._getSetTimeCode" /> + <keyword name="RP2Device.activateBluetoothInterface" id="RP2Device.activateBluetoothInterface" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.activateBluetoothInterface" /> + <keyword name="RP2Device.addDeviceMenuEntries" id="RP2Device.addDeviceMenuEntries" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.addDeviceMenuEntries" /> + <keyword name="RP2Device.addDeviceWifiEntries" id="RP2Device.addDeviceWifiEntries" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.addDeviceWifiEntries" /> + <keyword name="RP2Device.canRunScript" id="RP2Device.canRunScript" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.canRunScript" /> + <keyword name="RP2Device.canStartFileManager" id="RP2Device.canStartFileManager" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.canStartFileManager" /> + <keyword name="RP2Device.canStartPlotter" id="RP2Device.canStartPlotter" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.canStartPlotter" /> + <keyword name="RP2Device.canStartRepl" id="RP2Device.canStartRepl" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.canStartRepl" /> + <keyword name="RP2Device.checkInternet" id="RP2Device.checkInternet" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.checkInternet" /> + <keyword name="RP2Device.checkInternetViaLan" id="RP2Device.checkInternetViaLan" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.checkInternetViaLan" /> + <keyword name="RP2Device.connectToLan" id="RP2Device.connectToLan" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.connectToLan" /> + <keyword name="RP2Device.connectWifi" id="RP2Device.connectWifi" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.connectWifi" /> + <keyword name="RP2Device.deactivateBluetoothInterface" id="RP2Device.deactivateBluetoothInterface" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.deactivateBluetoothInterface" /> + <keyword name="RP2Device.deactivateEthernet" id="RP2Device.deactivateEthernet" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.deactivateEthernet" /> + <keyword name="RP2Device.deactivateInterface" id="RP2Device.deactivateInterface" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.deactivateInterface" /> + <keyword name="RP2Device.deviceName" id="RP2Device.deviceName" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.deviceName" /> + <keyword name="RP2Device.disableWebrepl" id="RP2Device.disableWebrepl" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.disableWebrepl" /> + <keyword name="RP2Device.disconnectFromLan" id="RP2Device.disconnectFromLan" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.disconnectFromLan" /> + <keyword name="RP2Device.disconnectWifi" id="RP2Device.disconnectWifi" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.disconnectWifi" /> + <keyword name="RP2Device.enableWebrepl" id="RP2Device.enableWebrepl" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.enableWebrepl" /> + <keyword name="RP2Device.forceInterrupt" id="RP2Device.forceInterrupt" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.forceInterrupt" /> + <keyword name="RP2Device.getBluetoothStatus" id="RP2Device.getBluetoothStatus" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.getBluetoothStatus" /> + <keyword name="RP2Device.getConnectedClients" id="RP2Device.getConnectedClients" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.getConnectedClients" /> + <keyword name="RP2Device.getDeviceScan" id="RP2Device.getDeviceScan" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.getDeviceScan" /> + <keyword name="RP2Device.getDocumentationUrl" id="RP2Device.getDocumentationUrl" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.getDocumentationUrl" /> + <keyword name="RP2Device.getDownloadMenuEntries" id="RP2Device.getDownloadMenuEntries" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.getDownloadMenuEntries" /> + <keyword name="RP2Device.getEthernetStatus" id="RP2Device.getEthernetStatus" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.getEthernetStatus" /> + <keyword name="RP2Device.getWifiData" id="RP2Device.getWifiData" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.getWifiData" /> + <keyword name="RP2Device.hasBluetooth" id="RP2Device.hasBluetooth" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.hasBluetooth" /> + <keyword name="RP2Device.hasEthernet" id="RP2Device.hasEthernet" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.hasEthernet" /> + <keyword name="RP2Device.hasFlashMenuEntry" id="RP2Device.hasFlashMenuEntry" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.hasFlashMenuEntry" /> + <keyword name="RP2Device.hasNetworkTime" id="RP2Device.hasNetworkTime" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.hasNetworkTime" /> + <keyword name="RP2Device.hasWifi" id="RP2Device.hasWifi" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.hasWifi" /> + <keyword name="RP2Device.hasWifiCountry" id="RP2Device.hasWifiCountry" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.hasWifiCountry" /> + <keyword name="RP2Device.isLanConnected" id="RP2Device.isLanConnected" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.isLanConnected" /> + <keyword name="RP2Device.isWifiApConnected" id="RP2Device.isWifiApConnected" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.isWifiApConnected" /> + <keyword name="RP2Device.isWifiClientConnected" id="RP2Device.isWifiClientConnected" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.isWifiClientConnected" /> + <keyword name="RP2Device.removeCredentials" id="RP2Device.removeCredentials" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.removeCredentials" /> + <keyword name="RP2Device.removeLanAutoConnect" id="RP2Device.removeLanAutoConnect" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.removeLanAutoConnect" /> + <keyword name="RP2Device.runScript" id="RP2Device.runScript" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.runScript" /> + <keyword name="RP2Device.scanNetworks" id="RP2Device.scanNetworks" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.scanNetworks" /> + <keyword name="RP2Device.setButtons" id="RP2Device.setButtons" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.setButtons" /> + <keyword name="RP2Device.setNetworkTime" id="RP2Device.setNetworkTime" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.setNetworkTime" /> + <keyword name="RP2Device.startAccessPoint" id="RP2Device.startAccessPoint" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.startAccessPoint" /> + <keyword name="RP2Device.stopAccessPoint" id="RP2Device.stopAccessPoint" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.stopAccessPoint" /> + <keyword name="RP2Device.writeCredentials" id="RP2Device.writeCredentials" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.writeCredentials" /> + <keyword name="RP2Device.writeLanAutoConnect" id="RP2Device.writeLanAutoConnect" ref="eric7.MicroPython.Devices.RP2Devices.html#RP2Device.writeLanAutoConnect" /> + <keyword name="RP2Devices (Module)" id="RP2Devices (Module)" ref="eric7.MicroPython.Devices.RP2Devices.html" /> <keyword name="RbModule" id="RbModule" ref="eric7.Utilities.ModuleParser.html#RbModule" /> <keyword name="RbModule (Constructor)" id="RbModule (Constructor)" ref="eric7.Utilities.ModuleParser.html#RbModule.__init__" /> <keyword name="RbModule.addClass" id="RbModule.addClass" ref="eric7.Utilities.ModuleParser.html#RbModule.addClass" /> @@ -20342,7 +20342,7 @@ <keyword name="createDevice" id="createDevice" ref="eric7.MicroPython.Devices.GenericMicroPythonDevices.html#createDevice" /> <keyword name="createDevice" id="createDevice" ref="eric7.MicroPython.Devices.MicrobitDevices.html#createDevice" /> <keyword name="createDevice" id="createDevice" ref="eric7.MicroPython.Devices.PyBoardDevices.html#createDevice" /> - <keyword name="createDevice" id="createDevice" ref="eric7.MicroPython.Devices.RP2040Devices.html#createDevice" /> + <keyword name="createDevice" id="createDevice" ref="eric7.MicroPython.Devices.RP2Devices.html#createDevice" /> <keyword name="createDevice" id="createDevice" ref="eric7.MicroPython.Devices.STLinkDevices.html#createDevice" /> <keyword name="createDevice" id="createDevice" ref="eric7.MicroPython.Devices.TeensyDevices.html#createDevice" /> <keyword name="createEngine" id="createEngine" ref="eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.DeepLEngine.html#createEngine" /> @@ -20814,6 +20814,7 @@ <keyword name="get_pkg_included_file" id="get_pkg_included_file" ref="eric7.PipInterface.piplicenses.html#get_pkg_included_file" /> <keyword name="get_pkg_info" id="get_pkg_info" ref="eric7.PipInterface.piplicenses.html#get_pkg_info" /> <keyword name="get_python_sys_path" id="get_python_sys_path" ref="eric7.PipInterface.piplicenses.html#get_python_sys_path" /> + <keyword name="get_value_from_enum" id="get_value_from_enum" ref="eric7.PipInterface.piplicenses.html#get_value_from_enum" /> <keyword name="getargvalues" id="getargvalues" ref="eric7.DebugClients.Python.DebugUtilities.html#getargvalues" /> <keyword name="getpass" id="getpass" ref="eric7.DebugClients.Python.getpass.html#getpass" /> <keyword name="getpass (Module)" id="getpass (Module)" ref="eric7.DebugClients.Python.getpass.html" /> @@ -21526,7 +21527,7 @@ <file>eric7.MicroPython.Devices.GenericMicroPythonDevices.html</file> <file>eric7.MicroPython.Devices.MicrobitDevices.html</file> <file>eric7.MicroPython.Devices.PyBoardDevices.html</file> - <file>eric7.MicroPython.Devices.RP2040Devices.html</file> + <file>eric7.MicroPython.Devices.RP2Devices.html</file> <file>eric7.MicroPython.Devices.STLinkDevices.html</file> <file>eric7.MicroPython.Devices.TeensyDevices.html</file> <file>eric7.MicroPython.Devices.__init__.html</file>
--- a/src/eric7/Documentation/Source/eric7.MicroPython.Devices.RP2040Devices.html Sat Aug 31 15:49:16 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1518 +0,0 @@ -<!DOCTYPE html> -<html><head> -<title>eric7.MicroPython.Devices.RP2040Devices</title> -<meta charset="UTF-8"> -<link rel="stylesheet" href="styles.css"> -</head> -<body> -<a NAME="top" ID="top"></a> -<h1>eric7.MicroPython.Devices.RP2040Devices</h1> -<p> -Module implementing the device interface class for RP2040 based boards -(e.g. Raspberry Pi Pico). -</p> - -<h3>Global Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Classes</h3> -<table> -<tr> -<td><a href="#RP2040Device">RP2040Device</a></td> -<td>Class implementing the device for RP2040 based boards.</td> -</tr> -</table> - -<h3>Functions</h3> -<table> -<tr> -<td><a href="#createDevice">createDevice</a></td> -<td>Function to instantiate a MicroPython device object.</td> -</tr> -</table> - -<hr /> -<hr /> -<a NAME="RP2040Device" ID="RP2040Device"></a> -<h2>RP2040Device</h2> -<p> - Class implementing the device for RP2040 based boards. -</p> - -<h3>Derived from</h3> -BaseDevice -<h3>Class Attributes</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Class Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - -<h3>Methods</h3> -<table> -<tr> -<td><a href="#RP2040Device.__init__">RP2040Device</a></td> -<td>Constructor</td> -</tr> -<tr> -<td><a href="#RP2040Device.__activateBootloader">__activateBootloader</a></td> -<td>Private slot to switch the board into 'bootloader' mode.</td> -</tr> -<tr> -<td><a href="#RP2040Device.__createRP2040Menu">__createRP2040Menu</a></td> -<td>Private method to create the RP2040 submenu.</td> -</tr> -<tr> -<td><a href="#RP2040Device.__firmwareVersionResponse">__firmwareVersionResponse</a></td> -<td>Private slot handling the response of the latest version request.</td> -</tr> -<tr> -<td><a href="#RP2040Device.__flashPython">__flashPython</a></td> -<td>Private slot to flash a MicroPython firmware to the device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.__resetCountry">__resetCountry</a></td> -<td>Private slot to reset the country of the connected ESP32 device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.__resetDevice">__resetDevice</a></td> -<td>Private slot to reset the connected device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.__setCountry">__setCountry</a></td> -<td>Private slot to configure the country of the connected RP2040 device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.__showFirmwareVersions">__showFirmwareVersions</a></td> -<td>Private slot to show the firmware version of the connected device and the available firmware version.</td> -</tr> -<tr> -<td><a href="#RP2040Device._getSetTimeCode">_getSetTimeCode</a></td> -<td>Protected method to get the device code to set the time.</td> -</tr> -<tr> -<td><a href="#RP2040Device.activateBluetoothInterface">activateBluetoothInterface</a></td> -<td>Public method to activate the Bluetooth interface.</td> -</tr> -<tr> -<td><a href="#RP2040Device.addDeviceMenuEntries">addDeviceMenuEntries</a></td> -<td>Public method to add device specific entries to the given menu.</td> -</tr> -<tr> -<td><a href="#RP2040Device.addDeviceWifiEntries">addDeviceWifiEntries</a></td> -<td>Public method to add device specific entries to the given menu.</td> -</tr> -<tr> -<td><a href="#RP2040Device.canRunScript">canRunScript</a></td> -<td>Public method to determine, if a script can be executed.</td> -</tr> -<tr> -<td><a href="#RP2040Device.canStartFileManager">canStartFileManager</a></td> -<td>Public method to determine, if a File Manager can be started.</td> -</tr> -<tr> -<td><a href="#RP2040Device.canStartPlotter">canStartPlotter</a></td> -<td>Public method to determine, if a Plotter can be started.</td> -</tr> -<tr> -<td><a href="#RP2040Device.canStartRepl">canStartRepl</a></td> -<td>Public method to determine, if a REPL can be started.</td> -</tr> -<tr> -<td><a href="#RP2040Device.checkInternet">checkInternet</a></td> -<td>Public method to check, if the internet can be reached.</td> -</tr> -<tr> -<td><a href="#RP2040Device.checkInternetViaLan">checkInternetViaLan</a></td> -<td>Public method to check, if the internet can be reached (LAN variant).</td> -</tr> -<tr> -<td><a href="#RP2040Device.connectToLan">connectToLan</a></td> -<td>Public method to connect the connected device to the LAN.</td> -</tr> -<tr> -<td><a href="#RP2040Device.connectWifi">connectWifi</a></td> -<td>Public method to connect a device to a WiFi network.</td> -</tr> -<tr> -<td><a href="#RP2040Device.deactivateBluetoothInterface">deactivateBluetoothInterface</a></td> -<td>Public method to deactivate the Bluetooth interface.</td> -</tr> -<tr> -<td><a href="#RP2040Device.deactivateEthernet">deactivateEthernet</a></td> -<td>Public method to deactivate the Ethernet interface of the connected device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.deactivateInterface">deactivateInterface</a></td> -<td>Public method to deactivate a given WiFi interface of the connected device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.deviceName">deviceName</a></td> -<td>Public method to get the name of the device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.disableWebrepl">disableWebrepl</a></td> -<td>Public method to write the given WebREPL password to the connected device and modify the start script to start the WebREPL server.</td> -</tr> -<tr> -<td><a href="#RP2040Device.disconnectFromLan">disconnectFromLan</a></td> -<td>Public method to disconnect from the LAN.</td> -</tr> -<tr> -<td><a href="#RP2040Device.disconnectWifi">disconnectWifi</a></td> -<td>Public method to disconnect a device from the WiFi network.</td> -</tr> -<tr> -<td><a href="#RP2040Device.enableWebrepl">enableWebrepl</a></td> -<td>Public method to write the given WebREPL password to the connected device and modify the start script to start the WebREPL server.</td> -</tr> -<tr> -<td><a href="#RP2040Device.forceInterrupt">forceInterrupt</a></td> -<td>Public method to determine the need for an interrupt when opening the serial connection.</td> -</tr> -<tr> -<td><a href="#RP2040Device.getBluetoothStatus">getBluetoothStatus</a></td> -<td>Public method to get Bluetooth status data of the connected board.</td> -</tr> -<tr> -<td><a href="#RP2040Device.getConnectedClients">getConnectedClients</a></td> -<td>Public method to get a list of connected clients.</td> -</tr> -<tr> -<td><a href="#RP2040Device.getDeviceScan">getDeviceScan</a></td> -<td>Public method to perform a Bluetooth device scan.</td> -</tr> -<tr> -<td><a href="#RP2040Device.getDocumentationUrl">getDocumentationUrl</a></td> -<td>Public method to get the device documentation URL.</td> -</tr> -<tr> -<td><a href="#RP2040Device.getDownloadMenuEntries">getDownloadMenuEntries</a></td> -<td>Public method to retrieve the entries for the downloads menu.</td> -</tr> -<tr> -<td><a href="#RP2040Device.getEthernetStatus">getEthernetStatus</a></td> -<td>Public method to get Ethernet status data of the connected board.</td> -</tr> -<tr> -<td><a href="#RP2040Device.getWifiData">getWifiData</a></td> -<td>Public method to get data related to the current WiFi status.</td> -</tr> -<tr> -<td><a href="#RP2040Device.hasBluetooth">hasBluetooth</a></td> -<td>Public method to check the availability of Bluetooth.</td> -</tr> -<tr> -<td><a href="#RP2040Device.hasEthernet">hasEthernet</a></td> -<td>Public method to check the availability of Ethernet.</td> -</tr> -<tr> -<td><a href="#RP2040Device.hasFlashMenuEntry">hasFlashMenuEntry</a></td> -<td>Public method to check, if the device has its own flash menu entry.</td> -</tr> -<tr> -<td><a href="#RP2040Device.hasNetworkTime">hasNetworkTime</a></td> -<td>Public method to check the availability of network time functions.</td> -</tr> -<tr> -<td><a href="#RP2040Device.hasWifi">hasWifi</a></td> -<td>Public method to check the availability of WiFi.</td> -</tr> -<tr> -<td><a href="#RP2040Device.hasWifiCountry">hasWifiCountry</a></td> -<td>Public method to check, if the device has support to set the WiFi country.</td> -</tr> -<tr> -<td><a href="#RP2040Device.isLanConnected">isLanConnected</a></td> -<td>Public method to check the LAN connection status.</td> -</tr> -<tr> -<td><a href="#RP2040Device.isWifiApConnected">isWifiApConnected</a></td> -<td>Public method to check the WiFi connection status as access point.</td> -</tr> -<tr> -<td><a href="#RP2040Device.isWifiClientConnected">isWifiClientConnected</a></td> -<td>Public method to check the WiFi connection status as client.</td> -</tr> -<tr> -<td><a href="#RP2040Device.removeCredentials">removeCredentials</a></td> -<td>Public method to remove the saved credentials from the connected device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.removeLanAutoConnect">removeLanAutoConnect</a></td> -<td>Public method to remove the saved IPv4 parameters from the connected device.</td> -</tr> -<tr> -<td><a href="#RP2040Device.runScript">runScript</a></td> -<td>Public method to run the given Python script.</td> -</tr> -<tr> -<td><a href="#RP2040Device.scanNetworks">scanNetworks</a></td> -<td>Public method to scan for available WiFi networks.</td> -</tr> -<tr> -<td><a href="#RP2040Device.setButtons">setButtons</a></td> -<td>Public method to enable the supported action buttons.</td> -</tr> -<tr> -<td><a href="#RP2040Device.setNetworkTime">setNetworkTime</a></td> -<td>Public method to set the time to the network time retrieved from an NTP server.</td> -</tr> -<tr> -<td><a href="#RP2040Device.startAccessPoint">startAccessPoint</a></td> -<td>Public method to start the access point interface.</td> -</tr> -<tr> -<td><a href="#RP2040Device.stopAccessPoint">stopAccessPoint</a></td> -<td>Public method to stop the access point interface.</td> -</tr> -<tr> -<td><a href="#RP2040Device.writeCredentials">writeCredentials</a></td> -<td>Public method to write the given credentials to the connected device and modify the start script to connect automatically.</td> -</tr> -<tr> -<td><a href="#RP2040Device.writeLanAutoConnect">writeLanAutoConnect</a></td> -<td>Public method to generate a script and associated configuration to connect the device to the LAN during boot time.</td> -</tr> -</table> - -<h3>Static Methods</h3> -<table> -<tr><td>None</td></tr> -</table> - - -<a NAME="RP2040Device.__init__" ID="RP2040Device.__init__"></a> -<h4>RP2040Device (Constructor)</h4> -<b>RP2040Device</b>(<i>microPythonWidget, deviceType, parent=None</i>) -<p> - Constructor -</p> - -<dl> - -<dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> -<dd> -reference to the main MicroPython widget -</dd> -<dt><i>deviceType</i> (str)</dt> -<dd> -device type assigned to this device interface -</dd> -<dt><i>parent</i> (QObject)</dt> -<dd> -reference to the parent object -</dd> -</dl> -<a NAME="RP2040Device.__activateBootloader" ID="RP2040Device.__activateBootloader"></a> -<h4>RP2040Device.__activateBootloader</h4> -<b>__activateBootloader</b>(<i></i>) -<p> - Private slot to switch the board into 'bootloader' mode. -</p> - -<a NAME="RP2040Device.__createRP2040Menu" ID="RP2040Device.__createRP2040Menu"></a> -<h4>RP2040Device.__createRP2040Menu</h4> -<b>__createRP2040Menu</b>(<i></i>) -<p> - Private method to create the RP2040 submenu. -</p> - -<a NAME="RP2040Device.__firmwareVersionResponse" ID="RP2040Device.__firmwareVersionResponse"></a> -<h4>RP2040Device.__firmwareVersionResponse</h4> -<b>__firmwareVersionResponse</b>(<i>reply</i>) -<p> - Private slot handling the response of the latest version request. -</p> - -<dl> - -<dt><i>reply</i> (QNetworkReply)</dt> -<dd> -reference to the reply object -</dd> -</dl> -<a NAME="RP2040Device.__flashPython" ID="RP2040Device.__flashPython"></a> -<h4>RP2040Device.__flashPython</h4> -<b>__flashPython</b>(<i></i>) -<p> - Private slot to flash a MicroPython firmware to the device. -</p> - -<a NAME="RP2040Device.__resetCountry" ID="RP2040Device.__resetCountry"></a> -<h4>RP2040Device.__resetCountry</h4> -<b>__resetCountry</b>(<i></i>) -<p> - Private slot to reset the country of the connected ESP32 device. -</p> -<p> - The country is the two-letter ISO 3166-1 Alpha-2 country code. This method - resets it to the default code 'XX' representing the "worldwide" region. -</p> - -<a NAME="RP2040Device.__resetDevice" ID="RP2040Device.__resetDevice"></a> -<h4>RP2040Device.__resetDevice</h4> -<b>__resetDevice</b>(<i></i>) -<p> - Private slot to reset the connected device. -</p> - -<a NAME="RP2040Device.__setCountry" ID="RP2040Device.__setCountry"></a> -<h4>RP2040Device.__setCountry</h4> -<b>__setCountry</b>(<i></i>) -<p> - Private slot to configure the country of the connected RP2040 device. -</p> -<p> - The country is the two-letter ISO 3166-1 Alpha-2 country code. -</p> - -<a NAME="RP2040Device.__showFirmwareVersions" ID="RP2040Device.__showFirmwareVersions"></a> -<h4>RP2040Device.__showFirmwareVersions</h4> -<b>__showFirmwareVersions</b>(<i></i>) -<p> - Private slot to show the firmware version of the connected device and the - available firmware version. -</p> - -<a NAME="RP2040Device._getSetTimeCode" ID="RP2040Device._getSetTimeCode"></a> -<h4>RP2040Device._getSetTimeCode</h4> -<b>_getSetTimeCode</b>(<i></i>) -<p> - Protected method to get the device code to set the time. -</p> -<p> - Note: This method must be implemented in the various device specific - subclasses. -</p> - -<dl> -<dt>Return:</dt> -<dd> -code to be executed on the connected device to set the time -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<a NAME="RP2040Device.activateBluetoothInterface" ID="RP2040Device.activateBluetoothInterface"></a> -<h4>RP2040Device.activateBluetoothInterface</h4> -<b>activateBluetoothInterface</b>(<i></i>) -<p> - Public method to activate the Bluetooth interface. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating the new state of the Bluetooth interface -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.addDeviceMenuEntries" ID="RP2040Device.addDeviceMenuEntries"></a> -<h4>RP2040Device.addDeviceMenuEntries</h4> -<b>addDeviceMenuEntries</b>(<i>menu</i>) -<p> - Public method to add device specific entries to the given menu. -</p> - -<dl> - -<dt><i>menu</i> (QMenu)</dt> -<dd> -reference to the context menu -</dd> -</dl> -<a NAME="RP2040Device.addDeviceWifiEntries" ID="RP2040Device.addDeviceWifiEntries"></a> -<h4>RP2040Device.addDeviceWifiEntries</h4> -<b>addDeviceWifiEntries</b>(<i>menu</i>) -<p> - Public method to add device specific entries to the given menu. -</p> - -<dl> - -<dt><i>menu</i> (QMenu)</dt> -<dd> -reference to the context menu -</dd> -</dl> -<a NAME="RP2040Device.canRunScript" ID="RP2040Device.canRunScript"></a> -<h4>RP2040Device.canRunScript</h4> -<b>canRunScript</b>(<i></i>) -<p> - Public method to determine, if a script can be executed. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating it is safe to start a - Plotter and a reason why it cannot. -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.canStartFileManager" ID="RP2040Device.canStartFileManager"></a> -<h4>RP2040Device.canStartFileManager</h4> -<b>canStartFileManager</b>(<i></i>) -<p> - Public method to determine, if a File Manager can be started. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating it is safe to start a - File Manager and a reason why it cannot. -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.canStartPlotter" ID="RP2040Device.canStartPlotter"></a> -<h4>RP2040Device.canStartPlotter</h4> -<b>canStartPlotter</b>(<i></i>) -<p> - Public method to determine, if a Plotter can be started. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating it is safe to start a - Plotter and a reason why it cannot. -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.canStartRepl" ID="RP2040Device.canStartRepl"></a> -<h4>RP2040Device.canStartRepl</h4> -<b>canStartRepl</b>(<i></i>) -<p> - Public method to determine, if a REPL can be started. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating it is safe to start a REPL - and a reason why it cannot. -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.checkInternet" ID="RP2040Device.checkInternet"></a> -<h4>RP2040Device.checkInternet</h4> -<b>checkInternet</b>(<i></i>) -<p> - Public method to check, if the internet can be reached. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating reachability and an error string -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.checkInternetViaLan" ID="RP2040Device.checkInternetViaLan"></a> -<h4>RP2040Device.checkInternetViaLan</h4> -<b>checkInternetViaLan</b>(<i></i>) -<p> - Public method to check, if the internet can be reached (LAN variant). -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating reachability and an error string -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.connectToLan" ID="RP2040Device.connectToLan"></a> -<h4>RP2040Device.connectToLan</h4> -<b>connectToLan</b>(<i>config, hostname</i>) -<p> - Public method to connect the connected device to the LAN. -</p> - -<dl> - -<dt><i>config</i> (str or tuple of (str, str, str, str))</dt> -<dd> -configuration for the connection (either the string 'dhcp' - for a dynamic address or a tuple of four strings with the IPv4 parameters. -</dd> -<dt><i>hostname</i> (str)</dt> -<dd> -host name of the device -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.connectWifi" ID="RP2040Device.connectWifi"></a> -<h4>RP2040Device.connectWifi</h4> -<b>connectWifi</b>(<i>ssid, password, hostname</i>) -<p> - Public method to connect a device to a WiFi network. -</p> - -<dl> - -<dt><i>ssid</i> (str)</dt> -<dd> -name (SSID) of the WiFi network -</dd> -<dt><i>password</i> (str)</dt> -<dd> -password needed to connect -</dd> -<dt><i>hostname</i> (str)</dt> -<dd> -host name of the device -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing the connection status and an error string -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.deactivateBluetoothInterface" ID="RP2040Device.deactivateBluetoothInterface"></a> -<h4>RP2040Device.deactivateBluetoothInterface</h4> -<b>deactivateBluetoothInterface</b>(<i></i>) -<p> - Public method to deactivate the Bluetooth interface. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating the new state of the Bluetooth interface -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.deactivateEthernet" ID="RP2040Device.deactivateEthernet"></a> -<h4>RP2040Device.deactivateEthernet</h4> -<b>deactivateEthernet</b>(<i></i>) -<p> - Public method to deactivate the Ethernet interface of the connected device. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containg a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.deactivateInterface" ID="RP2040Device.deactivateInterface"></a> -<h4>RP2040Device.deactivateInterface</h4> -<b>deactivateInterface</b>(<i>interface</i>) -<p> - Public method to deactivate a given WiFi interface of the connected device. -</p> - -<dl> - -<dt><i>interface</i> (str)</dt> -<dd> -designation of the interface to be deactivated (one of 'AP' - or 'STA') -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containg a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<dl> - -<dt>Raises <b>ValueError</b>:</dt> -<dd> -raised to indicate a wrong value for the interface type -</dd> -</dl> -<a NAME="RP2040Device.deviceName" ID="RP2040Device.deviceName"></a> -<h4>RP2040Device.deviceName</h4> -<b>deviceName</b>(<i></i>) -<p> - Public method to get the name of the device. -</p> - -<dl> -<dt>Return:</dt> -<dd> -name of the device -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<a NAME="RP2040Device.disableWebrepl" ID="RP2040Device.disableWebrepl"></a> -<h4>RP2040Device.disableWebrepl</h4> -<b>disableWebrepl</b>(<i></i>) -<p> - Public method to write the given WebREPL password to the connected device and - modify the start script to start the WebREPL server. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.disconnectFromLan" ID="RP2040Device.disconnectFromLan"></a> -<h4>RP2040Device.disconnectFromLan</h4> -<b>disconnectFromLan</b>(<i></i>) -<p> - Public method to disconnect from the LAN. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.disconnectWifi" ID="RP2040Device.disconnectWifi"></a> -<h4>RP2040Device.disconnectWifi</h4> -<b>disconnectWifi</b>(<i></i>) -<p> - Public method to disconnect a device from the WiFi network. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error string -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.enableWebrepl" ID="RP2040Device.enableWebrepl"></a> -<h4>RP2040Device.enableWebrepl</h4> -<b>enableWebrepl</b>(<i>password</i>) -<p> - Public method to write the given WebREPL password to the connected device and - modify the start script to start the WebREPL server. -</p> - -<dl> - -<dt><i>password</i> (str)</dt> -<dd> -password needed to authenticate -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.forceInterrupt" ID="RP2040Device.forceInterrupt"></a> -<h4>RP2040Device.forceInterrupt</h4> -<b>forceInterrupt</b>(<i></i>) -<p> - Public method to determine the need for an interrupt when opening the - serial connection. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating an interrupt is needed -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="RP2040Device.getBluetoothStatus" ID="RP2040Device.getBluetoothStatus"></a> -<h4>RP2040Device.getBluetoothStatus</h4> -<b>getBluetoothStatus</b>(<i></i>) -<p> - Public method to get Bluetooth status data of the connected board. -</p> - -<dl> -<dt>Return:</dt> -<dd> -list of tuples containing the translated status data label and - the associated value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -list of tuples of (str, str) -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.getConnectedClients" ID="RP2040Device.getConnectedClients"></a> -<h4>RP2040Device.getConnectedClients</h4> -<b>getConnectedClients</b>(<i></i>) -<p> - Public method to get a list of connected clients. -</p> - -<dl> -<dt>Return:</dt> -<dd> -a tuple containing a list of tuples containing the client MAC-Address - and the RSSI (if supported and available) and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of ([(bytes, int)], str) -</dd> -</dl> -<a NAME="RP2040Device.getDeviceScan" ID="RP2040Device.getDeviceScan"></a> -<h4>RP2040Device.getDeviceScan</h4> -<b>getDeviceScan</b>(<i>timeout=10</i>) -<p> - Public method to perform a Bluetooth device scan. -</p> - -<dl> - -<dt><i>timeout</i> (int (optional))</dt> -<dd> -duration of the device scan in seconds (defaults - to 10) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing a dictionary with the scan results and - an error string -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (dict, str) -</dd> -</dl> -<a NAME="RP2040Device.getDocumentationUrl" ID="RP2040Device.getDocumentationUrl"></a> -<h4>RP2040Device.getDocumentationUrl</h4> -<b>getDocumentationUrl</b>(<i></i>) -<p> - Public method to get the device documentation URL. -</p> - -<dl> -<dt>Return:</dt> -<dd> -documentation URL of the device -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -str -</dd> -</dl> -<a NAME="RP2040Device.getDownloadMenuEntries" ID="RP2040Device.getDownloadMenuEntries"></a> -<h4>RP2040Device.getDownloadMenuEntries</h4> -<b>getDownloadMenuEntries</b>(<i></i>) -<p> - Public method to retrieve the entries for the downloads menu. -</p> - -<dl> -<dt>Return:</dt> -<dd> -list of tuples with menu text and URL to be opened for each - entry -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -list of tuple of (str, str) -</dd> -</dl> -<a NAME="RP2040Device.getEthernetStatus" ID="RP2040Device.getEthernetStatus"></a> -<h4>RP2040Device.getEthernetStatus</h4> -<b>getEthernetStatus</b>(<i></i>) -<p> - Public method to get Ethernet status data of the connected board. -</p> - -<dl> -<dt>Return:</dt> -<dd> -list of tuples containing the translated status data label and - the associated value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -list of tuples of (str, str) -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.getWifiData" ID="RP2040Device.getWifiData"></a> -<h4>RP2040Device.getWifiData</h4> -<b>getWifiData</b>(<i></i>) -<p> - Public method to get data related to the current WiFi status. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple of three dictionaries containing the WiFi status data - for the WiFi client, access point and overall data -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (dict, dict, dict) -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.hasBluetooth" ID="RP2040Device.hasBluetooth"></a> -<h4>RP2040Device.hasBluetooth</h4> -<b>hasBluetooth</b>(<i></i>) -<p> - Public method to check the availability of Bluetooth. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating the availability of Bluetooth -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.hasEthernet" ID="RP2040Device.hasEthernet"></a> -<h4>RP2040Device.hasEthernet</h4> -<b>hasEthernet</b>(<i></i>) -<p> - Public method to check the availability of Ethernet. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating the availability of Ethernet - and the Ethernet type (picowiz) -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.hasFlashMenuEntry" ID="RP2040Device.hasFlashMenuEntry"></a> -<h4>RP2040Device.hasFlashMenuEntry</h4> -<b>hasFlashMenuEntry</b>(<i></i>) -<p> - Public method to check, if the device has its own flash menu entry. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating a specific flash menu entry -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="RP2040Device.hasNetworkTime" ID="RP2040Device.hasNetworkTime"></a> -<h4>RP2040Device.hasNetworkTime</h4> -<b>hasNetworkTime</b>(<i></i>) -<p> - Public method to check the availability of network time functions. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating the availability of network time functions -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.hasWifi" ID="RP2040Device.hasWifi"></a> -<h4>RP2040Device.hasWifi</h4> -<b>hasWifi</b>(<i></i>) -<p> - Public method to check the availability of WiFi. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating the availability of WiFi - and the WiFi type (picow or picowireless) -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<dl> - -<dt>Raises <b>OSError</b>:</dt> -<dd> -raised to indicate an issue with the device -</dd> -</dl> -<a NAME="RP2040Device.hasWifiCountry" ID="RP2040Device.hasWifiCountry"></a> -<h4>RP2040Device.hasWifiCountry</h4> -<b>hasWifiCountry</b>(<i></i>) -<p> - Public method to check, if the device has support to set the WiFi country. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating the support of WiFi country -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="RP2040Device.isLanConnected" ID="RP2040Device.isLanConnected"></a> -<h4>RP2040Device.isLanConnected</h4> -<b>isLanConnected</b>(<i></i>) -<p> - Public method to check the LAN connection status. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating that the device is connected to the LAN -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="RP2040Device.isWifiApConnected" ID="RP2040Device.isWifiApConnected"></a> -<h4>RP2040Device.isWifiApConnected</h4> -<b>isWifiApConnected</b>(<i></i>) -<p> - Public method to check the WiFi connection status as access point. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating the WiFi connection status -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="RP2040Device.isWifiClientConnected" ID="RP2040Device.isWifiClientConnected"></a> -<h4>RP2040Device.isWifiClientConnected</h4> -<b>isWifiClientConnected</b>(<i></i>) -<p> - Public method to check the WiFi connection status as client. -</p> - -<dl> -<dt>Return:</dt> -<dd> -flag indicating the WiFi connection status -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -bool -</dd> -</dl> -<a NAME="RP2040Device.removeCredentials" ID="RP2040Device.removeCredentials"></a> -<h4>RP2040Device.removeCredentials</h4> -<b>removeCredentials</b>(<i></i>) -<p> - Public method to remove the saved credentials from the connected device. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.removeLanAutoConnect" ID="RP2040Device.removeLanAutoConnect"></a> -<h4>RP2040Device.removeLanAutoConnect</h4> -<b>removeLanAutoConnect</b>(<i></i>) -<p> - Public method to remove the saved IPv4 parameters from the connected device. -</p> -<p> - Note: This disables the LAN auto-connect feature. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.runScript" ID="RP2040Device.runScript"></a> -<h4>RP2040Device.runScript</h4> -<b>runScript</b>(<i>script</i>) -<p> - Public method to run the given Python script. -</p> - -<dl> - -<dt><i>script</i> (str)</dt> -<dd> -script to be executed -</dd> -</dl> -<a NAME="RP2040Device.scanNetworks" ID="RP2040Device.scanNetworks"></a> -<h4>RP2040Device.scanNetworks</h4> -<b>scanNetworks</b>(<i></i>) -<p> - Public method to scan for available WiFi networks. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containing the list of available networks as a tuple of 'Name', - 'MAC-Address', 'channel', 'RSSI' and 'security' and an error string -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (list of tuple of (str, str, int, int, str), str) -</dd> -</dl> -<a NAME="RP2040Device.setButtons" ID="RP2040Device.setButtons"></a> -<h4>RP2040Device.setButtons</h4> -<b>setButtons</b>(<i></i>) -<p> - Public method to enable the supported action buttons. -</p> - -<a NAME="RP2040Device.setNetworkTime" ID="RP2040Device.setNetworkTime"></a> -<h4>RP2040Device.setNetworkTime</h4> -<b>setNetworkTime</b>(<i>server="pool.ntp.org", tzOffset=0, timeout=10</i>) -<p> - Public method to set the time to the network time retrieved from an - NTP server. -</p> - -<dl> - -<dt><i>server</i> (str (optional))</dt> -<dd> -name of the NTP server to get the network time from - (defaults to "0.pool.ntp.org") -</dd> -<dt><i>tzOffset</i> (int (optional))</dt> -<dd> -offset with respect to UTC (defaults to 0) -</dd> -<dt><i>timeout</i> (int)</dt> -<dd> -maximum time to wait for a server response in seconds - (defaults to 10) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error string -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.startAccessPoint" ID="RP2040Device.startAccessPoint"></a> -<h4>RP2040Device.startAccessPoint</h4> -<b>startAccessPoint</b>(<i>ssid, security=None, password=None, hostname=None, ifconfig=None, </i>) -<p> - Public method to start the access point interface. -</p> - -<dl> - -<dt><i>ssid</i> (str)</dt> -<dd> -SSID of the access point -</dd> -<dt><i>security</i> (int (optional))</dt> -<dd> -security method (defaults to None) -</dd> -<dt><i>password</i> (str (optional))</dt> -<dd> -password (defaults to None) -</dd> -<dt><i>hostname</i> (str (optional))</dt> -<dd> -host name of the device (defaults to None) -</dd> -<dt><i>ifconfig</i> (tuple of (str, str, str, str))</dt> -<dd> -IPv4 configuration for the access point if not default - (IPv4 address, netmask, gateway address, DNS server address) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.stopAccessPoint" ID="RP2040Device.stopAccessPoint"></a> -<h4>RP2040Device.stopAccessPoint</h4> -<b>stopAccessPoint</b>(<i></i>) -<p> - Public method to stop the access point interface. -</p> - -<dl> -<dt>Return:</dt> -<dd> -tuple containg a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.writeCredentials" ID="RP2040Device.writeCredentials"></a> -<h4>RP2040Device.writeCredentials</h4> -<b>writeCredentials</b>(<i>ssid, password, hostname, country</i>) -<p> - Public method to write the given credentials to the connected device and modify - the start script to connect automatically. -</p> - -<dl> - -<dt><i>ssid</i> (str)</dt> -<dd> -SSID of the network to connect to -</dd> -<dt><i>password</i> (str)</dt> -<dd> -password needed to authenticate -</dd> -<dt><i>hostname</i> (str)</dt> -<dd> -host name of the device -</dd> -<dt><i>country</i> (str)</dt> -<dd> -WiFi country code -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<a NAME="RP2040Device.writeLanAutoConnect" ID="RP2040Device.writeLanAutoConnect"></a> -<h4>RP2040Device.writeLanAutoConnect</h4> -<b>writeLanAutoConnect</b>(<i>config, hostname</i>) -<p> - Public method to generate a script and associated configuration to connect the - device to the LAN during boot time. -</p> - -<dl> - -<dt><i>config</i> (str or tuple of (str, str, str, str))</dt> -<dd> -configuration for the connection (either the string 'dhcp' - for a dynamic address or a tuple of four strings with the IPv4 parameters. -</dd> -<dt><i>hostname</i> (str)</dt> -<dd> -host name of the device -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -tuple containing a flag indicating success and an error message -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -tuple of (bool, str) -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -<hr /> -<a NAME="createDevice" ID="createDevice"></a> -<h2>createDevice</h2> -<b>createDevice</b>(<i>microPythonWidget, deviceType, _vid, _pid, _boardName, _serialNumber</i>) -<p> - Function to instantiate a MicroPython device object. -</p> - -<dl> - -<dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> -<dd> -reference to the main MicroPython widget -</dd> -<dt><i>deviceType</i> (str)</dt> -<dd> -device type assigned to this device interface -</dd> -<dt><i>_vid</i> (int)</dt> -<dd> -vendor ID (unused) -</dd> -<dt><i>_pid</i> (int)</dt> -<dd> -product ID (unused) -</dd> -<dt><i>_boardName</i> (str)</dt> -<dd> -name of the board (unused) -</dd> -<dt><i>_serialNumber</i> (str)</dt> -<dd> -serial number of the board (unused) -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -reference to the instantiated device object -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -RP2040Device -</dd> -</dl> -<div align="right"><a href="#top">Up</a></div> -<hr /> -</body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/Documentation/Source/eric7.MicroPython.Devices.RP2Devices.html Sat Aug 31 15:54:24 2024 +0200 @@ -0,0 +1,1518 @@ +<!DOCTYPE html> +<html><head> +<title>eric7.MicroPython.Devices.RP2Devices</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>eric7.MicroPython.Devices.RP2Devices</h1> +<p> +Module implementing the device interface class for RP2040/RP2350 based boards +(e.g. Raspberry Pi Pico / Pico 2). +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#RP2Device">RP2Device</a></td> +<td>Class implementing the device for RP2040/RP2350 based boards.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr> +<td><a href="#createDevice">createDevice</a></td> +<td>Function to instantiate a MicroPython device object.</td> +</tr> +</table> + +<hr /> +<hr /> +<a NAME="RP2Device" ID="RP2Device"></a> +<h2>RP2Device</h2> +<p> + Class implementing the device for RP2040/RP2350 based boards. +</p> + +<h3>Derived from</h3> +BaseDevice +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#RP2Device.__init__">RP2Device</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#RP2Device.__activateBootloader">__activateBootloader</a></td> +<td>Private slot to switch the board into 'bootloader' mode.</td> +</tr> +<tr> +<td><a href="#RP2Device.__createRP2Menu">__createRP2Menu</a></td> +<td>Private method to create the RP2 submenu.</td> +</tr> +<tr> +<td><a href="#RP2Device.__firmwareVersionResponse">__firmwareVersionResponse</a></td> +<td>Private slot handling the response of the latest version request.</td> +</tr> +<tr> +<td><a href="#RP2Device.__flashPython">__flashPython</a></td> +<td>Private slot to flash a MicroPython firmware to the device.</td> +</tr> +<tr> +<td><a href="#RP2Device.__resetCountry">__resetCountry</a></td> +<td>Private slot to reset the country of the connected ESP32 device.</td> +</tr> +<tr> +<td><a href="#RP2Device.__resetDevice">__resetDevice</a></td> +<td>Private slot to reset the connected device.</td> +</tr> +<tr> +<td><a href="#RP2Device.__setCountry">__setCountry</a></td> +<td>Private slot to configure the country of the connected device.</td> +</tr> +<tr> +<td><a href="#RP2Device.__showFirmwareVersions">__showFirmwareVersions</a></td> +<td>Private slot to show the firmware version of the connected device and the available firmware version.</td> +</tr> +<tr> +<td><a href="#RP2Device._getSetTimeCode">_getSetTimeCode</a></td> +<td>Protected method to get the device code to set the time.</td> +</tr> +<tr> +<td><a href="#RP2Device.activateBluetoothInterface">activateBluetoothInterface</a></td> +<td>Public method to activate the Bluetooth interface.</td> +</tr> +<tr> +<td><a href="#RP2Device.addDeviceMenuEntries">addDeviceMenuEntries</a></td> +<td>Public method to add device specific entries to the given menu.</td> +</tr> +<tr> +<td><a href="#RP2Device.addDeviceWifiEntries">addDeviceWifiEntries</a></td> +<td>Public method to add device specific entries to the given menu.</td> +</tr> +<tr> +<td><a href="#RP2Device.canRunScript">canRunScript</a></td> +<td>Public method to determine, if a script can be executed.</td> +</tr> +<tr> +<td><a href="#RP2Device.canStartFileManager">canStartFileManager</a></td> +<td>Public method to determine, if a File Manager can be started.</td> +</tr> +<tr> +<td><a href="#RP2Device.canStartPlotter">canStartPlotter</a></td> +<td>Public method to determine, if a Plotter can be started.</td> +</tr> +<tr> +<td><a href="#RP2Device.canStartRepl">canStartRepl</a></td> +<td>Public method to determine, if a REPL can be started.</td> +</tr> +<tr> +<td><a href="#RP2Device.checkInternet">checkInternet</a></td> +<td>Public method to check, if the internet can be reached.</td> +</tr> +<tr> +<td><a href="#RP2Device.checkInternetViaLan">checkInternetViaLan</a></td> +<td>Public method to check, if the internet can be reached (LAN variant).</td> +</tr> +<tr> +<td><a href="#RP2Device.connectToLan">connectToLan</a></td> +<td>Public method to connect the connected device to the LAN.</td> +</tr> +<tr> +<td><a href="#RP2Device.connectWifi">connectWifi</a></td> +<td>Public method to connect a device to a WiFi network.</td> +</tr> +<tr> +<td><a href="#RP2Device.deactivateBluetoothInterface">deactivateBluetoothInterface</a></td> +<td>Public method to deactivate the Bluetooth interface.</td> +</tr> +<tr> +<td><a href="#RP2Device.deactivateEthernet">deactivateEthernet</a></td> +<td>Public method to deactivate the Ethernet interface of the connected device.</td> +</tr> +<tr> +<td><a href="#RP2Device.deactivateInterface">deactivateInterface</a></td> +<td>Public method to deactivate a given WiFi interface of the connected device.</td> +</tr> +<tr> +<td><a href="#RP2Device.deviceName">deviceName</a></td> +<td>Public method to get the name of the device.</td> +</tr> +<tr> +<td><a href="#RP2Device.disableWebrepl">disableWebrepl</a></td> +<td>Public method to write the given WebREPL password to the connected device and modify the start script to start the WebREPL server.</td> +</tr> +<tr> +<td><a href="#RP2Device.disconnectFromLan">disconnectFromLan</a></td> +<td>Public method to disconnect from the LAN.</td> +</tr> +<tr> +<td><a href="#RP2Device.disconnectWifi">disconnectWifi</a></td> +<td>Public method to disconnect a device from the WiFi network.</td> +</tr> +<tr> +<td><a href="#RP2Device.enableWebrepl">enableWebrepl</a></td> +<td>Public method to write the given WebREPL password to the connected device and modify the start script to start the WebREPL server.</td> +</tr> +<tr> +<td><a href="#RP2Device.forceInterrupt">forceInterrupt</a></td> +<td>Public method to determine the need for an interrupt when opening the serial connection.</td> +</tr> +<tr> +<td><a href="#RP2Device.getBluetoothStatus">getBluetoothStatus</a></td> +<td>Public method to get Bluetooth status data of the connected board.</td> +</tr> +<tr> +<td><a href="#RP2Device.getConnectedClients">getConnectedClients</a></td> +<td>Public method to get a list of connected clients.</td> +</tr> +<tr> +<td><a href="#RP2Device.getDeviceScan">getDeviceScan</a></td> +<td>Public method to perform a Bluetooth device scan.</td> +</tr> +<tr> +<td><a href="#RP2Device.getDocumentationUrl">getDocumentationUrl</a></td> +<td>Public method to get the device documentation URL.</td> +</tr> +<tr> +<td><a href="#RP2Device.getDownloadMenuEntries">getDownloadMenuEntries</a></td> +<td>Public method to retrieve the entries for the downloads menu.</td> +</tr> +<tr> +<td><a href="#RP2Device.getEthernetStatus">getEthernetStatus</a></td> +<td>Public method to get Ethernet status data of the connected board.</td> +</tr> +<tr> +<td><a href="#RP2Device.getWifiData">getWifiData</a></td> +<td>Public method to get data related to the current WiFi status.</td> +</tr> +<tr> +<td><a href="#RP2Device.hasBluetooth">hasBluetooth</a></td> +<td>Public method to check the availability of Bluetooth.</td> +</tr> +<tr> +<td><a href="#RP2Device.hasEthernet">hasEthernet</a></td> +<td>Public method to check the availability of Ethernet.</td> +</tr> +<tr> +<td><a href="#RP2Device.hasFlashMenuEntry">hasFlashMenuEntry</a></td> +<td>Public method to check, if the device has its own flash menu entry.</td> +</tr> +<tr> +<td><a href="#RP2Device.hasNetworkTime">hasNetworkTime</a></td> +<td>Public method to check the availability of network time functions.</td> +</tr> +<tr> +<td><a href="#RP2Device.hasWifi">hasWifi</a></td> +<td>Public method to check the availability of WiFi.</td> +</tr> +<tr> +<td><a href="#RP2Device.hasWifiCountry">hasWifiCountry</a></td> +<td>Public method to check, if the device has support to set the WiFi country.</td> +</tr> +<tr> +<td><a href="#RP2Device.isLanConnected">isLanConnected</a></td> +<td>Public method to check the LAN connection status.</td> +</tr> +<tr> +<td><a href="#RP2Device.isWifiApConnected">isWifiApConnected</a></td> +<td>Public method to check the WiFi connection status as access point.</td> +</tr> +<tr> +<td><a href="#RP2Device.isWifiClientConnected">isWifiClientConnected</a></td> +<td>Public method to check the WiFi connection status as client.</td> +</tr> +<tr> +<td><a href="#RP2Device.removeCredentials">removeCredentials</a></td> +<td>Public method to remove the saved credentials from the connected device.</td> +</tr> +<tr> +<td><a href="#RP2Device.removeLanAutoConnect">removeLanAutoConnect</a></td> +<td>Public method to remove the saved IPv4 parameters from the connected device.</td> +</tr> +<tr> +<td><a href="#RP2Device.runScript">runScript</a></td> +<td>Public method to run the given Python script.</td> +</tr> +<tr> +<td><a href="#RP2Device.scanNetworks">scanNetworks</a></td> +<td>Public method to scan for available WiFi networks.</td> +</tr> +<tr> +<td><a href="#RP2Device.setButtons">setButtons</a></td> +<td>Public method to enable the supported action buttons.</td> +</tr> +<tr> +<td><a href="#RP2Device.setNetworkTime">setNetworkTime</a></td> +<td>Public method to set the time to the network time retrieved from an NTP server.</td> +</tr> +<tr> +<td><a href="#RP2Device.startAccessPoint">startAccessPoint</a></td> +<td>Public method to start the access point interface.</td> +</tr> +<tr> +<td><a href="#RP2Device.stopAccessPoint">stopAccessPoint</a></td> +<td>Public method to stop the access point interface.</td> +</tr> +<tr> +<td><a href="#RP2Device.writeCredentials">writeCredentials</a></td> +<td>Public method to write the given credentials to the connected device and modify the start script to connect automatically.</td> +</tr> +<tr> +<td><a href="#RP2Device.writeLanAutoConnect">writeLanAutoConnect</a></td> +<td>Public method to generate a script and associated configuration to connect the device to the LAN during boot time.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="RP2Device.__init__" ID="RP2Device.__init__"></a> +<h4>RP2Device (Constructor)</h4> +<b>RP2Device</b>(<i>microPythonWidget, deviceType, parent=None</i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> +<dd> +reference to the main MicroPython widget +</dd> +<dt><i>deviceType</i> (str)</dt> +<dd> +device type assigned to this device interface +</dd> +<dt><i>parent</i> (QObject)</dt> +<dd> +reference to the parent object +</dd> +</dl> +<a NAME="RP2Device.__activateBootloader" ID="RP2Device.__activateBootloader"></a> +<h4>RP2Device.__activateBootloader</h4> +<b>__activateBootloader</b>(<i></i>) +<p> + Private slot to switch the board into 'bootloader' mode. +</p> + +<a NAME="RP2Device.__createRP2Menu" ID="RP2Device.__createRP2Menu"></a> +<h4>RP2Device.__createRP2Menu</h4> +<b>__createRP2Menu</b>(<i></i>) +<p> + Private method to create the RP2 submenu. +</p> + +<a NAME="RP2Device.__firmwareVersionResponse" ID="RP2Device.__firmwareVersionResponse"></a> +<h4>RP2Device.__firmwareVersionResponse</h4> +<b>__firmwareVersionResponse</b>(<i>reply</i>) +<p> + Private slot handling the response of the latest version request. +</p> + +<dl> + +<dt><i>reply</i> (QNetworkReply)</dt> +<dd> +reference to the reply object +</dd> +</dl> +<a NAME="RP2Device.__flashPython" ID="RP2Device.__flashPython"></a> +<h4>RP2Device.__flashPython</h4> +<b>__flashPython</b>(<i></i>) +<p> + Private slot to flash a MicroPython firmware to the device. +</p> + +<a NAME="RP2Device.__resetCountry" ID="RP2Device.__resetCountry"></a> +<h4>RP2Device.__resetCountry</h4> +<b>__resetCountry</b>(<i></i>) +<p> + Private slot to reset the country of the connected ESP32 device. +</p> +<p> + The country is the two-letter ISO 3166-1 Alpha-2 country code. This method + resets it to the default code 'XX' representing the "worldwide" region. +</p> + +<a NAME="RP2Device.__resetDevice" ID="RP2Device.__resetDevice"></a> +<h4>RP2Device.__resetDevice</h4> +<b>__resetDevice</b>(<i></i>) +<p> + Private slot to reset the connected device. +</p> + +<a NAME="RP2Device.__setCountry" ID="RP2Device.__setCountry"></a> +<h4>RP2Device.__setCountry</h4> +<b>__setCountry</b>(<i></i>) +<p> + Private slot to configure the country of the connected device. +</p> +<p> + The country is the two-letter ISO 3166-1 Alpha-2 country code. +</p> + +<a NAME="RP2Device.__showFirmwareVersions" ID="RP2Device.__showFirmwareVersions"></a> +<h4>RP2Device.__showFirmwareVersions</h4> +<b>__showFirmwareVersions</b>(<i></i>) +<p> + Private slot to show the firmware version of the connected device and the + available firmware version. +</p> + +<a NAME="RP2Device._getSetTimeCode" ID="RP2Device._getSetTimeCode"></a> +<h4>RP2Device._getSetTimeCode</h4> +<b>_getSetTimeCode</b>(<i></i>) +<p> + Protected method to get the device code to set the time. +</p> +<p> + Note: This method must be implemented in the various device specific + subclasses. +</p> + +<dl> +<dt>Return:</dt> +<dd> +code to be executed on the connected device to set the time +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="RP2Device.activateBluetoothInterface" ID="RP2Device.activateBluetoothInterface"></a> +<h4>RP2Device.activateBluetoothInterface</h4> +<b>activateBluetoothInterface</b>(<i></i>) +<p> + Public method to activate the Bluetooth interface. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating the new state of the Bluetooth interface +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.addDeviceMenuEntries" ID="RP2Device.addDeviceMenuEntries"></a> +<h4>RP2Device.addDeviceMenuEntries</h4> +<b>addDeviceMenuEntries</b>(<i>menu</i>) +<p> + Public method to add device specific entries to the given menu. +</p> + +<dl> + +<dt><i>menu</i> (QMenu)</dt> +<dd> +reference to the context menu +</dd> +</dl> +<a NAME="RP2Device.addDeviceWifiEntries" ID="RP2Device.addDeviceWifiEntries"></a> +<h4>RP2Device.addDeviceWifiEntries</h4> +<b>addDeviceWifiEntries</b>(<i>menu</i>) +<p> + Public method to add device specific entries to the given menu. +</p> + +<dl> + +<dt><i>menu</i> (QMenu)</dt> +<dd> +reference to the context menu +</dd> +</dl> +<a NAME="RP2Device.canRunScript" ID="RP2Device.canRunScript"></a> +<h4>RP2Device.canRunScript</h4> +<b>canRunScript</b>(<i></i>) +<p> + Public method to determine, if a script can be executed. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating it is safe to start a + Plotter and a reason why it cannot. +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.canStartFileManager" ID="RP2Device.canStartFileManager"></a> +<h4>RP2Device.canStartFileManager</h4> +<b>canStartFileManager</b>(<i></i>) +<p> + Public method to determine, if a File Manager can be started. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating it is safe to start a + File Manager and a reason why it cannot. +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.canStartPlotter" ID="RP2Device.canStartPlotter"></a> +<h4>RP2Device.canStartPlotter</h4> +<b>canStartPlotter</b>(<i></i>) +<p> + Public method to determine, if a Plotter can be started. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating it is safe to start a + Plotter and a reason why it cannot. +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.canStartRepl" ID="RP2Device.canStartRepl"></a> +<h4>RP2Device.canStartRepl</h4> +<b>canStartRepl</b>(<i></i>) +<p> + Public method to determine, if a REPL can be started. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating it is safe to start a REPL + and a reason why it cannot. +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.checkInternet" ID="RP2Device.checkInternet"></a> +<h4>RP2Device.checkInternet</h4> +<b>checkInternet</b>(<i></i>) +<p> + Public method to check, if the internet can be reached. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating reachability and an error string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.checkInternetViaLan" ID="RP2Device.checkInternetViaLan"></a> +<h4>RP2Device.checkInternetViaLan</h4> +<b>checkInternetViaLan</b>(<i></i>) +<p> + Public method to check, if the internet can be reached (LAN variant). +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating reachability and an error string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.connectToLan" ID="RP2Device.connectToLan"></a> +<h4>RP2Device.connectToLan</h4> +<b>connectToLan</b>(<i>config, hostname</i>) +<p> + Public method to connect the connected device to the LAN. +</p> + +<dl> + +<dt><i>config</i> (str or tuple of (str, str, str, str))</dt> +<dd> +configuration for the connection (either the string 'dhcp' + for a dynamic address or a tuple of four strings with the IPv4 parameters. +</dd> +<dt><i>hostname</i> (str)</dt> +<dd> +host name of the device +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.connectWifi" ID="RP2Device.connectWifi"></a> +<h4>RP2Device.connectWifi</h4> +<b>connectWifi</b>(<i>ssid, password, hostname</i>) +<p> + Public method to connect a device to a WiFi network. +</p> + +<dl> + +<dt><i>ssid</i> (str)</dt> +<dd> +name (SSID) of the WiFi network +</dd> +<dt><i>password</i> (str)</dt> +<dd> +password needed to connect +</dd> +<dt><i>hostname</i> (str)</dt> +<dd> +host name of the device +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing the connection status and an error string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.deactivateBluetoothInterface" ID="RP2Device.deactivateBluetoothInterface"></a> +<h4>RP2Device.deactivateBluetoothInterface</h4> +<b>deactivateBluetoothInterface</b>(<i></i>) +<p> + Public method to deactivate the Bluetooth interface. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating the new state of the Bluetooth interface +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.deactivateEthernet" ID="RP2Device.deactivateEthernet"></a> +<h4>RP2Device.deactivateEthernet</h4> +<b>deactivateEthernet</b>(<i></i>) +<p> + Public method to deactivate the Ethernet interface of the connected device. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containg a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.deactivateInterface" ID="RP2Device.deactivateInterface"></a> +<h4>RP2Device.deactivateInterface</h4> +<b>deactivateInterface</b>(<i>interface</i>) +<p> + Public method to deactivate a given WiFi interface of the connected device. +</p> + +<dl> + +<dt><i>interface</i> (str)</dt> +<dd> +designation of the interface to be deactivated (one of 'AP' + or 'STA') +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containg a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<dl> + +<dt>Raises <b>ValueError</b>:</dt> +<dd> +raised to indicate a wrong value for the interface type +</dd> +</dl> +<a NAME="RP2Device.deviceName" ID="RP2Device.deviceName"></a> +<h4>RP2Device.deviceName</h4> +<b>deviceName</b>(<i></i>) +<p> + Public method to get the name of the device. +</p> + +<dl> +<dt>Return:</dt> +<dd> +name of the device +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="RP2Device.disableWebrepl" ID="RP2Device.disableWebrepl"></a> +<h4>RP2Device.disableWebrepl</h4> +<b>disableWebrepl</b>(<i></i>) +<p> + Public method to write the given WebREPL password to the connected device and + modify the start script to start the WebREPL server. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.disconnectFromLan" ID="RP2Device.disconnectFromLan"></a> +<h4>RP2Device.disconnectFromLan</h4> +<b>disconnectFromLan</b>(<i></i>) +<p> + Public method to disconnect from the LAN. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.disconnectWifi" ID="RP2Device.disconnectWifi"></a> +<h4>RP2Device.disconnectWifi</h4> +<b>disconnectWifi</b>(<i></i>) +<p> + Public method to disconnect a device from the WiFi network. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.enableWebrepl" ID="RP2Device.enableWebrepl"></a> +<h4>RP2Device.enableWebrepl</h4> +<b>enableWebrepl</b>(<i>password</i>) +<p> + Public method to write the given WebREPL password to the connected device and + modify the start script to start the WebREPL server. +</p> + +<dl> + +<dt><i>password</i> (str)</dt> +<dd> +password needed to authenticate +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.forceInterrupt" ID="RP2Device.forceInterrupt"></a> +<h4>RP2Device.forceInterrupt</h4> +<b>forceInterrupt</b>(<i></i>) +<p> + Public method to determine the need for an interrupt when opening the + serial connection. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating an interrupt is needed +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="RP2Device.getBluetoothStatus" ID="RP2Device.getBluetoothStatus"></a> +<h4>RP2Device.getBluetoothStatus</h4> +<b>getBluetoothStatus</b>(<i></i>) +<p> + Public method to get Bluetooth status data of the connected board. +</p> + +<dl> +<dt>Return:</dt> +<dd> +list of tuples containing the translated status data label and + the associated value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +list of tuples of (str, str) +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.getConnectedClients" ID="RP2Device.getConnectedClients"></a> +<h4>RP2Device.getConnectedClients</h4> +<b>getConnectedClients</b>(<i></i>) +<p> + Public method to get a list of connected clients. +</p> + +<dl> +<dt>Return:</dt> +<dd> +a tuple containing a list of tuples containing the client MAC-Address + and the RSSI (if supported and available) and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of ([(bytes, int)], str) +</dd> +</dl> +<a NAME="RP2Device.getDeviceScan" ID="RP2Device.getDeviceScan"></a> +<h4>RP2Device.getDeviceScan</h4> +<b>getDeviceScan</b>(<i>timeout=10</i>) +<p> + Public method to perform a Bluetooth device scan. +</p> + +<dl> + +<dt><i>timeout</i> (int (optional))</dt> +<dd> +duration of the device scan in seconds (defaults + to 10) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing a dictionary with the scan results and + an error string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (dict, str) +</dd> +</dl> +<a NAME="RP2Device.getDocumentationUrl" ID="RP2Device.getDocumentationUrl"></a> +<h4>RP2Device.getDocumentationUrl</h4> +<b>getDocumentationUrl</b>(<i></i>) +<p> + Public method to get the device documentation URL. +</p> + +<dl> +<dt>Return:</dt> +<dd> +documentation URL of the device +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="RP2Device.getDownloadMenuEntries" ID="RP2Device.getDownloadMenuEntries"></a> +<h4>RP2Device.getDownloadMenuEntries</h4> +<b>getDownloadMenuEntries</b>(<i></i>) +<p> + Public method to retrieve the entries for the downloads menu. +</p> + +<dl> +<dt>Return:</dt> +<dd> +list of tuples with menu text and URL to be opened for each + entry +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +list of tuple of (str, str) +</dd> +</dl> +<a NAME="RP2Device.getEthernetStatus" ID="RP2Device.getEthernetStatus"></a> +<h4>RP2Device.getEthernetStatus</h4> +<b>getEthernetStatus</b>(<i></i>) +<p> + Public method to get Ethernet status data of the connected board. +</p> + +<dl> +<dt>Return:</dt> +<dd> +list of tuples containing the translated status data label and + the associated value +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +list of tuples of (str, str) +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.getWifiData" ID="RP2Device.getWifiData"></a> +<h4>RP2Device.getWifiData</h4> +<b>getWifiData</b>(<i></i>) +<p> + Public method to get data related to the current WiFi status. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple of three dictionaries containing the WiFi status data + for the WiFi client, access point and overall data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (dict, dict, dict) +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.hasBluetooth" ID="RP2Device.hasBluetooth"></a> +<h4>RP2Device.hasBluetooth</h4> +<b>hasBluetooth</b>(<i></i>) +<p> + Public method to check the availability of Bluetooth. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating the availability of Bluetooth +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.hasEthernet" ID="RP2Device.hasEthernet"></a> +<h4>RP2Device.hasEthernet</h4> +<b>hasEthernet</b>(<i></i>) +<p> + Public method to check the availability of Ethernet. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating the availability of Ethernet + and the Ethernet type (picowiz) +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.hasFlashMenuEntry" ID="RP2Device.hasFlashMenuEntry"></a> +<h4>RP2Device.hasFlashMenuEntry</h4> +<b>hasFlashMenuEntry</b>(<i></i>) +<p> + Public method to check, if the device has its own flash menu entry. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating a specific flash menu entry +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="RP2Device.hasNetworkTime" ID="RP2Device.hasNetworkTime"></a> +<h4>RP2Device.hasNetworkTime</h4> +<b>hasNetworkTime</b>(<i></i>) +<p> + Public method to check the availability of network time functions. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating the availability of network time functions +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.hasWifi" ID="RP2Device.hasWifi"></a> +<h4>RP2Device.hasWifi</h4> +<b>hasWifi</b>(<i></i>) +<p> + Public method to check the availability of WiFi. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating the availability of WiFi + and the WiFi type (picow or picowireless) +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<dl> + +<dt>Raises <b>OSError</b>:</dt> +<dd> +raised to indicate an issue with the device +</dd> +</dl> +<a NAME="RP2Device.hasWifiCountry" ID="RP2Device.hasWifiCountry"></a> +<h4>RP2Device.hasWifiCountry</h4> +<b>hasWifiCountry</b>(<i></i>) +<p> + Public method to check, if the device has support to set the WiFi country. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating the support of WiFi country +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="RP2Device.isLanConnected" ID="RP2Device.isLanConnected"></a> +<h4>RP2Device.isLanConnected</h4> +<b>isLanConnected</b>(<i></i>) +<p> + Public method to check the LAN connection status. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating that the device is connected to the LAN +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="RP2Device.isWifiApConnected" ID="RP2Device.isWifiApConnected"></a> +<h4>RP2Device.isWifiApConnected</h4> +<b>isWifiApConnected</b>(<i></i>) +<p> + Public method to check the WiFi connection status as access point. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating the WiFi connection status +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="RP2Device.isWifiClientConnected" ID="RP2Device.isWifiClientConnected"></a> +<h4>RP2Device.isWifiClientConnected</h4> +<b>isWifiClientConnected</b>(<i></i>) +<p> + Public method to check the WiFi connection status as client. +</p> + +<dl> +<dt>Return:</dt> +<dd> +flag indicating the WiFi connection status +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl> +<a NAME="RP2Device.removeCredentials" ID="RP2Device.removeCredentials"></a> +<h4>RP2Device.removeCredentials</h4> +<b>removeCredentials</b>(<i></i>) +<p> + Public method to remove the saved credentials from the connected device. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.removeLanAutoConnect" ID="RP2Device.removeLanAutoConnect"></a> +<h4>RP2Device.removeLanAutoConnect</h4> +<b>removeLanAutoConnect</b>(<i></i>) +<p> + Public method to remove the saved IPv4 parameters from the connected device. +</p> +<p> + Note: This disables the LAN auto-connect feature. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.runScript" ID="RP2Device.runScript"></a> +<h4>RP2Device.runScript</h4> +<b>runScript</b>(<i>script</i>) +<p> + Public method to run the given Python script. +</p> + +<dl> + +<dt><i>script</i> (str)</dt> +<dd> +script to be executed +</dd> +</dl> +<a NAME="RP2Device.scanNetworks" ID="RP2Device.scanNetworks"></a> +<h4>RP2Device.scanNetworks</h4> +<b>scanNetworks</b>(<i></i>) +<p> + Public method to scan for available WiFi networks. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containing the list of available networks as a tuple of 'Name', + 'MAC-Address', 'channel', 'RSSI' and 'security' and an error string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (list of tuple of (str, str, int, int, str), str) +</dd> +</dl> +<a NAME="RP2Device.setButtons" ID="RP2Device.setButtons"></a> +<h4>RP2Device.setButtons</h4> +<b>setButtons</b>(<i></i>) +<p> + Public method to enable the supported action buttons. +</p> + +<a NAME="RP2Device.setNetworkTime" ID="RP2Device.setNetworkTime"></a> +<h4>RP2Device.setNetworkTime</h4> +<b>setNetworkTime</b>(<i>server="pool.ntp.org", tzOffset=0, timeout=10</i>) +<p> + Public method to set the time to the network time retrieved from an + NTP server. +</p> + +<dl> + +<dt><i>server</i> (str (optional))</dt> +<dd> +name of the NTP server to get the network time from + (defaults to "0.pool.ntp.org") +</dd> +<dt><i>tzOffset</i> (int (optional))</dt> +<dd> +offset with respect to UTC (defaults to 0) +</dd> +<dt><i>timeout</i> (int)</dt> +<dd> +maximum time to wait for a server response in seconds + (defaults to 10) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error string +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.startAccessPoint" ID="RP2Device.startAccessPoint"></a> +<h4>RP2Device.startAccessPoint</h4> +<b>startAccessPoint</b>(<i>ssid, security=None, password=None, hostname=None, ifconfig=None, </i>) +<p> + Public method to start the access point interface. +</p> + +<dl> + +<dt><i>ssid</i> (str)</dt> +<dd> +SSID of the access point +</dd> +<dt><i>security</i> (int (optional))</dt> +<dd> +security method (defaults to None) +</dd> +<dt><i>password</i> (str (optional))</dt> +<dd> +password (defaults to None) +</dd> +<dt><i>hostname</i> (str (optional))</dt> +<dd> +host name of the device (defaults to None) +</dd> +<dt><i>ifconfig</i> (tuple of (str, str, str, str))</dt> +<dd> +IPv4 configuration for the access point if not default + (IPv4 address, netmask, gateway address, DNS server address) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.stopAccessPoint" ID="RP2Device.stopAccessPoint"></a> +<h4>RP2Device.stopAccessPoint</h4> +<b>stopAccessPoint</b>(<i></i>) +<p> + Public method to stop the access point interface. +</p> + +<dl> +<dt>Return:</dt> +<dd> +tuple containg a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.writeCredentials" ID="RP2Device.writeCredentials"></a> +<h4>RP2Device.writeCredentials</h4> +<b>writeCredentials</b>(<i>ssid, password, hostname, country</i>) +<p> + Public method to write the given credentials to the connected device and modify + the start script to connect automatically. +</p> + +<dl> + +<dt><i>ssid</i> (str)</dt> +<dd> +SSID of the network to connect to +</dd> +<dt><i>password</i> (str)</dt> +<dd> +password needed to authenticate +</dd> +<dt><i>hostname</i> (str)</dt> +<dd> +host name of the device +</dd> +<dt><i>country</i> (str)</dt> +<dd> +WiFi country code +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<a NAME="RP2Device.writeLanAutoConnect" ID="RP2Device.writeLanAutoConnect"></a> +<h4>RP2Device.writeLanAutoConnect</h4> +<b>writeLanAutoConnect</b>(<i>config, hostname</i>) +<p> + Public method to generate a script and associated configuration to connect the + device to the LAN during boot time. +</p> + +<dl> + +<dt><i>config</i> (str or tuple of (str, str, str, str))</dt> +<dd> +configuration for the connection (either the string 'dhcp' + for a dynamic address or a tuple of four strings with the IPv4 parameters. +</dd> +<dt><i>hostname</i> (str)</dt> +<dd> +host name of the device +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +tuple containing a flag indicating success and an error message +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +tuple of (bool, str) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="createDevice" ID="createDevice"></a> +<h2>createDevice</h2> +<b>createDevice</b>(<i>microPythonWidget, deviceType, _vid, _pid, _boardName, _serialNumber</i>) +<p> + Function to instantiate a MicroPython device object. +</p> + +<dl> + +<dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> +<dd> +reference to the main MicroPython widget +</dd> +<dt><i>deviceType</i> (str)</dt> +<dd> +device type assigned to this device interface +</dd> +<dt><i>_vid</i> (int)</dt> +<dd> +vendor ID (unused) +</dd> +<dt><i>_pid</i> (int)</dt> +<dd> +product ID (unused) +</dd> +<dt><i>_boardName</i> (str)</dt> +<dd> +name of the board (unused) +</dd> +<dt><i>_serialNumber</i> (str)</dt> +<dd> +serial number of the board (unused) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +reference to the instantiated device object +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +RP2Device +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>
--- a/src/eric7/Documentation/Source/index-eric7.MicroPython.Devices.html Sat Aug 31 15:49:16 2024 +0200 +++ b/src/eric7/Documentation/Source/index-eric7.MicroPython.Devices.html Sat Aug 31 15:54:24 2024 +0200 @@ -52,8 +52,8 @@ <td>Module implementing the device interface class for PyBoard boards.</td> </tr> <tr> -<td><a href="eric7.MicroPython.Devices.RP2040Devices.html">RP2040Devices</a></td> -<td>Module implementing the device interface class for RP2040 based boards (e.g.</td> +<td><a href="eric7.MicroPython.Devices.RP2Devices.html">RP2Devices</a></td> +<td>Module implementing the device interface class for RP2040/RP2350 based boards (e.g.</td> </tr> <tr> <td><a href="eric7.MicroPython.Devices.STLinkDevices.html">STLinkDevices</a></td>
--- a/src/eric7/MicroPython/Devices/RP2040Devices.py Sat Aug 31 15:49:16 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2113 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright (c) 2021 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> -# - -""" -Module implementing the device interface class for RP2040 based boards -(e.g. Raspberry Pi Pico). -""" - -import ast -import binascii -import json -import os - -from PyQt6.QtCore import QUrl, pyqtSlot -from PyQt6.QtNetwork import QNetworkReply, QNetworkRequest -from PyQt6.QtWidgets import QDialog, QMenu - -from eric7 import EricUtilities, Preferences -from eric7.EricGui.EricOverrideCursor import EricOverrideCursor -from eric7.EricWidgets import EricMessageBox -from eric7.EricWidgets.EricApplication import ericApp - -from ..EthernetDialogs import WiznetUtilities -from ..MicroPythonWidget import HAS_QTCHART -from . import FirmwareGithubUrls -from .DeviceBase import BaseDevice - - -class RP2040Device(BaseDevice): - """ - Class implementing the device for RP2040 based boards. - """ - - def __init__(self, microPythonWidget, deviceType, parent=None): - """ - Constructor - - @param microPythonWidget reference to the main MicroPython widget - @type MicroPythonWidget - @param deviceType device type assigned to this device interface - @type str - @param parent reference to the parent object - @type QObject - """ - super().__init__(microPythonWidget, deviceType, parent) - - self.__createRP2040Menu() - - self.__statusTranslations = { - "picow": { - -3: self.tr("authentication failed"), - -2: self.tr("no matching access point found"), - -1: self.tr("connection failed"), - 0: self.tr("idle"), - 1: self.tr("connecting"), - 2: self.tr("connected, waiting for IP address"), - 3: self.tr("connected"), - }, - "picowireless": { - 0: self.tr("idle"), - 1: self.tr("no matching access point found"), - 2: self.tr("network scan completed"), - 3: self.tr("connected"), - 4: self.tr("connection failed"), - 5: self.tr("connection lost"), - 6: self.tr("disconnected"), - 7: self.tr("AP listening"), - 8: self.tr("AP connected"), - 9: self.tr("AP failed"), - }, - "picowiz": { - 0: self.tr("switched off"), - 1: self.tr("switched on, inactive"), - 2: self.tr("switched on, active"), - }, - } - - self.__securityTranslations = { - "picow": { - 0: self.tr("open", "open WiFi network"), - 1: "WEP", - 2: "WPA", - 3: "WPA2", - 4: "WPA/WPA2", - 5: "WPA2 (CCMP)", - 6: "WPA3", - 7: "WPA2/WPA3", - }, - "picowireless": { - 2: "WPA", - 4: "WPA2 (CCMP)", - 5: "WEP", - 7: self.tr("open", "open WiFi network"), - 8: self.tr("automatic"), - }, - } - - def setButtons(self): - """ - Public method to enable the supported action buttons. - """ - super().setButtons() - - self.microPython.setActionButtons( - run=True, repl=True, files=True, chart=HAS_QTCHART - ) - - def forceInterrupt(self): - """ - Public method to determine the need for an interrupt when opening the - serial connection. - - @return flag indicating an interrupt is needed - @rtype bool - """ - return False - - def deviceName(self): - """ - Public method to get the name of the device. - - @return name of the device - @rtype str - """ - return self.tr("RP2040") - - def canStartRepl(self): - """ - Public method to determine, if a REPL can be started. - - @return tuple containing a flag indicating it is safe to start a REPL - and a reason why it cannot. - @rtype tuple of (bool, str) - """ - return True, "" - - def canStartPlotter(self): - """ - Public method to determine, if a Plotter can be started. - - @return tuple containing a flag indicating it is safe to start a - Plotter and a reason why it cannot. - @rtype tuple of (bool, str) - """ - return True, "" - - def canRunScript(self): - """ - Public method to determine, if a script can be executed. - - @return tuple containing a flag indicating it is safe to start a - Plotter and a reason why it cannot. - @rtype tuple of (bool, str) - """ - return True, "" - - def runScript(self, script): - """ - Public method to run the given Python script. - - @param script script to be executed - @type str - """ - pythonScript = script.split("\n") - self.sendCommands(pythonScript) - - def canStartFileManager(self): - """ - Public method to determine, if a File Manager can be started. - - @return tuple containing a flag indicating it is safe to start a - File Manager and a reason why it cannot. - @rtype tuple of (bool, str) - """ - return True, "" - - def __createRP2040Menu(self): - """ - Private method to create the RP2040 submenu. - """ - self.__rp2040Menu = QMenu(self.tr("RP2040 Functions")) - - self.__showMpyAct = self.__rp2040Menu.addAction( - self.tr("Show MicroPython Versions"), self.__showFirmwareVersions - ) - self.__rp2040Menu.addSeparator() - self.__bootloaderAct = self.__rp2040Menu.addAction( - self.tr("Activate Bootloader"), self.__activateBootloader - ) - self.__flashMpyAct = self.__rp2040Menu.addAction( - self.tr("Flash MicroPython Firmware"), self.__flashPython - ) - self.__rp2040Menu.addSeparator() - self.__resetAct = self.__rp2040Menu.addAction( - self.tr("Reset Device"), self.__resetDevice - ) - - def addDeviceMenuEntries(self, menu): - """ - Public method to add device specific entries to the given menu. - - @param menu reference to the context menu - @type QMenu - """ - connected = self.microPython.isConnected() - linkConnected = self.microPython.isLinkConnected() - - self.__showMpyAct.setEnabled(connected) - self.__bootloaderAct.setEnabled(connected) - self.__flashMpyAct.setEnabled(not linkConnected) - self.__resetAct.setEnabled(connected) - - menu.addMenu(self.__rp2040Menu) - - def hasFlashMenuEntry(self): - """ - Public method to check, if the device has its own flash menu entry. - - @return flag indicating a specific flash menu entry - @rtype bool - """ - return True - - @pyqtSlot() - def __flashPython(self): - """ - Private slot to flash a MicroPython firmware to the device. - """ - from ..UF2FlashDialog import UF2FlashDialog - - dlg = UF2FlashDialog(boardType="rp2040") - dlg.exec() - - @pyqtSlot() - def __activateBootloader(self): - """ - Private slot to switch the board into 'bootloader' mode. - """ - if self.microPython.isConnected(): - self.executeCommands( - [ - "import machine", - "machine.bootloader()", - ], - mode=self._submitMode, - ) - # simulate pressing the disconnect button - self.microPython.on_connectButton_clicked() - - @pyqtSlot() - def __showFirmwareVersions(self): - """ - Private slot to show the firmware version of the connected device and the - available firmware version. - """ - if self.microPython.isConnected(): - 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 Pico": - # 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)) - - @pyqtSlot(QNetworkReply) - def __firmwareVersionResponse(self, reply): - """ - Private slot handling the response of the latest version request. - - @param reply reference to the reply object - @type QNetworkReply - """ - latestUrl = reply.url().toString() - tag = latestUrl.rsplit("/", 1)[-1] - while tag and not tag[0].isdecimal(): - # get rid of leading non-decimal characters - tag = tag[1:] - latestVersion = EricUtilities.versionToTuple(tag) - - if self._deviceData["mpy_version"] == "unknown": - currentVersionStr = self.tr("unknown") - currentVersion = (0, 0, 0) - else: - currentVersionStr = ( - self._deviceData["mpy_variant_version"] - if bool(self._deviceData["mpy_variant_version"]) - else self._deviceData["mpy_version"] - ) - currentVersion = EricUtilities.versionToTuple(currentVersionStr) - - msg = self.tr( - "<h4>MicroPython Version Information</h4>" - "<table>" - "<tr><td>Installed:</td><td>{0}</td></tr>" - "<tr><td>Available:</td><td>{1}</td></tr>" - "{2}" - "</table>" - ).format( - currentVersionStr, - tag, - ( - self.tr("<tr><td>Variant:</td><td>{0}</td></tr>").format( - self._deviceData["mpy_variant"] - ) - if self._deviceData["mpy_variant"] - else "" - ), - ) - if self._deviceData["mpy_variant"] in ["Pimoroni Pico"] and not bool( - self._deviceData["mpy_variant_version"] - ): - # cannot derive update info - msg += self.tr("<p>Update may be available.</p>") - elif currentVersion < latestVersion: - msg += self.tr("<p><b>Update available!</b></p>") - - EricMessageBox.information( - None, - self.tr("MicroPython Version"), - msg, - ) - - @pyqtSlot() - def __resetDevice(self): - """ - Private slot to reset the connected device. - """ - if self.microPython.isConnected(): - self.executeCommands( - "import machine\nmachine.reset()\n", mode=self._submitMode - ) - - def getDocumentationUrl(self): - """ - Public method to get the device documentation URL. - - @return documentation URL of the device - @rtype str - """ - return Preferences.getMicroPython("MicroPythonDocuUrl") - - def getDownloadMenuEntries(self): - """ - Public method to retrieve the entries for the downloads menu. - - @return list of tuples with menu text and URL to be opened for each - entry - @rtype list of tuple of (str, str) - """ - return [ - ( - self.tr("MicroPython Firmware"), - Preferences.getMicroPython("MicroPythonFirmwareUrl"), - ), - ("<separator>", ""), - (self.tr("Pimoroni Pico Firmware"), FirmwareGithubUrls["pimoroni_pico"]), - ("<separator>", ""), - ( - self.tr("CircuitPython Firmware"), - Preferences.getMicroPython("CircuitPythonFirmwareUrl"), - ), - ( - self.tr("CircuitPython Libraries"), - Preferences.getMicroPython("CircuitPythonLibrariesUrl"), - ), - ] - - ################################################################## - ## time related methods below - ################################################################## - - def _getSetTimeCode(self): - """ - Protected method to get the device code to set the time. - - Note: This method must be implemented in the various device specific - subclasses. - - @return code to be executed on the connected device to set the time - @rtype str - """ - # rtc_time[0] - year 4 digit - # rtc_time[1] - month 1..12 - # rtc_time[2] - day 1..31 - # rtc_time[3] - weekday 1..7 1=Monday - # rtc_time[4] - hour 0..23 - # rtc_time[5] - minute 0..59 - # rtc_time[6] - second 0..59 - # rtc_time[7] - yearday 1..366 - # rtc_time[8] - isdst 0, 1, or -1 - - # The machine.rtc.datetime() function takes the arguments in the order: - # (year, month, day, weekday, hour, minute, second, subseconds) - # __IGNORE_WARNING_M891__ - # https://docs.micropython.org/en/latest/library/machine.RTC.html#machine-rtc - return """ -def set_time(rtc_time): - import machine - rtc = machine.RTC() - rtc.datetime(rtc_time[:7] + (0,)) -""" - - ################################################################## - ## Methods below implement WiFi related methods - ################################################################## - - def addDeviceWifiEntries(self, menu): - """ - Public method to add device specific entries to the given menu. - - @param menu reference to the context menu - @type QMenu - """ - menu.addSeparator() - menu.addAction(self.tr("Set Country"), self.__setCountry).setEnabled( - self._deviceData["wifi_type"] == "picow" - ) - menu.addAction(self.tr("Reset Country"), self.__resetCountry).setEnabled( - self._deviceData["wifi_type"] == "picow" - ) - - def hasWifi(self): - """ - Public method to check the availability of WiFi. - - @return tuple containing a flag indicating the availability of WiFi - and the WiFi type (picow or picowireless) - @rtype tuple of (bool, str) - @exception OSError raised to indicate an issue with the device - """ - # picowireless: - # It seems to take up to 20 sec to detect, that no Pico Wireless Pack is - # attached. Therefore the command will timeout before. - command = """ -def has_wifi(): - try: - import network - if hasattr(network, 'WLAN'): - return True, 'picow' - except ImportError: - try: - import picowireless as pw - try: - if pw.get_fw_version() != '': - return True, 'picowireless' - except RuntimeError: - pw.init() - return True, 'picowireless' - except ImportError: - pass - - return False, '' - -print(has_wifi()) -del has_wifi -""" - out, err = self.executeCommands(command, mode=self._submitMode, timeout=20000) - if err: - if not err.startswith(b"Timeout "): - raise OSError(self._shortError(err)) - else: - # pimoroni firmware loaded but no pico wireless present - return False, "" - return ast.literal_eval(out.decode("utf-8")) - - def hasWifiCountry(self): - """ - Public method to check, if the device has support to set the WiFi country. - - @return flag indicating the support of WiFi country - @rtype bool - """ - return self._deviceData["wifi_type"] == "picow" - - def getWifiData(self): - """ - Public method to get data related to the current WiFi status. - - @return tuple of three dictionaries containing the WiFi status data - for the WiFi client, access point and overall data - @rtype tuple of (dict, dict, dict) - @exception OSError raised to indicate an issue with the device - """ - if self._deviceData["wifi_type"] == "picow": - command = """ -def wifi_status(): - import ubinascii - import ujson - import network - import rp2 - - wifi = network.WLAN(network.STA_IF) - station = { - 'active': wifi.active(), - 'connected': wifi.isconnected(), - 'status': wifi.status(), - 'ifconfig': wifi.ifconfig(), - 'mac': ubinascii.hexlify(wifi.config('mac'), ':').decode(), - 'channel': wifi.config('channel'), - 'txpower': wifi.config('txpower'), - } - print(ujson.dumps(station)) - - wifi = network.WLAN(network.AP_IF) - ap = { - 'active': wifi.active(), - 'connected': wifi.isconnected(), - 'status': wifi.status(), - 'ifconfig': wifi.ifconfig(), - 'mac': ubinascii.hexlify(wifi.config('mac'), ':').decode(), - 'channel': wifi.config('channel'), - 'txpower': wifi.config('txpower'), - 'essid': wifi.config('essid'), - } - print(ujson.dumps(ap)) - - overall = { - 'active': station['active'] or ap['active'] - } - try: - overall['country'] = network.country() - except AttributeError: - overall['country'] = rp2.country() - try: - overall['hostname'] = network.hostname() - except AttributeError: - pass - print(ujson.dumps(overall)) - -wifi_status() -del wifi_status -""" - elif self._deviceData["wifi_type"] == "picowireless": - command = """ -def wifi_status(): - import picowireless as pw - import ubinascii - import ujson - - def ip_str(ip): - return '.'.join(str(i) for i in ip) - - station = { - 'active': pw.get_connection_status() not in (0, 7, 8, 9), - 'connected': pw.get_connection_status() == 3, - 'status': pw.get_connection_status(), - 'ifconfig': ( - ip_str(pw.get_ip_address()), - ip_str(pw.get_subnet_mask()), - ip_str(pw.get_gateway_ip()), - '0.0.0.0' - ), - 'mac': ubinascii.hexlify(pw.get_mac_address(), ':').decode(), - } - if station['connected']: - station.update({ - 'ap_ssid': pw.get_current_ssid(), - 'ap_bssid': ubinascii.hexlify(pw.get_current_bssid(), ':'), - 'ap_rssi': pw.get_current_rssi(), - 'ap_security': pw.get_current_encryption_type(), - }) - print(ujson.dumps(station)) - - ap = { - 'active': pw.get_connection_status() in (7, 8, 9), - 'connected': pw.get_connection_status() == 8, - 'status': pw.get_connection_status(), - 'mac': ubinascii.hexlify(pw.get_mac_address(), ':').decode(), - } - if ap['active']: - ap['essid'] = pw.get_current_ssid() - ap['ifconfig'] = ( - ip_str(pw.get_ip_address()), - ip_str(pw.get_subnet_mask()), - ip_str(pw.get_gateway_ip()), - '0.0.0.0' - ) - print(ujson.dumps(ap)) - - overall = { - 'active': pw.get_connection_status() != 0 - } - print(ujson.dumps(overall)) - -wifi_status() -del wifi_status -""" - else: - return super().getWifiData() - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - raise OSError(self._shortError(err)) - - stationStr, apStr, overallStr = out.decode("utf-8").splitlines() - station = json.loads(stationStr) - ap = json.loads(apStr) - overall = json.loads(overallStr) - if "status" in station: - # translate the numerical status to a string - try: - station["status"] = self.__statusTranslations[ - self._deviceData["wifi_type"] - ][station["status"]] - except KeyError: - station["status"] = str(station["status"]) - if "status" in ap: - # translate the numerical status to a string - try: - ap["status"] = self.__statusTranslations[self._deviceData["wifi_type"]][ - ap["status"] - ] - except KeyError: - ap["status"] = str(ap["status"]) - if "ap_security" in station: - # translate the numerical AP security to a string - try: - station["ap_security"] = self.__securityTranslations[ - self._deviceData["wifi_type"] - ][station["ap_security"]] - except KeyError: - station["ap_security"] = self.tr("unknown ({0})").format( - station["ap_security"] - ) - return station, ap, overall - - def connectWifi(self, ssid, password, hostname): - """ - Public method to connect a device to a WiFi network. - - @param ssid name (SSID) of the WiFi network - @type str - @param password password needed to connect - @type str - @param hostname host name of the device - @type str - @return tuple containing the connection status and an error string - @rtype tuple of (bool, str) - """ - if self._deviceData["wifi_type"] == "picow": - country = Preferences.getMicroPython("WifiCountry").upper() - command = """ -def connect_wifi(ssid, password, hostname, country): - import network - import rp2 - import ujson - from time import sleep - - rp2.country(country) - - if hostname: - try: - network.hostname(hostname) - except AttributeError: - pass - - wifi = network.WLAN(network.STA_IF) - wifi.active(False) - wifi.active(True) - wifi.connect(ssid, password) - max_wait = 140 - while max_wait: - if wifi.status() < 0 or wifi.status() >= 3: - break - max_wait -= 1 - sleep(0.1) - status = wifi.status() - print(ujson.dumps({{'connected': wifi.isconnected(), 'status': status}})) - -connect_wifi({0}, {1}, {2}, {3}) -del connect_wifi -""".format( - repr(ssid), - repr(password if password else ""), - repr(hostname), - repr(country if country else "XX"), - ) - elif self._deviceData["wifi_type"] == "picowireless": - command = """ -def connect_wifi(ssid, password): - import picowireless as pw - import ujson - from time import sleep - - pw.init() - if bool(password): - pw.wifi_set_passphrase(ssid, password) - else: - pw.wifi_set_network(ssid) - - max_wait = 140 - while max_wait: - if pw.get_connection_status() == 3: - break - max_wait -= 1 - sleep(0.1) - status = pw.get_connection_status() - if status == 3: - pw.set_led(0, 64, 0) - else: - pw.set_led(64, 0, 0) - print(ujson.dumps({{'connected': status == 3, 'status': status}})) - -connect_wifi({0}, {1}) -del connect_wifi -""".format( - repr(ssid), - repr(password if password else ""), - ) - else: - return super().connectWifi(ssid, password, hostname) - - with EricOverrideCursor(): - out, err = self.executeCommands( - command, mode=self._submitMode, timeout=15000 - ) - if err: - return False, err - - result = json.loads(out.decode("utf-8").strip()) - if result["connected"]: - error = "" - else: - try: - error = self.__statusTranslations[self._deviceData["wifi_type"]][ - result["status"] - ] - except KeyError: - error = str(result["status"]) - - return result["connected"], error - - def disconnectWifi(self): - """ - Public method to disconnect a device from the WiFi network. - - @return tuple containing a flag indicating success and an error string - @rtype tuple of (bool, str) - """ - if self._deviceData["wifi_type"] == "picow": - command = """ -def disconnect_wifi(): - import network - from time import sleep - - wifi = network.WLAN(network.STA_IF) - wifi.disconnect() - wifi.active(False) - sleep(0.1) - print(not wifi.isconnected()) - -disconnect_wifi() -del disconnect_wifi -""" - elif self._deviceData["wifi_type"] == "picowireless": - command = """ -def disconnect_wifi(): - import picowireless as pw - from time import sleep - - pw.disconnect() - sleep(0.1) - print(pw.get_connection_status() != 3) - pw.set_led(0, 0, 0) - -disconnect_wifi() -del disconnect_wifi -""" - else: - return super().disconnectWifi() - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False, err - - return out.decode("utf-8").strip() == "True", "" - - def isWifiClientConnected(self): - """ - Public method to check the WiFi connection status as client. - - @return flag indicating the WiFi connection status - @rtype bool - """ - if self._deviceData["wifi_type"] == "picow": - command = """ -def wifi_connected(): - import network - - wifi = network.WLAN(network.STA_IF) - print(wifi.isconnected()) - -wifi_connected() -del wifi_connected -""" - elif self._deviceData["wifi_type"] == "picowireless": - command = """ -def wifi_connected(): - import picowireless as pw - - print(pw.get_connection_status() == 3) - -wifi_connected() -del wifi_connected -""" - else: - return super().isWifiClientConnected() - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False - - return out.strip() == b"True" - - def isWifiApConnected(self): - """ - Public method to check the WiFi connection status as access point. - - @return flag indicating the WiFi connection status - @rtype bool - """ - if self._deviceData["wifi_type"] == "picow": - command = """ -def wifi_connected(): - import network - - wifi = network.WLAN(network.AP_IF) - print(wifi.isconnected()) - -wifi_connected() -del wifi_connected -""" - elif self._deviceData["wifi_type"] == "picowireless": - command = """ -def wifi_connected(): - import picowireless as pw - - print(pw.get_connection_status() == 8) - -wifi_connected() -del wifi_connected -""" - else: - return super().isWifiClientConnected() - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False - - return out.strip() == b"True" - - def writeCredentials(self, ssid, password, hostname, country): - """ - Public method to write the given credentials to the connected device and modify - the start script to connect automatically. - - @param ssid SSID of the network to connect to - @type str - @param password password needed to authenticate - @type str - @param hostname host name of the device - @type str - @param country WiFi country code - @type str - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - command = """ -def modify_boot(): - add = True - try: - with open('/boot.py', 'r') as f: - for ln in f.readlines(): - if 'wifi_connect' in ln: - add = False - break - except: - pass - if add: - with open('/boot.py', 'a') as f: - f.write('\\nimport wifi_connect\\n') - print(True) - -modify_boot() -del modify_boot -""" - - if self._deviceData["wifi_type"] == "picow": - secrets = ( - "WIFI_SSID = {0}\nWIFI_KEY = {1}\nWIFI_COUNTRY={2}\n" - "WIFI_HOSTNAME = {3}\n" - ).format( - repr(ssid), - repr(password) if password else '""', - repr(country.upper()) if country else '""', - repr(hostname) if hostname else '""', - ) - wifiConnectFile = "picowWiFiConnect.py" - else: - secrets = "WIFI_SSID = {0}\nWIFI_KEY = {1}\n".format( - repr(ssid), - repr(password) if password else '""', - ) - if self._deviceData["wifi_type"] == "picowireless": - wifiConnectFile = "pimoroniWiFiConnect.py" - else: - secrets += "WIFI_HOSTNAME = {0}\n".format( - repr(hostname if hostname else '""') - ) - wifiConnectFile = "mpyWiFiConnect.py" - try: - # write secrets file - self.putData("/secrets.py", secrets.encode("utf-8")) - # copy auto-connect file - self.put( - os.path.join(os.path.dirname(__file__), "MCUScripts", wifiConnectFile), - "/wifi_connect.py", - ) - except OSError as err: - return False, str(err) - - # modify boot.py - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False, err - - return out.decode("utf-8").strip() == "True", "" - - def removeCredentials(self): - """ - Public method to remove the saved credentials from the connected device. - - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - try: - self.rm("/secrets.py") - except OSError as err: - return False, str(err) - - return True, "" - - def checkInternet(self): - """ - Public method to check, if the internet can be reached. - - @return tuple containing a flag indicating reachability and an error string - @rtype tuple of (bool, str) - """ - if self._deviceData["wifi_type"] == "picow": - command = """ -def check_internet(): - import network - import socket - - wifi = network.WLAN(network.STA_IF) - if wifi.isconnected(): - s = socket.socket() - try: - s.connect(socket.getaddrinfo('quad9.net', 443)[0][-1]) - s.close() - print(True) - except: - print(False) - else: - print(False) - -check_internet() -del check_internet -""" - elif self._deviceData["wifi_type"] == "picowireless": - command = """ -def check_internet(): - import picowireless as pw - - if pw.get_connection_status() == 3: - res = pw.ping((9, 9, 9, 9), 300) - print(res >= 0) - else: - print(False) - -check_internet() -del check_internet -""" - else: - return super().checkInternet() - - out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) - if err: - return False, err - - return out.decode("utf-8").strip() == "True", "" - - def scanNetworks(self): - """ - Public method to scan for available WiFi networks. - - @return tuple containing the list of available networks as a tuple of 'Name', - 'MAC-Address', 'channel', 'RSSI' and 'security' and an error string - @rtype tuple of (list of tuple of (str, str, int, int, str), str) - """ - if self._deviceData["wifi_type"] == "picow": - country = Preferences.getMicroPython("WifiCountry").upper() - command = """ -def scan_networks(): - import network - import rp2 - - rp2.country({0}) - - wifi = network.WLAN(network.STA_IF) - active = wifi.active() - if not active: - wifi.active(True) - network_list = wifi.scan() - if not active: - wifi.active(False) - print(network_list) - -scan_networks() -del scan_networks -""".format( - repr(country if country else "XX") - ) - - elif self._deviceData["wifi_type"] == "picowireless": - command = """ -def scan_networks(): - import picowireless as pw - - network_list = [] - pw.init() - pw.start_scan_networks() - networks = pw.get_scan_networks() - for n in range(networks): - network_list.append(( - pw.get_ssid_networks(n), - pw.get_bssid_networks(n), - pw.get_channel_networks(n), - pw.get_rssi_networks(n), - pw.get_enc_type_networks(n), - )) - print(network_list) - -scan_networks() -del scan_networks -""" - else: - return super().scanNetworks() - - out, err = self.executeCommands(command, mode=self._submitMode, timeout=15000) - if err: - return [], err - - networksList = ast.literal_eval(out.decode("utf-8")) - networks = [] - for network in networksList: - if network[0]: - ssid = ( - network[0].decode("utf-8") - if isinstance(network[0], bytes) - else network[0] - ) - mac = ( - binascii.hexlify(network[1], ":").decode("utf-8") - if network[1] is not None - else "" - ) - channel = network[2] - rssi = network[3] - try: - security = self.__securityTranslations[ - self._deviceData["wifi_type"] - ][network[4]] - except KeyError: - security = self.tr("unknown ({0})").format(network[4]) - networks.append((ssid, mac, channel, rssi, security)) - - return networks, "" - - def deactivateInterface(self, interface): - """ - Public method to deactivate a given WiFi interface of the connected device. - - @param interface designation of the interface to be deactivated (one of 'AP' - or 'STA') - @type str - @return tuple containg a flag indicating success and an error message - @rtype tuple of (bool, str) - @exception ValueError raised to indicate a wrong value for the interface type - """ - if interface not in ("STA", "AP"): - raise ValueError( - "interface must be 'AP' or 'STA', got '{0}'".format(interface) - ) - - if self._deviceData["wifi_type"] == "picow": - command = """ -def deactivate(): - import network - from time import sleep - - wifi = network.WLAN(network.{0}_IF) - wifi.active(False) - sleep(0.1) - print(not wifi.active()) - -deactivate() -del deactivate -""".format( - interface - ) - elif self._deviceData["wifi_type"] == "picowireless": - command = """ -def deactivate(): - import picowireless as pw - - pw.init() - print(True) - -deactivate() -del deactivate -""" - else: - return super().deactivateInterface(interface) - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False, err - else: - return out.decode("utf-8").strip() == "True", "" - - def startAccessPoint( - self, - ssid, - security=None, - password=None, - hostname=None, - ifconfig=None, - ): - """ - Public method to start the access point interface. - - @param ssid SSID of the access point - @type str - @param security security method (defaults to None) - @type int (optional) - @param password password (defaults to None) - @type str (optional) - @param hostname host name of the device (defaults to None) - @type str (optional) - @param ifconfig IPv4 configuration for the access point if not default - (IPv4 address, netmask, gateway address, DNS server address) - @type tuple of (str, str, str, str) - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - if security is None or password is None: - security = 0 - password = "" # secok - - if self._deviceData["wifi_type"] == "picow": - country = Preferences.getMicroPython("WifiCountry").upper() - if security: - security = 4 # Pico W supports just WPA/WPA2 - command = """ -def start_ap(ssid, security, password, hostname, ifconfig, country): - import network - import rp2 - from time import sleep - - rp2.country(country) - - if hostname: - try: - network.hostname(hostname) - except AttributeError: - pass - - ap = network.WLAN(network.AP_IF) - ap.active(True) - if ifconfig: - ap.ifconfig(ifconfig) - ap.config(ssid=ssid, security=security, password=password) - sleep(0.1) - print(ap.isconnected()) - -start_ap({0}, {1}, {2}, {3}, {4}, {5}) -del start_ap -""".format( - repr(ssid), - security, - repr(password), - repr(hostname), - ifconfig, - repr(country if country else "XX"), - ) - elif self._deviceData["wifi_type"] == "picowireless": - if ifconfig: - return ( - False, - self.tr( - "Pico Wireless does not support setting the IPv4 parameters of" - " the WiFi access point." - ), - ) - - # AP is fixed at channel 6 - command = """ -def start_ap(ssid, password): - import picowireless as pw - - pw.init() - if bool(password): - res = pw.wifi_set_ap_passphrase(ssid, password, 6) - else: - res = pw.wifi_set_ap_network(ssid, 6) - status = pw.get_connection_status() - if status in (7, 8): - pw.set_led(0, 64, 0) - else: - pw.set_led(64, 0, 0) - print(res >= 0) - -start_ap({0}, {1}) -del start_ap -""".format( - repr(ssid), - repr(password if password else ""), - ) - else: - return super().startAccessPoint( - ssid, - security=security, - password=password, - hostname=hostname, - ifconfig=ifconfig, - ) - - out, err = self.executeCommands(command, mode=self._submitMode, timeout=15000) - if err: - return False, err - else: - return out.decode("utf-8").strip() == "True", "" - - def stopAccessPoint(self): - """ - Public method to stop the access point interface. - - @return tuple containg a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - if self._deviceData["wifi_type"] in ("picow", "picowireless"): - return self.deactivateInterface("AP") - else: - return super().stopAccessPoint() - - def getConnectedClients(self): - """ - Public method to get a list of connected clients. - - @return a tuple containing a list of tuples containing the client MAC-Address - and the RSSI (if supported and available) and an error message - @rtype tuple of ([(bytes, int)], str) - """ - if self._deviceData["wifi_type"] == "picow": - command = """ -def get_stations(): - import network - - ap = network.WLAN(network.AP_IF) - stations = ap.status('stations') - print(stations) - -get_stations() -del get_stations -""" - elif self._deviceData["wifi_type"] == "picowireless": - return ( - [], - self.tr( - "Pico Wireless does not support reporting of connected clients." - ), - ) - else: - return super().checkInternet() - - out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) - if err: - return [], err - - clientsList = ast.literal_eval(out.decode("utf-8")) - return clientsList, "" - - def enableWebrepl(self, password): - """ - Public method to write the given WebREPL password to the connected device and - modify the start script to start the WebREPL server. - - @param password password needed to authenticate - @type str - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - command = """ -def modify_boot(): - import os - - try: - with open('/boot.py', 'r') as old_f, open('/boot.py.tmp', 'w') as new_f: - found = False - for l in old_f.read().splitlines(): - if 'webrepl' in l: - found = True - if l.startswith('#'): - l = l[1:] - new_f.write(l + '\\n') - if not found: - new_f.write('\\nimport webrepl\\nwebrepl.start()\\n') - - os.remove('/boot.py') - os.rename('/boot.py.tmp', '/boot.py') - except: - pass - - print(True) - -modify_boot() -del modify_boot -""" - - if self._deviceData["wifi_type"] == "picow": - config = "PASS = {0}\n".format(repr(password)) - else: - return False, self.tr("WebREPL is not supported on this device.") - - try: - # write config file - self.putData("/webrepl_cfg.py", config.encode("utf-8")) - except OSError as err: - return False, str(err) - - # modify boot.py - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False, err - - return out.decode("utf-8").strip() == "True", "" - - def disableWebrepl(self): - """ - Public method to write the given WebREPL password to the connected device and - modify the start script to start the WebREPL server. - - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - command = """ -def modify_boot(): - import os - - try: - with open('/boot.py', 'r') as old_f, open('/boot.py.tmp', 'w') as new_f: - for l in old_f.read().splitlines(): - if 'webrepl' in l: - if not l.startswith('#'): - l = '#' + l - new_f.write(l + '\\n') - - os.remove('/boot.py') - os.rename('/boot.py.tmp', '/boot.py') - except: - pass - - print(True) - -modify_boot() -del modify_boot -""" - - # modify boot.py - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False, err - - return out.decode("utf-8").strip() == "True", "" - - @pyqtSlot() - def __setCountry(self): - """ - Private slot to configure the country of the connected RP2040 device. - - The country is the two-letter ISO 3166-1 Alpha-2 country code. - """ - from ..WifiDialogs.WifiCountryDialog import WifiCountryDialog - - dlg = WifiCountryDialog() - if dlg.exec() == QDialog.DialogCode.Accepted: - country, remember = dlg.getCountry() - if remember: - Preferences.setMicroPython("WifiCountry", country) - - command = """ -try: - import network - network.country({0}) -except AttributeError: - import rp2 - rp2.country({0}) -""".format( - repr(country) - ) - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - self.microPython.showError("country()", err) - - @pyqtSlot() - def __resetCountry(self): - """ - Private slot to reset the country of the connected ESP32 device. - - The country is the two-letter ISO 3166-1 Alpha-2 country code. This method - resets it to the default code 'XX' representing the "worldwide" region. - """ - command = """ -try: - import network - network.country('XX') -except AttributeError: - pass -""" - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - self.microPython.showError("country()", err) - - ################################################################## - ## Methods below implement Bluetooth related methods - ################################################################## - - def hasBluetooth(self): - """ - Public method to check the availability of Bluetooth. - - @return flag indicating the availability of Bluetooth - @rtype bool - @exception OSError raised to indicate an issue with the device - """ - command = """ -def has_bt(): - try: - import bluetooth - if hasattr(bluetooth, 'BLE'): - return True - except ImportError: - pass - - return False - -print(has_bt()) -del has_bt -""" - out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) - if err: - raise OSError(self._shortError(err)) - return out.strip() == b"True" - - def getBluetoothStatus(self): - """ - Public method to get Bluetooth status data of the connected board. - - @return list of tuples containing the translated status data label and - the associated value - @rtype list of tuples of (str, str) - @exception OSError raised to indicate an issue with the device - """ - command = """ -def ble_status(): - import bluetooth - import ubinascii - import ujson - - ble = bluetooth.BLE() - - ble_active = ble.active() - if not ble_active: - ble.active(True) - - res = { - 'active': ble_active, - 'mac': ubinascii.hexlify(ble.config('mac')[1], ':').decode(), - 'addr_type': ble.config('mac')[0], - 'name': ble.config('gap_name'), - 'mtu': ble.config('mtu'), - } - - if not ble_active: - ble.active(False) - - print(ujson.dumps(res)) - -ble_status() -del ble_status -""" - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - raise OSError(self._shortError(err)) - - status = [] - bleStatus = json.loads(out.decode("utf-8")) - status.append((self.tr("Active"), self.bool2str(bleStatus["active"]))) - status.append((self.tr("Name"), bleStatus["name"])) - status.append((self.tr("MAC-Address"), bleStatus["mac"])) - status.append( - ( - self.tr("Address Type"), - self.tr("Public") if bleStatus == 0 else self.tr("Random"), - ) - ) - status.append((self.tr("MTU"), self.tr("{0} Bytes").format(bleStatus["mtu"]))) - - return status - - def activateBluetoothInterface(self): - """ - Public method to activate the Bluetooth interface. - - @return flag indicating the new state of the Bluetooth interface - @rtype bool - @exception OSError raised to indicate an issue with the device - """ - command = """ -def activate_ble(): - import bluetooth - - ble = bluetooth.BLE() - if not ble.active(): - ble.active(True) - print(ble.active()) - -activate_ble() -del activate_ble -""" - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - raise OSError(self._shortError(err)) - - return out.strip() == b"True" - - def deactivateBluetoothInterface(self): - """ - Public method to deactivate the Bluetooth interface. - - @return flag indicating the new state of the Bluetooth interface - @rtype bool - @exception OSError raised to indicate an issue with the device - """ - command = """ -def deactivate_ble(): - import bluetooth - - ble = bluetooth.BLE() - if ble.active(): - ble.active(False) - print(ble.active()) - -deactivate_ble() -del deactivate_ble -""" - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - raise OSError(self._shortError(err)) - - return out.strip() == b"True" - - def getDeviceScan(self, timeout=10): - """ - Public method to perform a Bluetooth device scan. - - @param timeout duration of the device scan in seconds (defaults - to 10) - @type int (optional) - @return tuple containing a dictionary with the scan results and - an error string - @rtype tuple of (dict, str) - """ - from ..BluetoothDialogs.BluetoothAdvertisement import BluetoothAdvertisement - - command = """ -_scan_done = False - -def ble_scan(): - import bluetooth - import time - import ubinascii - - IRQ_SCAN_RESULT = 5 - IRQ_SCAN_DONE = 6 - - def _bleIrq(event, data): - global _scan_done - if event == IRQ_SCAN_RESULT: - addr_type, addr, adv_type, rssi, adv_data = data - if addr: - print({{ - 'address': ubinascii.hexlify(addr,':').decode('utf-8'), - 'rssi': rssi, - 'adv_type': adv_type, - 'advertisement': bytes(adv_data), - }}) - elif event == IRQ_SCAN_DONE: - _scan_done = True - - ble = bluetooth.BLE() - - ble_active = ble.active() - if not ble_active: - ble.active(True) - - ble.irq(_bleIrq) - ble.gap_scan({0} * 1000, 1000000, 50000, True) - while not _scan_done: - time.sleep(0.2) - - if not ble_active: - ble.active(False) - -ble_scan() -del ble_scan, _scan_done -""".format( - timeout - ) - out, err = self.executeCommands( - command, mode=self._submitMode, timeout=(timeout + 5) * 1000 - ) - if err: - return {}, err - - scanResults = {} - for line in out.decode("utf-8").splitlines(): - res = ast.literal_eval(line) - address = res["address"] - if address not in scanResults: - scanResults[address] = BluetoothAdvertisement(address) - scanResults[address].update( - res["adv_type"], res["rssi"], res["advertisement"] - ) - - return scanResults, "" - - ################################################################## - ## Methods below implement Ethernet related methods - ################################################################## - - def hasEthernet(self): - """ - Public method to check the availability of Ethernet. - - @return tuple containing a flag indicating the availability of Ethernet - and the Ethernet type (picowiz) - @rtype tuple of (bool, str) - @exception OSError raised to indicate an issue with the device - """ - command = """ -def has_eth(): - try: - import network - if hasattr(network, 'WIZNET5K'): - return True, 'picowiz' - except ImportError: - pass - - return False, '' - -print(has_eth()) -del has_eth -""" - - out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) - if err: - raise OSError(self._shortError(err)) - - return ast.literal_eval(out.decode("utf-8")) - - def getEthernetStatus(self): - """ - Public method to get Ethernet status data of the connected board. - - @return list of tuples containing the translated status data label and - the associated value - @rtype list of tuples of (str, str) - @exception OSError raised to indicate an issue with the device - """ - command = """{0} -def ethernet_status(): - import network - import ubinascii - import ujson - - w5x00_init() - - res = {{ - 'active': nic.active(), - 'connected': nic.isconnected(), - 'status': nic.status(), - 'ifconfig': nic.ifconfig(), - 'mac': ubinascii.hexlify(nic.config('mac'), ':').decode(), - }} - try: - res['hostname'] = network.hostname() - except AttributeError: - res['hostname'] = '' - print(ujson.dumps(res)) - -ethernet_status() -del ethernet_status, w5x00_init -""".format( - WiznetUtilities.mpyWiznetInit() - ) - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - raise OSError(self._shortError(err)) - - status = [] - ethStatus = json.loads(out.decode("utf-8")) - status.append((self.tr("Active"), self.bool2str(ethStatus["active"]))) - status.append((self.tr("Connected"), self.bool2str(ethStatus["connected"]))) - status.append( - ( - self.tr("Status"), - self.__statusTranslations["picowiz"][ethStatus["status"]], - ) - ) - status.append( - ( - self.tr("Hostname"), - ethStatus["hostname"] if ethStatus["hostname"] else self.tr("unknown"), - ) - ) - status.append((self.tr("IPv4 Address"), ethStatus["ifconfig"][0])) - status.append((self.tr("Netmask"), ethStatus["ifconfig"][1])) - status.append((self.tr("Gateway"), ethStatus["ifconfig"][2])) - status.append((self.tr("DNS"), ethStatus["ifconfig"][3])) - status.append((self.tr("MAC-Address"), ethStatus["mac"])) - - return status - - def connectToLan(self, config, hostname): - """ - Public method to connect the connected device to the LAN. - - @param config configuration for the connection (either the string 'dhcp' - for a dynamic address or a tuple of four strings with the IPv4 parameters. - @type str or tuple of (str, str, str, str) - @param hostname host name of the device - @type str - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - command = """{0} -def connect_lan(config, hostname): - import network - import time - - if hostname: - try: - network.hostname(hostname) - except AttributeError: - pass - - w5x00_init() - - nic.active(False) - nic.active(True) - nic.ifconfig(config) - max_wait = 140 - while max_wait: - if nic.isconnected(): - break - max_wait -= 1 - time.sleep(0.1) - print(nic.isconnected()) - -connect_lan({1}, {2}) -del connect_lan, w5x00_init -""".format( - WiznetUtilities.mpyWiznetInit(), - "'dhcp'" if config == "dhcp" else config, - repr(hostname) if hostname else "''", - ) - - with EricOverrideCursor(): - out, err = self.executeCommands( - command, mode=self._submitMode, timeout=15000 - ) - if err: - return False, err - - return out.strip() == b"True", "" - - def disconnectFromLan(self): - """ - Public method to disconnect from the LAN. - - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - command = """{0} -def disconnect_lan(): - import time - - w5x00_init() - - nic.active(False) - time.sleep(0.1) - print(not nic.isconnected()) - -disconnect_lan() -del disconnect_lan, w5x00_init -""".format( - WiznetUtilities.mpyWiznetInit(), - ) - - with EricOverrideCursor(): - out, err = self.executeCommands( - command, mode=self._submitMode, timeout=15000 - ) - if err: - return False, err - - return out.strip() == b"True", "" - - def isLanConnected(self): - """ - Public method to check the LAN connection status. - - @return flag indicating that the device is connected to the LAN - @rtype bool - """ - command = """{0} -def is_connected(): - import network - - w5x00_init() - - print(nic.isconnected()) - -is_connected() -del is_connected, w5x00_init -""".format( - WiznetUtilities.mpyWiznetInit(), - ) - - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False - - return out.strip() == b"True" - - def checkInternetViaLan(self): - """ - Public method to check, if the internet can be reached (LAN variant). - - @return tuple containing a flag indicating reachability and an error string - @rtype tuple of (bool, str) - """ - command = """{0} -def check_internet(): - import network - import socket - - w5x00_init() - - if nic.isconnected(): - s = socket.socket() - try: - s.connect(socket.getaddrinfo('quad9.net', 443)[0][-1]) - s.close() - print(True) - except: - print(False) - else: - print(False) - -check_internet() -del check_internet, w5x00_init -""".format( - WiznetUtilities.mpyWiznetInit(), - ) - - out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) - if err: - return False, err - - return out.strip() == b"True", "" - - def deactivateEthernet(self): - """ - Public method to deactivate the Ethernet interface of the connected device. - - @return tuple containg a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - # The WIZnet 5x00 interface cannot be switched off explicitly. That means, - # disconnect from the LAN is all we can do. - - return self.disconnectFromLan() - - def writeLanAutoConnect(self, config, hostname): - """ - Public method to generate a script and associated configuration to connect the - device to the LAN during boot time. - - @param config configuration for the connection (either the string 'dhcp' - for a dynamic address or a tuple of four strings with the IPv4 parameters. - @type str or tuple of (str, str, str, str) - @param hostname host name of the device - @type str - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - command = """ -def modify_boot(): - add = True - try: - with open('/boot.py', 'r') as f: - for ln in f.readlines(): - if 'wiznet_connect' in ln: - add = False - break - except: - pass - if add: - with open('/boot.py', 'a') as f: - f.write('\\n') - f.write('import wiznet_connect\\n') - f.write('nic = wiznet_connect.connect_lan()\\n') - print(True) - -modify_boot() -del modify_boot -""" - devconfig = "ifconfig = {0}\nhostname = {1}".format( - "'dhcp'" if config == "dhcp" else config, - repr(hostname) if hostname else "''", - ) - try: - # write secrets file - self.putData("/wiznet_config.py", devconfig.encode("utf-8")) - # copy auto-connect file - self.put( - os.path.join( - os.path.dirname(__file__), "MCUScripts", "picoWiznetConnect.py" - ), - "/wiznet_connect.py", - ) - except OSError as err: - return False, str(err) - - # modify boot.py - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - return False, err - - return out.decode("utf-8").strip() == "True", "" - - def removeLanAutoConnect(self): - """ - Public method to remove the saved IPv4 parameters from the connected device. - - Note: This disables the LAN auto-connect feature. - - @return tuple containing a flag indicating success and an error message - @rtype tuple of (bool, str) - """ - try: - self.rm("/wiznet_config.py") - except OSError as err: - return False, str(err) - - return True, "" - - ################################################################## - ## Methods below implement NTP related methods - ################################################################## - - def hasNetworkTime(self): - """ - Public method to check the availability of network time functions. - - @return flag indicating the availability of network time functions - @rtype bool - @exception OSError raised to indicate an issue with the device - """ - command = """ -def has_ntp(): - try: - import ntptime - return True - except ImportError: - return False - -print(has_ntp()) -del has_ntp -""" - out, err = self.executeCommands(command, mode=self._submitMode) - if err: - raise OSError(self._shortError(err)) - return out.strip() == b"True" - - def setNetworkTime(self, server="pool.ntp.org", tzOffset=0, timeout=10): - """ - Public method to set the time to the network time retrieved from an - NTP server. - - @param server name of the NTP server to get the network time from - (defaults to "0.pool.ntp.org") - @type str (optional) - @param tzOffset offset with respect to UTC (defaults to 0) - @type int (optional) - @param timeout maximum time to wait for a server response in seconds - (defaults to 10) - @type int - @return tuple containing a flag indicating success and an error string - @rtype tuple of (bool, str) - """ - command = """ -def set_ntp_time(server, tz_offset, timeout): - import network - import ntptime - import machine - - if hasattr(network, 'WLAN') and not network.WLAN(network.STA_IF).isconnected(): - return False - elif hasattr(network, 'WIZNET5K'): - try: - if not nic.isconnected(): - return False - except NameError: - return False - - ntptime.host = server - ntptime.timeout = timeout - ntptime.settime() - - rtc = machine.RTC() - t = list(rtc.datetime()) - t[4] += tz_offset - rtc.datetime(t) - - return True - -try: - print({{ - 'result': set_ntp_time({0}, {1}, {2}), - 'error': '', - }}) -except Exception as err: - print({{ - 'result': False, - 'error': str(err), - }}) -del set_ntp_time -""".format( - repr(server), tzOffset, timeout - ) - out, err = self.executeCommands( - command, mode=self._submitMode, timeout=(timeout + 2) * 1000 - ) - if err: - return False, err - else: - res = ast.literal_eval(out.decode("utf-8")) - return res["result"], res["error"] - - -def createDevice(microPythonWidget, deviceType, _vid, _pid, _boardName, _serialNumber): - """ - Function to instantiate a MicroPython device object. - - @param microPythonWidget reference to the main MicroPython widget - @type MicroPythonWidget - @param deviceType device type assigned to this device interface - @type str - @param _vid vendor ID (unused) - @type int - @param _pid product ID (unused) - @type int - @param _boardName name of the board (unused) - @type str - @param _serialNumber serial number of the board (unused) - @type str - @return reference to the instantiated device object - @rtype RP2040Device - """ - return RP2040Device(microPythonWidget, deviceType)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/MicroPython/Devices/RP2Devices.py Sat Aug 31 15:54:24 2024 +0200 @@ -0,0 +1,2113 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2021 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing the device interface class for RP2040/RP2350 based boards +(e.g. Raspberry Pi Pico / Pico 2). +""" + +import ast +import binascii +import json +import os + +from PyQt6.QtCore import QUrl, pyqtSlot +from PyQt6.QtNetwork import QNetworkReply, QNetworkRequest +from PyQt6.QtWidgets import QDialog, QMenu + +from eric7 import EricUtilities, Preferences +from eric7.EricGui.EricOverrideCursor import EricOverrideCursor +from eric7.EricWidgets import EricMessageBox +from eric7.EricWidgets.EricApplication import ericApp + +from ..EthernetDialogs import WiznetUtilities +from ..MicroPythonWidget import HAS_QTCHART +from . import FirmwareGithubUrls +from .DeviceBase import BaseDevice + + +class RP2Device(BaseDevice): + """ + Class implementing the device for RP2040/RP2350 based boards. + """ + + def __init__(self, microPythonWidget, deviceType, parent=None): + """ + Constructor + + @param microPythonWidget reference to the main MicroPython widget + @type MicroPythonWidget + @param deviceType device type assigned to this device interface + @type str + @param parent reference to the parent object + @type QObject + """ + super().__init__(microPythonWidget, deviceType, parent) + + self.__createRP2Menu() + + self.__statusTranslations = { + "picow": { + -3: self.tr("authentication failed"), + -2: self.tr("no matching access point found"), + -1: self.tr("connection failed"), + 0: self.tr("idle"), + 1: self.tr("connecting"), + 2: self.tr("connected, waiting for IP address"), + 3: self.tr("connected"), + }, + "picowireless": { + 0: self.tr("idle"), + 1: self.tr("no matching access point found"), + 2: self.tr("network scan completed"), + 3: self.tr("connected"), + 4: self.tr("connection failed"), + 5: self.tr("connection lost"), + 6: self.tr("disconnected"), + 7: self.tr("AP listening"), + 8: self.tr("AP connected"), + 9: self.tr("AP failed"), + }, + "picowiz": { + 0: self.tr("switched off"), + 1: self.tr("switched on, inactive"), + 2: self.tr("switched on, active"), + }, + } + + self.__securityTranslations = { + "picow": { + 0: self.tr("open", "open WiFi network"), + 1: "WEP", + 2: "WPA", + 3: "WPA2", + 4: "WPA/WPA2", + 5: "WPA2 (CCMP)", + 6: "WPA3", + 7: "WPA2/WPA3", + }, + "picowireless": { + 2: "WPA", + 4: "WPA2 (CCMP)", + 5: "WEP", + 7: self.tr("open", "open WiFi network"), + 8: self.tr("automatic"), + }, + } + + def setButtons(self): + """ + Public method to enable the supported action buttons. + """ + super().setButtons() + + self.microPython.setActionButtons( + run=True, repl=True, files=True, chart=HAS_QTCHART + ) + + def forceInterrupt(self): + """ + Public method to determine the need for an interrupt when opening the + serial connection. + + @return flag indicating an interrupt is needed + @rtype bool + """ + return False + + def deviceName(self): + """ + Public method to get the name of the device. + + @return name of the device + @rtype str + """ + return self.tr("RP2040/RP2350") + + def canStartRepl(self): + """ + Public method to determine, if a REPL can be started. + + @return tuple containing a flag indicating it is safe to start a REPL + and a reason why it cannot. + @rtype tuple of (bool, str) + """ + return True, "" + + def canStartPlotter(self): + """ + Public method to determine, if a Plotter can be started. + + @return tuple containing a flag indicating it is safe to start a + Plotter and a reason why it cannot. + @rtype tuple of (bool, str) + """ + return True, "" + + def canRunScript(self): + """ + Public method to determine, if a script can be executed. + + @return tuple containing a flag indicating it is safe to start a + Plotter and a reason why it cannot. + @rtype tuple of (bool, str) + """ + return True, "" + + def runScript(self, script): + """ + Public method to run the given Python script. + + @param script script to be executed + @type str + """ + pythonScript = script.split("\n") + self.sendCommands(pythonScript) + + def canStartFileManager(self): + """ + Public method to determine, if a File Manager can be started. + + @return tuple containing a flag indicating it is safe to start a + File Manager and a reason why it cannot. + @rtype tuple of (bool, str) + """ + return True, "" + + def __createRP2Menu(self): + """ + Private method to create the RP2 submenu. + """ + self.__rp2Menu = QMenu(self.tr("RP2 Functions")) + + self.__showMpyAct = self.__rp2Menu.addAction( + self.tr("Show MicroPython Versions"), self.__showFirmwareVersions + ) + self.__rp2Menu.addSeparator() + self.__bootloaderAct = self.__rp2Menu.addAction( + self.tr("Activate Bootloader"), self.__activateBootloader + ) + self.__flashMpyAct = self.__rp2Menu.addAction( + self.tr("Flash MicroPython Firmware"), self.__flashPython + ) + self.__rp2Menu.addSeparator() + self.__resetAct = self.__rp2Menu.addAction( + self.tr("Reset Device"), self.__resetDevice + ) + + def addDeviceMenuEntries(self, menu): + """ + Public method to add device specific entries to the given menu. + + @param menu reference to the context menu + @type QMenu + """ + connected = self.microPython.isConnected() + linkConnected = self.microPython.isLinkConnected() + + self.__showMpyAct.setEnabled(connected) + self.__bootloaderAct.setEnabled(connected) + self.__flashMpyAct.setEnabled(not linkConnected) + self.__resetAct.setEnabled(connected) + + menu.addMenu(self.__rp2Menu) + + def hasFlashMenuEntry(self): + """ + Public method to check, if the device has its own flash menu entry. + + @return flag indicating a specific flash menu entry + @rtype bool + """ + return True + + @pyqtSlot() + def __flashPython(self): + """ + Private slot to flash a MicroPython firmware to the device. + """ + from ..UF2FlashDialog import UF2FlashDialog + + dlg = UF2FlashDialog(boardType="rp2") + dlg.exec() + + @pyqtSlot() + def __activateBootloader(self): + """ + Private slot to switch the board into 'bootloader' mode. + """ + if self.microPython.isConnected(): + self.executeCommands( + [ + "import machine", + "machine.bootloader()", + ], + mode=self._submitMode, + ) + # simulate pressing the disconnect button + self.microPython.on_connectButton_clicked() + + @pyqtSlot() + def __showFirmwareVersions(self): + """ + Private slot to show the firmware version of the connected device and the + available firmware version. + """ + if self.microPython.isConnected(): + 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 Pico": + # 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)) + + @pyqtSlot(QNetworkReply) + def __firmwareVersionResponse(self, reply): + """ + Private slot handling the response of the latest version request. + + @param reply reference to the reply object + @type QNetworkReply + """ + latestUrl = reply.url().toString() + tag = latestUrl.rsplit("/", 1)[-1] + while tag and not tag[0].isdecimal(): + # get rid of leading non-decimal characters + tag = tag[1:] + latestVersion = EricUtilities.versionToTuple(tag) + + if self._deviceData["mpy_version"] == "unknown": + currentVersionStr = self.tr("unknown") + currentVersion = (0, 0, 0) + else: + currentVersionStr = ( + self._deviceData["mpy_variant_version"] + if bool(self._deviceData["mpy_variant_version"]) + else self._deviceData["mpy_version"] + ) + currentVersion = EricUtilities.versionToTuple(currentVersionStr) + + msg = self.tr( + "<h4>MicroPython Version Information</h4>" + "<table>" + "<tr><td>Installed:</td><td>{0}</td></tr>" + "<tr><td>Available:</td><td>{1}</td></tr>" + "{2}" + "</table>" + ).format( + currentVersionStr, + tag, + ( + self.tr("<tr><td>Variant:</td><td>{0}</td></tr>").format( + self._deviceData["mpy_variant"] + ) + if self._deviceData["mpy_variant"] + else "" + ), + ) + if self._deviceData["mpy_variant"] in ["Pimoroni Pico"] and not bool( + self._deviceData["mpy_variant_version"] + ): + # cannot derive update info + msg += self.tr("<p>Update may be available.</p>") + elif currentVersion < latestVersion: + msg += self.tr("<p><b>Update available!</b></p>") + + EricMessageBox.information( + None, + self.tr("MicroPython Version"), + msg, + ) + + @pyqtSlot() + def __resetDevice(self): + """ + Private slot to reset the connected device. + """ + if self.microPython.isConnected(): + self.executeCommands( + "import machine\nmachine.reset()\n", mode=self._submitMode + ) + + def getDocumentationUrl(self): + """ + Public method to get the device documentation URL. + + @return documentation URL of the device + @rtype str + """ + return Preferences.getMicroPython("MicroPythonDocuUrl") + + def getDownloadMenuEntries(self): + """ + Public method to retrieve the entries for the downloads menu. + + @return list of tuples with menu text and URL to be opened for each + entry + @rtype list of tuple of (str, str) + """ + return [ + ( + self.tr("MicroPython Firmware"), + Preferences.getMicroPython("MicroPythonFirmwareUrl"), + ), + ("<separator>", ""), + (self.tr("Pimoroni Pico Firmware"), FirmwareGithubUrls["pimoroni_pico"]), + ("<separator>", ""), + ( + self.tr("CircuitPython Firmware"), + Preferences.getMicroPython("CircuitPythonFirmwareUrl"), + ), + ( + self.tr("CircuitPython Libraries"), + Preferences.getMicroPython("CircuitPythonLibrariesUrl"), + ), + ] + + ################################################################## + ## time related methods below + ################################################################## + + def _getSetTimeCode(self): + """ + Protected method to get the device code to set the time. + + Note: This method must be implemented in the various device specific + subclasses. + + @return code to be executed on the connected device to set the time + @rtype str + """ + # rtc_time[0] - year 4 digit + # rtc_time[1] - month 1..12 + # rtc_time[2] - day 1..31 + # rtc_time[3] - weekday 1..7 1=Monday + # rtc_time[4] - hour 0..23 + # rtc_time[5] - minute 0..59 + # rtc_time[6] - second 0..59 + # rtc_time[7] - yearday 1..366 + # rtc_time[8] - isdst 0, 1, or -1 + + # The machine.rtc.datetime() function takes the arguments in the order: + # (year, month, day, weekday, hour, minute, second, subseconds) + # __IGNORE_WARNING_M891__ + # https://docs.micropython.org/en/latest/library/machine.RTC.html#machine-rtc + return """ +def set_time(rtc_time): + import machine + rtc = machine.RTC() + rtc.datetime(rtc_time[:7] + (0,)) +""" + + ################################################################## + ## Methods below implement WiFi related methods + ################################################################## + + def addDeviceWifiEntries(self, menu): + """ + Public method to add device specific entries to the given menu. + + @param menu reference to the context menu + @type QMenu + """ + menu.addSeparator() + menu.addAction(self.tr("Set Country"), self.__setCountry).setEnabled( + self._deviceData["wifi_type"] == "picow" + ) + menu.addAction(self.tr("Reset Country"), self.__resetCountry).setEnabled( + self._deviceData["wifi_type"] == "picow" + ) + + def hasWifi(self): + """ + Public method to check the availability of WiFi. + + @return tuple containing a flag indicating the availability of WiFi + and the WiFi type (picow or picowireless) + @rtype tuple of (bool, str) + @exception OSError raised to indicate an issue with the device + """ + # picowireless: + # It seems to take up to 20 sec to detect, that no Pico Wireless Pack is + # attached. Therefore the command will timeout before. + command = """ +def has_wifi(): + try: + import network + if hasattr(network, 'WLAN'): + return True, 'picow' + except ImportError: + try: + import picowireless as pw + try: + if pw.get_fw_version() != '': + return True, 'picowireless' + except RuntimeError: + pw.init() + return True, 'picowireless' + except ImportError: + pass + + return False, '' + +print(has_wifi()) +del has_wifi +""" + out, err = self.executeCommands(command, mode=self._submitMode, timeout=20000) + if err: + if not err.startswith(b"Timeout "): + raise OSError(self._shortError(err)) + else: + # pimoroni firmware loaded but no pico wireless present + return False, "" + return ast.literal_eval(out.decode("utf-8")) + + def hasWifiCountry(self): + """ + Public method to check, if the device has support to set the WiFi country. + + @return flag indicating the support of WiFi country + @rtype bool + """ + return self._deviceData["wifi_type"] == "picow" + + def getWifiData(self): + """ + Public method to get data related to the current WiFi status. + + @return tuple of three dictionaries containing the WiFi status data + for the WiFi client, access point and overall data + @rtype tuple of (dict, dict, dict) + @exception OSError raised to indicate an issue with the device + """ + if self._deviceData["wifi_type"] == "picow": + command = """ +def wifi_status(): + import ubinascii + import ujson + import network + import rp2 + + wifi = network.WLAN(network.STA_IF) + station = { + 'active': wifi.active(), + 'connected': wifi.isconnected(), + 'status': wifi.status(), + 'ifconfig': wifi.ifconfig(), + 'mac': ubinascii.hexlify(wifi.config('mac'), ':').decode(), + 'channel': wifi.config('channel'), + 'txpower': wifi.config('txpower'), + } + print(ujson.dumps(station)) + + wifi = network.WLAN(network.AP_IF) + ap = { + 'active': wifi.active(), + 'connected': wifi.isconnected(), + 'status': wifi.status(), + 'ifconfig': wifi.ifconfig(), + 'mac': ubinascii.hexlify(wifi.config('mac'), ':').decode(), + 'channel': wifi.config('channel'), + 'txpower': wifi.config('txpower'), + 'essid': wifi.config('essid'), + } + print(ujson.dumps(ap)) + + overall = { + 'active': station['active'] or ap['active'] + } + try: + overall['country'] = network.country() + except AttributeError: + overall['country'] = rp2.country() + try: + overall['hostname'] = network.hostname() + except AttributeError: + pass + print(ujson.dumps(overall)) + +wifi_status() +del wifi_status +""" + elif self._deviceData["wifi_type"] == "picowireless": + command = """ +def wifi_status(): + import picowireless as pw + import ubinascii + import ujson + + def ip_str(ip): + return '.'.join(str(i) for i in ip) + + station = { + 'active': pw.get_connection_status() not in (0, 7, 8, 9), + 'connected': pw.get_connection_status() == 3, + 'status': pw.get_connection_status(), + 'ifconfig': ( + ip_str(pw.get_ip_address()), + ip_str(pw.get_subnet_mask()), + ip_str(pw.get_gateway_ip()), + '0.0.0.0' + ), + 'mac': ubinascii.hexlify(pw.get_mac_address(), ':').decode(), + } + if station['connected']: + station.update({ + 'ap_ssid': pw.get_current_ssid(), + 'ap_bssid': ubinascii.hexlify(pw.get_current_bssid(), ':'), + 'ap_rssi': pw.get_current_rssi(), + 'ap_security': pw.get_current_encryption_type(), + }) + print(ujson.dumps(station)) + + ap = { + 'active': pw.get_connection_status() in (7, 8, 9), + 'connected': pw.get_connection_status() == 8, + 'status': pw.get_connection_status(), + 'mac': ubinascii.hexlify(pw.get_mac_address(), ':').decode(), + } + if ap['active']: + ap['essid'] = pw.get_current_ssid() + ap['ifconfig'] = ( + ip_str(pw.get_ip_address()), + ip_str(pw.get_subnet_mask()), + ip_str(pw.get_gateway_ip()), + '0.0.0.0' + ) + print(ujson.dumps(ap)) + + overall = { + 'active': pw.get_connection_status() != 0 + } + print(ujson.dumps(overall)) + +wifi_status() +del wifi_status +""" + else: + return super().getWifiData() + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + raise OSError(self._shortError(err)) + + stationStr, apStr, overallStr = out.decode("utf-8").splitlines() + station = json.loads(stationStr) + ap = json.loads(apStr) + overall = json.loads(overallStr) + if "status" in station: + # translate the numerical status to a string + try: + station["status"] = self.__statusTranslations[ + self._deviceData["wifi_type"] + ][station["status"]] + except KeyError: + station["status"] = str(station["status"]) + if "status" in ap: + # translate the numerical status to a string + try: + ap["status"] = self.__statusTranslations[self._deviceData["wifi_type"]][ + ap["status"] + ] + except KeyError: + ap["status"] = str(ap["status"]) + if "ap_security" in station: + # translate the numerical AP security to a string + try: + station["ap_security"] = self.__securityTranslations[ + self._deviceData["wifi_type"] + ][station["ap_security"]] + except KeyError: + station["ap_security"] = self.tr("unknown ({0})").format( + station["ap_security"] + ) + return station, ap, overall + + def connectWifi(self, ssid, password, hostname): + """ + Public method to connect a device to a WiFi network. + + @param ssid name (SSID) of the WiFi network + @type str + @param password password needed to connect + @type str + @param hostname host name of the device + @type str + @return tuple containing the connection status and an error string + @rtype tuple of (bool, str) + """ + if self._deviceData["wifi_type"] == "picow": + country = Preferences.getMicroPython("WifiCountry").upper() + command = """ +def connect_wifi(ssid, password, hostname, country): + import network + import rp2 + import ujson + from time import sleep + + rp2.country(country) + + if hostname: + try: + network.hostname(hostname) + except AttributeError: + pass + + wifi = network.WLAN(network.STA_IF) + wifi.active(False) + wifi.active(True) + wifi.connect(ssid, password) + max_wait = 140 + while max_wait: + if wifi.status() < 0 or wifi.status() >= 3: + break + max_wait -= 1 + sleep(0.1) + status = wifi.status() + print(ujson.dumps({{'connected': wifi.isconnected(), 'status': status}})) + +connect_wifi({0}, {1}, {2}, {3}) +del connect_wifi +""".format( + repr(ssid), + repr(password if password else ""), + repr(hostname), + repr(country if country else "XX"), + ) + elif self._deviceData["wifi_type"] == "picowireless": + command = """ +def connect_wifi(ssid, password): + import picowireless as pw + import ujson + from time import sleep + + pw.init() + if bool(password): + pw.wifi_set_passphrase(ssid, password) + else: + pw.wifi_set_network(ssid) + + max_wait = 140 + while max_wait: + if pw.get_connection_status() == 3: + break + max_wait -= 1 + sleep(0.1) + status = pw.get_connection_status() + if status == 3: + pw.set_led(0, 64, 0) + else: + pw.set_led(64, 0, 0) + print(ujson.dumps({{'connected': status == 3, 'status': status}})) + +connect_wifi({0}, {1}) +del connect_wifi +""".format( + repr(ssid), + repr(password if password else ""), + ) + else: + return super().connectWifi(ssid, password, hostname) + + with EricOverrideCursor(): + out, err = self.executeCommands( + command, mode=self._submitMode, timeout=15000 + ) + if err: + return False, err + + result = json.loads(out.decode("utf-8").strip()) + if result["connected"]: + error = "" + else: + try: + error = self.__statusTranslations[self._deviceData["wifi_type"]][ + result["status"] + ] + except KeyError: + error = str(result["status"]) + + return result["connected"], error + + def disconnectWifi(self): + """ + Public method to disconnect a device from the WiFi network. + + @return tuple containing a flag indicating success and an error string + @rtype tuple of (bool, str) + """ + if self._deviceData["wifi_type"] == "picow": + command = """ +def disconnect_wifi(): + import network + from time import sleep + + wifi = network.WLAN(network.STA_IF) + wifi.disconnect() + wifi.active(False) + sleep(0.1) + print(not wifi.isconnected()) + +disconnect_wifi() +del disconnect_wifi +""" + elif self._deviceData["wifi_type"] == "picowireless": + command = """ +def disconnect_wifi(): + import picowireless as pw + from time import sleep + + pw.disconnect() + sleep(0.1) + print(pw.get_connection_status() != 3) + pw.set_led(0, 0, 0) + +disconnect_wifi() +del disconnect_wifi +""" + else: + return super().disconnectWifi() + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False, err + + return out.decode("utf-8").strip() == "True", "" + + def isWifiClientConnected(self): + """ + Public method to check the WiFi connection status as client. + + @return flag indicating the WiFi connection status + @rtype bool + """ + if self._deviceData["wifi_type"] == "picow": + command = """ +def wifi_connected(): + import network + + wifi = network.WLAN(network.STA_IF) + print(wifi.isconnected()) + +wifi_connected() +del wifi_connected +""" + elif self._deviceData["wifi_type"] == "picowireless": + command = """ +def wifi_connected(): + import picowireless as pw + + print(pw.get_connection_status() == 3) + +wifi_connected() +del wifi_connected +""" + else: + return super().isWifiClientConnected() + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False + + return out.strip() == b"True" + + def isWifiApConnected(self): + """ + Public method to check the WiFi connection status as access point. + + @return flag indicating the WiFi connection status + @rtype bool + """ + if self._deviceData["wifi_type"] == "picow": + command = """ +def wifi_connected(): + import network + + wifi = network.WLAN(network.AP_IF) + print(wifi.isconnected()) + +wifi_connected() +del wifi_connected +""" + elif self._deviceData["wifi_type"] == "picowireless": + command = """ +def wifi_connected(): + import picowireless as pw + + print(pw.get_connection_status() == 8) + +wifi_connected() +del wifi_connected +""" + else: + return super().isWifiClientConnected() + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False + + return out.strip() == b"True" + + def writeCredentials(self, ssid, password, hostname, country): + """ + Public method to write the given credentials to the connected device and modify + the start script to connect automatically. + + @param ssid SSID of the network to connect to + @type str + @param password password needed to authenticate + @type str + @param hostname host name of the device + @type str + @param country WiFi country code + @type str + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + command = """ +def modify_boot(): + add = True + try: + with open('/boot.py', 'r') as f: + for ln in f.readlines(): + if 'wifi_connect' in ln: + add = False + break + except: + pass + if add: + with open('/boot.py', 'a') as f: + f.write('\\nimport wifi_connect\\n') + print(True) + +modify_boot() +del modify_boot +""" + + if self._deviceData["wifi_type"] == "picow": + secrets = ( + "WIFI_SSID = {0}\nWIFI_KEY = {1}\nWIFI_COUNTRY={2}\n" + "WIFI_HOSTNAME = {3}\n" + ).format( + repr(ssid), + repr(password) if password else '""', + repr(country.upper()) if country else '""', + repr(hostname) if hostname else '""', + ) + wifiConnectFile = "picowWiFiConnect.py" + else: + secrets = "WIFI_SSID = {0}\nWIFI_KEY = {1}\n".format( + repr(ssid), + repr(password) if password else '""', + ) + if self._deviceData["wifi_type"] == "picowireless": + wifiConnectFile = "pimoroniWiFiConnect.py" + else: + secrets += "WIFI_HOSTNAME = {0}\n".format( + repr(hostname if hostname else '""') + ) + wifiConnectFile = "mpyWiFiConnect.py" + try: + # write secrets file + self.putData("/secrets.py", secrets.encode("utf-8")) + # copy auto-connect file + self.put( + os.path.join(os.path.dirname(__file__), "MCUScripts", wifiConnectFile), + "/wifi_connect.py", + ) + except OSError as err: + return False, str(err) + + # modify boot.py + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False, err + + return out.decode("utf-8").strip() == "True", "" + + def removeCredentials(self): + """ + Public method to remove the saved credentials from the connected device. + + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + try: + self.rm("/secrets.py") + except OSError as err: + return False, str(err) + + return True, "" + + def checkInternet(self): + """ + Public method to check, if the internet can be reached. + + @return tuple containing a flag indicating reachability and an error string + @rtype tuple of (bool, str) + """ + if self._deviceData["wifi_type"] == "picow": + command = """ +def check_internet(): + import network + import socket + + wifi = network.WLAN(network.STA_IF) + if wifi.isconnected(): + s = socket.socket() + try: + s.connect(socket.getaddrinfo('quad9.net', 443)[0][-1]) + s.close() + print(True) + except: + print(False) + else: + print(False) + +check_internet() +del check_internet +""" + elif self._deviceData["wifi_type"] == "picowireless": + command = """ +def check_internet(): + import picowireless as pw + + if pw.get_connection_status() == 3: + res = pw.ping((9, 9, 9, 9), 300) + print(res >= 0) + else: + print(False) + +check_internet() +del check_internet +""" + else: + return super().checkInternet() + + out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) + if err: + return False, err + + return out.decode("utf-8").strip() == "True", "" + + def scanNetworks(self): + """ + Public method to scan for available WiFi networks. + + @return tuple containing the list of available networks as a tuple of 'Name', + 'MAC-Address', 'channel', 'RSSI' and 'security' and an error string + @rtype tuple of (list of tuple of (str, str, int, int, str), str) + """ + if self._deviceData["wifi_type"] == "picow": + country = Preferences.getMicroPython("WifiCountry").upper() + command = """ +def scan_networks(): + import network + import rp2 + + rp2.country({0}) + + wifi = network.WLAN(network.STA_IF) + active = wifi.active() + if not active: + wifi.active(True) + network_list = wifi.scan() + if not active: + wifi.active(False) + print(network_list) + +scan_networks() +del scan_networks +""".format( + repr(country if country else "XX") + ) + + elif self._deviceData["wifi_type"] == "picowireless": + command = """ +def scan_networks(): + import picowireless as pw + + network_list = [] + pw.init() + pw.start_scan_networks() + networks = pw.get_scan_networks() + for n in range(networks): + network_list.append(( + pw.get_ssid_networks(n), + pw.get_bssid_networks(n), + pw.get_channel_networks(n), + pw.get_rssi_networks(n), + pw.get_enc_type_networks(n), + )) + print(network_list) + +scan_networks() +del scan_networks +""" + else: + return super().scanNetworks() + + out, err = self.executeCommands(command, mode=self._submitMode, timeout=15000) + if err: + return [], err + + networksList = ast.literal_eval(out.decode("utf-8")) + networks = [] + for network in networksList: + if network[0]: + ssid = ( + network[0].decode("utf-8") + if isinstance(network[0], bytes) + else network[0] + ) + mac = ( + binascii.hexlify(network[1], ":").decode("utf-8") + if network[1] is not None + else "" + ) + channel = network[2] + rssi = network[3] + try: + security = self.__securityTranslations[ + self._deviceData["wifi_type"] + ][network[4]] + except KeyError: + security = self.tr("unknown ({0})").format(network[4]) + networks.append((ssid, mac, channel, rssi, security)) + + return networks, "" + + def deactivateInterface(self, interface): + """ + Public method to deactivate a given WiFi interface of the connected device. + + @param interface designation of the interface to be deactivated (one of 'AP' + or 'STA') + @type str + @return tuple containg a flag indicating success and an error message + @rtype tuple of (bool, str) + @exception ValueError raised to indicate a wrong value for the interface type + """ + if interface not in ("STA", "AP"): + raise ValueError( + "interface must be 'AP' or 'STA', got '{0}'".format(interface) + ) + + if self._deviceData["wifi_type"] == "picow": + command = """ +def deactivate(): + import network + from time import sleep + + wifi = network.WLAN(network.{0}_IF) + wifi.active(False) + sleep(0.1) + print(not wifi.active()) + +deactivate() +del deactivate +""".format( + interface + ) + elif self._deviceData["wifi_type"] == "picowireless": + command = """ +def deactivate(): + import picowireless as pw + + pw.init() + print(True) + +deactivate() +del deactivate +""" + else: + return super().deactivateInterface(interface) + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False, err + else: + return out.decode("utf-8").strip() == "True", "" + + def startAccessPoint( + self, + ssid, + security=None, + password=None, + hostname=None, + ifconfig=None, + ): + """ + Public method to start the access point interface. + + @param ssid SSID of the access point + @type str + @param security security method (defaults to None) + @type int (optional) + @param password password (defaults to None) + @type str (optional) + @param hostname host name of the device (defaults to None) + @type str (optional) + @param ifconfig IPv4 configuration for the access point if not default + (IPv4 address, netmask, gateway address, DNS server address) + @type tuple of (str, str, str, str) + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + if security is None or password is None: + security = 0 + password = "" # secok + + if self._deviceData["wifi_type"] == "picow": + country = Preferences.getMicroPython("WifiCountry").upper() + if security: + security = 4 # Pico W supports just WPA/WPA2 + command = """ +def start_ap(ssid, security, password, hostname, ifconfig, country): + import network + import rp2 + from time import sleep + + rp2.country(country) + + if hostname: + try: + network.hostname(hostname) + except AttributeError: + pass + + ap = network.WLAN(network.AP_IF) + ap.active(True) + if ifconfig: + ap.ifconfig(ifconfig) + ap.config(ssid=ssid, security=security, password=password) + sleep(0.1) + print(ap.isconnected()) + +start_ap({0}, {1}, {2}, {3}, {4}, {5}) +del start_ap +""".format( + repr(ssid), + security, + repr(password), + repr(hostname), + ifconfig, + repr(country if country else "XX"), + ) + elif self._deviceData["wifi_type"] == "picowireless": + if ifconfig: + return ( + False, + self.tr( + "Pico Wireless does not support setting the IPv4 parameters of" + " the WiFi access point." + ), + ) + + # AP is fixed at channel 6 + command = """ +def start_ap(ssid, password): + import picowireless as pw + + pw.init() + if bool(password): + res = pw.wifi_set_ap_passphrase(ssid, password, 6) + else: + res = pw.wifi_set_ap_network(ssid, 6) + status = pw.get_connection_status() + if status in (7, 8): + pw.set_led(0, 64, 0) + else: + pw.set_led(64, 0, 0) + print(res >= 0) + +start_ap({0}, {1}) +del start_ap +""".format( + repr(ssid), + repr(password if password else ""), + ) + else: + return super().startAccessPoint( + ssid, + security=security, + password=password, + hostname=hostname, + ifconfig=ifconfig, + ) + + out, err = self.executeCommands(command, mode=self._submitMode, timeout=15000) + if err: + return False, err + else: + return out.decode("utf-8").strip() == "True", "" + + def stopAccessPoint(self): + """ + Public method to stop the access point interface. + + @return tuple containg a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + if self._deviceData["wifi_type"] in ("picow", "picowireless"): + return self.deactivateInterface("AP") + else: + return super().stopAccessPoint() + + def getConnectedClients(self): + """ + Public method to get a list of connected clients. + + @return a tuple containing a list of tuples containing the client MAC-Address + and the RSSI (if supported and available) and an error message + @rtype tuple of ([(bytes, int)], str) + """ + if self._deviceData["wifi_type"] == "picow": + command = """ +def get_stations(): + import network + + ap = network.WLAN(network.AP_IF) + stations = ap.status('stations') + print(stations) + +get_stations() +del get_stations +""" + elif self._deviceData["wifi_type"] == "picowireless": + return ( + [], + self.tr( + "Pico Wireless does not support reporting of connected clients." + ), + ) + else: + return super().checkInternet() + + out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) + if err: + return [], err + + clientsList = ast.literal_eval(out.decode("utf-8")) + return clientsList, "" + + def enableWebrepl(self, password): + """ + Public method to write the given WebREPL password to the connected device and + modify the start script to start the WebREPL server. + + @param password password needed to authenticate + @type str + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + command = """ +def modify_boot(): + import os + + try: + with open('/boot.py', 'r') as old_f, open('/boot.py.tmp', 'w') as new_f: + found = False + for l in old_f.read().splitlines(): + if 'webrepl' in l: + found = True + if l.startswith('#'): + l = l[1:] + new_f.write(l + '\\n') + if not found: + new_f.write('\\nimport webrepl\\nwebrepl.start()\\n') + + os.remove('/boot.py') + os.rename('/boot.py.tmp', '/boot.py') + except: + pass + + print(True) + +modify_boot() +del modify_boot +""" + + if self._deviceData["wifi_type"] == "picow": + config = "PASS = {0}\n".format(repr(password)) + else: + return False, self.tr("WebREPL is not supported on this device.") + + try: + # write config file + self.putData("/webrepl_cfg.py", config.encode("utf-8")) + except OSError as err: + return False, str(err) + + # modify boot.py + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False, err + + return out.decode("utf-8").strip() == "True", "" + + def disableWebrepl(self): + """ + Public method to write the given WebREPL password to the connected device and + modify the start script to start the WebREPL server. + + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + command = """ +def modify_boot(): + import os + + try: + with open('/boot.py', 'r') as old_f, open('/boot.py.tmp', 'w') as new_f: + for l in old_f.read().splitlines(): + if 'webrepl' in l: + if not l.startswith('#'): + l = '#' + l + new_f.write(l + '\\n') + + os.remove('/boot.py') + os.rename('/boot.py.tmp', '/boot.py') + except: + pass + + print(True) + +modify_boot() +del modify_boot +""" + + # modify boot.py + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False, err + + return out.decode("utf-8").strip() == "True", "" + + @pyqtSlot() + def __setCountry(self): + """ + Private slot to configure the country of the connected device. + + The country is the two-letter ISO 3166-1 Alpha-2 country code. + """ + from ..WifiDialogs.WifiCountryDialog import WifiCountryDialog + + dlg = WifiCountryDialog() + if dlg.exec() == QDialog.DialogCode.Accepted: + country, remember = dlg.getCountry() + if remember: + Preferences.setMicroPython("WifiCountry", country) + + command = """ +try: + import network + network.country({0}) +except AttributeError: + import rp2 + rp2.country({0}) +""".format( + repr(country) + ) + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + self.microPython.showError("country()", err) + + @pyqtSlot() + def __resetCountry(self): + """ + Private slot to reset the country of the connected ESP32 device. + + The country is the two-letter ISO 3166-1 Alpha-2 country code. This method + resets it to the default code 'XX' representing the "worldwide" region. + """ + command = """ +try: + import network + network.country('XX') +except AttributeError: + pass +""" + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + self.microPython.showError("country()", err) + + ################################################################## + ## Methods below implement Bluetooth related methods + ################################################################## + + def hasBluetooth(self): + """ + Public method to check the availability of Bluetooth. + + @return flag indicating the availability of Bluetooth + @rtype bool + @exception OSError raised to indicate an issue with the device + """ + command = """ +def has_bt(): + try: + import bluetooth + if hasattr(bluetooth, 'BLE'): + return True + except ImportError: + pass + + return False + +print(has_bt()) +del has_bt +""" + out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) + if err: + raise OSError(self._shortError(err)) + return out.strip() == b"True" + + def getBluetoothStatus(self): + """ + Public method to get Bluetooth status data of the connected board. + + @return list of tuples containing the translated status data label and + the associated value + @rtype list of tuples of (str, str) + @exception OSError raised to indicate an issue with the device + """ + command = """ +def ble_status(): + import bluetooth + import ubinascii + import ujson + + ble = bluetooth.BLE() + + ble_active = ble.active() + if not ble_active: + ble.active(True) + + res = { + 'active': ble_active, + 'mac': ubinascii.hexlify(ble.config('mac')[1], ':').decode(), + 'addr_type': ble.config('mac')[0], + 'name': ble.config('gap_name'), + 'mtu': ble.config('mtu'), + } + + if not ble_active: + ble.active(False) + + print(ujson.dumps(res)) + +ble_status() +del ble_status +""" + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + raise OSError(self._shortError(err)) + + status = [] + bleStatus = json.loads(out.decode("utf-8")) + status.append((self.tr("Active"), self.bool2str(bleStatus["active"]))) + status.append((self.tr("Name"), bleStatus["name"])) + status.append((self.tr("MAC-Address"), bleStatus["mac"])) + status.append( + ( + self.tr("Address Type"), + self.tr("Public") if bleStatus == 0 else self.tr("Random"), + ) + ) + status.append((self.tr("MTU"), self.tr("{0} Bytes").format(bleStatus["mtu"]))) + + return status + + def activateBluetoothInterface(self): + """ + Public method to activate the Bluetooth interface. + + @return flag indicating the new state of the Bluetooth interface + @rtype bool + @exception OSError raised to indicate an issue with the device + """ + command = """ +def activate_ble(): + import bluetooth + + ble = bluetooth.BLE() + if not ble.active(): + ble.active(True) + print(ble.active()) + +activate_ble() +del activate_ble +""" + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + raise OSError(self._shortError(err)) + + return out.strip() == b"True" + + def deactivateBluetoothInterface(self): + """ + Public method to deactivate the Bluetooth interface. + + @return flag indicating the new state of the Bluetooth interface + @rtype bool + @exception OSError raised to indicate an issue with the device + """ + command = """ +def deactivate_ble(): + import bluetooth + + ble = bluetooth.BLE() + if ble.active(): + ble.active(False) + print(ble.active()) + +deactivate_ble() +del deactivate_ble +""" + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + raise OSError(self._shortError(err)) + + return out.strip() == b"True" + + def getDeviceScan(self, timeout=10): + """ + Public method to perform a Bluetooth device scan. + + @param timeout duration of the device scan in seconds (defaults + to 10) + @type int (optional) + @return tuple containing a dictionary with the scan results and + an error string + @rtype tuple of (dict, str) + """ + from ..BluetoothDialogs.BluetoothAdvertisement import BluetoothAdvertisement + + command = """ +_scan_done = False + +def ble_scan(): + import bluetooth + import time + import ubinascii + + IRQ_SCAN_RESULT = 5 + IRQ_SCAN_DONE = 6 + + def _bleIrq(event, data): + global _scan_done + if event == IRQ_SCAN_RESULT: + addr_type, addr, adv_type, rssi, adv_data = data + if addr: + print({{ + 'address': ubinascii.hexlify(addr,':').decode('utf-8'), + 'rssi': rssi, + 'adv_type': adv_type, + 'advertisement': bytes(adv_data), + }}) + elif event == IRQ_SCAN_DONE: + _scan_done = True + + ble = bluetooth.BLE() + + ble_active = ble.active() + if not ble_active: + ble.active(True) + + ble.irq(_bleIrq) + ble.gap_scan({0} * 1000, 1000000, 50000, True) + while not _scan_done: + time.sleep(0.2) + + if not ble_active: + ble.active(False) + +ble_scan() +del ble_scan, _scan_done +""".format( + timeout + ) + out, err = self.executeCommands( + command, mode=self._submitMode, timeout=(timeout + 5) * 1000 + ) + if err: + return {}, err + + scanResults = {} + for line in out.decode("utf-8").splitlines(): + res = ast.literal_eval(line) + address = res["address"] + if address not in scanResults: + scanResults[address] = BluetoothAdvertisement(address) + scanResults[address].update( + res["adv_type"], res["rssi"], res["advertisement"] + ) + + return scanResults, "" + + ################################################################## + ## Methods below implement Ethernet related methods + ################################################################## + + def hasEthernet(self): + """ + Public method to check the availability of Ethernet. + + @return tuple containing a flag indicating the availability of Ethernet + and the Ethernet type (picowiz) + @rtype tuple of (bool, str) + @exception OSError raised to indicate an issue with the device + """ + command = """ +def has_eth(): + try: + import network + if hasattr(network, 'WIZNET5K'): + return True, 'picowiz' + except ImportError: + pass + + return False, '' + +print(has_eth()) +del has_eth +""" + + out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) + if err: + raise OSError(self._shortError(err)) + + return ast.literal_eval(out.decode("utf-8")) + + def getEthernetStatus(self): + """ + Public method to get Ethernet status data of the connected board. + + @return list of tuples containing the translated status data label and + the associated value + @rtype list of tuples of (str, str) + @exception OSError raised to indicate an issue with the device + """ + command = """{0} +def ethernet_status(): + import network + import ubinascii + import ujson + + w5x00_init() + + res = {{ + 'active': nic.active(), + 'connected': nic.isconnected(), + 'status': nic.status(), + 'ifconfig': nic.ifconfig(), + 'mac': ubinascii.hexlify(nic.config('mac'), ':').decode(), + }} + try: + res['hostname'] = network.hostname() + except AttributeError: + res['hostname'] = '' + print(ujson.dumps(res)) + +ethernet_status() +del ethernet_status, w5x00_init +""".format( + WiznetUtilities.mpyWiznetInit() + ) + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + raise OSError(self._shortError(err)) + + status = [] + ethStatus = json.loads(out.decode("utf-8")) + status.append((self.tr("Active"), self.bool2str(ethStatus["active"]))) + status.append((self.tr("Connected"), self.bool2str(ethStatus["connected"]))) + status.append( + ( + self.tr("Status"), + self.__statusTranslations["picowiz"][ethStatus["status"]], + ) + ) + status.append( + ( + self.tr("Hostname"), + ethStatus["hostname"] if ethStatus["hostname"] else self.tr("unknown"), + ) + ) + status.append((self.tr("IPv4 Address"), ethStatus["ifconfig"][0])) + status.append((self.tr("Netmask"), ethStatus["ifconfig"][1])) + status.append((self.tr("Gateway"), ethStatus["ifconfig"][2])) + status.append((self.tr("DNS"), ethStatus["ifconfig"][3])) + status.append((self.tr("MAC-Address"), ethStatus["mac"])) + + return status + + def connectToLan(self, config, hostname): + """ + Public method to connect the connected device to the LAN. + + @param config configuration for the connection (either the string 'dhcp' + for a dynamic address or a tuple of four strings with the IPv4 parameters. + @type str or tuple of (str, str, str, str) + @param hostname host name of the device + @type str + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + command = """{0} +def connect_lan(config, hostname): + import network + import time + + if hostname: + try: + network.hostname(hostname) + except AttributeError: + pass + + w5x00_init() + + nic.active(False) + nic.active(True) + nic.ifconfig(config) + max_wait = 140 + while max_wait: + if nic.isconnected(): + break + max_wait -= 1 + time.sleep(0.1) + print(nic.isconnected()) + +connect_lan({1}, {2}) +del connect_lan, w5x00_init +""".format( + WiznetUtilities.mpyWiznetInit(), + "'dhcp'" if config == "dhcp" else config, + repr(hostname) if hostname else "''", + ) + + with EricOverrideCursor(): + out, err = self.executeCommands( + command, mode=self._submitMode, timeout=15000 + ) + if err: + return False, err + + return out.strip() == b"True", "" + + def disconnectFromLan(self): + """ + Public method to disconnect from the LAN. + + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + command = """{0} +def disconnect_lan(): + import time + + w5x00_init() + + nic.active(False) + time.sleep(0.1) + print(not nic.isconnected()) + +disconnect_lan() +del disconnect_lan, w5x00_init +""".format( + WiznetUtilities.mpyWiznetInit(), + ) + + with EricOverrideCursor(): + out, err = self.executeCommands( + command, mode=self._submitMode, timeout=15000 + ) + if err: + return False, err + + return out.strip() == b"True", "" + + def isLanConnected(self): + """ + Public method to check the LAN connection status. + + @return flag indicating that the device is connected to the LAN + @rtype bool + """ + command = """{0} +def is_connected(): + import network + + w5x00_init() + + print(nic.isconnected()) + +is_connected() +del is_connected, w5x00_init +""".format( + WiznetUtilities.mpyWiznetInit(), + ) + + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False + + return out.strip() == b"True" + + def checkInternetViaLan(self): + """ + Public method to check, if the internet can be reached (LAN variant). + + @return tuple containing a flag indicating reachability and an error string + @rtype tuple of (bool, str) + """ + command = """{0} +def check_internet(): + import network + import socket + + w5x00_init() + + if nic.isconnected(): + s = socket.socket() + try: + s.connect(socket.getaddrinfo('quad9.net', 443)[0][-1]) + s.close() + print(True) + except: + print(False) + else: + print(False) + +check_internet() +del check_internet, w5x00_init +""".format( + WiznetUtilities.mpyWiznetInit(), + ) + + out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000) + if err: + return False, err + + return out.strip() == b"True", "" + + def deactivateEthernet(self): + """ + Public method to deactivate the Ethernet interface of the connected device. + + @return tuple containg a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + # The WIZnet 5x00 interface cannot be switched off explicitly. That means, + # disconnect from the LAN is all we can do. + + return self.disconnectFromLan() + + def writeLanAutoConnect(self, config, hostname): + """ + Public method to generate a script and associated configuration to connect the + device to the LAN during boot time. + + @param config configuration for the connection (either the string 'dhcp' + for a dynamic address or a tuple of four strings with the IPv4 parameters. + @type str or tuple of (str, str, str, str) + @param hostname host name of the device + @type str + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + command = """ +def modify_boot(): + add = True + try: + with open('/boot.py', 'r') as f: + for ln in f.readlines(): + if 'wiznet_connect' in ln: + add = False + break + except: + pass + if add: + with open('/boot.py', 'a') as f: + f.write('\\n') + f.write('import wiznet_connect\\n') + f.write('nic = wiznet_connect.connect_lan()\\n') + print(True) + +modify_boot() +del modify_boot +""" + devconfig = "ifconfig = {0}\nhostname = {1}".format( + "'dhcp'" if config == "dhcp" else config, + repr(hostname) if hostname else "''", + ) + try: + # write secrets file + self.putData("/wiznet_config.py", devconfig.encode("utf-8")) + # copy auto-connect file + self.put( + os.path.join( + os.path.dirname(__file__), "MCUScripts", "picoWiznetConnect.py" + ), + "/wiznet_connect.py", + ) + except OSError as err: + return False, str(err) + + # modify boot.py + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + return False, err + + return out.decode("utf-8").strip() == "True", "" + + def removeLanAutoConnect(self): + """ + Public method to remove the saved IPv4 parameters from the connected device. + + Note: This disables the LAN auto-connect feature. + + @return tuple containing a flag indicating success and an error message + @rtype tuple of (bool, str) + """ + try: + self.rm("/wiznet_config.py") + except OSError as err: + return False, str(err) + + return True, "" + + ################################################################## + ## Methods below implement NTP related methods + ################################################################## + + def hasNetworkTime(self): + """ + Public method to check the availability of network time functions. + + @return flag indicating the availability of network time functions + @rtype bool + @exception OSError raised to indicate an issue with the device + """ + command = """ +def has_ntp(): + try: + import ntptime + return True + except ImportError: + return False + +print(has_ntp()) +del has_ntp +""" + out, err = self.executeCommands(command, mode=self._submitMode) + if err: + raise OSError(self._shortError(err)) + return out.strip() == b"True" + + def setNetworkTime(self, server="pool.ntp.org", tzOffset=0, timeout=10): + """ + Public method to set the time to the network time retrieved from an + NTP server. + + @param server name of the NTP server to get the network time from + (defaults to "0.pool.ntp.org") + @type str (optional) + @param tzOffset offset with respect to UTC (defaults to 0) + @type int (optional) + @param timeout maximum time to wait for a server response in seconds + (defaults to 10) + @type int + @return tuple containing a flag indicating success and an error string + @rtype tuple of (bool, str) + """ + command = """ +def set_ntp_time(server, tz_offset, timeout): + import network + import ntptime + import machine + + if hasattr(network, 'WLAN') and not network.WLAN(network.STA_IF).isconnected(): + return False + elif hasattr(network, 'WIZNET5K'): + try: + if not nic.isconnected(): + return False + except NameError: + return False + + ntptime.host = server + ntptime.timeout = timeout + ntptime.settime() + + rtc = machine.RTC() + t = list(rtc.datetime()) + t[4] += tz_offset + rtc.datetime(t) + + return True + +try: + print({{ + 'result': set_ntp_time({0}, {1}, {2}), + 'error': '', + }}) +except Exception as err: + print({{ + 'result': False, + 'error': str(err), + }}) +del set_ntp_time +""".format( + repr(server), tzOffset, timeout + ) + out, err = self.executeCommands( + command, mode=self._submitMode, timeout=(timeout + 2) * 1000 + ) + if err: + return False, err + else: + res = ast.literal_eval(out.decode("utf-8")) + return res["result"], res["error"] + + +def createDevice(microPythonWidget, deviceType, _vid, _pid, _boardName, _serialNumber): + """ + Function to instantiate a MicroPython device object. + + @param microPythonWidget reference to the main MicroPython widget + @type MicroPythonWidget + @param deviceType device type assigned to this device interface + @type str + @param _vid vendor ID (unused) + @type int + @param _pid product ID (unused) + @type int + @param _boardName name of the board (unused) + @type str + @param _serialNumber serial number of the board (unused) + @type str + @return reference to the instantiated device object + @rtype RP2Device + """ + return RP2Device(microPythonWidget, deviceType)
--- a/src/eric7/MicroPython/Devices/__init__.py Sat Aug 31 15:49:16 2024 +0200 +++ b/src/eric7/MicroPython/Devices/__init__.py Sat Aug 31 15:54:24 2024 +0200 @@ -367,27 +367,30 @@ "port_description": "Pyboard", "module": ".PyBoardDevices", }, - "rp2040": { + "rp2": { "ids": [ (0x1209, 0xF502), # Silicognition RP2040-Shim (0x16D0, 0x08C7), # Pimoroni Tiny 2040 (8MB) (0x1B4F, 0x0025), # SparkFun Thing Plus RP2040 (0x1B4F, 0x0026), # SparkFun Pro Micro RP2040 + (0x1B4F, 0x0039), # SparkFun Pro Micro RP2350 (0x1FFB, 0x2043), # Pololu 3pi+ 2040 Robot (0x1FFB, 0x2044), # Pololu Zumo 2040 Robot (0x2341, 0x025E), # Arduino Nano RP2040 Connect (0x239A, 0x80F2), # Adafruit Feather RP2040 (0x239A, 0x80F8), # Adafruit QT Py RP2040 (0x239A, 0x80FE), # Adafruit ItsyBitsy RP2040 - (0x2E8A, 0x0005), # Raspberry Pi Pico - (0x2E8A, 0x000C), # Raspberry Pi Pico + (0x2E8A, 0x0005), # Raspberry Pi Pico, Raspberry Pi Pico 2 + (0x2E8A, 0x000C), # Raspberry Pi Pico, Raspberry Pi Pico 2 (0x2E8A, 0x1002), # Pimoroni Pico LiPo (4MB) (0x2E8A, 0x1003), # Pimoroni Pico LiPo (16MB) ], - "description": QCoreApplication.translate("MicroPythonDevice", "RP2040 based"), - "icon": "rp2040Device", + "description": QCoreApplication.translate( + "MicroPythonDevice", "RP2040/RP2350 based" + ), + "icon": "rp2Device", "port_description": "", - "module": ".RP2040Devices", + "module": ".RP2Devices", }, "stlink": { "ids": [
--- a/src/eric7/MicroPython/UF2FlashDialog.py Sat Aug 31 15:49:16 2024 +0200 +++ b/src/eric7/MicroPython/UF2FlashDialog.py Sat Aug 31 15:54:24 2024 +0200 @@ -717,15 +717,16 @@ "show_all": True, "firmware": "CircuitPython", }, - "rp2040": { + "rp2": { "volumes": { (0x0000, 0x0000): [ ("RPI-RP2", "Raspberry Pi Pico"), # we don't have valid VID/PID + ("RP2350", "Raspberry Pi Pico 2"), # we don't have valid VID/PID ], }, "instructions": QCoreApplication.translate( "UF2FlashDialog", - "<h3>Pi Pico (RP2040) Board</h3>" + "<h3>Pi Pico (RP2040/RP2350) Board</h3>" "<p>In order to prepare the board for flashing follow these" " steps:</p><ol>" "<li>Enter 'bootloader' mode (board <b>without</b> RESET button):"
--- a/src/eric7/icons/breeze-dark/rp2040Device.svg Sat Aug 31 15:49:16 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - viewBox="0 0 48 48" - version="1.1" - id="svg5" - sodipodi:docname="rp2040Device.svg" - width="48" - height="48" - inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"> - <defs - id="defs9" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1842" - inkscape:window-height="1052" - id="namedview7" - showgrid="false" - inkscape:zoom="16.925218" - inkscape:cx="23.8705" - inkscape:cy="23.090012" - inkscape:window-x="0" - inkscape:window-y="0" - inkscape:window-maximized="0" - inkscape:current-layer="svg5" /> - <path - d="M 38.853544,21.878491 38.50065,21.347755 c 0,-4.24235 -1.945353,-5.838097 -4.07868,-7.076481 0.712883,-0.180451 1.418672,-0.353824 1.599552,-1.238385 1.239564,-0.350285 1.418671,-0.88456 1.592458,-1.415296 0.354668,-0.18045 1.241337,-0.70411 1.241337,-1.7691202 0.532002,-0.353824 0.886671,-0.88456 0.712883,-1.58867 0.532002,-0.7129557 0.705789,-1.2454609 0.532002,-1.7691206 0.707562,-0.8845601 0.354667,-1.4170654 0.173787,-1.9495706 0.533775,-1.0650104 0,-2.1229444 -1.418672,-1.9495706 C 38.328636,1.7069808 36.908191,1.8874311 36.727311,1.8874311 36.555297,1.533607 36.195309,1.356695 35.30864,1.533607 34.42197,1.0028709 33.714408,1.0028709 33.00862,1.356695 32.12195,0.64904688 31.588175,1.1833212 31.0544,1.356695 29.986849,1.0028709 29.813063,1.533607 29.281061,1.7069808 28.213511,1.5353762 27.86239,2.0678814 27.326842,2.591541 H 26.801933 C 25.200609,3.4761012 24.313938,5.6061221 23.961045,6.4906822 23.606376,5.4256718 22.893494,3.4761012 21.120156,2.591541 H 20.595247 C 20.061472,2.0678814 19.708578,1.5353762 18.641027,1.7069808 18.109026,1.5353762 17.935239,1.0028709 16.867689,1.3549259 16.513021,1.1833212 16.1619,1.0028709 15.626352,1.0028709 c -0.177334,0 -0.351122,0.1804503 -0.712882,0.3538241 -0.705789,-0.3538241 -1.411578,-0.3538241 -1.945354,0.176912 -0.886669,-0.176912 -1.241337,0.1733738 -1.420444,0.3538241 -0.18088,0 -1.5924585,-0.1804503 -2.1280068,0.7041099 C 7.8201135,2.4199363 7.2952052,3.4761012 7.8201135,4.5411116 7.4672191,5.0718477 7.2952052,5.4256718 8.0009941,6.4906822 7.6463263,6.8427372 7.8201135,7.5468471 8.5329957,8.0793528 c -0.1773338,0.704109 0,1.238384 0.7093356,1.76912 -0.1737873,0.8845602 0.8866697,1.4152962 1.0640037,1.7691202 0.173788,0.530736 0.354668,1.065011 1.596005,1.415296 0.177334,0.884561 0.886669,1.057934 1.599552,1.238385 -2.307114,1.238384 -4.0804535,3.007504 -4.0804535,7.076481 l -0.3546678,0.530736 c -2.4862211,1.592209 -4.793335,6.545746 -1.2466572,10.614722 0.1808806,1.238385 0.533775,2.122945 0.8866695,3.187955 0.5337749,4.061901 3.90844,6.011471 4.795109,6.191921 1.239564,1.056165 2.660008,1.940725 4.60536,2.653681 C 19.880592,46.29589 21.834811,47 23.781937,47 c 1.952446,0 3.906666,-0.70411 5.680005,-2.47323 1.945352,-0.712956 3.365797,-1.597516 4.60536,-2.653681 0.886671,-0.18045 4.261334,-2.13002 4.788015,-6.191921 0.358215,-1.06501 0.71111,-1.94957 1.065778,-3.187955 3.901344,-4.070746 1.592458,-9.026052 -1.067551,-10.614722 z m -2.298247,-0.711186 c -0.18088,1.76912 -8.694681,-5.831021 -7.274236,-6.011471 4.078679,-0.70411 7.448023,1.58867 7.274236,6.011471 z M 27.153054,3.6565514 c 0,0.3538241 0.172014,0.5307362 0.172014,0.7041099 0.533775,-0.5236596 0.88667,-1.0561648 1.420444,-1.58867 0,0.353824 -0.172013,0.5307361 0.180882,0.8845601 0.352893,-0.5307361 0.705788,-0.8845601 1.418671,-1.2383842 -0.359989,0.5342744 0,0.7076481 0.173787,0.8845602 C 31.052627,2.9524416 31.405521,2.591541 32.292191,2.2412552 32.120176,2.591541 31.760189,2.7719913 32.120176,3.1258153 32.645085,2.7719913 33.006846,2.591541 34.24641,2.2412552 34.065529,2.591541 33.531754,2.7719913 33.712635,3.1258153 34.244636,2.9524416 34.953973,2.7719913 35.666854,2.591541 35.305093,2.9524416 34.952198,3.1240462 35.305093,3.3044965 36.019749,3.1240462 36.725538,2.7719913 37.612207,3.1240462 l -0.532001,0.5325052 h 2.133326 c -0.361761,0.5307362 -0.714656,0.8845602 -0.88667,1.5886701 h 0.88667 c -0.361761,1.0650105 -1.06755,1.2454607 -1.24843,1.5975157 0.18088,0.1716047 0.533774,0.1716047 1.067549,0 -0.354668,0.7041099 -0.886669,1.0561648 -1.418671,1.5886696 0.177334,0.180451 0.351122,0.180451 0.88667,0 -0.535548,0.532506 -1.060457,0.884561 -1.596005,1.417066 0.173787,0.1804502 0.535548,0.1804502 0.886669,0.1804502 -0.532001,0.52366 -1.418671,0.88456 -2.12446,1.236615 0.172015,0.352055 0.524909,0.171605 0.705789,0.171605 -0.532001,0.3609 -1.41867,0.712955 -2.128007,0.88456 0.173788,0.18045 0.354669,0.360901 0.709337,0.360901 -0.886671,0.523659 -2.128008,0.171604 -2.482675,0.523659 0,0.180451 0.354667,0.360901 0.535548,0.532506 -1.420444,0 -5.148003,0 -5.853792,-2.825286 1.418671,-1.5975152 3.899573,-3.3666359 8.33292,-5.6682615 C 32.120176,6.4906822 28.92462,7.898902 26.438399,10.028923 23.606376,8.6118578 25.551729,5.0736168 27.153054,3.6565514 Z M 23.961045,13.91745 c 2.128006,0 4.788014,1.592208 4.788014,3.187955 0,1.408219 -1.947126,2.47323 -4.788014,2.47323 -2.840889,0 -4.788015,-1.415296 -4.788015,-2.653681 0,-1.238384 2.308886,-3.007504 4.788015,-3.007504 z M 13.14013,12.855977 c 0.361762,0 0.533775,-0.173373 0.714656,-0.353824 -0.88667,-0.353824 -1.773339,-0.530736 -2.307114,-1.06501 0.354668,0 0.532002,0 0.886669,-0.171605 -0.705789,-0.353824 -1.41867,-0.712955 -2.128006,-1.238384 0.354668,0 0.709336,0 0.886669,-0.1786812 -0.532001,-0.353824 -1.064003,-0.88456 -1.5995516,-1.238384 H 10.480123 C 9.9552135,7.898902 9.4214385,7.5486162 9.068544,6.8409681 c 0.3528945,0.1733738 0.7057889,0.1733738 1.058683,0 C 9.9552135,6.4906822 9.068544,6.310232 8.7085563,5.4256718 H 9.5952257 C 9.4214385,4.7215619 9.068544,4.1872876 8.8876636,3.8370017 H 11.015671 L 10.480123,3.1240462 c 0.886669,-0.1716046 1.773338,0 2.307113,0.1804503 0.354668,-0.1804503 0,-0.5325052 -0.352895,-0.7129555 0.705789,0.1804503 1.418672,0.3609006 1.95422,0.5325052 0.352895,-0.3520549 -0.18088,-0.5307361 -0.533775,-0.8845602 1.239564,0.1804503 1.592459,0.5325053 2.126233,0.8845602 0.354668,-0.3520549 0,-0.5307361 -0.18088,-0.8845602 0.886669,0.3538241 1.24843,0.7129556 1.773339,1.0650105 0.18088,-0.1804503 0.361761,-0.3538241 0.18088,-0.8845602 0.354668,0.352055 0.886669,0.7041099 1.241338,1.2366151 0.35112,-0.1804502 0.177334,-0.5307361 0.177334,-0.8845601 0.535548,0.5307361 1.060457,1.0650104 1.422217,1.58867 0.172014,0 0.172014,-0.3520549 0.172014,-0.7041099 1.420444,1.4152963 3.546677,4.9535374 0.533775,6.3723716 -2.479127,-2.130021 -5.674684,-3.718691 -9.047575,-4.7837015 4.433347,2.3016256 6.921342,4.0707463 8.341786,5.6682615 -0.714655,2.825286 -4.433347,3.005736 -5.853791,2.825286 0.352894,-0.171605 0.532001,-0.352055 0.532001,-0.530737 -0.179107,-0.173373 -1.246657,0 -2.133327,-0.353824 z m 4.967122,2.119407 c 1.420446,0.18045 -7.093355,7.789437 -7.265369,6.020316 -0.18088,-4.251196 3.184917,-6.724426 7.265369,-6.020316 z M 9.068544,31.782027 c -2.1351,-1.76912 -2.8408888,-6.543976 1.058683,-8.845602 2.307114,-0.70411 0.88667,9.558557 -1.058683,8.845602 z m 8.152039,8.845602 c -1.239564,0.712955 -4.078679,0.3609 -6.025805,-2.473231 -1.4204451,-2.47323 -1.2413378,-4.953537 -0.180881,-5.661185 1.420444,-0.88456 3.727559,0.353824 5.320017,2.303395 1.420444,1.58867 2.128006,4.774856 0.886669,5.831021 z m -2.30534,-10.786327 c -2.128007,-1.417065 -2.480902,-4.603251 -0.88667,-7.256932 1.773339,-2.47323 4.793336,-3.53824 6.919569,-2.121175 2.126233,1.415296 2.479127,4.603251 0.886669,7.256932 -1.601324,2.65368 -4.788015,3.53824 -6.921341,2.121175 z m 9.045802,15.741633 c -2.660009,0.18045 -5.139136,-2.121175 -5.139136,-2.825285 0,-1.065011 3.184916,-1.949571 5.320016,-1.949571 2.126233,-0.18045 4.958255,0.70411 4.958255,1.76912 0,0.70411 -2.660008,3.007505 -5.139135,3.007505 z m 5.320016,-11.318832 c 0,2.65368 -2.305341,4.774856 -5.139136,4.774856 -2.840889,0 -5.320016,-2.122945 -5.320016,-4.776625 0,-2.653681 2.298247,-4.773087 5.139136,-4.773087 3.014675,0 5.320016,2.121175 5.320016,4.774856 z m -3.19201,-6.724427 c -1.773338,-2.47323 -1.241337,-5.838097 0.886669,-7.256931 2.12446,-1.40822 5.320017,-0.52366 6.919569,2.130021 1.592458,2.65368 1.239564,5.83102 -0.886669,7.248086 -2.1351,1.238384 -5.320017,0.353824 -6.921342,-2.121176 z m 10.640033,10.614722 c -2.308887,3.184417 -5.320016,3.184417 -6.380473,2.299857 -1.248431,-1.061472 -0.361762,-4.599713 1.411578,-6.542207 1.773338,-2.130021 3.908439,-3.538241 5.148002,-2.482076 0.88667,1.238384 1.418671,4.603251 -0.18088,6.724426 z m 1.599552,-6.545745 c -1.954219,0.88456 -3.546678,-9.376338 -1.06755,-8.845602 3.901346,2.122945 3.19201,7.076482 1.06755,8.845602 z" - id="surface1" - style="stroke-width:1.77123;fill:#eff0f1;fill-opacity:1" /> - <metadata - id="metadata3"> - <rdf:RDF> - <rdf:Description - about="https://iconscout.com/legal#licenses" - dc:title="raspberry,pi" - dc:description="raspberry,pi" - dc:publisher="Iconscout" - dc:date="2017-12-30" - dc:format="image/svg+xml" - dc:language="en"> - <dc:creator> - <rdf:Bag> - <rdf:li>Icons8</rdf:li> - </rdf:Bag> - </dc:creator> - </rdf:Description> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> -</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/icons/breeze-dark/rp2Device.svg Sat Aug 31 15:54:24 2024 +0200 @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 48 48" + version="1.1" + id="svg5" + sodipodi:docname="rp2040Device.svg" + width="48" + height="48" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"> + <defs + id="defs9" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1842" + inkscape:window-height="1052" + id="namedview7" + showgrid="false" + inkscape:zoom="16.925218" + inkscape:cx="23.8705" + inkscape:cy="23.090012" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg5" /> + <path + d="M 38.853544,21.878491 38.50065,21.347755 c 0,-4.24235 -1.945353,-5.838097 -4.07868,-7.076481 0.712883,-0.180451 1.418672,-0.353824 1.599552,-1.238385 1.239564,-0.350285 1.418671,-0.88456 1.592458,-1.415296 0.354668,-0.18045 1.241337,-0.70411 1.241337,-1.7691202 0.532002,-0.353824 0.886671,-0.88456 0.712883,-1.58867 0.532002,-0.7129557 0.705789,-1.2454609 0.532002,-1.7691206 0.707562,-0.8845601 0.354667,-1.4170654 0.173787,-1.9495706 0.533775,-1.0650104 0,-2.1229444 -1.418672,-1.9495706 C 38.328636,1.7069808 36.908191,1.8874311 36.727311,1.8874311 36.555297,1.533607 36.195309,1.356695 35.30864,1.533607 34.42197,1.0028709 33.714408,1.0028709 33.00862,1.356695 32.12195,0.64904688 31.588175,1.1833212 31.0544,1.356695 29.986849,1.0028709 29.813063,1.533607 29.281061,1.7069808 28.213511,1.5353762 27.86239,2.0678814 27.326842,2.591541 H 26.801933 C 25.200609,3.4761012 24.313938,5.6061221 23.961045,6.4906822 23.606376,5.4256718 22.893494,3.4761012 21.120156,2.591541 H 20.595247 C 20.061472,2.0678814 19.708578,1.5353762 18.641027,1.7069808 18.109026,1.5353762 17.935239,1.0028709 16.867689,1.3549259 16.513021,1.1833212 16.1619,1.0028709 15.626352,1.0028709 c -0.177334,0 -0.351122,0.1804503 -0.712882,0.3538241 -0.705789,-0.3538241 -1.411578,-0.3538241 -1.945354,0.176912 -0.886669,-0.176912 -1.241337,0.1733738 -1.420444,0.3538241 -0.18088,0 -1.5924585,-0.1804503 -2.1280068,0.7041099 C 7.8201135,2.4199363 7.2952052,3.4761012 7.8201135,4.5411116 7.4672191,5.0718477 7.2952052,5.4256718 8.0009941,6.4906822 7.6463263,6.8427372 7.8201135,7.5468471 8.5329957,8.0793528 c -0.1773338,0.704109 0,1.238384 0.7093356,1.76912 -0.1737873,0.8845602 0.8866697,1.4152962 1.0640037,1.7691202 0.173788,0.530736 0.354668,1.065011 1.596005,1.415296 0.177334,0.884561 0.886669,1.057934 1.599552,1.238385 -2.307114,1.238384 -4.0804535,3.007504 -4.0804535,7.076481 l -0.3546678,0.530736 c -2.4862211,1.592209 -4.793335,6.545746 -1.2466572,10.614722 0.1808806,1.238385 0.533775,2.122945 0.8866695,3.187955 0.5337749,4.061901 3.90844,6.011471 4.795109,6.191921 1.239564,1.056165 2.660008,1.940725 4.60536,2.653681 C 19.880592,46.29589 21.834811,47 23.781937,47 c 1.952446,0 3.906666,-0.70411 5.680005,-2.47323 1.945352,-0.712956 3.365797,-1.597516 4.60536,-2.653681 0.886671,-0.18045 4.261334,-2.13002 4.788015,-6.191921 0.358215,-1.06501 0.71111,-1.94957 1.065778,-3.187955 3.901344,-4.070746 1.592458,-9.026052 -1.067551,-10.614722 z m -2.298247,-0.711186 c -0.18088,1.76912 -8.694681,-5.831021 -7.274236,-6.011471 4.078679,-0.70411 7.448023,1.58867 7.274236,6.011471 z M 27.153054,3.6565514 c 0,0.3538241 0.172014,0.5307362 0.172014,0.7041099 0.533775,-0.5236596 0.88667,-1.0561648 1.420444,-1.58867 0,0.353824 -0.172013,0.5307361 0.180882,0.8845601 0.352893,-0.5307361 0.705788,-0.8845601 1.418671,-1.2383842 -0.359989,0.5342744 0,0.7076481 0.173787,0.8845602 C 31.052627,2.9524416 31.405521,2.591541 32.292191,2.2412552 32.120176,2.591541 31.760189,2.7719913 32.120176,3.1258153 32.645085,2.7719913 33.006846,2.591541 34.24641,2.2412552 34.065529,2.591541 33.531754,2.7719913 33.712635,3.1258153 34.244636,2.9524416 34.953973,2.7719913 35.666854,2.591541 35.305093,2.9524416 34.952198,3.1240462 35.305093,3.3044965 36.019749,3.1240462 36.725538,2.7719913 37.612207,3.1240462 l -0.532001,0.5325052 h 2.133326 c -0.361761,0.5307362 -0.714656,0.8845602 -0.88667,1.5886701 h 0.88667 c -0.361761,1.0650105 -1.06755,1.2454607 -1.24843,1.5975157 0.18088,0.1716047 0.533774,0.1716047 1.067549,0 -0.354668,0.7041099 -0.886669,1.0561648 -1.418671,1.5886696 0.177334,0.180451 0.351122,0.180451 0.88667,0 -0.535548,0.532506 -1.060457,0.884561 -1.596005,1.417066 0.173787,0.1804502 0.535548,0.1804502 0.886669,0.1804502 -0.532001,0.52366 -1.418671,0.88456 -2.12446,1.236615 0.172015,0.352055 0.524909,0.171605 0.705789,0.171605 -0.532001,0.3609 -1.41867,0.712955 -2.128007,0.88456 0.173788,0.18045 0.354669,0.360901 0.709337,0.360901 -0.886671,0.523659 -2.128008,0.171604 -2.482675,0.523659 0,0.180451 0.354667,0.360901 0.535548,0.532506 -1.420444,0 -5.148003,0 -5.853792,-2.825286 1.418671,-1.5975152 3.899573,-3.3666359 8.33292,-5.6682615 C 32.120176,6.4906822 28.92462,7.898902 26.438399,10.028923 23.606376,8.6118578 25.551729,5.0736168 27.153054,3.6565514 Z M 23.961045,13.91745 c 2.128006,0 4.788014,1.592208 4.788014,3.187955 0,1.408219 -1.947126,2.47323 -4.788014,2.47323 -2.840889,0 -4.788015,-1.415296 -4.788015,-2.653681 0,-1.238384 2.308886,-3.007504 4.788015,-3.007504 z M 13.14013,12.855977 c 0.361762,0 0.533775,-0.173373 0.714656,-0.353824 -0.88667,-0.353824 -1.773339,-0.530736 -2.307114,-1.06501 0.354668,0 0.532002,0 0.886669,-0.171605 -0.705789,-0.353824 -1.41867,-0.712955 -2.128006,-1.238384 0.354668,0 0.709336,0 0.886669,-0.1786812 -0.532001,-0.353824 -1.064003,-0.88456 -1.5995516,-1.238384 H 10.480123 C 9.9552135,7.898902 9.4214385,7.5486162 9.068544,6.8409681 c 0.3528945,0.1733738 0.7057889,0.1733738 1.058683,0 C 9.9552135,6.4906822 9.068544,6.310232 8.7085563,5.4256718 H 9.5952257 C 9.4214385,4.7215619 9.068544,4.1872876 8.8876636,3.8370017 H 11.015671 L 10.480123,3.1240462 c 0.886669,-0.1716046 1.773338,0 2.307113,0.1804503 0.354668,-0.1804503 0,-0.5325052 -0.352895,-0.7129555 0.705789,0.1804503 1.418672,0.3609006 1.95422,0.5325052 0.352895,-0.3520549 -0.18088,-0.5307361 -0.533775,-0.8845602 1.239564,0.1804503 1.592459,0.5325053 2.126233,0.8845602 0.354668,-0.3520549 0,-0.5307361 -0.18088,-0.8845602 0.886669,0.3538241 1.24843,0.7129556 1.773339,1.0650105 0.18088,-0.1804503 0.361761,-0.3538241 0.18088,-0.8845602 0.354668,0.352055 0.886669,0.7041099 1.241338,1.2366151 0.35112,-0.1804502 0.177334,-0.5307361 0.177334,-0.8845601 0.535548,0.5307361 1.060457,1.0650104 1.422217,1.58867 0.172014,0 0.172014,-0.3520549 0.172014,-0.7041099 1.420444,1.4152963 3.546677,4.9535374 0.533775,6.3723716 -2.479127,-2.130021 -5.674684,-3.718691 -9.047575,-4.7837015 4.433347,2.3016256 6.921342,4.0707463 8.341786,5.6682615 -0.714655,2.825286 -4.433347,3.005736 -5.853791,2.825286 0.352894,-0.171605 0.532001,-0.352055 0.532001,-0.530737 -0.179107,-0.173373 -1.246657,0 -2.133327,-0.353824 z m 4.967122,2.119407 c 1.420446,0.18045 -7.093355,7.789437 -7.265369,6.020316 -0.18088,-4.251196 3.184917,-6.724426 7.265369,-6.020316 z M 9.068544,31.782027 c -2.1351,-1.76912 -2.8408888,-6.543976 1.058683,-8.845602 2.307114,-0.70411 0.88667,9.558557 -1.058683,8.845602 z m 8.152039,8.845602 c -1.239564,0.712955 -4.078679,0.3609 -6.025805,-2.473231 -1.4204451,-2.47323 -1.2413378,-4.953537 -0.180881,-5.661185 1.420444,-0.88456 3.727559,0.353824 5.320017,2.303395 1.420444,1.58867 2.128006,4.774856 0.886669,5.831021 z m -2.30534,-10.786327 c -2.128007,-1.417065 -2.480902,-4.603251 -0.88667,-7.256932 1.773339,-2.47323 4.793336,-3.53824 6.919569,-2.121175 2.126233,1.415296 2.479127,4.603251 0.886669,7.256932 -1.601324,2.65368 -4.788015,3.53824 -6.921341,2.121175 z m 9.045802,15.741633 c -2.660009,0.18045 -5.139136,-2.121175 -5.139136,-2.825285 0,-1.065011 3.184916,-1.949571 5.320016,-1.949571 2.126233,-0.18045 4.958255,0.70411 4.958255,1.76912 0,0.70411 -2.660008,3.007505 -5.139135,3.007505 z m 5.320016,-11.318832 c 0,2.65368 -2.305341,4.774856 -5.139136,4.774856 -2.840889,0 -5.320016,-2.122945 -5.320016,-4.776625 0,-2.653681 2.298247,-4.773087 5.139136,-4.773087 3.014675,0 5.320016,2.121175 5.320016,4.774856 z m -3.19201,-6.724427 c -1.773338,-2.47323 -1.241337,-5.838097 0.886669,-7.256931 2.12446,-1.40822 5.320017,-0.52366 6.919569,2.130021 1.592458,2.65368 1.239564,5.83102 -0.886669,7.248086 -2.1351,1.238384 -5.320017,0.353824 -6.921342,-2.121176 z m 10.640033,10.614722 c -2.308887,3.184417 -5.320016,3.184417 -6.380473,2.299857 -1.248431,-1.061472 -0.361762,-4.599713 1.411578,-6.542207 1.773338,-2.130021 3.908439,-3.538241 5.148002,-2.482076 0.88667,1.238384 1.418671,4.603251 -0.18088,6.724426 z m 1.599552,-6.545745 c -1.954219,0.88456 -3.546678,-9.376338 -1.06755,-8.845602 3.901346,2.122945 3.19201,7.076482 1.06755,8.845602 z" + id="surface1" + style="stroke-width:1.77123;fill:#eff0f1;fill-opacity:1" /> + <metadata + id="metadata3"> + <rdf:RDF> + <rdf:Description + about="https://iconscout.com/legal#licenses" + dc:title="raspberry,pi" + dc:description="raspberry,pi" + dc:publisher="Iconscout" + dc:date="2017-12-30" + dc:format="image/svg+xml" + dc:language="en"> + <dc:creator> + <rdf:Bag> + <rdf:li>Icons8</rdf:li> + </rdf:Bag> + </dc:creator> + </rdf:Description> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> +</svg>
--- a/src/eric7/icons/breeze-light/rp2040Device.svg Sat Aug 31 15:49:16 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - viewBox="0 0 48 48" - version="1.1" - id="svg5" - sodipodi:docname="rp2040Device.svg" - width="48" - height="48" - inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"> - <defs - id="defs9" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1842" - inkscape:window-height="1052" - id="namedview7" - showgrid="false" - inkscape:zoom="16.925218" - inkscape:cx="23.8705" - inkscape:cy="23.090012" - inkscape:window-x="0" - inkscape:window-y="0" - inkscape:window-maximized="0" - inkscape:current-layer="svg5" /> - <path - d="M 38.853544,21.878491 38.50065,21.347755 c 0,-4.24235 -1.945353,-5.838097 -4.07868,-7.076481 0.712883,-0.180451 1.418672,-0.353824 1.599552,-1.238385 1.239564,-0.350285 1.418671,-0.88456 1.592458,-1.415296 0.354668,-0.18045 1.241337,-0.70411 1.241337,-1.7691202 0.532002,-0.353824 0.886671,-0.88456 0.712883,-1.58867 0.532002,-0.7129557 0.705789,-1.2454609 0.532002,-1.7691206 0.707562,-0.8845601 0.354667,-1.4170654 0.173787,-1.9495706 0.533775,-1.0650104 0,-2.1229444 -1.418672,-1.9495706 C 38.328636,1.7069808 36.908191,1.8874311 36.727311,1.8874311 36.555297,1.533607 36.195309,1.356695 35.30864,1.533607 34.42197,1.0028709 33.714408,1.0028709 33.00862,1.356695 32.12195,0.64904688 31.588175,1.1833212 31.0544,1.356695 29.986849,1.0028709 29.813063,1.533607 29.281061,1.7069808 28.213511,1.5353762 27.86239,2.0678814 27.326842,2.591541 H 26.801933 C 25.200609,3.4761012 24.313938,5.6061221 23.961045,6.4906822 23.606376,5.4256718 22.893494,3.4761012 21.120156,2.591541 H 20.595247 C 20.061472,2.0678814 19.708578,1.5353762 18.641027,1.7069808 18.109026,1.5353762 17.935239,1.0028709 16.867689,1.3549259 16.513021,1.1833212 16.1619,1.0028709 15.626352,1.0028709 c -0.177334,0 -0.351122,0.1804503 -0.712882,0.3538241 -0.705789,-0.3538241 -1.411578,-0.3538241 -1.945354,0.176912 -0.886669,-0.176912 -1.241337,0.1733738 -1.420444,0.3538241 -0.18088,0 -1.5924585,-0.1804503 -2.1280068,0.7041099 C 7.8201135,2.4199363 7.2952052,3.4761012 7.8201135,4.5411116 7.4672191,5.0718477 7.2952052,5.4256718 8.0009941,6.4906822 7.6463263,6.8427372 7.8201135,7.5468471 8.5329957,8.0793528 c -0.1773338,0.704109 0,1.238384 0.7093356,1.76912 -0.1737873,0.8845602 0.8866697,1.4152962 1.0640037,1.7691202 0.173788,0.530736 0.354668,1.065011 1.596005,1.415296 0.177334,0.884561 0.886669,1.057934 1.599552,1.238385 -2.307114,1.238384 -4.0804535,3.007504 -4.0804535,7.076481 l -0.3546678,0.530736 c -2.4862211,1.592209 -4.793335,6.545746 -1.2466572,10.614722 0.1808806,1.238385 0.533775,2.122945 0.8866695,3.187955 0.5337749,4.061901 3.90844,6.011471 4.795109,6.191921 1.239564,1.056165 2.660008,1.940725 4.60536,2.653681 C 19.880592,46.29589 21.834811,47 23.781937,47 c 1.952446,0 3.906666,-0.70411 5.680005,-2.47323 1.945352,-0.712956 3.365797,-1.597516 4.60536,-2.653681 0.886671,-0.18045 4.261334,-2.13002 4.788015,-6.191921 0.358215,-1.06501 0.71111,-1.94957 1.065778,-3.187955 3.901344,-4.070746 1.592458,-9.026052 -1.067551,-10.614722 z m -2.298247,-0.711186 c -0.18088,1.76912 -8.694681,-5.831021 -7.274236,-6.011471 4.078679,-0.70411 7.448023,1.58867 7.274236,6.011471 z M 27.153054,3.6565514 c 0,0.3538241 0.172014,0.5307362 0.172014,0.7041099 0.533775,-0.5236596 0.88667,-1.0561648 1.420444,-1.58867 0,0.353824 -0.172013,0.5307361 0.180882,0.8845601 0.352893,-0.5307361 0.705788,-0.8845601 1.418671,-1.2383842 -0.359989,0.5342744 0,0.7076481 0.173787,0.8845602 C 31.052627,2.9524416 31.405521,2.591541 32.292191,2.2412552 32.120176,2.591541 31.760189,2.7719913 32.120176,3.1258153 32.645085,2.7719913 33.006846,2.591541 34.24641,2.2412552 34.065529,2.591541 33.531754,2.7719913 33.712635,3.1258153 34.244636,2.9524416 34.953973,2.7719913 35.666854,2.591541 35.305093,2.9524416 34.952198,3.1240462 35.305093,3.3044965 36.019749,3.1240462 36.725538,2.7719913 37.612207,3.1240462 l -0.532001,0.5325052 h 2.133326 c -0.361761,0.5307362 -0.714656,0.8845602 -0.88667,1.5886701 h 0.88667 c -0.361761,1.0650105 -1.06755,1.2454607 -1.24843,1.5975157 0.18088,0.1716047 0.533774,0.1716047 1.067549,0 -0.354668,0.7041099 -0.886669,1.0561648 -1.418671,1.5886696 0.177334,0.180451 0.351122,0.180451 0.88667,0 -0.535548,0.532506 -1.060457,0.884561 -1.596005,1.417066 0.173787,0.1804502 0.535548,0.1804502 0.886669,0.1804502 -0.532001,0.52366 -1.418671,0.88456 -2.12446,1.236615 0.172015,0.352055 0.524909,0.171605 0.705789,0.171605 -0.532001,0.3609 -1.41867,0.712955 -2.128007,0.88456 0.173788,0.18045 0.354669,0.360901 0.709337,0.360901 -0.886671,0.523659 -2.128008,0.171604 -2.482675,0.523659 0,0.180451 0.354667,0.360901 0.535548,0.532506 -1.420444,0 -5.148003,0 -5.853792,-2.825286 1.418671,-1.5975152 3.899573,-3.3666359 8.33292,-5.6682615 C 32.120176,6.4906822 28.92462,7.898902 26.438399,10.028923 23.606376,8.6118578 25.551729,5.0736168 27.153054,3.6565514 Z M 23.961045,13.91745 c 2.128006,0 4.788014,1.592208 4.788014,3.187955 0,1.408219 -1.947126,2.47323 -4.788014,2.47323 -2.840889,0 -4.788015,-1.415296 -4.788015,-2.653681 0,-1.238384 2.308886,-3.007504 4.788015,-3.007504 z M 13.14013,12.855977 c 0.361762,0 0.533775,-0.173373 0.714656,-0.353824 -0.88667,-0.353824 -1.773339,-0.530736 -2.307114,-1.06501 0.354668,0 0.532002,0 0.886669,-0.171605 -0.705789,-0.353824 -1.41867,-0.712955 -2.128006,-1.238384 0.354668,0 0.709336,0 0.886669,-0.1786812 -0.532001,-0.353824 -1.064003,-0.88456 -1.5995516,-1.238384 H 10.480123 C 9.9552135,7.898902 9.4214385,7.5486162 9.068544,6.8409681 c 0.3528945,0.1733738 0.7057889,0.1733738 1.058683,0 C 9.9552135,6.4906822 9.068544,6.310232 8.7085563,5.4256718 H 9.5952257 C 9.4214385,4.7215619 9.068544,4.1872876 8.8876636,3.8370017 H 11.015671 L 10.480123,3.1240462 c 0.886669,-0.1716046 1.773338,0 2.307113,0.1804503 0.354668,-0.1804503 0,-0.5325052 -0.352895,-0.7129555 0.705789,0.1804503 1.418672,0.3609006 1.95422,0.5325052 0.352895,-0.3520549 -0.18088,-0.5307361 -0.533775,-0.8845602 1.239564,0.1804503 1.592459,0.5325053 2.126233,0.8845602 0.354668,-0.3520549 0,-0.5307361 -0.18088,-0.8845602 0.886669,0.3538241 1.24843,0.7129556 1.773339,1.0650105 0.18088,-0.1804503 0.361761,-0.3538241 0.18088,-0.8845602 0.354668,0.352055 0.886669,0.7041099 1.241338,1.2366151 0.35112,-0.1804502 0.177334,-0.5307361 0.177334,-0.8845601 0.535548,0.5307361 1.060457,1.0650104 1.422217,1.58867 0.172014,0 0.172014,-0.3520549 0.172014,-0.7041099 1.420444,1.4152963 3.546677,4.9535374 0.533775,6.3723716 -2.479127,-2.130021 -5.674684,-3.718691 -9.047575,-4.7837015 4.433347,2.3016256 6.921342,4.0707463 8.341786,5.6682615 -0.714655,2.825286 -4.433347,3.005736 -5.853791,2.825286 0.352894,-0.171605 0.532001,-0.352055 0.532001,-0.530737 -0.179107,-0.173373 -1.246657,0 -2.133327,-0.353824 z m 4.967122,2.119407 c 1.420446,0.18045 -7.093355,7.789437 -7.265369,6.020316 -0.18088,-4.251196 3.184917,-6.724426 7.265369,-6.020316 z M 9.068544,31.782027 c -2.1351,-1.76912 -2.8408888,-6.543976 1.058683,-8.845602 2.307114,-0.70411 0.88667,9.558557 -1.058683,8.845602 z m 8.152039,8.845602 c -1.239564,0.712955 -4.078679,0.3609 -6.025805,-2.473231 -1.4204451,-2.47323 -1.2413378,-4.953537 -0.180881,-5.661185 1.420444,-0.88456 3.727559,0.353824 5.320017,2.303395 1.420444,1.58867 2.128006,4.774856 0.886669,5.831021 z m -2.30534,-10.786327 c -2.128007,-1.417065 -2.480902,-4.603251 -0.88667,-7.256932 1.773339,-2.47323 4.793336,-3.53824 6.919569,-2.121175 2.126233,1.415296 2.479127,4.603251 0.886669,7.256932 -1.601324,2.65368 -4.788015,3.53824 -6.921341,2.121175 z m 9.045802,15.741633 c -2.660009,0.18045 -5.139136,-2.121175 -5.139136,-2.825285 0,-1.065011 3.184916,-1.949571 5.320016,-1.949571 2.126233,-0.18045 4.958255,0.70411 4.958255,1.76912 0,0.70411 -2.660008,3.007505 -5.139135,3.007505 z m 5.320016,-11.318832 c 0,2.65368 -2.305341,4.774856 -5.139136,4.774856 -2.840889,0 -5.320016,-2.122945 -5.320016,-4.776625 0,-2.653681 2.298247,-4.773087 5.139136,-4.773087 3.014675,0 5.320016,2.121175 5.320016,4.774856 z m -3.19201,-6.724427 c -1.773338,-2.47323 -1.241337,-5.838097 0.886669,-7.256931 2.12446,-1.40822 5.320017,-0.52366 6.919569,2.130021 1.592458,2.65368 1.239564,5.83102 -0.886669,7.248086 -2.1351,1.238384 -5.320017,0.353824 -6.921342,-2.121176 z m 10.640033,10.614722 c -2.308887,3.184417 -5.320016,3.184417 -6.380473,2.299857 -1.248431,-1.061472 -0.361762,-4.599713 1.411578,-6.542207 1.773338,-2.130021 3.908439,-3.538241 5.148002,-2.482076 0.88667,1.238384 1.418671,4.603251 -0.18088,6.724426 z m 1.599552,-6.545745 c -1.954219,0.88456 -3.546678,-9.376338 -1.06755,-8.845602 3.901346,2.122945 3.19201,7.076482 1.06755,8.845602 z" - id="surface1" - style="stroke-width:1.77123;fill:#232629;fill-opacity:1" /> - <metadata - id="metadata3"> - <rdf:RDF> - <rdf:Description - about="https://iconscout.com/legal#licenses" - dc:title="raspberry,pi" - dc:description="raspberry,pi" - dc:publisher="Iconscout" - dc:date="2017-12-30" - dc:format="image/svg+xml" - dc:language="en"> - <dc:creator> - <rdf:Bag> - <rdf:li>Icons8</rdf:li> - </rdf:Bag> - </dc:creator> - </rdf:Description> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> -</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/eric7/icons/breeze-light/rp2Device.svg Sat Aug 31 15:54:24 2024 +0200 @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 48 48" + version="1.1" + id="svg5" + sodipodi:docname="rp2040Device.svg" + width="48" + height="48" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"> + <defs + id="defs9" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1842" + inkscape:window-height="1052" + id="namedview7" + showgrid="false" + inkscape:zoom="16.925218" + inkscape:cx="23.8705" + inkscape:cy="23.090012" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg5" /> + <path + d="M 38.853544,21.878491 38.50065,21.347755 c 0,-4.24235 -1.945353,-5.838097 -4.07868,-7.076481 0.712883,-0.180451 1.418672,-0.353824 1.599552,-1.238385 1.239564,-0.350285 1.418671,-0.88456 1.592458,-1.415296 0.354668,-0.18045 1.241337,-0.70411 1.241337,-1.7691202 0.532002,-0.353824 0.886671,-0.88456 0.712883,-1.58867 0.532002,-0.7129557 0.705789,-1.2454609 0.532002,-1.7691206 0.707562,-0.8845601 0.354667,-1.4170654 0.173787,-1.9495706 0.533775,-1.0650104 0,-2.1229444 -1.418672,-1.9495706 C 38.328636,1.7069808 36.908191,1.8874311 36.727311,1.8874311 36.555297,1.533607 36.195309,1.356695 35.30864,1.533607 34.42197,1.0028709 33.714408,1.0028709 33.00862,1.356695 32.12195,0.64904688 31.588175,1.1833212 31.0544,1.356695 29.986849,1.0028709 29.813063,1.533607 29.281061,1.7069808 28.213511,1.5353762 27.86239,2.0678814 27.326842,2.591541 H 26.801933 C 25.200609,3.4761012 24.313938,5.6061221 23.961045,6.4906822 23.606376,5.4256718 22.893494,3.4761012 21.120156,2.591541 H 20.595247 C 20.061472,2.0678814 19.708578,1.5353762 18.641027,1.7069808 18.109026,1.5353762 17.935239,1.0028709 16.867689,1.3549259 16.513021,1.1833212 16.1619,1.0028709 15.626352,1.0028709 c -0.177334,0 -0.351122,0.1804503 -0.712882,0.3538241 -0.705789,-0.3538241 -1.411578,-0.3538241 -1.945354,0.176912 -0.886669,-0.176912 -1.241337,0.1733738 -1.420444,0.3538241 -0.18088,0 -1.5924585,-0.1804503 -2.1280068,0.7041099 C 7.8201135,2.4199363 7.2952052,3.4761012 7.8201135,4.5411116 7.4672191,5.0718477 7.2952052,5.4256718 8.0009941,6.4906822 7.6463263,6.8427372 7.8201135,7.5468471 8.5329957,8.0793528 c -0.1773338,0.704109 0,1.238384 0.7093356,1.76912 -0.1737873,0.8845602 0.8866697,1.4152962 1.0640037,1.7691202 0.173788,0.530736 0.354668,1.065011 1.596005,1.415296 0.177334,0.884561 0.886669,1.057934 1.599552,1.238385 -2.307114,1.238384 -4.0804535,3.007504 -4.0804535,7.076481 l -0.3546678,0.530736 c -2.4862211,1.592209 -4.793335,6.545746 -1.2466572,10.614722 0.1808806,1.238385 0.533775,2.122945 0.8866695,3.187955 0.5337749,4.061901 3.90844,6.011471 4.795109,6.191921 1.239564,1.056165 2.660008,1.940725 4.60536,2.653681 C 19.880592,46.29589 21.834811,47 23.781937,47 c 1.952446,0 3.906666,-0.70411 5.680005,-2.47323 1.945352,-0.712956 3.365797,-1.597516 4.60536,-2.653681 0.886671,-0.18045 4.261334,-2.13002 4.788015,-6.191921 0.358215,-1.06501 0.71111,-1.94957 1.065778,-3.187955 3.901344,-4.070746 1.592458,-9.026052 -1.067551,-10.614722 z m -2.298247,-0.711186 c -0.18088,1.76912 -8.694681,-5.831021 -7.274236,-6.011471 4.078679,-0.70411 7.448023,1.58867 7.274236,6.011471 z M 27.153054,3.6565514 c 0,0.3538241 0.172014,0.5307362 0.172014,0.7041099 0.533775,-0.5236596 0.88667,-1.0561648 1.420444,-1.58867 0,0.353824 -0.172013,0.5307361 0.180882,0.8845601 0.352893,-0.5307361 0.705788,-0.8845601 1.418671,-1.2383842 -0.359989,0.5342744 0,0.7076481 0.173787,0.8845602 C 31.052627,2.9524416 31.405521,2.591541 32.292191,2.2412552 32.120176,2.591541 31.760189,2.7719913 32.120176,3.1258153 32.645085,2.7719913 33.006846,2.591541 34.24641,2.2412552 34.065529,2.591541 33.531754,2.7719913 33.712635,3.1258153 34.244636,2.9524416 34.953973,2.7719913 35.666854,2.591541 35.305093,2.9524416 34.952198,3.1240462 35.305093,3.3044965 36.019749,3.1240462 36.725538,2.7719913 37.612207,3.1240462 l -0.532001,0.5325052 h 2.133326 c -0.361761,0.5307362 -0.714656,0.8845602 -0.88667,1.5886701 h 0.88667 c -0.361761,1.0650105 -1.06755,1.2454607 -1.24843,1.5975157 0.18088,0.1716047 0.533774,0.1716047 1.067549,0 -0.354668,0.7041099 -0.886669,1.0561648 -1.418671,1.5886696 0.177334,0.180451 0.351122,0.180451 0.88667,0 -0.535548,0.532506 -1.060457,0.884561 -1.596005,1.417066 0.173787,0.1804502 0.535548,0.1804502 0.886669,0.1804502 -0.532001,0.52366 -1.418671,0.88456 -2.12446,1.236615 0.172015,0.352055 0.524909,0.171605 0.705789,0.171605 -0.532001,0.3609 -1.41867,0.712955 -2.128007,0.88456 0.173788,0.18045 0.354669,0.360901 0.709337,0.360901 -0.886671,0.523659 -2.128008,0.171604 -2.482675,0.523659 0,0.180451 0.354667,0.360901 0.535548,0.532506 -1.420444,0 -5.148003,0 -5.853792,-2.825286 1.418671,-1.5975152 3.899573,-3.3666359 8.33292,-5.6682615 C 32.120176,6.4906822 28.92462,7.898902 26.438399,10.028923 23.606376,8.6118578 25.551729,5.0736168 27.153054,3.6565514 Z M 23.961045,13.91745 c 2.128006,0 4.788014,1.592208 4.788014,3.187955 0,1.408219 -1.947126,2.47323 -4.788014,2.47323 -2.840889,0 -4.788015,-1.415296 -4.788015,-2.653681 0,-1.238384 2.308886,-3.007504 4.788015,-3.007504 z M 13.14013,12.855977 c 0.361762,0 0.533775,-0.173373 0.714656,-0.353824 -0.88667,-0.353824 -1.773339,-0.530736 -2.307114,-1.06501 0.354668,0 0.532002,0 0.886669,-0.171605 -0.705789,-0.353824 -1.41867,-0.712955 -2.128006,-1.238384 0.354668,0 0.709336,0 0.886669,-0.1786812 -0.532001,-0.353824 -1.064003,-0.88456 -1.5995516,-1.238384 H 10.480123 C 9.9552135,7.898902 9.4214385,7.5486162 9.068544,6.8409681 c 0.3528945,0.1733738 0.7057889,0.1733738 1.058683,0 C 9.9552135,6.4906822 9.068544,6.310232 8.7085563,5.4256718 H 9.5952257 C 9.4214385,4.7215619 9.068544,4.1872876 8.8876636,3.8370017 H 11.015671 L 10.480123,3.1240462 c 0.886669,-0.1716046 1.773338,0 2.307113,0.1804503 0.354668,-0.1804503 0,-0.5325052 -0.352895,-0.7129555 0.705789,0.1804503 1.418672,0.3609006 1.95422,0.5325052 0.352895,-0.3520549 -0.18088,-0.5307361 -0.533775,-0.8845602 1.239564,0.1804503 1.592459,0.5325053 2.126233,0.8845602 0.354668,-0.3520549 0,-0.5307361 -0.18088,-0.8845602 0.886669,0.3538241 1.24843,0.7129556 1.773339,1.0650105 0.18088,-0.1804503 0.361761,-0.3538241 0.18088,-0.8845602 0.354668,0.352055 0.886669,0.7041099 1.241338,1.2366151 0.35112,-0.1804502 0.177334,-0.5307361 0.177334,-0.8845601 0.535548,0.5307361 1.060457,1.0650104 1.422217,1.58867 0.172014,0 0.172014,-0.3520549 0.172014,-0.7041099 1.420444,1.4152963 3.546677,4.9535374 0.533775,6.3723716 -2.479127,-2.130021 -5.674684,-3.718691 -9.047575,-4.7837015 4.433347,2.3016256 6.921342,4.0707463 8.341786,5.6682615 -0.714655,2.825286 -4.433347,3.005736 -5.853791,2.825286 0.352894,-0.171605 0.532001,-0.352055 0.532001,-0.530737 -0.179107,-0.173373 -1.246657,0 -2.133327,-0.353824 z m 4.967122,2.119407 c 1.420446,0.18045 -7.093355,7.789437 -7.265369,6.020316 -0.18088,-4.251196 3.184917,-6.724426 7.265369,-6.020316 z M 9.068544,31.782027 c -2.1351,-1.76912 -2.8408888,-6.543976 1.058683,-8.845602 2.307114,-0.70411 0.88667,9.558557 -1.058683,8.845602 z m 8.152039,8.845602 c -1.239564,0.712955 -4.078679,0.3609 -6.025805,-2.473231 -1.4204451,-2.47323 -1.2413378,-4.953537 -0.180881,-5.661185 1.420444,-0.88456 3.727559,0.353824 5.320017,2.303395 1.420444,1.58867 2.128006,4.774856 0.886669,5.831021 z m -2.30534,-10.786327 c -2.128007,-1.417065 -2.480902,-4.603251 -0.88667,-7.256932 1.773339,-2.47323 4.793336,-3.53824 6.919569,-2.121175 2.126233,1.415296 2.479127,4.603251 0.886669,7.256932 -1.601324,2.65368 -4.788015,3.53824 -6.921341,2.121175 z m 9.045802,15.741633 c -2.660009,0.18045 -5.139136,-2.121175 -5.139136,-2.825285 0,-1.065011 3.184916,-1.949571 5.320016,-1.949571 2.126233,-0.18045 4.958255,0.70411 4.958255,1.76912 0,0.70411 -2.660008,3.007505 -5.139135,3.007505 z m 5.320016,-11.318832 c 0,2.65368 -2.305341,4.774856 -5.139136,4.774856 -2.840889,0 -5.320016,-2.122945 -5.320016,-4.776625 0,-2.653681 2.298247,-4.773087 5.139136,-4.773087 3.014675,0 5.320016,2.121175 5.320016,4.774856 z m -3.19201,-6.724427 c -1.773338,-2.47323 -1.241337,-5.838097 0.886669,-7.256931 2.12446,-1.40822 5.320017,-0.52366 6.919569,2.130021 1.592458,2.65368 1.239564,5.83102 -0.886669,7.248086 -2.1351,1.238384 -5.320017,0.353824 -6.921342,-2.121176 z m 10.640033,10.614722 c -2.308887,3.184417 -5.320016,3.184417 -6.380473,2.299857 -1.248431,-1.061472 -0.361762,-4.599713 1.411578,-6.542207 1.773338,-2.130021 3.908439,-3.538241 5.148002,-2.482076 0.88667,1.238384 1.418671,4.603251 -0.18088,6.724426 z m 1.599552,-6.545745 c -1.954219,0.88456 -3.546678,-9.376338 -1.06755,-8.845602 3.901346,2.122945 3.19201,7.076482 1.06755,8.845602 z" + id="surface1" + style="stroke-width:1.77123;fill:#232629;fill-opacity:1" /> + <metadata + id="metadata3"> + <rdf:RDF> + <rdf:Description + about="https://iconscout.com/legal#licenses" + dc:title="raspberry,pi" + dc:description="raspberry,pi" + dc:publisher="Iconscout" + dc:date="2017-12-30" + dc:format="image/svg+xml" + dc:language="en"> + <dc:creator> + <rdf:Bag> + <rdf:li>Icons8</rdf:li> + </rdf:Bag> + </dc:creator> + </rdf:Description> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> +</svg>