commit
bbda15d36f
@ -48,7 +48,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
||||
release_version = 1.9.90
|
||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
||||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||
debug_level = 5
|
||||
debug_level = 2
|
||||
extra_scripts = pre:build.py
|
||||
otakeyfile = ota.conf
|
||||
lorakeyfile = loraconf.h
|
||||
|
@ -10,10 +10,6 @@
|
||||
// Hardware related definitions for generic ESP32 boards
|
||||
// generic.h is kitchensink with all available options
|
||||
|
||||
// SDS011 dust sensor settings
|
||||
#define HAS_SDS011 1 // use SDS011
|
||||
#define SDS011_SERIAL 9600, SERIAL_8N1, GPIO_NUM_19, GPIO_NUM_23 // SDS011 RX, TX
|
||||
|
||||
#define HAS_LORA 1 // comment out if device shall not send data via LoRa or has no LoRa
|
||||
#define HAS_SPI 1 // comment out if device shall not send data via SPI
|
||||
// pin definitions for SPI slave interface
|
||||
|
@ -12,6 +12,12 @@
|
||||
// This settings are for boards labeled v1.6 on pcb, NOT for v1.5 or older
|
||||
*/
|
||||
|
||||
// SDS011 dust sensor settings
|
||||
#define HAS_SDS011 1 // use SDS011
|
||||
// used pins on the ESP-side:
|
||||
#define ESP_PIN_TX 19 // connect to RX on the SDS011
|
||||
#define ESP_PIN_RX 23 // connect to TX on the SDS011
|
||||
|
||||
#define HAS_LORA 1 // comment out if device shall not send data via LoRa
|
||||
#define CFG_sx1276_radio 1 // HPD13A LoRa SoC
|
||||
|
||||
|
@ -24,6 +24,8 @@ bool sdcard_init() {
|
||||
useSDCard = SD.begin(SDCARD_CS, SDCARD_MOSI, SDCARD_MISO, SDCARD_SCLK);
|
||||
if (useSDCard)
|
||||
createFile();
|
||||
else
|
||||
ESP_LOGD(TAG,"SD-card not found");
|
||||
return useSDCard;
|
||||
}
|
||||
|
||||
@ -84,4 +86,3 @@ void createFile(void) {
|
||||
}
|
||||
|
||||
#endif // (HAS_SDCARD)
|
||||
|
||||
|
@ -3,19 +3,12 @@
|
||||
// Local logging tag
|
||||
static const char TAG[] = __FILE__;
|
||||
|
||||
#if (HAS_SDS)
|
||||
|
||||
#include "sds011read.h"
|
||||
|
||||
// UART(2) is unused in this project
|
||||
#if (HAS_IF482)
|
||||
#error cannot use IF482 together with SDS011 (both use UART#2)
|
||||
#endif
|
||||
|
||||
#ifndef SDS011_SERIAL
|
||||
#error serial settings for SDS011 connection missing
|
||||
#endif
|
||||
|
||||
// UART(2) is unused in this project
|
||||
static HardwareSerial sdsSerial(2); // so we use it here
|
||||
static SDS011 sdsSensor; // fine dust sensor
|
||||
|
||||
@ -27,12 +20,13 @@ boolean isSDS011Active;
|
||||
// init
|
||||
bool sds011_init() {
|
||||
pm25 = pm10 = 0.0;
|
||||
sdsSerial.begin(SDS011_SERIAL);
|
||||
sdsSensor.begin(&sdsSerial);
|
||||
//sdsSensor.contmode(0); // for safety: no wakeup/sleep by the sensor
|
||||
sds011_sleep(); // we do it by ourselves
|
||||
#if (HAS_SDS011)
|
||||
sdsSensor.begin (&sdsSerial, ESP_PIN_RX, ESP_PIN_TX);
|
||||
#endif
|
||||
sds011_sleep(); // we do sleep/wakup by ourselves
|
||||
return true;
|
||||
}
|
||||
|
||||
// reading data:
|
||||
void sds011_loop() {
|
||||
if (isSDS011Active) {
|
||||
@ -62,5 +56,3 @@ void sds011_wakeup() {
|
||||
isSDS011Active = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAS_SDS
|
Loading…
Reference in New Issue
Block a user