Update setSleepMode

This commit is contained in:
Theo Arends 2021-01-14 17:04:54 +01:00
parent fdbd1dcc0a
commit e891c4e490
2 changed files with 12 additions and 20 deletions

View File

@ -28,14 +28,12 @@
#undef WiFi #undef WiFi
#endif #endif
void WiFiClass32::setSleepMode(int iSleepMode) void WiFiClass32::setSleepMode(int iSleepMode) {
{ // WIFI_LIGHT_SLEEP and WIFI_MODEM_SLEEP
// WIFI_MODEM_SLEEP WiFi.setSleep(iSleepMode != WIFI_NONE_SLEEP);
WiFi.setSleep(iSleepMode != WIFI_MODEM_SLEEP);
} }
int WiFiClass32::getPhyMode() int WiFiClass32::getPhyMode() {
{
int phy_mode = 0; // " BGNL" int phy_mode = 0; // " BGNL"
uint8_t protocol_bitmap; uint8_t protocol_bitmap;
if (esp_wifi_get_protocol(WIFI_IF_STA, &protocol_bitmap) == ESP_OK) { if (esp_wifi_get_protocol(WIFI_IF_STA, &protocol_bitmap) == ESP_OK) {
@ -47,12 +45,10 @@ int WiFiClass32::getPhyMode()
return phy_mode; return phy_mode;
} }
void WiFiClass32::wps_disable() void WiFiClass32::wps_disable() {
{
} }
void WiFiClass32::setOutputPower(int n) void WiFiClass32::setOutputPower(int n) {
{
wifi_power_t p = WIFI_POWER_2dBm; wifi_power_t p = WIFI_POWER_2dBm;
if (n > 19) if (n > 19)
p = WIFI_POWER_19_5dBm; p = WIFI_POWER_19_5dBm;
@ -75,28 +71,23 @@ void WiFiClass32::setOutputPower(int n)
WiFi.setTxPower(p); WiFi.setTxPower(p);
} }
void WiFiClass32::forceSleepBegin() void WiFiClass32::forceSleepBegin() {
{
} }
void WiFiClass32::forceSleepWake() void WiFiClass32::forceSleepWake() {
{
} }
bool WiFiClass32::getNetworkInfo(uint8_t i, String &ssid, uint8_t &encType, int32_t &rssi, uint8_t *&bssid, int32_t &channel, bool &hidden_scan) bool WiFiClass32::getNetworkInfo(uint8_t i, String &ssid, uint8_t &encType, int32_t &rssi, uint8_t *&bssid, int32_t &channel, bool &hidden_scan) {
{
hidden_scan = false; hidden_scan = false;
return WiFi.getNetworkInfo(i, ssid, encType, rssi, bssid, channel); return WiFi.getNetworkInfo(i, ssid, encType, rssi, bssid, channel);
} }
void wifi_station_disconnect() void wifi_station_disconnect() {
{
// erase ap: empty ssid, ... // erase ap: empty ssid, ...
WiFi.disconnect(true, true); WiFi.disconnect(true, true);
} }
void wifi_station_dhcpc_start() void wifi_station_dhcpc_start() {
{
} }
WiFiClass32 WiFi32; WiFiClass32 WiFi32;

View File

@ -28,6 +28,7 @@
#define ENC_TYPE_TKIP WIFI_AUTH_WPA_WPA2_PSK #define ENC_TYPE_TKIP WIFI_AUTH_WPA_WPA2_PSK
#define ENC_TYPE_AUTO WIFI_AUTH_MAX + 1 #define ENC_TYPE_AUTO WIFI_AUTH_MAX + 1
#define WIFI_NONE_SLEEP 0
#define WIFI_LIGHT_SLEEP 1 #define WIFI_LIGHT_SLEEP 1
#define WIFI_MODEM_SLEEP 2 #define WIFI_MODEM_SLEEP 2