|
@ -141,17 +141,19 @@ void _powerLoopProvider(bool before) { |
|
|
|
|
|
|
|
|
static unsigned long last = 0; |
|
|
static unsigned long last = 0; |
|
|
if (millis() - last > POWER_READ_INTERVAL) { |
|
|
if (millis() - last > POWER_READ_INTERVAL) { |
|
|
|
|
|
|
|
|
last = millis(); |
|
|
last = millis(); |
|
|
_power_newdata = true; |
|
|
_power_newdata = true; |
|
|
|
|
|
|
|
|
|
|
|
// Toggle between current and voltage monitoring
|
|
|
|
|
|
#if (HLW8012_USE_INTERRUPTS == 0)
|
|
|
|
|
|
_hlw8012.toggleMode(); |
|
|
|
|
|
#endif // (HLW8012_USE_INTERRUPTS == 0)
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
|
|
|
|
|
|
// Toggle between current and voltage monitoring
|
|
|
|
|
|
#if (HLW8012_USE_INTERRUPTS == 0)
|
|
|
|
|
|
_hlw8012.toggleMode(); |
|
|
|
|
|
#endif // (HLW8012_USE_INTERRUPTS == 0)
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|