Skip to content

Wifi low power #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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
9 changes: 9 additions & 0 deletions adafruit_esp32spi/adafruit_esp32spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# pylint: disable=bad-whitespace
_SET_NET_CMD = const(0x10)
_SET_PASSPHRASE_CMD = const(0x11)
_SET_POWER_MODE_CMD = const(0x17)
_SET_AP_NET_CMD = const(0x18)
_SET_AP_PASSPHRASE_CMD = const(0x19)
_SET_DEBUG_CMD = const(0x1A)
Expand Down Expand Up @@ -448,6 +449,14 @@ def _wifi_set_ap_network(self, ssid, channel):
if resp[0][0] != 1:
raise RuntimeError("Failed to setup AP network")

def wifi_set_power_mode(self, power_mode):
"""Sets wi-fi power save mode on or off"""
resp = self._send_command_get_response(
_SET_POWER_MODE_CMD, ((bool(power_mode),),)
)
if resp[0][0] != 1:
raise RuntimeError("Failed to set power mode")

def _wifi_set_ap_passphrase(self, ssid, passphrase, channel):
"""Creates an Access point with SSID, passphrase, and Channel"""
resp = self._send_command_get_response(
Expand Down