mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-18 19:24:49 +01:00
Sleep fix when saving Config
This commit is contained in:
parent
aba82ef3e0
commit
14473cb7c7
|
|
@ -4,6 +4,9 @@
|
|||
#include "display.h"
|
||||
|
||||
|
||||
bool shouldSleepStop = true;
|
||||
|
||||
|
||||
void Configuration::writeFile() {
|
||||
Serial.println("Saving config...");
|
||||
|
||||
|
|
@ -166,6 +169,7 @@ bool Configuration::readFile() {
|
|||
|
||||
digi.mode = data["digi"]["mode"] | 0;
|
||||
digi.ecoMode = data["digi"]["ecoMode"] | 0;
|
||||
if (digi.ecoMode == 1) shouldSleepStop = false;
|
||||
|
||||
loramodule.txFreq = data["lora"]["txFreq"] | 433775000;
|
||||
loramodule.rxFreq = data["lora"]["rxFreq"] | 433775000;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
|
||||
extern Configuration Config;
|
||||
extern bool shouldSleepStop;
|
||||
extern uint32_t lastBeaconTx;
|
||||
|
||||
bool wakeUpFlag = false;
|
||||
|
|
@ -48,15 +49,15 @@ namespace SLEEP_Utils {
|
|||
}
|
||||
|
||||
void startSleeping() {
|
||||
uint32_t timeToSleep = getSecondsToSleep();
|
||||
esp_sleep_enable_timer_wakeup(timeToSleep * 1000000); // 1 min = 60sec
|
||||
Serial.print("(Sleeping : "); Serial.print(timeToSleep); Serial.println("seconds)");
|
||||
|
||||
//esp_sleep_enable_timer_wakeup(getSecondsToSleep() * 1000000); // 1 min = 60sec
|
||||
|
||||
delay(100);
|
||||
LoRa_Utils::wakeRadio();
|
||||
esp_light_sleep_start();
|
||||
if (!shouldSleepStop) {
|
||||
uint32_t timeToSleep = getSecondsToSleep();
|
||||
esp_sleep_enable_timer_wakeup(timeToSleep * 1000000); // 1 min = 60sec
|
||||
Serial.print("(Sleeping : "); Serial.print(timeToSleep); Serial.println("seconds)");
|
||||
delay(100);
|
||||
LoRa_Utils::wakeRadio();
|
||||
esp_light_sleep_start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue