Browse Source

Check HLW8012_USE_INTERRUPS in _powerEnabledProvider

fastled
Xose Pérez 7 years ago
parent
commit
b64cef67b7
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      code/espurna/power_hlw8012.ino

+ 9
- 7
code/espurna/power_hlw8012.ino View File

@ -80,13 +80,15 @@ double _powerEnergy() {
}
void _powerEnabledProvider() {
if (_power_enabled) {
attachInterrupt(HLW8012_CF1_PIN, _hlw_cf1_isr, CHANGE);
attachInterrupt(HLW8012_CF_PIN, _hlw_cf_isr, CHANGE);
} else {
detachInterrupt(HLW8012_CF1_PIN);
detachInterrupt(HLW8012_CF_PIN);
}
#if HLW8012_USE_INTERRUPTS
if (_power_enabled) {
attachInterrupt(HLW8012_CF1_PIN, _hlw_cf1_isr, CHANGE);
attachInterrupt(HLW8012_CF_PIN, _hlw_cf_isr, CHANGE);
} else {
detachInterrupt(HLW8012_CF1_PIN);
detachInterrupt(HLW8012_CF_PIN);
}
#endif
}
void _powerCalibrateProvider(unsigned char magnitude, double value) {


Loading…
Cancel
Save