src/eric7/MicroPython/Devices/RP2Devices.py

branch
eric7
changeset 11240
c48c615c04a3
parent 11237
c1c31b861d54
equal deleted inserted replaced
11239:dff8babf4707 11240:c48c615c04a3
511 @exception OSError raised to indicate an issue with the device 511 @exception OSError raised to indicate an issue with the device
512 """ 512 """
513 # picowireless: 513 # picowireless:
514 # It seems to take up to 20 sec to detect, that no Pico Wireless Pack is 514 # It seems to take up to 20 sec to detect, that no Pico Wireless Pack is
515 # attached. Therefore the command will timeout before. 515 # attached. Therefore the command will timeout before.
516 command = """ 516 if Preferences.getMicroPython("DisablePicowireless"):
517 # Support for Pimoroni Pico Wireless Pack is disabled.
518 command = """
519 def has_wifi():
520 try:
521 import network
522 if hasattr(network, 'WLAN'):
523 wifi = network.WLAN(network.STA_IF)
524 if not wifi.active():
525 wifi.active(True)
526 wifi.active(False)
527 return True, 'picow'
528 except ImportError:
529 pass
530
531 return False, ''
532
533 print(has_wifi())
534 del has_wifi
535 """
536 else:
537 command = """
517 def has_wifi(): 538 def has_wifi():
518 try: 539 try:
519 import network 540 import network
520 if hasattr(network, 'WLAN'): 541 if hasattr(network, 'WLAN'):
521 wifi = network.WLAN(network.STA_IF) 542 wifi = network.WLAN(network.STA_IF)

eric ide

mercurial