added support for SDS011

This commit is contained in:
August Quint 2020-01-22 15:49:07 +01:00 committed by GitHub
parent 7a465f7c75
commit c1411e5c1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,11 @@
Ticker sendcycler; Ticker sendcycler;
#if (HAS_SDS011)
extern float pm10;
extern float pm25;
#endif
void sendcycle() { void sendcycle() {
xTaskNotifyFromISR(irqHandlerTask, SENDCYCLE_IRQ, eSetBits, NULL); xTaskNotifyFromISR(irqHandlerTask, SENDCYCLE_IRQ, eSetBits, NULL);
} }
@ -13,6 +18,10 @@ void SendPayload(uint8_t port, sendprio_t prio) {
MessageBuffer_t MessageBuffer_t
SendBuffer; // contains MessageSize, MessagePort, MessagePrio, Message[] SendBuffer; // contains MessageSize, MessagePort, MessagePrio, Message[]
#if (HAS_SDS011)
sds011_loop();
#endif
SendBuffer.MessageSize = payload.getSize(); SendBuffer.MessageSize = payload.getSize();
SendBuffer.MessagePrio = prio; SendBuffer.MessagePrio = prio;
@ -94,6 +103,10 @@ void sendData() {
payload.addCount(macs_wifi, MAC_SNIFF_WIFI); payload.addCount(macs_wifi, MAC_SNIFF_WIFI);
if (cfg.blescan) if (cfg.blescan)
payload.addCount(macs_ble, MAC_SNIFF_BLE); payload.addCount(macs_ble, MAC_SNIFF_BLE);
#endif
#if (HAS_SDS011)
payload.addPM10(pm10);
payload.addPM25(pm25);
#endif #endif
SendPayload(COUNTERPORT, prio_normal); SendPayload(COUNTERPORT, prio_normal);
// clear counter if not in cumulative counter mode // clear counter if not in cumulative counter mode
@ -172,4 +185,4 @@ void flushQueues() {
#ifdef HAS_SPI #ifdef HAS_SPI
spi_queuereset(); spi_queuereset();
#endif #endif
} }