@@ -56,7 +56,7 @@ A simple example would be:
5656 import espnow
5757
5858 # A WLAN interface must be active to send()/recv()
59- sta = network.WLAN(network.STA_IF ) # Or network.AP_IF
59+ sta = network.WLAN(network.WLAN.IF_STA ) # Or network.WLAN.IF_AP
6060 sta.active(True)
6161 sta.disconnect() # For ESP8266
6262
@@ -76,7 +76,7 @@ A simple example would be:
7676 import espnow
7777
7878 # A WLAN interface must be active to send()/recv()
79- sta = network.WLAN(network.STA_IF )
79+ sta = network.WLAN(network.WLAN.IF_STA )
8080 sta.active(True)
8181 sta.disconnect() # Because ESP8266 auto-connects to last Access Point
8282
@@ -182,14 +182,14 @@ Configuration
182182Sending and Receiving Data
183183--------------------------
184184
185- A wifi interface (``network.STA_IF `` or ``network.AP_IF ``) must be
185+ A wifi interface (``network.WLAN.IF_STA `` or ``network.WLAN.IF_AP ``) must be
186186`active()<network.WLAN.active> ` before messages can be sent or received,
187187but it is not necessary to connect or configure the WLAN interface.
188188For example::
189189
190190 import network
191191
192- sta = network.WLAN(network.STA_IF )
192+ sta = network.WLAN(network.WLAN.IF_STA )
193193 sta.active(True)
194194 sta.disconnect() # For ESP8266
195195
@@ -445,8 +445,8 @@ must first register the sender and use the same encryption keys as the sender
445445
446446 - *ifidx *: (ESP32 only) Index of the wifi interface which will be
447447 used to send data to this peer. Must be an integer set to
448- ``network.STA_IF `` (=0) or ``network.AP_IF `` (=1).
449- (default=0/``network.STA_IF ``). See `ESPNow and Wifi Operation `_
448+ ``network.WLAN.IF_STA `` (=0) or ``network.WLAN.IF_AP `` (=1).
449+ (default=0/``network.WLAN.IF_STA ``). See `ESPNow and Wifi Operation `_
450450 below for more information.
451451
452452 - *encrypt *: (ESP32 only) If set to ``True `` data exchanged with
@@ -588,7 +588,7 @@ api-reference/network/esp_now.html#api-reference>`_. For example::
588588 elif err.args[1] == 'ESP_ERR_ESPNOW_NOT_FOUND':
589589 e.add_peer(peer)
590590 elif err.args[1] == 'ESP_ERR_ESPNOW_IF':
591- network.WLAN(network.STA_IF ).active(True)
591+ network.WLAN(network.WLAN.IF_STA ).active(True)
592592 else:
593593 raise err
594594
@@ -645,7 +645,7 @@ A small async server example::
645645 import asyncio
646646
647647 # A WLAN interface must be active to send()/recv()
648- network.WLAN(network.STA_IF ).active(True)
648+ network.WLAN(network.WLAN.IF_STA ).active(True)
649649
650650 e = aioespnow.AIOESPNow() # Returns AIOESPNow enhanced with async support
651651 e.active(True)
@@ -747,8 +747,8 @@ ESPNow and Wifi Operation
747747-------------------------
748748
749749ESPNow messages may be sent and received on any `active()<network.WLAN.active> `
750- `WLAN<network.WLAN()> ` interface (``network.STA_IF `` or ``network.AP_IF ``), even
751- if that interface is also connected to a wifi network or configured as an access
750+ `WLAN<network.WLAN()> ` interface (``network.WLAN.IF_STA `` or ``network.WLAN.IF_AP ``),
751+ even if that interface is also connected to a wifi network or configured as an access
752752point. When an ESP32 or ESP8266 device connects to a Wifi Access Point (see
753753`ESP32 Quickref <../esp32/quickref.html#networking >`__) the following things
754754happen which affect ESPNow communications:
@@ -832,8 +832,8 @@ Other issues to take care with when using ESPNow with wifi are:
832832 import network, time
833833
834834 def wifi_reset(): # Reset wifi to AP_IF off, STA_IF on and disconnected
835- sta = network.WLAN(network.STA_IF ); sta.active(False)
836- ap = network.WLAN(network.AP_IF ); ap.active(False)
835+ sta = network.WLAN(network.WLAN.IF_STA ); sta.active(False)
836+ ap = network.WLAN(network.WLAN.IF_AP ); ap.active(False)
837837 sta.active(True)
838838 while not sta.active():
839839 time.sleep(0.1)
0 commit comments