BUG in activating network interfaces

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Posts: 50
Joined: Mon Dec 25, 2017 1:48 pm
Location: Netherlands

BUG in activating network interfaces

Post by jomas » Sat Jan 11, 2020 2:42 pm

I think there is a bug in activating sta/ap interfaces.

When running the script below, ap_if.active() wil continuously print False.
However the bug will only appear with sta_if configured with SSID and pasword for your modem/router and with ap_active deactivated on start of the script.

If ap_if.active() returns True, then run ap_if.activate(False) and run the script again. After a few runs the bug will appear.
If I use the time.sleep(0.1) then everything works as expected.

Can someone confirm this bug? (I used the latest 1.12 version from the main Python site)

Code: Select all

import network
import time

ap_if = network.WLAN(network.AP_IF)
# time.sleep(0.1)
sta_if = network.WLAN(network.STA_IF)
while True:
    print("AP: ", ap_if.active())
    print("STA: ", sta_if.active())
    if ap_if.active():
        if sta_if.active():
            print("All interfaces active")

Post Reply