Merge pull request #557 from AugustQu/SDS011

Sds011
This commit is contained in:
Verkehrsrot authored and GitHub committed 2020-03-14 07:39:08 +01:00
commit 5e9d69966b
2 files changed
+15 -9

No files matched your search

+2
View File
@@ -23,6 +23,8 @@
#define LPP_HUMIDITY_CHANNEL 29
#define LPP_BAROMETER_CHANNEL 30
#define LPP_AIR_CHANNEL 31
#define LPP_PARTMATTER10_CHANNEL 32 // particular matter for PM 10
#define LPP_PARTMATTER25_CHANNEL 33 // particular matter for PM 2.5
// MyDevices CayenneLPP 2.0 types for Packed Sensor Payload, not using channels,
// but different FPorts
+13 -9
View File
@@ -331,17 +331,21 @@ 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
#error not implemented yet
buffer[cursor++] = LPP_PARTMATTER10_CHANNEL; // for PM10
#endif
#if (PAYLOAD_ENCODER == 4) // Cayenne LPP packed
#error not implemented yet
buffer[cursor++] = LPP_LUMINOSITY; // workaround since cayenne has no data type meter
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
#endif // HAS_SDS011
}
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
void PayloadConvert::addCount(uint16_t value, uint8_t snifftype) {
switch (snifftype) {
@@ -520,4 +524,4 @@ void PayloadConvert::addTime(time_t value) {
void PayloadConvert::addChars(char *string, int len) {
for (int i = 0; i < len; i++)
addByte(string[i]);
}
}