oversample ADC_RANGE by 32 like ADC_INPUT (#17975)

This commit is contained in:
Barbudor 2023-02-17 22:33:06 +01:00 committed by GitHub
parent d8d9c549ab
commit 119aeca4d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -452,7 +452,7 @@ float AdcGetRange(uint32_t idx) {
// formula for calibration: value, fromLow, fromHigh, toLow, toHigh
// Example: 514, 632, 236, 0, 100
// int( ((<param2> - <analog-value>) / (<param2> - <param1>) ) * (<param3> - <param4>) ) + <param4> )
int adc = AdcRead(Adc[idx].pin, 2);
int adc = AdcRead(Adc[idx].pin, 5);
double adcrange = ( ((double)Adc[idx].param2 - (double)adc) / ( ((double)Adc[idx].param2 - (double)Adc[idx].param1)) * ((double)Adc[idx].param3 - (double)Adc[idx].param4) + (double)Adc[idx].param4 );
return (float)adcrange;
}