From 8520afcf8d2502c786b053e950ce148e75e78464 Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Fri, 13 Mar 2020 15:25:18 +0100 Subject: [PATCH] Update payload.cpp --- src/payload.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/payload.cpp b/src/payload.cpp index 06bbf5bd..b565c3b4 100644 --- a/src/payload.cpp +++ b/src/payload.cpp @@ -319,14 +319,20 @@ void PayloadConvert::addByte(uint8_t value) { void PayloadConvert::addSDS(sdsStatus_t sds) { #if (HAS_SDS011) +// value of PM10 #if (PAYLOAD_ENCODER == 3) // Cayenne LPP dynamic - buffer[cursor++] = LPP_PARTMATTER_CHANNEL; // for PM10 and PM25 + buffer[cursor++] = LPP_PARTMATTER10_CHANNEL; // for PM10 #endif buffer[cursor++] = LPP_LUMINOSITY; // workaround since cayenne has no data type meter - buffer[cursor++] = highByte(sds.pm10); - buffer[cursor++] = lowByte(sds.pm10); - buffer[cursor++] = highByte(sds.pm25); - buffer[cursor++] = lowByte(sds.pm25); + buffer[cursor++] = highByte((uint16_t)(sds.pm10 * 10)); + buffer[cursor++] = lowByte((uint16_t)(sds.pm10 * 10)); +// value of PM2.5 +#if (PAYLOAD_ENCODER == 3) // Cayenne LPP dynamic + buffer[cursor++] = LPP_PARTMATTER25_CHANNEL; // for PM2.5 +#endif + buffer[cursor++] = LPP_LUMINOSITY; // workaround since cayenne has no data type meter + buffer[cursor++] = highByte((uint16_t)(sds.pm25 * 10)); + buffer[cursor++] = lowByte((uint16_t)(sds.pm25 * 10)); #endif // HAS_SDS011 }