mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-05-17 19:53:06 +00:00
Moved reset of reboot reason to main program (#1153)
* Moved reset of reboot reason to main program * Allow up to 8 cycles to charge capacitor
This commit is contained in:
@@ -30,6 +30,7 @@ ADC_MODE(ADC_VCC);
|
||||
#include "ZmartChargeCloudConnector.h"
|
||||
#endif
|
||||
|
||||
#define MAX_BOOT_CYCLES 8
|
||||
#define WDT_TIMEOUT 120
|
||||
#if defined(SLOW_PROC_TRIGGER_MS)
|
||||
#warning "Using predefined slow process trigger"
|
||||
@@ -191,8 +192,6 @@ CloudConnector *cloud = NULL;
|
||||
ZmartChargeCloudConnector *zcloud = NULL;
|
||||
#endif
|
||||
|
||||
#define MAX_BOOT_CYCLES 6
|
||||
|
||||
#if defined(ESP32)
|
||||
__NOINIT_ATTR EnergyAccountingRealtimeData rtd;
|
||||
RTC_DATA_ATTR uint8_t bootcount = 0;
|
||||
@@ -470,7 +469,7 @@ void setup() {
|
||||
float vcc = hw.getVcc();
|
||||
debugI_P(PSTR("Voltage: %.2fV"), vcc);
|
||||
|
||||
bool deepSleep = true;
|
||||
bool deepSleep = false; // Disable for now, as it makes it difficult to debug why devices rebooted
|
||||
#if defined(ESP32)
|
||||
float allowedDrift = bootcount * 0.01;
|
||||
#else
|
||||
@@ -504,6 +503,16 @@ void setup() {
|
||||
#if defined(ESP8266)
|
||||
resetBootCycleCounter(deepSleep);
|
||||
#endif
|
||||
|
||||
if(rdc.magic != 0x4a) {
|
||||
rdc.last_cause = 0;
|
||||
rdc.cause = 0;
|
||||
rdc.magic = 0x4a;
|
||||
} else {
|
||||
rdc.last_cause = rdc.cause;
|
||||
rdc.cause = 0;
|
||||
}
|
||||
|
||||
hw.ledOff(LED_YELLOW);
|
||||
hw.ledOff(LED_INTERNAL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user