From 57310a76999a4d6b8502d5855b43009775fca885 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 8 Jul 2019 12:52:26 +0200 Subject: [PATCH] Fix Domoticz battery level at 200 when ADC voltage reading is disabled Fix Domoticz battery level at 200 when ADC voltage reading is disabled (#6033) --- sonoff/xdrv_07_domoticz.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sonoff/xdrv_07_domoticz.ino b/sonoff/xdrv_07_domoticz.ino index d67c771c3de5..c79710081389 100644 --- a/sonoff/xdrv_07_domoticz.ino +++ b/sonoff/xdrv_07_domoticz.ino @@ -52,8 +52,9 @@ int DomoticzBatteryQuality(void) // Battery 100%: ESP 3.6V (maximum operating voltage is 3.6) // Battery 101% to 200%: ESP over 3.6V (means over maximum operating voltage) - int quality = 0; // Voltage range from 2,6V > 0% to 3,6V > 100% + int quality = 100; // Voltage range from 2,6V > 0% to 3,6V > 100% +#ifdef USE_ADC_VCC uint16_t voltage = ESP.getVcc(); if (voltage <= 2600) { quality = 0; @@ -62,6 +63,7 @@ int DomoticzBatteryQuality(void) } else { quality = (voltage - 2600) / 10; } +#endif return quality; }