Skip to content

Commit

Permalink
WIFI_PS_MAX_MODEM feature requested #3896 (#3900)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbernstone authored Sep 30, 2020
1 parent c18d50c commit 19ccc47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/WiFi/src/WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,20 @@ bool WiFiGenericClass::setSleep(bool enable)
return esp_wifi_set_ps(enable?WIFI_PS_MIN_MODEM:WIFI_PS_NONE) == ESP_OK;
}

/**
* control modem sleep when only in STA mode
* @param mode wifi_ps_type_t
* @return ok
*/
bool WiFiGenericClass::setSleep(wifi_ps_type_t mode)
{
if((getMode() & WIFI_MODE_STA) == 0){
log_w("STA has not been started");
return false;
}
return esp_wifi_set_ps(mode) == ESP_OK;
}

/**
* get modem sleep enabled
* @return true if modem sleep is enabled
Expand Down
1 change: 1 addition & 0 deletions libraries/WiFi/src/WiFiGeneric.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class WiFiGenericClass
bool enableAP(bool enable);

bool setSleep(bool enable);
bool setSleep(wifi_ps_type_t mode);
bool getSleep();

bool setTxPower(wifi_power_t power);
Expand Down

0 comments on commit 19ccc47

Please sign in to comment.