File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff 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 
Original file line number Diff line number Diff 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);
                                 You can’t perform that action at this time. 
               
                  
0 commit comments