fix analog input

This commit is contained in:
Matthew Kennedy 2020-10-26 14:06:00 -07:00
parent 55d693e9a5
commit 8939670c7a
1 changed files with 2 additions and 2 deletions

View File

@ -26,10 +26,10 @@ static float AverageSamples(adcsample_t* buffer, size_t idx)
for (size_t i = 0; i < ADC_OVERSAMPLE; i++)
{
sum += buffer[idx];
idx += ADC_OVERSAMPLE;
idx += ADC_CHANNEL_COUNT;
}
constexpr float scale = 3.3f / (2048 * ADC_OVERSAMPLE);
constexpr float scale = 3.3f / (4095 * ADC_OVERSAMPLE);
return (float)sum * scale;
}