mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-06-25 15:51:32 +02:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
6a83743e2a | |||
faaf051e39 | |||
280ea5e997 | |||
566f8a63b4 | |||
9e4d52454b | |||
5f5e985309 | |||
d638573ca7 | |||
79fbd901bd | |||
3644dc43fe | |||
03fa62d8f0 | |||
902a768f28 | |||
1de9344f43 | |||
46f6309b77 | |||
a6b48acb41 | |||
1b4d89e1a1 | |||
0d2b0fb657 |
@ -156,7 +156,7 @@ If the monitor is set up on the AirGradient dashboard, it will also receive the
|
||||
| `tvocLearningOffset` | Set VOC learning gain offset. | Number | 0-720 (default 12) | `{"tvocLearningOffset": 12}` |
|
||||
| `offlineMode` | Set monitor to run without WiFi. | Boolean | `false`: Disabled (default) <br> `true`: Enabled | `{"offlineMode": true}` |
|
||||
| `monitorDisplayCompensatedValues` | Set the display show the PM value with/without compensate value (only on [3.1.9]()) | Boolean | `false`: Without compensate (default) <br> `true`: with compensate | `{"monitorDisplayCompensatedValues": false }` |
|
||||
| `corrections` | Sets correction options to display and measurement values on local server response. | Object | _see corrections section_ | _see corrections section_ |
|
||||
| `corrections` | Sets correction options to display and measurement values on local server response. (version >= [3.1.11]()) | Object | _see corrections section_ | _see corrections section_ |
|
||||
|
||||
|
||||
|
||||
@ -206,11 +206,11 @@ curl --location -X PUT 'http://airgradient_84fce612eff4.local/config' --header '
|
||||
- PMS5003_20231218
|
||||
|
||||
```bash
|
||||
curl --location -X PUT 'http://airgradient_84fce612eff4.local/config' --header 'Content-Type: application/json' --data '{"corrections":{"pm02":{"correctionAlgorithm":"slr_PMS5003_20231218","slr":{"intercept":0,"scalingFactor":0,03525,"useEpa2021":true}}}}'
|
||||
curl --location -X PUT 'http://airgradient_84fce612eff4.local/config' --header 'Content-Type: application/json' --data '{"corrections":{"pm02":{"correctionAlgorithm":"slr_PMS5003_20231218","slr":{"intercept":0,"scalingFactor":0.03525,"useEpa2021":true}}}}'
|
||||
```
|
||||
|
||||
- PMS5003_20240104
|
||||
|
||||
```bash
|
||||
curl --location -X PUT 'http://airgradient_84fce612eff4.local/config' --header 'Content-Type: application/json' --data '{"corrections":{"pm02":{"correctionAlgorithm":"slr_PMS5003_20240104","slr":{"intercept":0,"scalingFactor":0.02896,"useEpa2021":true}}}}'
|
||||
```
|
||||
```
|
||||
|
@ -57,26 +57,20 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge", "dbm");
|
||||
add_metric_point("", String(wifiConnector.RSSI()));
|
||||
|
||||
if (config.hasSensorS8 && measure.CO2 >= 0) {
|
||||
add_metric("co2",
|
||||
"Carbon dioxide concentration as measured by the AirGradient S8 "
|
||||
"sensor, in parts per million",
|
||||
"gauge", "ppm");
|
||||
add_metric_point("", String(measure.CO2));
|
||||
}
|
||||
|
||||
// Initialize default invalid value for each measurements
|
||||
float _temp = utils::getInvalidTemperature();
|
||||
float _hum = utils::getInvalidHumidity();
|
||||
int pm01 = utils::getInvalidPmValue();
|
||||
int pm25 = utils::getInvalidPmValue();
|
||||
int pm10 = utils::getInvalidPmValue();
|
||||
int pm03PCount = utils::getInvalidPmValue();
|
||||
int co2 = utils::getInvalidCO2();
|
||||
int atmpCompensated = utils::getInvalidTemperature();
|
||||
int ahumCompensated = utils::getInvalidHumidity();
|
||||
int tvoc = utils::getInvalidVOC();
|
||||
int tvoc_raw = utils::getInvalidVOC();
|
||||
int tvocRaw = utils::getInvalidVOC();
|
||||
int nox = utils::getInvalidNOx();
|
||||
int nox_raw = utils::getInvalidNOx();
|
||||
int noxRaw = utils::getInvalidNOx();
|
||||
|
||||
if (config.hasSensorSHT) {
|
||||
_temp = measure.getFloat(Measurements::Temperature);
|
||||
@ -94,9 +88,13 @@ String OpenMetrics::getPayload(void) {
|
||||
|
||||
if (config.hasSensorSGP) {
|
||||
tvoc = measure.get(Measurements::TVOC);
|
||||
tvoc_raw = measure.get(Measurements::TVOCRaw);
|
||||
tvocRaw = measure.get(Measurements::TVOCRaw);
|
||||
nox = measure.get(Measurements::NOx);
|
||||
nox_raw = measure.get(Measurements::NOxRaw);
|
||||
noxRaw = measure.get(Measurements::NOxRaw);
|
||||
}
|
||||
|
||||
if (config.hasSensorS8) {
|
||||
co2 = measure.get(Measurements::CO2);
|
||||
}
|
||||
|
||||
if (config.hasSensorPMS1) {
|
||||
@ -138,12 +136,12 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge");
|
||||
add_metric_point("", String(tvoc));
|
||||
}
|
||||
if (utils::isValidVOC(tvoc_raw)) {
|
||||
if (utils::isValidVOC(tvocRaw)) {
|
||||
add_metric("tvoc_raw",
|
||||
"The raw input value to the Total Volatile Organic Compounds "
|
||||
"(TVOC) index as measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(tvoc_raw));
|
||||
add_metric_point("", String(tvocRaw));
|
||||
}
|
||||
if (utils::isValidNOx(nox)) {
|
||||
add_metric("nox_index",
|
||||
@ -152,15 +150,23 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge");
|
||||
add_metric_point("", String(nox));
|
||||
}
|
||||
if (utils::isValidNOx(nox_raw)) {
|
||||
if (utils::isValidNOx(noxRaw)) {
|
||||
add_metric("nox_raw",
|
||||
"The raw input value to the Nitrous Oxide (NOx) index as "
|
||||
"measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(nox_raw));
|
||||
add_metric_point("", String(noxRaw));
|
||||
}
|
||||
}
|
||||
|
||||
if (utils::isValidCO2(co2)) {
|
||||
add_metric("co2",
|
||||
"Carbon dioxide concentration as measured by the AirGradient S8 "
|
||||
"sensor, in parts per million",
|
||||
"gauge", "ppm");
|
||||
add_metric_point("", String(co2));
|
||||
}
|
||||
|
||||
if (utils::isValidTemperature(_temp)) {
|
||||
add_metric(
|
||||
"temperature",
|
||||
|
@ -57,26 +57,20 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge", "dbm");
|
||||
add_metric_point("", String(wifiConnector.RSSI()));
|
||||
|
||||
if (config.hasSensorS8 && measure.CO2 >= 0) {
|
||||
add_metric("co2",
|
||||
"Carbon dioxide concentration as measured by the AirGradient S8 "
|
||||
"sensor, in parts per million",
|
||||
"gauge", "ppm");
|
||||
add_metric_point("", String(measure.CO2));
|
||||
}
|
||||
|
||||
// Initialize default invalid value for each measurements
|
||||
float _temp = utils::getInvalidTemperature();
|
||||
float _hum = utils::getInvalidHumidity();
|
||||
int pm01 = utils::getInvalidPmValue();
|
||||
int pm25 = utils::getInvalidPmValue();
|
||||
int pm10 = utils::getInvalidPmValue();
|
||||
int pm03PCount = utils::getInvalidPmValue();
|
||||
int co2 = utils::getInvalidCO2();
|
||||
int atmpCompensated = utils::getInvalidTemperature();
|
||||
int ahumCompensated = utils::getInvalidHumidity();
|
||||
int tvoc = utils::getInvalidVOC();
|
||||
int tvoc_raw = utils::getInvalidVOC();
|
||||
int tvocRaw = utils::getInvalidVOC();
|
||||
int nox = utils::getInvalidNOx();
|
||||
int nox_raw = utils::getInvalidNOx();
|
||||
int noxRaw = utils::getInvalidNOx();
|
||||
|
||||
if (config.hasSensorSHT) {
|
||||
_temp = measure.getFloat(Measurements::Temperature);
|
||||
@ -94,9 +88,13 @@ String OpenMetrics::getPayload(void) {
|
||||
|
||||
if (config.hasSensorSGP) {
|
||||
tvoc = measure.get(Measurements::TVOC);
|
||||
tvoc_raw = measure.get(Measurements::TVOCRaw);
|
||||
tvocRaw = measure.get(Measurements::TVOCRaw);
|
||||
nox = measure.get(Measurements::NOx);
|
||||
nox_raw = measure.get(Measurements::NOxRaw);
|
||||
noxRaw = measure.get(Measurements::NOxRaw);
|
||||
}
|
||||
|
||||
if (config.hasSensorS8) {
|
||||
co2 = measure.get(Measurements::CO2);
|
||||
}
|
||||
|
||||
if (config.hasSensorPMS1) {
|
||||
@ -138,12 +136,13 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge");
|
||||
add_metric_point("", String(tvoc));
|
||||
}
|
||||
if (utils::isValidVOC(tvoc_raw)) {
|
||||
|
||||
if (utils::isValidVOC(tvocRaw)) {
|
||||
add_metric("tvoc_raw",
|
||||
"The raw input value to the Total Volatile Organic Compounds "
|
||||
"(TVOC) index as measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(tvoc_raw));
|
||||
add_metric_point("", String(tvocRaw));
|
||||
}
|
||||
if (utils::isValidNOx(nox)) {
|
||||
add_metric("nox_index",
|
||||
@ -152,15 +151,23 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge");
|
||||
add_metric_point("", String(nox));
|
||||
}
|
||||
if (utils::isValidNOx(nox_raw)) {
|
||||
if (utils::isValidNOx(noxRaw)) {
|
||||
add_metric("nox_raw",
|
||||
"The raw input value to the Nitrous Oxide (NOx) index as "
|
||||
"measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(nox_raw));
|
||||
add_metric_point("", String(noxRaw));
|
||||
}
|
||||
}
|
||||
|
||||
if (utils::isValidCO2(co2)) {
|
||||
add_metric("co2",
|
||||
"Carbon dioxide concentration as measured by the AirGradient S8 "
|
||||
"sensor, in parts per million",
|
||||
"gauge", "ppm");
|
||||
add_metric_point("", String(co2));
|
||||
}
|
||||
|
||||
if (utils::isValidTemperature(_temp)) {
|
||||
add_metric(
|
||||
"temperature",
|
||||
|
@ -57,26 +57,20 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge", "dbm");
|
||||
add_metric_point("", String(wifiConnector.RSSI()));
|
||||
|
||||
if (config.hasSensorS8 && measure.CO2 >= 0) {
|
||||
add_metric("co2",
|
||||
"Carbon dioxide concentration as measured by the AirGradient S8 "
|
||||
"sensor, in parts per million",
|
||||
"gauge", "ppm");
|
||||
add_metric_point("", String(measure.CO2));
|
||||
}
|
||||
|
||||
// Initialize default invalid value for each measurements
|
||||
float _temp = utils::getInvalidTemperature();
|
||||
float _hum = utils::getInvalidHumidity();
|
||||
int pm01 = utils::getInvalidPmValue();
|
||||
int pm25 = utils::getInvalidPmValue();
|
||||
int pm10 = utils::getInvalidPmValue();
|
||||
int pm03PCount = utils::getInvalidPmValue();
|
||||
int co2 = utils::getInvalidCO2();
|
||||
int atmpCompensated = utils::getInvalidTemperature();
|
||||
int ahumCompensated = utils::getInvalidHumidity();
|
||||
int tvoc = utils::getInvalidVOC();
|
||||
int tvoc_raw = utils::getInvalidVOC();
|
||||
int tvocRaw = utils::getInvalidVOC();
|
||||
int nox = utils::getInvalidNOx();
|
||||
int nox_raw = utils::getInvalidNOx();
|
||||
int noxRaw = utils::getInvalidNOx();
|
||||
|
||||
if (config.hasSensorSHT) {
|
||||
_temp = measure.getFloat(Measurements::Temperature);
|
||||
@ -94,9 +88,13 @@ String OpenMetrics::getPayload(void) {
|
||||
|
||||
if (config.hasSensorSGP) {
|
||||
tvoc = measure.get(Measurements::TVOC);
|
||||
tvoc_raw = measure.get(Measurements::TVOCRaw);
|
||||
tvocRaw = measure.get(Measurements::TVOCRaw);
|
||||
nox = measure.get(Measurements::NOx);
|
||||
nox_raw = measure.get(Measurements::NOxRaw);
|
||||
noxRaw = measure.get(Measurements::NOxRaw);
|
||||
}
|
||||
|
||||
if (config.hasSensorS8) {
|
||||
co2 = measure.get(Measurements::CO2);
|
||||
}
|
||||
|
||||
if (config.hasSensorPMS1) {
|
||||
@ -138,12 +136,12 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge");
|
||||
add_metric_point("", String(tvoc));
|
||||
}
|
||||
if (utils::isValidVOC(tvoc_raw)) {
|
||||
if (utils::isValidVOC(tvocRaw)) {
|
||||
add_metric("tvoc_raw",
|
||||
"The raw input value to the Total Volatile Organic Compounds "
|
||||
"(TVOC) index as measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(tvoc_raw));
|
||||
add_metric_point("", String(tvocRaw));
|
||||
}
|
||||
if (utils::isValidNOx(nox)) {
|
||||
add_metric("nox_index",
|
||||
@ -152,15 +150,23 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge");
|
||||
add_metric_point("", String(nox));
|
||||
}
|
||||
if (utils::isValidNOx(nox_raw)) {
|
||||
if (utils::isValidNOx(noxRaw)) {
|
||||
add_metric("nox_raw",
|
||||
"The raw input value to the Nitrous Oxide (NOx) index as "
|
||||
"measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(nox_raw));
|
||||
add_metric_point("", String(noxRaw));
|
||||
}
|
||||
}
|
||||
|
||||
if (utils::isValidCO2(co2)) {
|
||||
add_metric("co2",
|
||||
"Carbon dioxide concentration as measured by the AirGradient S8 "
|
||||
"sensor, in parts per million",
|
||||
"gauge", "ppm");
|
||||
add_metric_point("", String(co2));
|
||||
}
|
||||
|
||||
if (utils::isValidTemperature(_temp)) {
|
||||
add_metric(
|
||||
"temperature",
|
||||
|
@ -57,22 +57,22 @@ String OpenMetrics::getPayload(void) {
|
||||
"gauge", "dbm");
|
||||
add_metric_point("", String(wifiConnector.RSSI()));
|
||||
|
||||
if (config.hasSensorS8 && measure.CO2 >= 0) {
|
||||
add_metric("co2",
|
||||
"Carbon dioxide concentration as measured by the AirGradient S8 "
|
||||
"sensor, in parts per million",
|
||||
"gauge", "ppm");
|
||||
add_metric_point("", String(measure.CO2));
|
||||
}
|
||||
|
||||
// Initialize default invalid value for each measurements
|
||||
float _temp = utils::getInvalidTemperature();
|
||||
float _hum = utils::getInvalidHumidity();
|
||||
int pm01 = utils::getInvalidPmValue();
|
||||
int pm25 = utils::getInvalidPmValue();
|
||||
int pm10 = utils::getInvalidPmValue();
|
||||
int pm03PCount = utils::getInvalidPmValue();
|
||||
int co2 = utils::getInvalidCO2();
|
||||
int atmpCompensated = utils::getInvalidTemperature();
|
||||
int ahumCompensated = utils::getInvalidHumidity();
|
||||
int tvoc = utils::getInvalidVOC();
|
||||
int tvocRaw = utils::getInvalidVOC();
|
||||
int nox = utils::getInvalidNOx();
|
||||
int noxRaw = utils::getInvalidNOx();
|
||||
|
||||
// Get values
|
||||
if (config.hasSensorPMS1 && config.hasSensorPMS2) {
|
||||
_temp = (measure.getFloat(Measurements::Temperature, 1) +
|
||||
measure.getFloat(Measurements::Temperature, 2)) /
|
||||
@ -118,6 +118,17 @@ String OpenMetrics::getPayload(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (config.hasSensorSGP) {
|
||||
tvoc = measure.get(Measurements::TVOC);
|
||||
tvocRaw = measure.get(Measurements::TVOCRaw);
|
||||
nox = measure.get(Measurements::NOx);
|
||||
noxRaw = measure.get(Measurements::NOxRaw);
|
||||
}
|
||||
|
||||
if (config.hasSensorS8) {
|
||||
co2 = measure.get(Measurements::CO2);
|
||||
}
|
||||
|
||||
/** Get temperature and humidity compensated */
|
||||
if (ag->isOne()) {
|
||||
atmpCompensated = _temp;
|
||||
@ -127,6 +138,7 @@ String OpenMetrics::getPayload(void) {
|
||||
ahumCompensated = ag->pms5003t_1.compensateHum(_hum);
|
||||
}
|
||||
|
||||
// Add measurements that valid to the metrics
|
||||
if (config.hasSensorPMS1 || config.hasSensorPMS2) {
|
||||
if (utils::isValidPm(pm01)) {
|
||||
add_metric("pm1",
|
||||
@ -159,36 +171,44 @@ String OpenMetrics::getPayload(void) {
|
||||
}
|
||||
|
||||
if (config.hasSensorSGP) {
|
||||
if (utils::isValidVOC(measure.TVOC)) {
|
||||
if (utils::isValidVOC(tvoc)) {
|
||||
add_metric("tvoc_index",
|
||||
"The processed Total Volatile Organic Compounds (TVOC) index "
|
||||
"as measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(measure.TVOC));
|
||||
add_metric_point("", String(tvoc));
|
||||
}
|
||||
if (utils::isValidVOC(measure.TVOCRaw)) {
|
||||
if (utils::isValidVOC(tvocRaw)) {
|
||||
add_metric("tvoc_raw",
|
||||
"The raw input value to the Total Volatile Organic Compounds "
|
||||
"(TVOC) index as measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(measure.TVOCRaw));
|
||||
add_metric_point("", String(tvocRaw));
|
||||
}
|
||||
if (utils::isValidNOx(measure.NOx)) {
|
||||
if (utils::isValidNOx(nox)) {
|
||||
add_metric("nox_index",
|
||||
"The processed Nitrous Oxide (NOx) index as measured by the "
|
||||
"AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(measure.NOx));
|
||||
add_metric_point("", String(nox));
|
||||
}
|
||||
if (utils::isValidNOx(measure.NOxRaw)) {
|
||||
if (utils::isValidNOx(noxRaw)) {
|
||||
add_metric("nox_raw",
|
||||
"The raw input value to the Nitrous Oxide (NOx) index as "
|
||||
"measured by the AirGradient SGP sensor",
|
||||
"gauge");
|
||||
add_metric_point("", String(measure.NOxRaw));
|
||||
add_metric_point("", String(noxRaw));
|
||||
}
|
||||
}
|
||||
|
||||
if (utils::isValidCO2(co2)) {
|
||||
add_metric("co2",
|
||||
"Carbon dioxide concentration as measured by the AirGradient S8 "
|
||||
"sensor, in parts per million",
|
||||
"gauge", "ppm");
|
||||
add_metric_point("", String(co2));
|
||||
}
|
||||
|
||||
if (utils::isValidTemperature(_temp)) {
|
||||
add_metric("temperature",
|
||||
"The ambient temperature as measured by the AirGradient SHT / PMS "
|
||||
@ -197,25 +217,21 @@ String OpenMetrics::getPayload(void) {
|
||||
add_metric_point("", String(_temp));
|
||||
}
|
||||
if (utils::isValidTemperature(atmpCompensated)) {
|
||||
add_metric(
|
||||
"temperature_compensated",
|
||||
"The compensated ambient temperature as measured by the AirGradient SHT / PMS "
|
||||
"sensor, in degrees Celsius",
|
||||
"gauge", "celsius");
|
||||
add_metric("temperature_compensated",
|
||||
"The compensated ambient temperature as measured by the AirGradient SHT / PMS "
|
||||
"sensor, in degrees Celsius",
|
||||
"gauge", "celsius");
|
||||
add_metric_point("", String(atmpCompensated));
|
||||
}
|
||||
if (utils::isValidHumidity(_hum)) {
|
||||
add_metric(
|
||||
"humidity",
|
||||
"The relative humidity as measured by the AirGradient SHT sensor",
|
||||
"gauge", "percent");
|
||||
add_metric("humidity", "The relative humidity as measured by the AirGradient SHT sensor",
|
||||
"gauge", "percent");
|
||||
add_metric_point("", String(_hum));
|
||||
}
|
||||
if (utils::isValidHumidity(ahumCompensated)) {
|
||||
add_metric(
|
||||
"humidity_compensated",
|
||||
"The compensated relative humidity as measured by the AirGradient SHT / PMS sensor",
|
||||
"gauge", "percent");
|
||||
add_metric("humidity_compensated",
|
||||
"The compensated relative humidity as measured by the AirGradient SHT / PMS sensor",
|
||||
"gauge", "percent");
|
||||
add_metric_point("", String(ahumCompensated));
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=AirGradient Air Quality Sensor
|
||||
version=3.1.11
|
||||
version=3.1.16
|
||||
author=AirGradient <support@airgradient.com>
|
||||
maintainer=AirGradient <support@airgradient.com>
|
||||
sentence=ESP32-C3 / ESP8266 library for air quality monitor measuring PM, CO2, Temperature, TVOC and Humidity with OLED display.
|
||||
|
@ -354,16 +354,16 @@ bool Configuration::begin(void) {
|
||||
* @return false Failure
|
||||
*/
|
||||
bool Configuration::parse(String data, bool isLocal) {
|
||||
logInfo("Parse configure: " + data);
|
||||
logInfo("Parsing configuration: " + data);
|
||||
|
||||
JSONVar root = JSON.parse(data);
|
||||
failedMessage = "";
|
||||
if (root == undefined) {
|
||||
if (root == undefined || JSONVar::typeof_(root) != "object") {
|
||||
logError("Parse configuration failed, JSON invalid (" + JSONVar::typeof_(root) + ")");
|
||||
failedMessage = "JSON invalid";
|
||||
logError(failedMessage);
|
||||
return false;
|
||||
}
|
||||
logInfo("Parse configure success");
|
||||
logInfo("Parse configuration success");
|
||||
|
||||
/** Is configuration changed */
|
||||
bool changed = false;
|
||||
|
@ -87,37 +87,37 @@ bool StateMachine::sensorhandleLeds(void) {
|
||||
int StateMachine::co2handleLeds(void) {
|
||||
int totalUsed = ag->ledBar.getNumberOfLeds();
|
||||
int co2Value = round(value.getAverage(Measurements::CO2));
|
||||
if (co2Value <= 700) {
|
||||
if (co2Value <= 600) {
|
||||
/** G; 1 */
|
||||
ag->ledBar.setColor(RGB_COLOR_G, ag->ledBar.getNumberOfLeds() - 1);
|
||||
totalUsed = 1;
|
||||
} else if (co2Value <= 1000) {
|
||||
} else if (co2Value <= 800) {
|
||||
/** GG; 2 */
|
||||
ag->ledBar.setColor(RGB_COLOR_G, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_G, ag->ledBar.getNumberOfLeds() - 2);
|
||||
totalUsed = 2;
|
||||
} else if (co2Value <= 1333) {
|
||||
} else if (co2Value <= 1000) {
|
||||
/** YYY; 3 */
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 2);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 3);
|
||||
totalUsed = 3;
|
||||
} else if (co2Value <= 1666) {
|
||||
} else if (co2Value <= 1250) {
|
||||
/** OOOO; 4 */
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 2);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 3);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 4);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 2);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 3);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 4);
|
||||
totalUsed = 4;
|
||||
} else if (co2Value <= 2000) {
|
||||
} else if (co2Value <= 1500) {
|
||||
/** OOOOO; 5 */
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 2);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 3);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 4);
|
||||
ag->ledBar.setColor(RGB_COLOR_Y, ag->ledBar.getNumberOfLeds() - 5);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 2);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 3);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 4);
|
||||
ag->ledBar.setColor(RGB_COLOR_O, ag->ledBar.getNumberOfLeds() - 5);
|
||||
totalUsed = 5;
|
||||
} else if (co2Value <= 2666) {
|
||||
} else if (co2Value <= 1750) {
|
||||
/** RRRRRR; 6 */
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 2);
|
||||
@ -126,7 +126,7 @@ int StateMachine::co2handleLeds(void) {
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 5);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 6);
|
||||
totalUsed = 6;
|
||||
} else if (co2Value <= 3333) {
|
||||
} else if (co2Value <= 2000) {
|
||||
/** RRRRRRR; 7 */
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 2);
|
||||
@ -136,18 +136,18 @@ int StateMachine::co2handleLeds(void) {
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 6);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 7);
|
||||
totalUsed = 7;
|
||||
} else if (co2Value <= 4000) {
|
||||
/** RRRRRRRR; 8 */
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 2);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 3);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 4);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 5);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 6);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 7);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 8);
|
||||
} else if (co2Value <= 3000) {
|
||||
/** PPPPPPPP; 8 */
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 2);
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 3);
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 4);
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 5);
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 6);
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 7);
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 8);
|
||||
totalUsed = 8;
|
||||
} else { /** > 4000 */
|
||||
} else { /** > 3000 */
|
||||
/* PRPRPRPRP; 9 */
|
||||
ag->ledBar.setColor(RGB_COLOR_P, ag->ledBar.getNumberOfLeds() - 1);
|
||||
ag->ledBar.setColor(RGB_COLOR_R, ag->ledBar.getNumberOfLeds() - 2);
|
||||
|
@ -562,7 +562,7 @@ float Measurements::getCorrectedPM25(AirGradient &ag, Configuration &config, boo
|
||||
pmCorrection.intercept);
|
||||
if (pmCorrection.useEPA) {
|
||||
// Add EPA compensation on top of SLR
|
||||
corrected = ag.pms5003.compensate(pm25, humidity);
|
||||
corrected = ag.pms5003.compensate(corrected, humidity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -896,10 +896,10 @@ JSONVar Measurements::buildPMS(AirGradient &ag, int ch, bool allCh, bool withTem
|
||||
pms[json_prop_pm03Count] = ag.round2(avg);
|
||||
pms["channels"]["1"][json_prop_pm03Count] = ag.round2(_pm_03_pc[0].update.avg);
|
||||
pms["channels"]["2"][json_prop_pm03Count] = ag.round2(_pm_03_pc[1].update.avg);
|
||||
} else if (utils::isValidPm(_pm_03_pc[0].update.avg)) {
|
||||
} else if (utils::isValidPm03Count(_pm_03_pc[0].update.avg)) {
|
||||
pms[json_prop_pm03Count] = ag.round2(_pm_03_pc[0].update.avg);
|
||||
pms["channels"]["1"][json_prop_pm03Count] = ag.round2(_pm_03_pc[0].update.avg);
|
||||
} else if (utils::isValidPm(_pm_03_pc[1].update.avg)) {
|
||||
} else if (utils::isValidPm03Count(_pm_03_pc[1].update.avg)) {
|
||||
pms[json_prop_pm03Count] = ag.round2(_pm_03_pc[1].update.avg);
|
||||
pms["channels"]["2"][json_prop_pm03Count] = ag.round2(_pm_03_pc[1].update.avg);
|
||||
}
|
||||
@ -911,10 +911,10 @@ JSONVar Measurements::buildPMS(AirGradient &ag, int ch, bool allCh, bool withTem
|
||||
pms[json_prop_pm05Count] = ag.round2(avg);
|
||||
pms["channels"]["1"][json_prop_pm05Count] = ag.round2(_pm_05_pc[0].update.avg);
|
||||
pms["channels"]["2"][json_prop_pm05Count] = ag.round2(_pm_05_pc[1].update.avg);
|
||||
} else if (utils::isValidPm(_pm_05_pc[0].update.avg)) {
|
||||
} else if (utils::isValidPm03Count(_pm_05_pc[0].update.avg)) {
|
||||
pms[json_prop_pm05Count] = ag.round2(_pm_05_pc[0].update.avg);
|
||||
pms["channels"]["1"][json_prop_pm05Count] = ag.round2(_pm_05_pc[0].update.avg);
|
||||
} else if (utils::isValidPm(_pm_05_pc[1].update.avg)) {
|
||||
} else if (utils::isValidPm03Count(_pm_05_pc[1].update.avg)) {
|
||||
pms[json_prop_pm05Count] = ag.round2(_pm_05_pc[1].update.avg);
|
||||
pms["channels"]["2"][json_prop_pm05Count] = ag.round2(_pm_05_pc[1].update.avg);
|
||||
}
|
||||
@ -925,10 +925,10 @@ JSONVar Measurements::buildPMS(AirGradient &ag, int ch, bool allCh, bool withTem
|
||||
pms[json_prop_pm1Count] = ag.round2(avg);
|
||||
pms["channels"]["1"][json_prop_pm1Count] = ag.round2(_pm_01_pc[0].update.avg);
|
||||
pms["channels"]["2"][json_prop_pm1Count] = ag.round2(_pm_01_pc[1].update.avg);
|
||||
} else if (utils::isValidPm(_pm_01_pc[0].update.avg)) {
|
||||
} else if (utils::isValidPm03Count(_pm_01_pc[0].update.avg)) {
|
||||
pms[json_prop_pm1Count] = ag.round2(_pm_01_pc[0].update.avg);
|
||||
pms["channels"]["1"][json_prop_pm1Count] = ag.round2(_pm_01_pc[0].update.avg);
|
||||
} else if (utils::isValidPm(_pm_01_pc[1].update.avg)) {
|
||||
} else if (utils::isValidPm03Count(_pm_01_pc[1].update.avg)) {
|
||||
pms[json_prop_pm1Count] = ag.round2(_pm_01_pc[1].update.avg);
|
||||
pms["channels"]["2"][json_prop_pm1Count] = ag.round2(_pm_01_pc[1].update.avg);
|
||||
}
|
||||
@ -940,10 +940,10 @@ JSONVar Measurements::buildPMS(AirGradient &ag, int ch, bool allCh, bool withTem
|
||||
pms[json_prop_pm25Count] = ag.round2(avg);
|
||||
pms["channels"]["1"][json_prop_pm25Count] = ag.round2(_pm_25_pc[0].update.avg);
|
||||
pms["channels"]["2"][json_prop_pm25Count] = ag.round2(_pm_25_pc[1].update.avg);
|
||||
} else if (utils::isValidPm(_pm_25_pc[0].update.avg)) {
|
||||
} else if (utils::isValidPm03Count(_pm_25_pc[0].update.avg)) {
|
||||
pms[json_prop_pm25Count] = ag.round2(_pm_25_pc[0].update.avg);
|
||||
pms["channels"]["1"][json_prop_pm25Count] = ag.round2(_pm_25_pc[0].update.avg);
|
||||
} else if (utils::isValidPm(_pm_25_pc[1].update.avg)) {
|
||||
} else if (utils::isValidPm03Count(_pm_25_pc[1].update.avg)) {
|
||||
pms[json_prop_pm25Count] = ag.round2(_pm_25_pc[1].update.avg);
|
||||
pms["channels"]["2"][json_prop_pm25Count] = ag.round2(_pm_25_pc[1].update.avg);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "Main/utils.h"
|
||||
|
||||
#ifndef GIT_VERSION
|
||||
#define GIT_VERSION "3.1.11-snap"
|
||||
#define GIT_VERSION "3.1.16-snap"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user