src/eric7/MicroPython/Devices/RP2040Devices.py

branch
eric7
changeset 9880
f425c58cf8e9
parent 9878
a82014a9e57b
child 9888
f76eeb80907b
equal deleted inserted replaced
9879:925cf5d8d80f 9880:f425c58cf8e9
468 ) 468 )
469 if err: 469 if err:
470 if not err.startswith(b"Timeout "): 470 if not err.startswith(b"Timeout "):
471 raise OSError(self._shortError(err)) 471 raise OSError(self._shortError(err))
472 else: 472 else:
473 return False # pimoroni firmware loaded but no pico wireless present 473 # pimoroni firmware loaded but no pico wireless present
474 return False, ""
474 return ast.literal_eval(out.decode("utf-8")) 475 return ast.literal_eval(out.decode("utf-8"))
475 476
476 def getWifiData(self): 477 def getWifiData(self):
477 """ 478 """
478 Public method to get data related to the current WiFi status. 479 Public method to get data related to the current WiFi status.
1186 1187
1187 def hasEthernet(self): 1188 def hasEthernet(self):
1188 """ 1189 """
1189 Public method to check the availability of Ethernet. 1190 Public method to check the availability of Ethernet.
1190 1191
1191 @return flag indicating the availability of Ethernet 1192 @return tuple containing a flag indicating the availability of Ethernet
1192 @rtype bool 1193 and the Ethernet type (picowiz)
1194 @rtype tuple of (bool, str)
1193 @exception OSError raised to indicate an issue with the device 1195 @exception OSError raised to indicate an issue with the device
1194 """ 1196 """
1195 command = """ 1197 command = """
1196 def has_eth(): 1198 def has_eth():
1197 try: 1199 try:
1209 1211
1210 out, err = self._interface.execute( 1212 out, err = self._interface.execute(
1211 command, mode=self._submitMode, timeout=10000 1213 command, mode=self._submitMode, timeout=10000
1212 ) 1214 )
1213 if err: 1215 if err:
1214 if not err.startswith(b"Timeout "): 1216 raise OSError(self._shortError(err))
1215 raise OSError(self._shortError(err)) 1217
1216 else:
1217 return False # pimoroni firmware loaded but no pico wireless present
1218 return ast.literal_eval(out.decode("utf-8")) 1218 return ast.literal_eval(out.decode("utf-8"))
1219 1219
1220 def getEthernetStatus(self): 1220 def getEthernetStatus(self):
1221 """ 1221 """
1222 Public method to get Ethernet status data of the connected board. 1222 Public method to get Ethernet status data of the connected board.

eric ide

mercurial