src/eric7/MicroPython/Devices/CircuitPythonDevices.py

branch
mpy_network
changeset 9989
286c2a21f36f
parent 9979
dbafba79461d
child 10032
102b79b2a8cd
diff -r 1ba9d07ba9da -r 286c2a21f36f src/eric7/MicroPython/Devices/CircuitPythonDevices.py
--- a/src/eric7/MicroPython/Devices/CircuitPythonDevices.py	Mon Apr 24 17:51:11 2023 +0200
+++ b/src/eric7/MicroPython/Devices/CircuitPythonDevices.py	Thu Apr 27 17:59:09 2023 +0200
@@ -469,7 +469,7 @@
         Private slot to reset the connected device.
         """
         if self.microPython.isConnected():
-            self.microPython.deviceInterface().execute(
+            self.executeCommands(
                 "import microcontroller as mc\n"
                 "mc.on_next_reset(mc.RunMode.NORMAL)"
                 "mc.reset()\n",
@@ -501,7 +501,7 @@
         Private slot to switch the board into 'bootloader' mode.
         """
         if self.microPython.isConnected():
-            self.microPython.deviceInterface().execute(
+            self.executeCommands(
                 "import microcontroller as mc\n"
                 "mc.on_next_reset(mc.RunMode.BOOTLOADER)\n"
                 "mc.reset()\n",
@@ -514,7 +514,7 @@
         Private slot to switch the board into 'UF2 Boot' mode.
         """
         if self.microPython.isConnected():
-            self.microPython.deviceInterface().execute(
+            self.executeCommands(
                 "import microcontroller as mc\n"
                 "mc.on_next_reset(mc.RunMode.UF2)\n"
                 "mc.reset()\n",
@@ -764,7 +764,7 @@
 print(has_wifi())
 del has_wifi
 """
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             raise OSError(self._shortError(err))
         return ast.literal_eval(out.decode("utf-8"))
@@ -848,7 +848,7 @@
 del wifi_status
 """
 
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             raise OSError(self._shortError(err))
 
@@ -902,7 +902,7 @@
         )
 
         with EricOverrideCursor():
-            out, err = self._interface.execute(
+            out, err = self.executeCommands(
                 command, mode=self._submitMode, timeout=15000
             )
         if err:
@@ -938,7 +938,7 @@
 del disconnect_wifi
 """
 
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             return False, err
 
@@ -1070,7 +1070,7 @@
 del check_internet
 """
 
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             return False, err
 
@@ -1107,9 +1107,7 @@
 del scan_networks
 """
 
-        out, err = self._interface.execute(
-            command, mode=self._submitMode, timeout=15000
-        )
+        out, err = self.executeCommands(command, mode=self._submitMode, timeout=15000)
         if err:
             return [], err
 
@@ -1162,7 +1160,7 @@
 del deactivate
 """
 
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             return False, err
         else:
@@ -1214,9 +1212,7 @@
             repr(ssid), repr(password), authmode
         )
 
-        out, err = self._interface.execute(
-            command, mode=self._submitMode, timeout=15000
-        )
+        out, err = self.executeCommands(command, mode=self._submitMode, timeout=15000)
         if err:
             return False, err
         elif out and out.startswith(b"Error:"):
@@ -1245,7 +1241,7 @@
 del stop_ap
 """
 
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             return False, err
         elif out and out.startswith(b"Error:"):
@@ -1294,9 +1290,7 @@
 del has_eth
 """
 
-        out, err = self._interface.execute(
-            command, mode=self._submitMode, timeout=10000
-        )
+        out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000)
         if err:
             raise OSError(self._shortError(err))
 
@@ -1339,9 +1333,7 @@
             WiznetUtilities.cpyWiznetInit()
         )
 
-        out, err = self._interface.execute(
-            command, mode=self._submitMode, timeout=10000
-        )
+        out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000)
         if err:
             raise OSError(self._shortError(err))
 
@@ -1396,7 +1388,7 @@
         )
 
         with EricOverrideCursor():
-            out, err = self._interface.execute(
+            out, err = self.executeCommands(
                 command, mode=self._submitMode, timeout=15000
             )
         if err:
@@ -1428,7 +1420,7 @@
         )
 
         with EricOverrideCursor():
-            out, err = self._interface.execute(
+            out, err = self.executeCommands(
                 command, mode=self._submitMode, timeout=15000
             )
         if err:
@@ -1465,9 +1457,7 @@
             WiznetUtilities.cpyWiznetInit(),
         )
 
-        out, err = self._interface.execute(
-            command, mode=self._submitMode, timeout=15000
-        )
+        out, err = self.executeCommands(command, mode=self._submitMode, timeout=15000)
         if err:
             return False, err
 
@@ -1621,9 +1611,7 @@
 print(has_bt())
 del has_bt
 """
-        out, err = self._interface.execute(
-            command, mode=self._submitMode, timeout=10000
-        )
+        out, err = self.executeCommands(command, mode=self._submitMode, timeout=10000)
         if err:
             raise OSError(self._shortError(err))
         return out.strip() == b"True"
@@ -1666,7 +1654,7 @@
 ble_status()
 del ble_status
 """
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             raise OSError(self._shortError(err))
 
@@ -1703,7 +1691,7 @@
 activate_ble()
 del activate_ble
 """
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             raise OSError(self._shortError(err))
 
@@ -1729,7 +1717,7 @@
 deactivate_ble()
 del deactivate_ble
 """
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             raise OSError(self._shortError(err))
 
@@ -1790,7 +1778,7 @@
 """.format(
             timeout
         )
-        out, err = self._interface.execute(
+        out, err = self.executeCommands(
             command, mode=self._submitMode, timeout=(timeout + 5) * 1000
         )
         if err:
@@ -1845,7 +1833,7 @@
 print(has_ntp())
 del has_ntp
 """
-        out, err = self._interface.execute(command, mode=self._submitMode)
+        out, err = self.executeCommands(command, mode=self._submitMode)
         if err:
             raise OSError(self._shortError(err))
         return out.strip() == b"True"
@@ -1937,7 +1925,7 @@
                 repr(server), tzOffset, timeout
             )
 
-        out, err = self._interface.execute(
+        out, err = self.executeCommands(
             command, mode=self._submitMode, timeout=(timeout + 2) * 1000
         )
         if err:

eric ide

mercurial