Added defaults in fctn

This commit is contained in:
miguel5612 2019-05-29 21:03:46 -05:00
parent 6d1229977e
commit 93d8685378
2 changed files with 12 additions and 52 deletions

View File

@ -8,61 +8,73 @@
if(_type == 2)
{
memcpy(_MQ, _MQ2, sizeof(_MQ2));
_ratioInCleanAir = RatioMQ2CleanAir;
//_MQ = MQ2;
}
else if(_type == 3)
{
memcpy(_MQ, _MQ3, sizeof(_MQ3));
_ratioInCleanAir = RatioMQ3CleanAir;
//_MQ = MQ3;
}
else if(_type == 4)
{
memcpy(_MQ, _MQ4, sizeof(_MQ4));
_ratioInCleanAir = RatioMQ4CleanAir;
//_MQ = MQ4;
}
else if(_type == 5)
{
memcpy(_MQ, _MQ5, sizeof(_MQ5));
_ratioInCleanAir = RatioMQ5CleanAir;
//_MQ = MQ5;
}
else if(_type == 6)
{
memcpy(_MQ, _MQ6, sizeof(_MQ6));
_ratioInCleanAir = RatioMQ6CleanAir;
//_MQ = MQ6;
}
else if(_type == 7)
{
memcpy(_MQ, _MQ7, sizeof(_MQ7));
_ratioInCleanAir = RatioMQ7CleanAir;
//_MQ = MQ7;
}
else if(_type == 8)
{
memcpy(_MQ, _MQ8, sizeof(_MQ8));
_ratioInCleanAir = RatioMQ8CleanAir;
//_MQ = MQ8;
}
else if(_type == 9)
{
memcpy(_MQ, _MQ9, sizeof(_MQ9));
_ratioInCleanAir = RatioMQ9CleanAir;
//_MQ = MQ9;
}
else if(_type == 131)
{
memcpy(_MQ, _MQ131, sizeof(_MQ131));
_ratioInCleanAir = RatioMQ131CleanAir;
//_MQ = MQ131;
}
else if(_type == 135)
{
memcpy(_MQ, _MQ135, sizeof(_MQ135));
_ratioInCleanAir = RatioMQ135CleanAir;
//_MQ = MQ135;
}
else if(_type == 303)
{
memcpy(_MQ, _MQ303A, sizeof(_MQ303A));
_ratioInCleanAir = RatioMQ303CleanAir;
//_MQ = MQ303A;
}
else if(_type == 309)
{
memcpy(_MQ, _MQ309A, sizeof(_MQ309A));
_ratioInCleanAir = RatioMQ309CleanAir;
//_MQ = MQ309;
}
}
@ -222,57 +234,6 @@ void MQUnifiedsensor::setDefaultGas()
_nameLectureRequeired = defaultMQ309;
}
}
void MQUnifiedsensor::setRatioInCleanAir()
{
if(_type == 2)
{
_ratioInCleanAir = RatioMQ2CleanAir;
}
else if(_type == 3)
{
_ratioInCleanAir = RatioMQ3CleanAir;
}
else if(_type == 4)
{
_ratioInCleanAir = RatioMQ4CleanAir;
}
else if(_type == 5)
{
_ratioInCleanAir = RatioMQ5CleanAir;
}
else if(_type == 6)
{
_ratioInCleanAir = RatioMQ6CleanAir;
}
else if(_type == 7)
{
_ratioInCleanAir = RatioMQ7CleanAir;
}
else if(_type == 8)
{
_ratioInCleanAir = RatioMQ8CleanAir;
}
else if(_type == 9)
{
_ratioInCleanAir = RatioMQ9CleanAir;
}
else if(_type == 131)
{
_ratioInCleanAir = RatioMQ131CleanAir;
}
else if(_type == 135)
{
_ratioInCleanAir = RatioMQ135CleanAir;
}
else if(_type == 303)
{
_ratioInCleanAir = RatioMQ303CleanAir;
}
else if(_type == 309)
{
_ratioInCleanAir = RatioMQ309CleanAir;
}
}
double MQUnifiedsensor::stringToDouble(String & str)
{
return atof( str.c_str() );

View File

@ -75,7 +75,6 @@ class MQUnifiedsensor
void setVoltResolution(float voltaje);
void setSensorCharacteristics(String nameLectureReqeuired, bool print);
void setDefaultGas();
void setRatioInCleanAir();
int readSensor(String nameLectureRequeired = "", bool print = false);
int readPPM(int m, int b);