File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88#include < rom/rtc.h>
99#include < sys/time.h>
1010#include < Wire.h>
11- #include < WiFi.h >
11+ #include " esp_wifi.h "
1212#include " driver/rtc_io.h"
1313
1414class ESP32Board : public mesh ::MainBoard {
@@ -65,8 +65,12 @@ class ESP32Board : public mesh::MainBoard {
6565 }
6666
6767 void sleep (uint32_t secs) override {
68- if (WiFi.getMode () == WIFI_MODE_NULL ) { // WiFi is off ~ No active OTA, safe to go to sleep
69- enterLightSleep (secs); // To wake up after "secs" seconds or when receiving a LoRa packet
68+ // To check for WiFi status to see if there is active OTA
69+ wifi_mode_t mode;
70+ esp_err_t err = esp_wifi_get_mode (&mode);
71+
72+ if (err != ESP_OK ) { // WiFi is off ~ No active OTA, safe to go to sleep
73+ enterLightSleep (secs); // To wake up after "secs" seconds or when receiving a LoRa packet
7074 }
7175 }
7276
You can’t perform that action at this time.
0 commit comments