Browse Source

SDS011 query mode

main
Hendrik Langer 7 years ago
parent
commit
4a2f245d85
  1. 5
      platformio.ini
  2. 4
      src/main.cpp
  3. 2
      src/main.h

5
platformio.ini

@ -17,7 +17,7 @@ board_build.f_cpu = 80000000L
board_build.f_flash = 40000000L board_build.f_flash = 40000000L
build_flags = build_flags =
-DUSERDEBUG ; -DUSERDEBUG
; -DDEBUG_ESP_PORT=Serial ; -DDEBUG_ESP_PORT=Serial
; -DDEBUG ; -DDEBUG
; -DDEBUG_ESP_SSL ; -DDEBUG_ESP_SSL
@ -30,7 +30,8 @@ lib_deps =
Adafruit BMP085 Library Adafruit BMP085 Library
DHT sensor library DHT sensor library
; SDS011 sensor Library ; SDS011 sensor Library
https://github.com/Zanop/SDS011.git#more-sensor-modes ; https://github.com/Zanop/SDS011.git#more-sensor-modes
https://github.com/h3ndrik/SDS011.git#more-sensor-modes
EspSoftwareSerial EspSoftwareSerial
RunningAverage RunningAverage
MQTT MQTT

4
src/main.cpp

@ -155,13 +155,12 @@ void ICACHE_FLASH_ATTR sendValues() {
sd.voltage = analogRead(A0)*0.04285078 -0.05942125; // by linear regression for my(!) voltage divider. else: sd.voltage = analogRead(A0)*3.3*(R1+R2)/(R2*1024) sd.voltage = analogRead(A0)*0.04285078 -0.05942125; // by linear regression for my(!) voltage divider. else: sd.voltage = analogRead(A0)*3.3*(R1+R2)/(R2*1024)
#endif #endif
int sds_error = sds.read(&(sd.p25), &(sd.p10)); int sds_error = sds.query(&(sd.p25), &(sd.p10));
if(!sds_error) { if(!sds_error) {
// DEBUG_MSG("SDS011 updated.\n"); // DEBUG_MSG("SDS011 updated.\n");
} else { } else {
// DEBUG_MSG("SDS011 no new values.\n"); // DEBUG_MSG("SDS011 no new values.\n");
} }
// sds.sleep(); // sds.sleep();
if (rtcMillis() - geiger_previousMillis > 10000) { if (rtcMillis() - geiger_previousMillis > 10000) {
@ -387,6 +386,7 @@ void setup() {
sds.begin(SDS_TX, SDS_RX); sds.begin(SDS_TX, SDS_RX);
sds.mode_mon_300(); sds.mode_mon_300();
sds.mode_query();
Wire.begin(BMP_SDA, BMP_SCL); Wire.begin(BMP_SDA, BMP_SCL);
if (!bmp.begin(BMP085_MODE_STANDARD)) { if (!bmp.begin(BMP085_MODE_STANDARD)) {

2
src/main.h

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

Loading…
Cancel
Save