summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2024-11-05 11:19:00 +1100
committerDamien George <damien@micropython.org>2024-11-08 12:03:48 +1100
commitf5b81bee6141f925ed32d2d7968b0c90d7b41b61 (patch)
tree6917ad8d63f7ec5176ef400ccaf1d74d2f3f087d
parent285e1d0b80d821ba910249e8804697ec1739bac7 (diff)
downloadmicropython-f5b81bee6141f925ed32d2d7968b0c90d7b41b61.tar.gz
micropython-f5b81bee6141f925ed32d2d7968b0c90d7b41b61.zip
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>
-rw-r--r--ports/esp8266/help.c4
-rw-r--r--ports/esp8266/modules/inisetup.py2
-rw-r--r--ports/esp8266/modules/port_diag.py4
3 files changed, 5 insertions, 5 deletions
diff --git a/ports/esp8266/help.c b/ports/esp8266/help.c
index a9cb27bad5..694cd90b95 100644
--- a/ports/esp8266/help.c
+++ b/ports/esp8266/help.c
@@ -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"
diff --git a/ports/esp8266/modules/inisetup.py b/ports/esp8266/modules/inisetup.py
index 20bb28e80b..f97c238520 100644
--- a/ports/esp8266/modules/inisetup.py
+++ b/ports/esp8266/modules/inisetup.py
@@ -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")
diff --git a/ports/esp8266/modules/port_diag.py b/ports/esp8266/modules/port_diag.py
index 4eea6a6d90..bbd6225a61 100644
--- a/ports/esp8266/modules/port_diag.py
+++ b/ports/esp8266/modules/port_diag.py
@@ -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")