Commit 2929f763 authored by Simone's avatar Simone

Update temperature.cpp

parent f07d5f18
...@@ -1656,10 +1656,11 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1656,10 +1656,11 @@ ISR(TIMER0_COMPB_vect) {
case Measure_POWCONSUMPTION: case Measure_POWCONSUMPTION:
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS_POWER_CONSUMPTION_SENSOR
// raw_powconsumption_value += ADC; //remove to use an IIR filter approach // raw_powconsumption_value += ADC; //remove to use an IIR filter approach
if (ADC > 512) { //check that ADC is reading a voltage > 2.5 volts, otherwise don't take in the data. 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 -= (raw_powconsumption_value>>7); //multiply raw_powconsumption_value by 127/128
raw_powconsumption_value += ((unsigned long)ADC<<7); //add new ADC reading raw_powconsumption_value += ((unsigned long)ADC<<7); //add new ADC reading
}
#endif #endif
temp_state = PrepareTemp_0; temp_state = PrepareTemp_0;
temp_count++; temp_count++;
......
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