power optimization

Signed-off-by: dragonchaser <christian@boltares.de>
This commit is contained in:
dragonchaser
2025-07-14 18:02:54 +02:00
parent cdd2349a91
commit 2dac7aa5c3

View File

@@ -6,8 +6,14 @@
#include <mutex> #include <mutex>
// POWER SAVE ATTEMPTS extern "C" {
//#include <WiFi.h> #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 // Methods
uint64_t StrToHex(const char* str); uint64_t StrToHex(const char* str);
@@ -213,8 +219,19 @@ void setup() {
pBLEScan->setWindow(BLE_WINDOW); // less or equal setInterval value pBLEScan->setWindow(BLE_WINDOW); // less or equal setInterval value
// POWER SAVING! // POWER SAVING!
//WiFi.disconnect(true); // Disconnect from the network // Measurements:
//WiFi.mode(WIFI_OFF); // ------------- (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() { void loop() {