mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-26 22:33:24 +00:00
show reason for last reset
This commit is contained in:
parent
a4ebf83b69
commit
f87cb00940
@ -5,5 +5,5 @@ release. It is used by the android app for forcing software updates. Do not ed
|
||||
Generated by bin/buildall.sh -->
|
||||
|
||||
<resources>
|
||||
<string name="cur_firmware_version">0.1.0</string>
|
||||
<string name="cur_firmware_version">0.1.3</string>
|
||||
</resources>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifdef T_BEAM_V10
|
||||
#include "axp20x.h"
|
||||
extern AXP20X_Class axp;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// deep sleep support
|
||||
RTC_DATA_ATTR int bootCount = 0;
|
||||
@ -28,8 +28,6 @@ esp_sleep_source_t wakeCause; // the reason we booted this time
|
||||
#define xstr(s) str(s)
|
||||
#define str(s) #s
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Application
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -63,7 +61,7 @@ void setLed(bool ledOn)
|
||||
|
||||
void setGPSPower(bool on)
|
||||
{
|
||||
DEBUG_MSG("Setting GPS power=%d\n", on);
|
||||
DEBUG_MSG("Setting GPS power=%d\n", on);
|
||||
|
||||
#ifdef T_BEAM_V10
|
||||
if (axp192_found)
|
||||
@ -84,9 +82,24 @@ void initDeepSleep()
|
||||
wakeButtons = ((uint64_t)1) << buttons.gpios[0];
|
||||
*/
|
||||
|
||||
DEBUG_MSG("booted, wake cause %d (boot count %d)\n", wakeCause, bootCount);
|
||||
}
|
||||
// If we booted because our timer ran out or the user pressed reset, send those as fake events
|
||||
const char *reason = "reset"; // our best guess
|
||||
RESET_REASON hwReason = rtc_get_reset_reason(0);
|
||||
|
||||
if (hwReason == RTCWDT_BROWN_OUT_RESET)
|
||||
reason = "brownout";
|
||||
|
||||
if (hwReason == TG0WDT_SYS_RESET)
|
||||
reason = "taskWatchdog";
|
||||
|
||||
if (hwReason == TG1WDT_SYS_RESET)
|
||||
reason = "intWatchdog";
|
||||
|
||||
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER)
|
||||
reason = "timeout";
|
||||
|
||||
DEBUG_MSG("booted, wake cause %d (boot count %d), reset_reason=%s\n", wakeCause, bootCount, reason);
|
||||
}
|
||||
|
||||
void doDeepSleep(uint64_t msecToWake)
|
||||
{
|
||||
@ -175,9 +188,6 @@ void doDeepSleep(uint64_t msecToWake)
|
||||
esp_deep_sleep_start(); // TBD mA sleep current (battery)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* enter light sleep (preserves ram but stops everything about CPU).
|
||||
*
|
||||
@ -188,7 +198,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
||||
//DEBUG_MSG("Enter light sleep\n");
|
||||
uint64_t sleepUsec = sleepMsec * 1000LL;
|
||||
|
||||
Serial.flush(); // send all our characters before we stop cpu clock
|
||||
Serial.flush(); // send all our characters before we stop cpu clock
|
||||
setBluetoothEnable(false); // has to be off before calling light sleep
|
||||
|
||||
// NOTE! ESP docs say we must disable bluetooth and wifi before light sleep
|
||||
|
Loading…
Reference in New Issue
Block a user