Correct naming

This commit is contained in:
Theo Arends 2022-06-10 10:20:31 +02:00
parent 8f60d464f3
commit 84ec331b62

View File

@ -41,7 +41,7 @@
//#define ADE7880_DEBUG //#define ADE7880_DEBUG
//#define ADE7880_PROFILING //#define ADE7880_PROFILING
#define ADE7880_HEARTBEAT 5 // Allow x seconds of missed interrupts before reinit #define ADE7880_WATCHDOG 5 // Allow x seconds of missed interrupts before reinit
// Default calibration parameters can be overridden by a rule as documented above. // Default calibration parameters can be overridden by a rule as documented above.
#define ADE7880_FREQ_INIT 0 // Connected to networks with fundamental frequencies between 55 Hz and 66 Hz (1). Default 45 Hz to 55 Hz (0). #define ADE7880_FREQ_INIT 0 // Connected to networks with fundamental frequencies between 55 Hz and 66 Hz (1). Default 45 Hz to 55 Hz (0).
@ -264,7 +264,7 @@ struct Ade7880 {
bool calib_frequency; bool calib_frequency;
bool irq0_state; bool irq0_state;
uint8_t cycle_count; uint8_t cycle_count;
uint8_t heartbeat; uint8_t watchdog;
} Ade7880; } Ade7880;
/*********************************************************************************************/ /*********************************************************************************************/
@ -463,7 +463,7 @@ bool Ade7880SetCalibrate(void) {
#endif // ADE7880_PROFILING #endif // ADE7880_PROFILING
if (Ade7880Init()) { if (Ade7880Init()) {
Ade7880.heartbeat = 0; Ade7880.watchdog = 0;
return true; return true;
} }
} }
@ -538,7 +538,7 @@ void Ade7880Service0(void) {
// Poll sequence // Poll sequence
SkipSleep(false); SkipSleep(false);
Ade7880Cycle(); Ade7880Cycle();
Ade7880.heartbeat = 0; Ade7880.watchdog = 0;
Ade7880.irq0_state = 0; Ade7880.irq0_state = 0;
} }
@ -550,10 +550,10 @@ void IRAM_ATTR Ade7880Isr0(void) {
} }
} }
void Ade7880Heartbeat(void) { void Ade7880Watchdog(void) {
// Reinit if interrupt stopped // Reinit if interrupt stopped
Ade7880.heartbeat++; Ade7880.watchdog++;
if (Ade7880.heartbeat > ADE7880_HEARTBEAT) { if (Ade7880.watchdog > ADE7880_WATCHDOG) {
AddLog(LOG_LEVEL_DEBUG, PSTR("A78: Reinit")); AddLog(LOG_LEVEL_DEBUG, PSTR("A78: Reinit"));
Ade7880SetCalibrate(); Ade7880SetCalibrate();
} }
@ -762,7 +762,7 @@ bool Xnrg23(uint8_t function) {
if (Ade7880.irq0_state) { Ade7880Service0(); } if (Ade7880.irq0_state) { Ade7880Service0(); }
break; break;
case FUNC_EVERY_SECOND: case FUNC_EVERY_SECOND:
Ade7880Heartbeat(); Ade7880Watchdog();
break; break;
#ifdef ADE7880_MORE_REGS #ifdef ADE7880_MORE_REGS
case FUNC_JSON_APPEND: case FUNC_JSON_APPEND: