mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Used esp_wifi_get_mode instead of WiFi.getMode() to reduce the code size
This commit is contained in:
parent
33b1e7edb9
commit
d911a34eeb
1 changed files with 7 additions and 3 deletions
|
|
@ -8,7 +8,7 @@
|
|||
#include <rom/rtc.h>
|
||||
#include <sys/time.h>
|
||||
#include <Wire.h>
|
||||
#include <WiFi.h>
|
||||
#include "esp_wifi.h"
|
||||
#include "driver/rtc_io.h"
|
||||
|
||||
class ESP32Board : public mesh::MainBoard {
|
||||
|
|
@ -65,8 +65,12 @@ public:
|
|||
}
|
||||
|
||||
void sleep(uint32_t secs) override {
|
||||
if (WiFi.getMode() == WIFI_MODE_NULL) { // WiFi is off ~ No active OTA, safe to go to sleep
|
||||
enterLightSleep(secs); // To wake up after "secs" seconds or when receiving a LoRa packet
|
||||
// To check for WiFi status to see if there is active OTA
|
||||
wifi_mode_t mode;
|
||||
esp_err_t err = esp_wifi_get_mode(&mode);
|
||||
|
||||
if (err != ESP_OK) { // WiFi is off ~ No active OTA, safe to go to sleep
|
||||
enterLightSleep(secs); // To wake up after "secs" seconds or when receiving a LoRa packet
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue