From ad404dfc0c86d0463ce771ecd730b36ee37d2d02 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 30 Jun 2023 11:55:48 +0200 Subject: [PATCH] Allow disable of frequency Allow disable of frequency in dummy driver --- tasmota/tasmota_xnrg_energy/xnrg_30_dummy.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xnrg_energy/xnrg_30_dummy.ino b/tasmota/tasmota_xnrg_energy/xnrg_30_dummy.ino index 3f51b1ce6..1f6735f3e 100644 --- a/tasmota/tasmota_xnrg_energy/xnrg_30_dummy.ino +++ b/tasmota/tasmota_xnrg_energy/xnrg_30_dummy.ino @@ -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]) {