mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-22 09:17:02 +00:00
Compare commits
2 Commits
feat/setup
...
fix/rdc_re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c49ff9f3ec | ||
|
|
ae473cab20 |
@@ -61,14 +61,6 @@ AmsWebServer::AmsWebServer(uint8_t* buf, Stream* Debug, HwTools* hw, ResetDataCo
|
|||||||
this->hw = hw;
|
this->hw = hw;
|
||||||
this->buf = (char*) buf;
|
this->buf = (char*) buf;
|
||||||
this->rdc = rdc;
|
this->rdc = rdc;
|
||||||
if(rdc->magic != 0x4a) {
|
|
||||||
rdc->last_cause = 0;
|
|
||||||
rdc->cause = 0;
|
|
||||||
rdc->magic = 0x4a;
|
|
||||||
} else {
|
|
||||||
rdc->last_cause = rdc->cause;
|
|
||||||
rdc->cause = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmsWebServer::setup(AmsConfiguration* config, GpioConfig* gpioConfig, AmsData* meterState, AmsDataStorage* ds, EnergyAccounting* ea, RealtimePlot* rtp, AmsFirmwareUpdater* updater) {
|
void AmsWebServer::setup(AmsConfiguration* config, GpioConfig* gpioConfig, AmsData* meterState, AmsDataStorage* ds, EnergyAccounting* ea, RealtimePlot* rtp, AmsFirmwareUpdater* updater) {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ ADC_MODE(ADC_VCC);
|
|||||||
#include "ZmartChargeCloudConnector.h"
|
#include "ZmartChargeCloudConnector.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MAX_BOOT_CYCLES 8
|
||||||
#define WDT_TIMEOUT 120
|
#define WDT_TIMEOUT 120
|
||||||
#if defined(SLOW_PROC_TRIGGER_MS)
|
#if defined(SLOW_PROC_TRIGGER_MS)
|
||||||
#warning "Using predefined slow process trigger"
|
#warning "Using predefined slow process trigger"
|
||||||
@@ -191,8 +192,6 @@ CloudConnector *cloud = NULL;
|
|||||||
ZmartChargeCloudConnector *zcloud = NULL;
|
ZmartChargeCloudConnector *zcloud = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_BOOT_CYCLES 6
|
|
||||||
|
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
__NOINIT_ATTR EnergyAccountingRealtimeData rtd;
|
__NOINIT_ATTR EnergyAccountingRealtimeData rtd;
|
||||||
RTC_DATA_ATTR uint8_t bootcount = 0;
|
RTC_DATA_ATTR uint8_t bootcount = 0;
|
||||||
@@ -466,7 +465,7 @@ void setup() {
|
|||||||
float vcc = hw.getVcc();
|
float vcc = hw.getVcc();
|
||||||
debugI_P(PSTR("Voltage: %.2fV"), vcc);
|
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)
|
#if defined(ESP32)
|
||||||
float allowedDrift = bootcount * 0.01;
|
float allowedDrift = bootcount * 0.01;
|
||||||
#else
|
#else
|
||||||
@@ -500,6 +499,16 @@ void setup() {
|
|||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
resetBootCycleCounter(deepSleep);
|
resetBootCycleCounter(deepSleep);
|
||||||
#endif
|
#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_YELLOW);
|
||||||
hw.ledOff(LED_INTERNAL);
|
hw.ledOff(LED_INTERNAL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user