|
@ -597,12 +597,34 @@ void _sensorConfigure() { |
|
|
delSetting("pwrRatioC"); |
|
|
delSetting("pwrRatioC"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (getSetting("pwrResetE", 0).toInt() == 1) { |
|
|
|
|
|
sensor->resetEnergy(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
sensor->setVoltage(getSetting("pwrVoltage", EMON_MAINS_VOLTAGE).toInt()); |
|
|
sensor->setVoltage(getSetting("pwrVoltage", EMON_MAINS_VOLTAGE).toInt()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // EMON_ANALOG_SUPPORT
|
|
|
#endif // EMON_ANALOG_SUPPORT
|
|
|
|
|
|
|
|
|
|
|
|
#if EMON_ADC121_SUPPORT
|
|
|
|
|
|
if (_sensors[i]->getID() == SENSOR_EMON_ADC121_ID) { |
|
|
|
|
|
EmonADC121Sensor * sensor = (EmonADC121Sensor *) _sensors[i]; |
|
|
|
|
|
if (getSetting("pwrResetE", 0).toInt() == 1) { |
|
|
|
|
|
sensor->resetEnergy(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if EMON_ADS1X15_SUPPORT
|
|
|
|
|
|
if (_sensors[i]->getID() == SENSOR_EMON_ADS1X15_ID) { |
|
|
|
|
|
EmonADS1X15Sensor * sensor = (EmonADS1X15Sensor *) _sensors[i]; |
|
|
|
|
|
if (getSetting("pwrResetE", 0).toInt() == 1) { |
|
|
|
|
|
sensor->resetEnergy(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
#if HLW8012_SUPPORT
|
|
|
#if HLW8012_SUPPORT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -626,6 +648,10 @@ void _sensorConfigure() { |
|
|
setSetting("pwrRatioP", sensor->getPowerRatio()); |
|
|
setSetting("pwrRatioP", sensor->getPowerRatio()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (getSetting("pwrResetE", 0).toInt() == 1) { |
|
|
|
|
|
sensor->resetEnergy(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (getSetting("pwrResetCalibration", 0).toInt() == 1) { |
|
|
if (getSetting("pwrResetCalibration", 0).toInt() == 1) { |
|
|
sensor->resetRatios(); |
|
|
sensor->resetRatios(); |
|
|
delSetting("pwrRatioC"); |
|
|
delSetting("pwrRatioC"); |
|
@ -649,6 +675,7 @@ void _sensorConfigure() { |
|
|
delSetting("pwrExpectedC"); |
|
|
delSetting("pwrExpectedC"); |
|
|
delSetting("pwrExpectedV"); |
|
|
delSetting("pwrExpectedV"); |
|
|
delSetting("pwrResetCalibration"); |
|
|
delSetting("pwrResetCalibration"); |
|
|
|
|
|
delSetting("pwrResetE"); |
|
|
saveSettings(); |
|
|
saveSettings(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|