WiFi Hang



  • Hi,

    I'm seeing the fipy wifi hang in a couple seconds of running the below sample code from the pycom website.

    from network import WLAN
    import ubinascii
    import time
    
    def pack_cb(pack):
        global update
        update = update + 1
        mac = bytearray(6)
        pk = wlan.wifi_packet()
        control = pk.data[0]
        subtype = (0xF0 & control) >> 4
        type = 0x0C & control
        print("Control:{}, subtype:{}, type:{}".format(control, subtype, type))
        if subtype == 4:
            print("subType==4")
            for i in range (0,6):
                mac[i] = pk.data[10 + i]
            print ("Wifi Node with MAC: {}".format(ubinascii.hexlify(mac)))
    
    wlan = WLAN(mode=WLAN.STA, antenna=WLAN.EXT_ANT)
    wlan.callback(trigger=WLAN.EVENT_PKT_MGMT, handler=pack_cb)
    wlan.promiscuous(True)
    
    while True:
        print("alive")
        sleep(5)
    

    I can tell the whole fipy isn't locked up because the alive prints keep coming out. But wifi completely checks out. Any thoughts how to keep wifi itself going without a hang?


Log in to reply
 

Pycom on Twitter