diff --git a/btcontrol.ino b/btcontrol.ino index 6348e2f..797ceeb 100644 --- a/btcontrol.ino +++ b/btcontrol.ino @@ -6,8 +6,14 @@ #include -// POWER SAVE ATTEMPTS -//#include +extern "C" { + #include "esp_wifi.h" + #include "esp_event.h" + #include "esp_log.h" + #include "nvs_flash.h" + #include "soc/rtc_cntl_reg.h" + #include "soc/soc.h" +} // Methods uint64_t StrToHex(const char* str); @@ -213,8 +219,19 @@ void setup() { pBLEScan->setWindow(BLE_WINDOW); // less or equal setInterval value // POWER SAVING! - //WiFi.disconnect(true); // Disconnect from the network - //WiFi.mode(WIFI_OFF); + // Measurements: + // ------------- (All tests run with 1 device detected, providing color FF0000) + // Default, 240Mhz nothing disabled -> 0.13A + // No Wifi, throttled to 80Mhz (this is the minimum) -> 0.11A + + // Assuming the best case 0.07A when no lights ae on and the worst case 0.15A when all 7 lights are on + // and using a 20Ah powerbank, the device sholuld run between 5.5 days and 11.9 days + // esp_light_sleep does not work, neither das disabling the brown-out-detector + esp_wifi_stop(); + esp_wifi_deinit(); + esp_wifi_set_mode(WIFI_MODE_NULL); + + setCpuFrequencyMhz(80); } void loop() {