Skip to content

Commit 19ccc47

Browse files
authored
WIFI_PS_MAX_MODEM feature requested #3896 (#3900)
1 parent c18d50c commit 19ccc47

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Diff for: libraries/WiFi/src/WiFiGeneric.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,20 @@ bool WiFiGenericClass::setSleep(bool enable)
639639
return esp_wifi_set_ps(enable?WIFI_PS_MIN_MODEM:WIFI_PS_NONE) == ESP_OK;
640640
}
641641

642+
/**
643+
* control modem sleep when only in STA mode
644+
* @param mode wifi_ps_type_t
645+
* @return ok
646+
*/
647+
bool WiFiGenericClass::setSleep(wifi_ps_type_t mode)
648+
{
649+
if((getMode() & WIFI_MODE_STA) == 0){
650+
log_w("STA has not been started");
651+
return false;
652+
}
653+
return esp_wifi_set_ps(mode) == ESP_OK;
654+
}
655+
642656
/**
643657
* get modem sleep enabled
644658
* @return true if modem sleep is enabled

Diff for: libraries/WiFi/src/WiFiGeneric.h

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class WiFiGenericClass
108108
bool enableAP(bool enable);
109109

110110
bool setSleep(bool enable);
111+
bool setSleep(wifi_ps_type_t mode);
111112
bool getSleep();
112113

113114
bool setTxPower(wifi_power_t power);

0 commit comments

Comments
 (0)