diff --git a/reference/micropython/network/WLAN.pyi b/reference/micropython/network/WLAN.pyi index 9820180cb..c0552a45c 100644 --- a/reference/micropython/network/WLAN.pyi +++ b/reference/micropython/network/WLAN.pyi @@ -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: """ diff --git a/tests/quality_tests/feat_networking/check_network/check_wlan.py b/tests/quality_tests/feat_networking/check_network/check_wlan.py index 09d62ad63..647677db6 100644 --- a/tests/quality_tests/feat_networking/check_network/check_wlan.py +++ b/tests/quality_tests/feat_networking/check_network/check_wlan.py @@ -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) \ No newline at end of file +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 \ No newline at end of file