Add files via upload

This commit is contained in:
Al
2023-11-28 02:00:26 +01:00
committed by GitHub
parent d947a8be97
commit 2c53e28b9a

View File

@@ -37,8 +37,8 @@ private:
float RlR0CleanAirDefault; float RlR0CleanAirDefault;
float ppmCleanAir; float ppmCleanAir;
float ppmCleanAirDefault; float ppmCleanAirDefault;
double aLimit; float aLimit;
double bLimit; float bLimit;
byte sampleTimes = 10; byte sampleTimes = 10;
byte sampleInterval = 20; byte sampleInterval = 20;
byte intensity = 5; byte intensity = 5;
@@ -49,14 +49,15 @@ private:
bool _stateCalibrate = false; bool _stateCalibrate = false;
bool _stateCalibrateTH = false; bool _stateCalibrateTH = false;
String lastCalibration; String lastCalibration;
unsigned long lastCalibrationMillis;
float highRs = 0; float highRs = 0;
bool enableTempHumCorrection = false; bool enableTempHumCorrection = false;
float k1; float k1;
float k2; float k2;
float b1; float b1;
float b2; float b2;
double Hum; float Hum;
double Temp; float Temp;
double tempHumCorrection; double tempHumCorrection;
String _idTempSensor; String _idTempSensor;
String _idHumSensor; String _idHumSensor;
@@ -248,6 +249,21 @@ public:
{ {
IoTValue valTmp; IoTValue valTmp;
valTmp.isDecimal = false; valTmp.isDecimal = false;
if (lastCalibration == "00.00.00 00:00:00")
{
unsigned long miliSeconds = millis() - lastCalibrationMillis;
unsigned long seconds = miliSeconds / 1000;
unsigned long minutes = seconds / 60;
unsigned long hours = minutes / 60;
unsigned long days = hours / 24;
// miliSeconds %= 1000;
seconds %= 60;
minutes %= 60;
hours %= 24;
lastCalibration = String(days) + "d " + String(hours) + ":" + String(minutes) + ":" + String(seconds);
}
valTmp.valS = lastCalibration; valTmp.valS = lastCalibration;
String output = "By request: lastCalibration = " + String(valTmp.valS); String output = "By request: lastCalibration = " + String(valTmp.valS);
SerialPrint("I", "MQgas", output, _id); SerialPrint("I", "MQgas", output, _id);
@@ -273,7 +289,7 @@ public:
String output = "TempHumCorrection() temperature = " + String(Temp) + " humidity = " + String(Hum); String output = "TempHumCorrection() temperature = " + String(Temp) + " humidity = " + String(Hum);
SerialPrint("I", "MQgas", output, _id); SerialPrint("I", "MQgas", output, _id);
} }
return {}; // команда поддерживает возвращаемое значения. Т.е. по итогу выполнения команды или общения с внешней системой, можно вернуть значение в сценарий для дальнейшей обработки return {}; // команда поддерживает возвращаемое значения. Т.е. по итогу выполнения команды или общения с внешней системой, можно вернуть значение в сценарий для дальнейшей обработки
} }
@@ -314,6 +330,7 @@ public:
_ro = ro; // значение сопративления сенсора на воздухе _ro = ro; // значение сопративления сенсора на воздухе
_stateCalibrate = true; _stateCalibrate = true;
lastCalibration = getDateTimeDotFormated(); lastCalibration = getDateTimeDotFormated();
lastCalibrationMillis = millis();
String output = "Calibration successful! Ro in Clean Air = " + String(_ro); String output = "Calibration successful! Ro in Clean Air = " + String(_ro);
Serial.println(); Serial.println();
SerialPrint("I", "MQgas", output, _id); SerialPrint("I", "MQgas", output, _id);
@@ -335,6 +352,7 @@ public:
{ {
_stateCalibrate = true; _stateCalibrate = true;
lastCalibration = getDateTimeDotFormated(); lastCalibration = getDateTimeDotFormated();
lastCalibrationMillis = millis();
String output = "autoCalibration successful!, R0 = " + String(_ro); String output = "autoCalibration successful!, R0 = " + String(_ro);
Serial.println(); Serial.println();
SerialPrint("I", "MQgas", output, _id); SerialPrint("I", "MQgas", output, _id);