Update BaseMQ.cpp

This commit is contained in:
Igor89 2016-05-12 17:53:29 +03:00
parent f45756d36e
commit 3e6a1379ab

View File

@ -11,12 +11,13 @@ BaseMQ::BaseMQ(uint8_t pin, uint8_t pinHeater) {
_prMillis = 0; _prMillis = 0;
} }
// калибровка датчика
void BaseMQ::calibrate(float ro) { void BaseMQ::calibrate(float ro) {
_ro = ro; _ro = ro;
_stateCalibrate = true; _stateCalibrate = true;
} }
// калиброка датчика // калибровка датчика
void BaseMQ::calibrate() { void BaseMQ::calibrate() {
float ro = 0; float ro = 0;
for (int i = 0; i < MQ_SAMPLE_TIMES; i++) { for (int i = 0; i < MQ_SAMPLE_TIMES; i++) {
@ -47,7 +48,7 @@ void BaseMQ::heaterPwrOff() {
_heater = false; _heater = false;
} }
// сопративление датчика // сопротивление датчика
float BaseMQ::calculateResistance(int rawAdc) { float BaseMQ::calculateResistance(int rawAdc) {
float vrl = rawAdc*(5.0 / 1023); float vrl = rawAdc*(5.0 / 1023);
float rsAir = (5.0 - vrl)/vrl*getRL(); float rsAir = (5.0 - vrl)/vrl*getRL();
@ -78,14 +79,14 @@ float BaseMQ::readRatio() {
} }
bool BaseMQ::heatingCompleted() { bool BaseMQ::heatingCompleted() {
if ((_heater) && (!_cooler) && (millis() - _prMillis > 3000)) if ((_heater) && (!_cooler) && (millis() - _prMillis > 60000))
return true; return true;
else else
return false; return false;
} }
bool BaseMQ::coolanceCompleted() { bool BaseMQ::coolanceCompleted() {
if ((_heater) && (_cooler) && (millis() - _prMillis > 5000)) if ((_heater) && (_cooler) && (millis() - _prMillis > 90000))
return true; return true;
else else
return false; return false;