mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
refactor pow to constant
This commit is contained in:
parent
1bbec84f24
commit
4d7f78e06e
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user