esp8266: Use the recommended network.WLAN.IF_[AP|STA] constants.

Removes the deprecated network.[AP|STA]_IF form from the esp8266 port

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
Angus Gratton 2024-11-05 11:19:00 +11:00 committed by Damien George
parent 285e1d0b80
commit f5b81bee61
3 changed files with 5 additions and 5 deletions

View File

@ -36,12 +36,12 @@ const char esp_help_text[] =
"Basic WiFi configuration:\n"
"\n"
"import network\n"
"sta_if = network.WLAN(network.STA_IF); sta_if.active(True)\n"
"sta_if = network.WLAN(network.WLAN.IF_STA); sta_if.active(True)\n"
"sta_if.scan() # Scan for available access points\n"
"sta_if.connect(\"<AP_name>\", \"<key>\") # Connect to an AP\n"
"sta_if.isconnected() # Check for successful connection\n"
"# Change name/password of ESP8266's AP:\n"
"ap_if = network.WLAN(network.AP_IF)\n"
"ap_if = network.WLAN(network.WLAN.IF_AP)\n"
"ap_if.config(ssid=\"<AP_NAME>\", security=network.AUTH_WPA_WPA2_PSK, key=\"<key>\")\n"
"\n"
"Control commands:\n"

View File

@ -6,7 +6,7 @@ from flashbdev import bdev
def wifi():
import binascii
ap_if = network.WLAN(network.AP_IF)
ap_if = network.WLAN(network.WLAN.IF_AP)
ssid = b"MicroPython-%s" % binascii.hexlify(ap_if.config("mac")[-3:])
ap_if.config(ssid=ssid, security=network.AUTH_WPA_WPA2_PSK, key=b"micropythoN")

View File

@ -23,8 +23,8 @@ def main():
print(esp.check_fw())
print("\nNetworking:")
print("STA ifconfig:", network.WLAN(network.STA_IF).ifconfig())
print("AP ifconfig:", network.WLAN(network.AP_IF).ifconfig())
print("STA ifconfig:", network.WLAN(network.WLAN.IF_STA).ifconfig())
print("AP ifconfig:", network.WLAN(network.WLAN.IF_AP).ifconfig())
print("Free WiFi driver buffers of type:")
for i, comm in enumerate(
("1,2 TX", "4 Mngmt TX(len: 0x41-0x100)", "5 Mngmt TX (len: 0-0x40)", "7", "8 RX")