WIFI_PS_MAX_MODEM feature requested #3896 (#3900)

This commit is contained in:
lbernstone 2020-09-30 06:06:58 -06:00 committed by GitHub
parent c18d50cb91
commit 19ccc479c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -639,6 +639,20 @@ bool WiFiGenericClass::setSleep(bool enable)
return esp_wifi_set_ps(enable?WIFI_PS_MIN_MODEM:WIFI_PS_NONE) == ESP_OK; 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 * get modem sleep enabled
* @return true if modem sleep is enabled * @return true if modem sleep is enabled

View File

@ -108,6 +108,7 @@ class WiFiGenericClass
bool enableAP(bool enable); bool enableAP(bool enable);
bool setSleep(bool enable); bool setSleep(bool enable);
bool setSleep(wifi_ps_type_t mode);
bool getSleep(); bool getSleep();
bool setTxPower(wifi_power_t power); bool setTxPower(wifi_power_t power);