mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-03-25 10:10:01 +03:00
Added defaults in fctn
This commit is contained in:
parent
6d1229977e
commit
93d8685378
@ -8,61 +8,73 @@
|
|||||||
if(_type == 2)
|
if(_type == 2)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ2, sizeof(_MQ2));
|
memcpy(_MQ, _MQ2, sizeof(_MQ2));
|
||||||
|
_ratioInCleanAir = RatioMQ2CleanAir;
|
||||||
//_MQ = MQ2;
|
//_MQ = MQ2;
|
||||||
}
|
}
|
||||||
else if(_type == 3)
|
else if(_type == 3)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ3, sizeof(_MQ3));
|
memcpy(_MQ, _MQ3, sizeof(_MQ3));
|
||||||
|
_ratioInCleanAir = RatioMQ3CleanAir;
|
||||||
//_MQ = MQ3;
|
//_MQ = MQ3;
|
||||||
}
|
}
|
||||||
else if(_type == 4)
|
else if(_type == 4)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ4, sizeof(_MQ4));
|
memcpy(_MQ, _MQ4, sizeof(_MQ4));
|
||||||
|
_ratioInCleanAir = RatioMQ4CleanAir;
|
||||||
//_MQ = MQ4;
|
//_MQ = MQ4;
|
||||||
}
|
}
|
||||||
else if(_type == 5)
|
else if(_type == 5)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ5, sizeof(_MQ5));
|
memcpy(_MQ, _MQ5, sizeof(_MQ5));
|
||||||
|
_ratioInCleanAir = RatioMQ5CleanAir;
|
||||||
//_MQ = MQ5;
|
//_MQ = MQ5;
|
||||||
}
|
}
|
||||||
else if(_type == 6)
|
else if(_type == 6)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ6, sizeof(_MQ6));
|
memcpy(_MQ, _MQ6, sizeof(_MQ6));
|
||||||
|
_ratioInCleanAir = RatioMQ6CleanAir;
|
||||||
//_MQ = MQ6;
|
//_MQ = MQ6;
|
||||||
}
|
}
|
||||||
else if(_type == 7)
|
else if(_type == 7)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ7, sizeof(_MQ7));
|
memcpy(_MQ, _MQ7, sizeof(_MQ7));
|
||||||
|
_ratioInCleanAir = RatioMQ7CleanAir;
|
||||||
//_MQ = MQ7;
|
//_MQ = MQ7;
|
||||||
}
|
}
|
||||||
else if(_type == 8)
|
else if(_type == 8)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ8, sizeof(_MQ8));
|
memcpy(_MQ, _MQ8, sizeof(_MQ8));
|
||||||
|
_ratioInCleanAir = RatioMQ8CleanAir;
|
||||||
//_MQ = MQ8;
|
//_MQ = MQ8;
|
||||||
}
|
}
|
||||||
else if(_type == 9)
|
else if(_type == 9)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ9, sizeof(_MQ9));
|
memcpy(_MQ, _MQ9, sizeof(_MQ9));
|
||||||
|
_ratioInCleanAir = RatioMQ9CleanAir;
|
||||||
//_MQ = MQ9;
|
//_MQ = MQ9;
|
||||||
}
|
}
|
||||||
else if(_type == 131)
|
else if(_type == 131)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ131, sizeof(_MQ131));
|
memcpy(_MQ, _MQ131, sizeof(_MQ131));
|
||||||
|
_ratioInCleanAir = RatioMQ131CleanAir;
|
||||||
//_MQ = MQ131;
|
//_MQ = MQ131;
|
||||||
}
|
}
|
||||||
else if(_type == 135)
|
else if(_type == 135)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ135, sizeof(_MQ135));
|
memcpy(_MQ, _MQ135, sizeof(_MQ135));
|
||||||
|
_ratioInCleanAir = RatioMQ135CleanAir;
|
||||||
//_MQ = MQ135;
|
//_MQ = MQ135;
|
||||||
}
|
}
|
||||||
else if(_type == 303)
|
else if(_type == 303)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ303A, sizeof(_MQ303A));
|
memcpy(_MQ, _MQ303A, sizeof(_MQ303A));
|
||||||
|
_ratioInCleanAir = RatioMQ303CleanAir;
|
||||||
//_MQ = MQ303A;
|
//_MQ = MQ303A;
|
||||||
}
|
}
|
||||||
else if(_type == 309)
|
else if(_type == 309)
|
||||||
{
|
{
|
||||||
memcpy(_MQ, _MQ309A, sizeof(_MQ309A));
|
memcpy(_MQ, _MQ309A, sizeof(_MQ309A));
|
||||||
|
_ratioInCleanAir = RatioMQ309CleanAir;
|
||||||
//_MQ = MQ309;
|
//_MQ = MQ309;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,57 +234,6 @@ void MQUnifiedsensor::setDefaultGas()
|
|||||||
_nameLectureRequeired = defaultMQ309;
|
_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)
|
double MQUnifiedsensor::stringToDouble(String & str)
|
||||||
{
|
{
|
||||||
return atof( str.c_str() );
|
return atof( str.c_str() );
|
||||||
|
@ -75,7 +75,6 @@ class MQUnifiedsensor
|
|||||||
void setVoltResolution(float voltaje);
|
void setVoltResolution(float voltaje);
|
||||||
void setSensorCharacteristics(String nameLectureReqeuired, bool print);
|
void setSensorCharacteristics(String nameLectureReqeuired, bool print);
|
||||||
void setDefaultGas();
|
void setDefaultGas();
|
||||||
void setRatioInCleanAir();
|
|
||||||
|
|
||||||
int readSensor(String nameLectureRequeired = "", bool print = false);
|
int readSensor(String nameLectureRequeired = "", bool print = false);
|
||||||
int readPPM(int m, int b);
|
int readPPM(int m, int b);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user