diff --git a/EmonLib.cpp b/EmonLib.cpp index eb04dc8..1c036ed 100644 --- a/EmonLib.cpp +++ b/EmonLib.cpp @@ -227,8 +227,7 @@ void EnergyMonitor::serialprint() //and Jérôme who alerted us to http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/ long EnergyMonitor::readVcc() { - long result; - + //not used on emonTx V3 - as Vcc is always 3.3V - eliminates bandgap error and need for calibration http://harizanov.com/2013/09/thoughts-on-avr-adc-accuracy/ #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328__) || defined (__AVR_ATmega328P__) @@ -247,6 +246,7 @@ long EnergyMonitor::readVcc() { #if defined(__AVR__) + long result; delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Convert while (bit_is_set(ADCSRA,ADSC));