Add CONFIG_ENABLE_POWER_SAVE

Enable light sleep
Switch off internal LED
Disable mDNS
This commit is contained in:
Mathieu Maret 2016-04-06 16:03:14 +02:00
parent 0190133bf3
commit fe3dba6cad
2 changed files with 8 additions and 2 deletions

View File

@ -103,6 +103,7 @@ void WifiSetup(int bootmode, int forceSetup, char *confSsid, char *confPassword,
SKETCH_DEBUG_PRINTLN("");
SKETCH_DEBUG_PRINTLN("WiFi connected");
#ifndef CONFIG_ENABLE_POWER_SAVE
if (!MDNS.begin(confHost)) {
SKETCH_DEBUG_PRINTLN("Error setting up MDNS responder!");
while (1) {
@ -110,6 +111,7 @@ void WifiSetup(int bootmode, int forceSetup, char *confSsid, char *confPassword,
}
}
SKETCH_DEBUG_PRINTLN("mDNS responder started");
#endif
myIP = WiFi.localIP();
}
@ -222,8 +224,10 @@ void setup() {
SKETCH_DEBUG_PRINTLN("BMP180 init success");
WebSetupServer(mode);
}
#ifdef CONFIG_ENABLE_LIGHT_SLEEP
#ifdef CONFIG_ENABLE_POWER_SAVE
wifi_set_sleep_type(LIGHT_SLEEP_T);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH); //Active at low level
#endif
}

View File

@ -13,7 +13,9 @@
#define CONFIG_BMP180_SCL 14
// Enable light sleep to save some power (http://bbs.espressif.com/viewtopic.php?f=6&t=133&p=485&hilit=sleep+modem#p485)
//#define CONFIG_ENABLE_LIGHT_SLEEP
// Switch off internal LED
// Disable mDNS
//#define CONFIG_ENABLE_POWER_SAVE
/* DEFAULT VALUE ALSO DEFINED IN CONFIG.H */