From 85e779cfc2b70fcadaa2674ad1e006bdf5f6915a Mon Sep 17 00:00:00 2001 From: samuelbles07 Date: Wed, 23 Oct 2024 11:05:16 +0700 Subject: [PATCH] Use camel case for transmission payload --- docs/local-server.md | 8 ++++---- src/AgValue.cpp | 48 ++++++++++++++++++++++---------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/local-server.md b/docs/local-server.md index fe0d496..d65aee1 100644 --- a/docs/local-server.md +++ b/docs/local-server.md @@ -54,14 +54,14 @@ You get the following response: | `pm02` | Number | PM2.5 in ug/m3 (atmospheric environment) | | `pm10` | Number | PM10 in ug/m3 (atmospheric environment) | | `pm02Compensated` | Number | PM2.5 in ug/m3 with correction applied (from fw version 3.1.4 onwards) | -| `pm01_sp` | Number | PM1.0 in ug/m3 (standard particle) | -| `pm02_sp` | Number | PM2.5 in ug/m3 (standard particle) | -| `pm10_sp` | Number | PM10 in ug/m3 (standard particle) | +| `pm01Standard` | Number | PM1.0 in ug/m3 (standard particle) | +| `pm02Standard` | Number | PM2.5 in ug/m3 (standard particle) | +| `pm10Standard` | Number | PM10 in ug/m3 (standard particle) | | `rco2` | Number | CO2 in ppm | | `pm003Count` | Number | Particle count 0.3um per dL | | `pm01Count` | Number | Particle count 1.0um per dL | | `pm25Count` | Number | Particle count 2.5um per dL | -| `pm10Count` | Number | Particle count 10um per dL | +| `pm10Count` | Number | Particle count 10um per dL (only for indoor monitor) | | `atmp` | Number | Temperature in Degrees Celsius | | `atmpCompensated` | Number | Temperature in Degrees Celsius with correction applied | | `rhum` | Number | Relative Humidity | diff --git a/src/AgValue.cpp b/src/AgValue.cpp index 638bee1..aa21145 100644 --- a/src/AgValue.cpp +++ b/src/AgValue.cpp @@ -591,13 +591,13 @@ JSONVar Measurements::buildPMS(AirGradient &ag, int ch, bool allCh, bool withTem pms["pm10"] = ag.round2(_pm_10[ch].update.avg); } if (utils::isValidPm(_pm_01_sp[ch].update.avg)) { - pms["pm01_sp"] = ag.round2(_pm_01_sp[ch].update.avg); + pms["pm01Standard"] = ag.round2(_pm_01_sp[ch].update.avg); } if (utils::isValidPm(_pm_25_sp[ch].update.avg)) { - pms["pm02_sp"] = ag.round2(_pm_25_sp[ch].update.avg); + pms["pm02Standard"] = ag.round2(_pm_25_sp[ch].update.avg); } if (utils::isValidPm(_pm_10_sp[ch].update.avg)) { - pms["pm10_sp"] = ag.round2(_pm_10_sp[ch].update.avg); + pms["pm10Standard"] = ag.round2(_pm_10_sp[ch].update.avg); } if (utils::isValidPm03Count(_pm_03_pc[ch].update.avg)) { pms["pm003Count"] = ag.round2(_pm_03_pc[ch].update.avg); @@ -706,43 +706,43 @@ JSONVar Measurements::buildPMS(AirGradient &ag, int ch, bool allCh, bool withTem /// PM1.0 standard particle if (utils::isValidPm(_pm_01_sp[0].update.avg) && utils::isValidPm(_pm_01_sp[1].update.avg)) { float avg = (_pm_01_sp[0].update.avg + _pm_01_sp[1].update.avg) / 2.0f; - pms["pm01_sp"] = ag.round2(avg); - pms["channels"]["1"]["pm01_sp"] = ag.round2(_pm_01_sp[0].update.avg); - pms["channels"]["2"]["pm01_sp"] = ag.round2(_pm_01_sp[1].update.avg); + pms["pm01Standard"] = ag.round2(avg); + pms["channels"]["1"]["pm01Standard"] = ag.round2(_pm_01_sp[0].update.avg); + pms["channels"]["2"]["pm01Standard"] = ag.round2(_pm_01_sp[1].update.avg); } else if (utils::isValidPm(_pm_01_sp[0].update.avg)) { - pms["pm01_sp"] = ag.round2(_pm_01_sp[0].update.avg); - pms["channels"]["1"]["pm01_sp"] = ag.round2(_pm_01_sp[0].update.avg); + pms["pm01Standard"] = ag.round2(_pm_01_sp[0].update.avg); + pms["channels"]["1"]["pm01Standard"] = ag.round2(_pm_01_sp[0].update.avg); } else if (utils::isValidPm(_pm_01_sp[1].update.avg)) { - pms["pm01_sp"] = ag.round2(_pm_01_sp[1].update.avg); - pms["channels"]["2"]["pm01_sp"] = ag.round2(_pm_01_sp[1].update.avg); + pms["pm01Standard"] = ag.round2(_pm_01_sp[1].update.avg); + pms["channels"]["2"]["pm01Standard"] = ag.round2(_pm_01_sp[1].update.avg); } /// PM2.5 standard particle if (utils::isValidPm(_pm_25_sp[0].update.avg) && utils::isValidPm(_pm_25_sp[1].update.avg)) { float avg = (_pm_25_sp[0].update.avg + _pm_25_sp[1].update.avg) / 2.0f; - pms["pm02_sp"] = ag.round2(avg); - pms["channels"]["1"]["pm02_sp"] = ag.round2(_pm_25_sp[0].update.avg); - pms["channels"]["2"]["pm02_sp"] = ag.round2(_pm_25_sp[1].update.avg); + pms["pm02Standard"] = ag.round2(avg); + pms["channels"]["1"]["pm02Standard"] = ag.round2(_pm_25_sp[0].update.avg); + pms["channels"]["2"]["pm02Standard"] = ag.round2(_pm_25_sp[1].update.avg); } else if (utils::isValidPm(_pm_25_sp[0].update.avg)) { - pms["pm02_sp"] = ag.round2(_pm_25_sp[0].update.avg); - pms["channels"]["1"]["pm02_sp"] = ag.round2(_pm_25_sp[0].update.avg); + pms["pm02Standard"] = ag.round2(_pm_25_sp[0].update.avg); + pms["channels"]["1"]["pm02Standard"] = ag.round2(_pm_25_sp[0].update.avg); } else if (utils::isValidPm(_pm_25_sp[1].update.avg)) { - pms["pm02_sp"] = ag.round2(_pm_25_sp[1].update.avg); - pms["channels"]["2"]["pm02_sp"] = ag.round2(_pm_25_sp[1].update.avg); + pms["pm02Standard"] = ag.round2(_pm_25_sp[1].update.avg); + pms["channels"]["2"]["pm02Standard"] = ag.round2(_pm_25_sp[1].update.avg); } /// PM10 standard particle if (utils::isValidPm(_pm_10_sp[0].update.avg) && utils::isValidPm(_pm_10_sp[1].update.avg)) { float avg = (_pm_10_sp[0].update.avg + _pm_10_sp[1].update.avg) / 2.0f; - pms["pm10_sp"] = ag.round2(avg); - pms["channels"]["1"]["pm10_sp"] = ag.round2(_pm_10_sp[0].update.avg); - pms["channels"]["2"]["pm10_sp"] = ag.round2(_pm_10_sp[1].update.avg); + pms["pm10Standard"] = ag.round2(avg); + pms["channels"]["1"]["pm10Standard"] = ag.round2(_pm_10_sp[0].update.avg); + pms["channels"]["2"]["pm10Standard"] = ag.round2(_pm_10_sp[1].update.avg); } else if (utils::isValidPm(_pm_10_sp[0].update.avg)) { - pms["pm10_sp"] = ag.round2(_pm_10_sp[0].update.avg); - pms["channels"]["1"]["pm10_sp"] = ag.round2(_pm_10_sp[0].update.avg); + pms["pm10Standard"] = ag.round2(_pm_10_sp[0].update.avg); + pms["channels"]["1"]["pm10Standard"] = ag.round2(_pm_10_sp[0].update.avg); } else if (utils::isValidPm(_pm_10_sp[1].update.avg)) { - pms["pm10_sp"] = ag.round2(_pm_10_sp[1].update.avg); - pms["channels"]["2"]["pm10_sp"] = ag.round2(_pm_10_sp[1].update.avg); + pms["pm10Standard"] = ag.round2(_pm_10_sp[1].update.avg); + pms["channels"]["2"]["pm10Standard"] = ag.round2(_pm_10_sp[1].update.avg); } /// PM003 particle count