Allow disable of frequency

Allow disable of frequency in dummy driver
This commit is contained in:
Theo Arends 2023-06-30 11:55:48 +02:00
parent 1e3b41dd2d
commit ad404dfc0c
1 changed files with 4 additions and 2 deletions

View File

@ -65,8 +65,10 @@ void NrgDummyEverySecond(void) {
float current_calibration = (float)EnergyGetCalibration(ENERGY_CURRENT_CALIBRATION, channel) / 100000;
float frequency_calibration = (float)EnergyGetCalibration(ENERGY_FREQUENCY_CALIBRATION, channel) / 100;
Energy->voltage[channel] = voltage_calibration; // V
Energy->frequency[channel] = frequency_calibration; // Hz
if (voltage_calibration > 100) {
Energy->voltage[channel] = voltage_calibration; // V
}
Energy->frequency[channel] = (frequency_calibration > 45) ? frequency_calibration : NAN; // Hz
if (bitRead(TasmotaGlobal.power, channel)) { // Emulate power read only if device is powered on
Energy->active_power[channel] = (NrgDummy.power[channel]) ? ((float)NrgDummy.power[channel] / 1000) : power_calibration; // W
if (0 == Energy->active_power[channel]) {