Browse Source

correct sensor offsets, dust sensor interval to 5 minutes

main
Hendrik Langer 5 years ago
parent
commit
0cd10d3b85
  1. 1
      platformio.ini
  2. 13
      src/main.cpp
  3. 2
      src/main.h

1
platformio.ini

@ -10,6 +10,7 @@
[env:nodemcu]
;platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
;platform = https://github.com/platformio/platform-espressif8266.git
platform = espressif8266
board = nodemcu
framework = arduino

13
src/main.cpp

@ -51,8 +51,10 @@ uint32_t loop_count = 0;
#define SENSOR1_ID "5a9e9e38f55bff001a49487e"
// Humidity
#define SENSOR2_ID "5a9e9e38f55bff001a49487d"
// Pressure
// Pressure (sea-level)
#define SENSOR3_ID "5a9e9e38f55bff001a49487c"
// Pressure RAW
#define SENSOR9_ID "5d12233630bde6001adf6092"
// PM10
#define SENSOR4_ID "5a9e9e38f55bff001a49487b"
// PM2.5
@ -75,7 +77,7 @@ static constexpr uint8_t SDS_TX = D1;
static constexpr uint8_t SDS_RX = D2;
static constexpr uint8_t GEIGER_PIN = D6;
static constexpr float CONV_FACTOR = 0.008120;
static constexpr float CONV_FACTOR = 0.008120 / 2.5;
static constexpr float OWN_BACKGROUND_CPS = 0; // documentation says 0.2 (make sure value doesn't get negative if subtracting!)
#ifndef EXTERNAL_POWER
@ -156,8 +158,11 @@ void ICACHE_FLASH_ATTR getValuesJSON(char* buffer, const size_t buf_len, int for
humidityObject["sensor"] = SENSOR2_ID;
humidityObject["value"] = sd.humidity;
JsonObject pressureObject = array.createNestedObject();
pressureObject["sensor"] = SENSOR3_ID;
pressureObject["sensor"] = SENSOR9_ID;
pressureObject["value"] = sd.pressure;
JsonObject pressureObject2 = array.createNestedObject();
pressureObject2["sensor"] = SENSOR3_ID;
pressureObject2["value"] = sd.pressure+16;
if (sd.sds_updated) {
JsonObject pm10Object = array.createNestedObject();
pm10Object["sensor"] = SENSOR4_ID;
@ -409,7 +414,7 @@ void setup() {
//wifi_status_led_uninstall();
sds.begin();
sds.setCustomWorkingPeriod(15); // sensor sends data every 15 minutes
sds.setCustomWorkingPeriod(5); // sensor sends data every 5 minutes
sds.setQueryReportingMode(); // ensures sensor is in 'query' reporting mode
Wire.begin(BMP_SDA, BMP_SCL);

2
src/main.h

@ -7,6 +7,6 @@
#define DEBUG_MSG(...)
#endif
#define FW_VERSION 28
#define FW_VERSION 29
#endif /* _MAIN_H */

Loading…
Cancel
Save