mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-13 07:56:32 +02:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
@ -243,15 +243,7 @@ public:
|
|||||||
uint8_t ledBarMode = UseLedBarOff;
|
uint8_t ledBarMode = UseLedBarOff;
|
||||||
if (JSON.typeof_(root["ledBarMode"]) == "string") {
|
if (JSON.typeof_(root["ledBarMode"]) == "string") {
|
||||||
String mode = root["ledBarMode"];
|
String mode = root["ledBarMode"];
|
||||||
if (mode == "co2") {
|
ledBarMode = parseLedBarMode(mode);
|
||||||
ledBarMode = UseLedBarCO2;
|
|
||||||
} else if (mode == "pm") {
|
|
||||||
ledBarMode = UseLedBarPM;
|
|
||||||
} else if (mode == "off") {
|
|
||||||
ledBarMode = UseLedBarOff;
|
|
||||||
} else {
|
|
||||||
ledBarMode = UseLedBarOff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get model */
|
/** Get model */
|
||||||
@ -446,6 +438,24 @@ public:
|
|||||||
*/
|
*/
|
||||||
UseLedBar getLedBarMode(void) { return (UseLedBar)config.useRGBLedBar; }
|
UseLedBar getLedBarMode(void) { return (UseLedBar)config.useRGBLedBar; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the name of the led bare mode.
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
String getLedBarModeName(void) {
|
||||||
|
UseLedBar ledBarMode = getLedBarMode();
|
||||||
|
if (ledBarMode == UseLedBarOff) {
|
||||||
|
return String("off");
|
||||||
|
} else if (ledBarMode == UseLedBarPM) {
|
||||||
|
return String("pm");
|
||||||
|
} else if (ledBarMode == UseLedBarCO2) {
|
||||||
|
return String("co2");
|
||||||
|
} else {
|
||||||
|
return String("off");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the Country
|
* @brief Get the Country
|
||||||
*
|
*
|
||||||
@ -516,6 +526,21 @@ private:
|
|||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
Serial.println("Save config");
|
Serial.println("Save config");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UseLedBar parseLedBarMode(String mode) {
|
||||||
|
UseLedBar ledBarMode = UseLedBarOff;
|
||||||
|
if (mode == "co2") {
|
||||||
|
ledBarMode = UseLedBarCO2;
|
||||||
|
} else if (mode == "pm") {
|
||||||
|
ledBarMode = UseLedBarPM;
|
||||||
|
} else if (mode == "off") {
|
||||||
|
ledBarMode = UseLedBarOff;
|
||||||
|
} else {
|
||||||
|
ledBarMode = UseLedBarOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ledBarMode;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
AgServer agServer;
|
AgServer agServer;
|
||||||
|
|
||||||
@ -1080,7 +1105,7 @@ void webServerMetricsGet(void) {
|
|||||||
add_metric("temperature",
|
add_metric("temperature",
|
||||||
"The ambient temperature as measured by the AirGradient SHT "
|
"The ambient temperature as measured by the AirGradient SHT "
|
||||||
"sensor, in degrees Celsius",
|
"sensor, in degrees Celsius",
|
||||||
"gauge", "celcius");
|
"gauge", "celsius");
|
||||||
add_metric_point("", String(temp));
|
add_metric_point("", String(temp));
|
||||||
}
|
}
|
||||||
if (hum >= 0) {
|
if (hum >= 0) {
|
||||||
@ -1150,18 +1175,30 @@ static String getServerSyncData(bool localServer) {
|
|||||||
root["pm10"] = pm10;
|
root["pm10"] = pm10;
|
||||||
}
|
}
|
||||||
if (pm03PCount >= 0) {
|
if (pm03PCount >= 0) {
|
||||||
root["pm003_count"] = pm03PCount;
|
if (localServer) {
|
||||||
|
root["pm003Count"] = pm03PCount;
|
||||||
|
} else {
|
||||||
|
root["pm003_count"] = pm03PCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasSensorSGP) {
|
if (hasSensorSGP) {
|
||||||
if (tvocIndex >= 0) {
|
if (tvocIndex >= 0) {
|
||||||
root["tvoc_index"] = tvocIndex;
|
if (localServer) {
|
||||||
|
root["tvocIndex"] = tvocIndex;
|
||||||
|
} else {
|
||||||
|
root["tvoc_index"] = tvocIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (tvocRawIndex >= 0) {
|
if (tvocRawIndex >= 0) {
|
||||||
root["tvoc_raw"] = tvocRawIndex;
|
root["tvoc_raw"] = tvocRawIndex;
|
||||||
}
|
}
|
||||||
if (noxIndex >= 0) {
|
if (noxIndex >= 0) {
|
||||||
root["nox_index"] = noxIndex;
|
if (localServer) {
|
||||||
|
root["noxIndex"] = noxIndex;
|
||||||
|
} else {
|
||||||
|
root["nox_index"] = noxIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (noxRawIndex >= 0) {
|
if (noxRawIndex >= 0) {
|
||||||
root["nox_raw"] = noxRawIndex;
|
root["nox_raw"] = noxRawIndex;
|
||||||
@ -1177,6 +1214,11 @@ static String getServerSyncData(bool localServer) {
|
|||||||
}
|
}
|
||||||
root["boot"] = bootCount;
|
root["boot"] = bootCount;
|
||||||
|
|
||||||
|
if (localServer) {
|
||||||
|
root["ledMode"] = agServer.getLedBarModeName();
|
||||||
|
root["firmwareVersion"] = ag.getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
return JSON.stringify(root);
|
return JSON.stringify(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user