Include other PMS data to measurements

This commit is contained in:
samuelbles07
2024-10-22 17:13:15 +07:00
parent fd1f35f6d8
commit eeba41f497
3 changed files with 144 additions and 21 deletions
+70 -4
View File
@@ -41,10 +41,34 @@ void Measurements::maxPeriod(MeasurementType type, int max) {
_pm_10[0].update.max = max;
_pm_10[1].update.max = max;
break;
case PM01_SP:
_pm_01_sp[0].update.max = max;
_pm_01_sp[1].update.max = max;
break;
case PM25_SP:
_pm_25_sp[0].update.max = max;
_pm_25_sp[1].update.max = max;
break;
case PM10_SP:
_pm_10_sp[0].update.max = max;
_pm_10_sp[1].update.max = max;
break;
case PM03_PC:
_pm_03_pc[0].update.max = max;
_pm_03_pc[1].update.max = max;
break;
case PM01_PC:
_pm_01_pc[0].update.max = max;
_pm_01_pc[1].update.max = max;
break;
case PM25_PC:
_pm_25_pc[0].update.max = max;
_pm_25_pc[1].update.max = max;
break;
case PM10_PC:
_pm_10_pc[0].update.max = max;
_pm_10_pc[1].update.max = max;
break;
};
}
@@ -91,10 +115,34 @@ bool Measurements::update(MeasurementType type, int val, int ch) {
temporary = &_pm_10[ch];
invalidValue = utils::getInvalidPmValue();
break;
case PM01_SP:
temporary = &_pm_01_sp[ch];
invalidValue = utils::getInvalidPmValue();
break;
case PM25_SP:
temporary = &_pm_25_sp[ch];
invalidValue = utils::getInvalidPmValue();
break;
case PM10_SP:
temporary = &_pm_10_sp[ch];
invalidValue = utils::getInvalidPmValue();
break;
case PM03_PC:
temporary = &_pm_03_pc[ch];
invalidValue = utils::getInvalidPmValue();
break;
case PM01_PC:
temporary = &_pm_01_pc[ch];
invalidValue = utils::getInvalidPmValue();
break;
case PM25_PC:
temporary = &_pm_25_pc[ch];
invalidValue = utils::getInvalidPmValue();
break;
case PM10_PC:
temporary = &_pm_10_pc[ch];
invalidValue = utils::getInvalidPmValue();
break;
default:
break;
};
@@ -344,16 +392,34 @@ String Measurements::measurementTypeStr(MeasurementType type) {
str = "NOxRaw";
break;
case PM25:
str = "PM25";
str = "PM25_AE";
break;
case PM01:
str = "PM01";
str = "PM1_AE";
break;
case PM10:
str = "PM10";
str = "PM10_AE";
break;
case PM25_SP:
str = "PM25_SP";
break;
case PM01_SP:
str = "PM1_SP";
break;
case PM10_SP:
str = "PM10_SP";
break;
case PM03_PC:
str = "PM03";
str = "PM003_PC";
break;
case PM01_PC:
str = "PM01_PC";
break;
case PM25_PC:
str = "PM25_PC";
break;
case PM10_PC:
str = "PM10_PC";
break;
default:
break;
+19 -7
View File
@@ -46,10 +46,16 @@ public:
TVOCRaw,
NOx, // index value
NOxRaw,
PM25,
PM01,
PM10,
PM03_PC, // Particle count
PM01, // PM1.0 under atmospheric environment
PM25, // PM2.5 under athompheric environment
PM10, // PM10 under atmospheric environment
PM01_SP, // PM1.0 standard particle
PM25_SP, // PM2.5 standard particle
PM10_SP, // PM10 standard particle
PM03_PC, // Particle 0.3 count
PM01_PC, // Particle 1.0 count
PM25_PC, // Particle 2.5 count
PM10_PC, // Particle 10 count
};
/**
@@ -129,10 +135,16 @@ private:
IntegerValue _tvoc_raw;
IntegerValue _nox; // Index value
IntegerValue _nox_raw;
IntegerValue _pm_25[2];
IntegerValue _pm_01[2];
IntegerValue _pm_10[2];
IntegerValue _pm_01[2]; // pm 1.0 atmospheric environment
IntegerValue _pm_25[2]; // pm 2.5 atmospheric environment
IntegerValue _pm_10[2]; // pm 10 atmospheric environment
IntegerValue _pm_01_sp[2]; // pm 1.0 standard particle
IntegerValue _pm_25_sp[2]; // pm 2.5 standard particle
IntegerValue _pm_10_sp[2]; // pm 10 standard particle
IntegerValue _pm_03_pc[2]; // particle count 0.3
IntegerValue _pm_01_pc[2]; // particle count 1.0
IntegerValue _pm_25_pc[2]; // particle count 2.5
IntegerValue _pm_10_pc[2]; // particle count 10
bool _debug = false;