4 files changed
+58
-2
No files matched your search
+37
-1
@@ -489,5 +489,41 @@ void PayloadConvert::addTime(time_t value) {
|
||||
buffer[cursor++] = (byte)((tx_period & 0x000000FF));
|
||||
#endif
|
||||
}
|
||||
#endif // PAYLOAD_ENCODER
|
||||
|
||||
#endif
|
||||
void PayloadConvert::addPM10( float value) {
|
||||
#if (HAS_SDS011)
|
||||
#if (PAYLOAD_ENCODER == 1) // plain
|
||||
char tempBuffer[10+1];
|
||||
sprintf( tempBuffer, ",%5.1f", value);
|
||||
addChars(tempBuffer, strlen(tempBuffer));
|
||||
#elif (PAYLOAD_ENCODER == 2 ) // packed
|
||||
writeUint16( (uint16_t) (value*10) );
|
||||
#elif (PAYLOAD_ENCODER == 3 ) // Cayenne LPP dynamic
|
||||
// TODO
|
||||
#elif (PAYLOAD_ENCODER == 4 ) // Cayenne LPP packed
|
||||
// TODO
|
||||
#endif
|
||||
#endif // HAS_SDS011
|
||||
}
|
||||
|
||||
void PayloadConvert::addPM25( float value) {
|
||||
#if (HAS_SDS011)
|
||||
#if (PAYLOAD_ENCODER == 1) // plain
|
||||
char tempBuffer[10+1];
|
||||
sprintf( tempBuffer, ",%5.1f", value);
|
||||
addChars(tempBuffer, strlen(tempBuffer));
|
||||
#elif (PAYLOAD_ENCODER == 2 ) // packed
|
||||
writeUint16( (uint16_t) (value*10) );
|
||||
#elif (PAYLOAD_ENCODER == 3 ) // Cayenne LPP dynamic
|
||||
// TODO
|
||||
#elif (PAYLOAD_ENCODER == 4 ) // Cayenne LPP packed
|
||||
// TODO
|
||||
#endif
|
||||
#endif // HAS_SDS011
|
||||
}
|
||||
|
||||
void PayloadConvert::addChars( char * string, int len) {
|
||||
for (int i=0; i < len; i++)
|
||||
addByte(string[i]);
|
||||
}
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
Ticker sendcycler;
|
||||
|
||||
#if (HAS_SDS011)
|
||||
extern float pm10;
|
||||
extern float pm25;
|
||||
#endif
|
||||
|
||||
void sendcycle() {
|
||||
xTaskNotifyFromISR(irqHandlerTask, SENDCYCLE_IRQ, eSetBits, NULL);
|
||||
}
|
||||
@@ -98,6 +103,10 @@ void sendData() {
|
||||
payload.addCount(macs_wifi, MAC_SNIFF_WIFI);
|
||||
if (cfg.blescan)
|
||||
payload.addCount(macs_ble, MAC_SNIFF_BLE);
|
||||
#endif
|
||||
#if (HAS_SDS011)
|
||||
payload.addPM10(pm10);
|
||||
payload.addPM25(pm25);
|
||||
#endif
|
||||
SendPayload(COUNTERPORT, prio_normal);
|
||||
// clear counter if not in cumulative counter mode
|
||||
|
||||
Reference in new issue
Block a user