refactor pow to constant

This commit is contained in:
barbudor 2022-08-22 14:32:08 +02:00
parent 1bbec84f24
commit 4d7f78e06e
1 changed files with 7 additions and 7 deletions

View File

@ -404,7 +404,7 @@ float AdcGetMq(uint32_t idx) {
float _R0 = 10;
for (int i = 0; i < ANALOG_MQ_SAMPLES; i ++)
avg += Adc[idx].mq_samples[i];
float voltage = (avg / ANALOG_MQ_SAMPLES) * ANALOG_V33 / ((FastPrecisePow(2, ANALOG_RESOLUTION)) - 1);
float voltage = (avg / ANALOG_MQ_SAMPLES) * ANALOG_V33 / ANALOG_RANGE;
float _RS_Calc = ((ANALOG_V33 * _RL) / voltage) -_RL; //Get value of RS in a gas
if (_RS_Calc < 0) _RS_Calc = 0; //No negative values accepted.