Skip to content

Commit

Permalink
Fix Domoticz battery level at 200 when ADC voltage reading is disabled
Browse files Browse the repository at this point in the history
Fix Domoticz battery level at 200 when ADC voltage reading is disabled (arendst#6033)
  • Loading branch information
arendst committed Jul 8, 2019
1 parent 86314e2 commit 57310a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sonoff/xdrv_07_domoticz.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -62,6 +63,7 @@ int DomoticzBatteryQuality(void)
} else {
quality = (voltage - 2600) / 10;
}
#endif
return quality;
}

Expand Down

0 comments on commit 57310a7

Please sign in to comment.