don't need WiFi at all, so I wanna turn it off, as much as possible.
Found some references that setting mode to OFF & forcing to sleep are doing the job.
Sadly I can't call the forceSleepBegin() method, as it's not found
I didn't found any reference about it would be guaranteed that, when not including WiFi.h, no power will be consumed. So, to be sure I'm running on a minimum power level, I'm trying to disable as much as possible.
ESP32 runs FreeRTOS, and the WiFi is always run on core number 1 (the other being 0).
It seems possible to force core 1 not to run, thus no WiFi, but not from the Arduino IDE. See here for (little) more.
Futher search leads here, so maybe it's possible after all:
/*Simple example of multi loop
* By Evandro Luis Copercini
* Based on pcbreflux video
* Public domain license 2017
*/
#if CONFIG_FREERTOS_UNICORE
#define ARDUINO_RUNNING_CORE 0
#else
#define ARDUINO_RUNNING_CORE 1
#endif
void loop1(void *pvParameters) {
while (1) {
Serial.println("loop1");
delay(1000);
}
}
void loop2(void *pvParameters) {
while (1) {
Serial.println("loop2");
delay(300);
}
}
void loop3(void *pvParameters) {
while (1) {
Serial.println("loop3");
delay(4000);
}
}
void setup() {
Serial.begin(115200);
xTaskCreatePinnedToCore(loop1, "loop1", 4096, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
xTaskCreatePinnedToCore(loop2, "loop2", 4096, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
xTaskCreatePinnedToCore(loop3, "loop3", 4096, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
}
void loop() {
Serial.println("loop0");
delay(5000);
}
Tasks loop1, loop2 and loop3 are supposed to run on core 1. But if you set
#define ARDUINO_RUNNING_CORE 0
maybe these tasks won't run at all and the serial monitor will only show "loop0"
Edit: no, it's not that simple...
But I think it is possible to set this option using the ESP IDF configuration menu. The guide for the ESP-IDF is here.