Skip to content

Commit 285e1d0

Browse files
projectgusdpgeorge
authored andcommitted
esp32: Use the recommended network.WLAN.IF_[AP|STA] constants.
Removes the deprecated network.[AP|STA]_IF form from the esp32 port This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 48f96e9 commit 285e1d0

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

ports/esp32/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ quickly call `wlan_connect()` and it just works):
195195
```python
196196
def wlan_connect(ssid='MYSSID', password='MYPASS'):
197197
import network
198-
wlan = network.WLAN(network.STA_IF)
198+
wlan = network.WLAN(network.WLAN.IF_STA)
199199
if not wlan.active() or not wlan.isconnected():
200200
wlan.active(True)
201201
print('connecting to:', ssid)

ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lilygo_oled.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def display_wifi(self):
3030
self.text("Scan...", 0, 0, 1)
3131
self.show()
3232

33-
sta_if = network.WLAN(network.STA_IF)
33+
sta_if = network.WLAN(network.WLAN.IF_STA)
3434
sta_if.active(True)
3535
_wifi = sta_if.scan()
3636

ports/esp32/boards/LOLIN_S2_PICO/modules/s2pico_oled.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def display_wifi(self):
3737
self.text("Scan...", 0, 0, 1)
3838
self.show()
3939

40-
sta_if = network.WLAN(network.STA_IF)
40+
sta_if = network.WLAN(network.WLAN.IF_STA)
4141
sta_if.active(True)
4242
_wifi = sta_if.scan()
4343

ports/esp32/help.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const char esp32_help_text[] =
4848
"Basic WiFi configuration:\n"
4949
"\n"
5050
"import network\n"
51-
"sta_if = network.WLAN(network.STA_IF); sta_if.active(True)\n"
51+
"sta_if = network.WLAN(network.WLAN.IF_STA); sta_if.active(True)\n"
5252
"sta_if.scan() # Scan for available access points\n"
5353
"sta_if.connect(\"<AP_name>\", \"<password>\") # Connect to an AP\n"
5454
"sta_if.isconnected() # Check for successful connection\n"

0 commit comments

Comments
 (0)