mirror of https://github.com/arendst/Tasmota.git
oversample ADC_RANGE by 32 like ADC_INPUT (#17975)
This commit is contained in:
parent
d8d9c549ab
commit
119aeca4d9
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue