Implement light sleep
This commit is contained in:
parent
a204d6fddf
commit
2778443ccc
1
TODO.md
1
TODO.md
@ -1,7 +1,6 @@
|
||||
# WifiControlSensor
|
||||
* MQTT Watch GPIO value using interuption
|
||||
* Configure BMP180 altitude in EEPROM thanks to web interface
|
||||
* Enable LIGHT_SLEEP_T wifi sleep type
|
||||
* Make mqtt optionnal
|
||||
* Make web interface optionnal
|
||||
|
||||
|
@ -35,14 +35,18 @@
|
||||
#include <EEPROM.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "debug_sketch.h"
|
||||
#include "BMP180.h"
|
||||
|
||||
#include "Adafruit_MQTT.h"
|
||||
#include "Adafruit_MQTT_Client.h"
|
||||
|
||||
extern "C" {
|
||||
#include <user_interface.h>
|
||||
}
|
||||
|
||||
#define CONFIG_EEPROM_SIZE 256
|
||||
char eeprom[CONFIG_EEPROM_SIZE];
|
||||
|
||||
@ -218,6 +222,9 @@ void setup() {
|
||||
SKETCH_DEBUG_PRINTLN("BMP180 init success");
|
||||
WebSetupServer(mode);
|
||||
}
|
||||
#ifdef CONFIG_ENABLE_LIGHT_SLEEP
|
||||
wifi_set_sleep_type(LIGHT_SLEEP_T);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint nbCycle = 0;
|
||||
|
@ -12,6 +12,9 @@
|
||||
#define CONFIG_BMP180_SDA 12
|
||||
#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
|
||||
|
||||
/* DEFAULT VALUE ALSO DEFINED IN CONFIG.H */
|
||||
|
||||
// Time to sleep between 2 webserver request (increase it reduce battery usage but increase latency)
|
||||
|
Loading…
Reference in New Issue
Block a user