fix: remove esp_wifi.h from esp32board.h
saves ~500 bytes of dram and allows Tbeam to compile again
This commit is contained in:
@@ -194,6 +194,7 @@ void setup() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
#ifdef WIFI_SSID
|
#ifdef WIFI_SSID
|
||||||
|
board.setInhibitSleep(true); // prevent sleep when WiFi is active
|
||||||
WiFi.begin(WIFI_SSID, WIFI_PWD);
|
WiFi.begin(WIFI_SSID, WIFI_PWD);
|
||||||
serial_interface.begin(TCP_PORT);
|
serial_interface.begin(TCP_PORT);
|
||||||
#elif defined(BLE_PIN_CODE)
|
#elif defined(BLE_PIN_CODE)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <SPIFFS.h>
|
#include <SPIFFS.h>
|
||||||
|
|
||||||
bool ESP32Board::startOTAUpdate(const char* id, char reply[]) {
|
bool ESP32Board::startOTAUpdate(const char* id, char reply[]) {
|
||||||
|
inhibit_sleep = true; // prevent sleep during OTA
|
||||||
WiFi.softAP("MeshCore-OTA", NULL);
|
WiFi.softAP("MeshCore-OTA", NULL);
|
||||||
|
|
||||||
sprintf(reply, "Started: http://%s/update", WiFi.softAPIP().toString().c_str());
|
sprintf(reply, "Started: http://%s/update", WiFi.softAPIP().toString().c_str());
|
||||||
|
|||||||
@@ -8,12 +8,12 @@
|
|||||||
#include <rom/rtc.h>
|
#include <rom/rtc.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include "esp_wifi.h"
|
|
||||||
#include "driver/rtc_io.h"
|
#include "driver/rtc_io.h"
|
||||||
|
|
||||||
class ESP32Board : public mesh::MainBoard {
|
class ESP32Board : public mesh::MainBoard {
|
||||||
protected:
|
protected:
|
||||||
uint8_t startup_reason;
|
uint8_t startup_reason;
|
||||||
|
bool inhibit_sleep = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void begin() {
|
void begin() {
|
||||||
@@ -72,11 +72,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sleep(uint32_t secs) override {
|
void sleep(uint32_t secs) override {
|
||||||
// To check for WiFi status to see if there is active OTA
|
if (!inhibit_sleep) {
|
||||||
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
|
enterLightSleep(secs); // To wake up after "secs" seconds or when receiving a LoRa packet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,6 +122,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool startOTAUpdate(const char* id, char reply[]) override;
|
bool startOTAUpdate(const char* id, char reply[]) override;
|
||||||
|
|
||||||
|
void setInhibitSleep(bool inhibit) {
|
||||||
|
inhibit_sleep = inhibit;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ESP32RTCClock : public mesh::RTCClock {
|
class ESP32RTCClock : public mesh::RTCClock {
|
||||||
|
|||||||
Reference in New Issue
Block a user