Commit b002c3be authored by Simone's avatar Simone

Update temperature.cpp

parent 2929f763
......@@ -1656,8 +1656,8 @@ ISR(TIMER0_COMPB_vect) {
case Measure_POWCONSUMPTION:
#if HAS_POWER_CONSUMPTION_SENSOR
// raw_powconsumption_value += ADC; //remove to use an IIR filter approach
if (ADC < (POWER_ZERO*1023)/5.0) { //check that ADC is reading a voltage > POWER_ZERO volts.
ADC += unsigned long((POWER_ZERO*1023)/5.0);
if (ADC < (POWER_ZERO*1023)/5.0) { //check that ADC is reading a voltage < POWER_ZERO volts.
ADC += (unsigned long)((POWER_ZERO*1023)/5.0);
}
raw_powconsumption_value -= (raw_powconsumption_value>>7); //multiply raw_powconsumption_value by 127/128
raw_powconsumption_value += ((unsigned long)ADC<<7); //add new ADC reading
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment