mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-18 00:32:38 +00:00
Merge branch 'master' into esp32-c6
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#endif
|
||||
|
||||
#include "ButtonThread.h"
|
||||
#include "Default.h"
|
||||
#include "Led.h"
|
||||
#include "MeshRadio.h"
|
||||
#include "MeshService.h"
|
||||
@@ -29,6 +30,7 @@
|
||||
|
||||
esp_sleep_source_t wakeCause; // the reason we booted this time
|
||||
#endif
|
||||
#include "Throttle.h"
|
||||
|
||||
#ifndef INCLUDE_vTaskSuspend
|
||||
#define INCLUDE_vTaskSuspend 0
|
||||
@@ -169,7 +171,8 @@ static void waitEnterSleep(bool skipPreflight = false)
|
||||
while (!doPreflightSleep()) {
|
||||
delay(100); // Kinda yucky - wait until radio says say we can shutdown (finished in process sends/receives)
|
||||
|
||||
if (millis() - now > 30 * 1000) { // If we wait too long just report an error and go to sleep
|
||||
if (!Throttle::isWithinTimespanMs(now,
|
||||
THIRTY_SECONDS_MS)) { // If we wait too long just report an error and go to sleep
|
||||
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_SLEEP_ENTER_WAIT);
|
||||
assert(0); // FIXME - for now we just restart, need to fix bug #167
|
||||
break;
|
||||
@@ -272,13 +275,6 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
|
||||
digitalWrite(LORA_CS, HIGH);
|
||||
gpio_hold_en((gpio_num_t)LORA_CS);
|
||||
}
|
||||
|
||||
#if defined(I2C_SDA)
|
||||
Wire.end();
|
||||
pinMode(I2C_SDA, ANALOG);
|
||||
pinMode(I2C_SCL, ANALOG);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAS_PMU
|
||||
@@ -316,6 +312,14 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ARCH_ESP32) && defined(I2C_SDA)
|
||||
// Added by https://github.com/meshtastic/firmware/pull/4418
|
||||
// Possibly to support Heltec Capsule Sensor?
|
||||
Wire.end();
|
||||
pinMode(I2C_SDA, ANALOG);
|
||||
pinMode(I2C_SCL, ANALOG);
|
||||
#endif
|
||||
|
||||
console->flush();
|
||||
cpuDeepSleep(msecToWake);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user