mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-06-07 22:30:13 +03:00
Merge branch 'master' into codex/resolver-issues-del-repositorio
This commit is contained in:
commit
f7fae4e03c
@ -246,6 +246,15 @@ test(MQ303A_Ethanol)
|
|||||||
assertEqual(PPM,ppmExp);
|
assertEqual(PPM,ppmExp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test(MQ303A_VoltResolution)
|
||||||
|
{
|
||||||
|
float vRes = 4.7;
|
||||||
|
MQ303A.setVoltResolution(vRes);
|
||||||
|
MQ303A.setADC(100); // provide dummy ADC value
|
||||||
|
MQ303A.readSensor(true); // dummy read for MQ303A
|
||||||
|
assertEqualFloat(MQ303A.getVoltResolution(), vRes);
|
||||||
|
}
|
||||||
|
|
||||||
test(MQ309A_CO)
|
test(MQ309A_CO)
|
||||||
{
|
{
|
||||||
MQ309A.setRegressionMethod(1); //_PPM = a*ratio^b
|
MQ309A.setRegressionMethod(1); //_PPM = a*ratio^b
|
||||||
|
@ -152,8 +152,10 @@ float MQUnifiedsensor::validateEcuation(float ratioInput)
|
|||||||
float MQUnifiedsensor::readSensor(bool isMQ303A, float correctionFactor, bool injected)
|
float MQUnifiedsensor::readSensor(bool isMQ303A, float correctionFactor, bool injected)
|
||||||
{
|
{
|
||||||
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
||||||
|
|
||||||
|
float voltRes = _VOLT_RESOLUTION; // preserve global resolution
|
||||||
if(isMQ303A) {
|
if(isMQ303A) {
|
||||||
_VOLT_RESOLUTION = _VOLT_RESOLUTION - 0.45; //Calculations for RS using mq303a sensor look wrong #42
|
voltRes = voltRes - 0.45; //Calculations for RS using mq303a sensor look wrong #42
|
||||||
}
|
}
|
||||||
_RS_Calc = ((_VCC*_RL)/_sensor_volt)-_RL; //Get value of RS in a gas
|
_RS_Calc = ((_VCC*_RL)/_sensor_volt)-_RL; //Get value of RS in a gas
|
||||||
if(_RS_Calc < 0) _RS_Calc = 0; //No negative values accepted.
|
if(_RS_Calc < 0) _RS_Calc = 0; //No negative values accepted.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user