scale properly to volts

This commit is contained in:
Matthew Kennedy 2020-09-20 13:39:14 -07:00
parent 1fca955973
commit 684760babd
1 changed files with 3 additions and 1 deletions

View File

@ -25,7 +25,9 @@ static float AverageSamples(adcsample_t* buffer, size_t idx)
idx += ADC_OVERSAMPLE;
}
return (float)sum / ADC_OVERSAMPLE;
constexpr float scale = 3.3f / (2048 * ADC_OVERSAMPLE);
return (float)sum * scale;
}
AnalogResult AnalogSample()