⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/companion_radio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ void setup() {
);

#ifdef WIFI_SSID
board.setInhibitSleep(true); // prevent sleep when WiFi is active
WiFi.begin(WIFI_SSID, WIFI_PWD);
serial_interface.begin(TCP_PORT);
#elif defined(BLE_PIN_CODE)
Expand Down
1 change: 1 addition & 0 deletions src/helpers/ESP32Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <SPIFFS.h>

bool ESP32Board::startOTAUpdate(const char* id, char reply[]) {
inhibit_sleep = true; // prevent sleep during OTA
WiFi.softAP("MeshCore-OTA", NULL);

sprintf(reply, "Started: http://%s/update", WiFi.softAPIP().toString().c_str());
Expand Down
12 changes: 6 additions & 6 deletions src/helpers/ESP32Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#include <rom/rtc.h>
#include <sys/time.h>
#include <Wire.h>
#include "esp_wifi.h"
#include "driver/rtc_io.h"

class ESP32Board : public mesh::MainBoard {
protected:
uint8_t startup_reason;
bool inhibit_sleep = false;

public:
void begin() {
Expand Down Expand Up @@ -72,11 +72,7 @@ class ESP32Board : public mesh::MainBoard {
}

void sleep(uint32_t secs) override {
// 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
if (!inhibit_sleep) {
enterLightSleep(secs); // To wake up after "secs" seconds or when receiving a LoRa packet
}
}
Expand Down Expand Up @@ -126,6 +122,10 @@ class ESP32Board : public mesh::MainBoard {
}

bool startOTAUpdate(const char* id, char reply[]) override;

void setInhibitSleep(bool inhibit) {
inhibit_sleep = inhibit;
}
};

class ESP32RTCClock : public mesh::RTCClock {
Expand Down