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
|
||||
@ -104,4 +100,4 @@
|
||||
#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64
|
||||
#define MCP_24AA02E64_MAC_ADDRESS 0xF8 // Memory adress of unique deveui 64 bits
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -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
|
||||
|
||||
@ -48,4 +54,4 @@
|
||||
#define LORA_IO1 (33)
|
||||
#define LORA_IO2 (32)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -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