Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions reference/micropython/network/WLAN.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@ class WLAN:
# now use sockets as usual
"""

PM_NONE: int
PM_POWERSAVE: int
PM_PERFORMANCE: int

"""\
Allowed values for the ``WLAN.config(pm=...)`` network interface parameter:

* ``PM_PERFORMANCE``: enable WiFi power management to balance power
savings and WiFi performance
* ``PM_POWERSAVE``: enable WiFi power management with additional power
savings and reduced WiFi performance
* ``PM_NONE``: disable wifi power management
"""
PM_NONE: int = ...
"""Disable WiFi power management (always on, highest performance, highest power consumption)"""
PM_PERFORMANCE: int = ...
"""Enable WiFi power management to balance power savings and WiFi performance"""
PM_POWERSAVE: int = ...
"""Enable WiFi power management with additional power savings and reduced WiFi performance""""

// **Note:** The numeric values of these constants are platform-specific:

def __init__(self, interface_id: int = ..., /) -> None:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
# ref : https://github.com/Josverl/micropython-stubber/issues/338
wlan = network.WLAN(network.STA_IF)

wlan.config(pm = 0xa11140) # set power mode to get WiFi power-saving off (if needed)
wlan.config(pm = 0xa11140) # set power mode to get WiFi power-saving off (if needed)

# Better: Use symbolic constants for portability across different MicroPython ports
wlan.config(pm=network.WLAN.PM_NONE) # Disable power management
wlan.config(pm=network.WLAN.PM_PERFORMANCE) # Balanced power/performance
wlan.config(pm=network.WLAN.PM_POWERSAVE) # Maximum power saving
Loading