From 2ff0e5f79e9b8e2b13b76be7f03013cc2ff33cfc Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Sun, 10 May 2020 10:09:29 +0200 Subject: [PATCH] Add Brightness Measurement Decoding to Payload Decoder --- Firmware/README.md | 10 +++++++++- Firmware/src/main.cpp | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Firmware/README.md b/Firmware/README.md index d92c0b0..68b2248 100644 --- a/Firmware/README.md +++ b/Firmware/README.md @@ -33,9 +33,17 @@ function Decoder(bytes, port) { if (bytes.length >= 9) decoded.h = ((bytes[5]) | (bytes[6] << 8 ) | (bytes[7] << 16 ) | (bytes[8] << 24)) / 100.0; - // Atmospheric Pressure (int32t) + // SHT21 + Brightness (int16_t) + if (bytes.length == 11) + decoded.b = ((bytes[9]) | (bytes[10] << 8 )); + + // Atmospheric Pressure (int32_t) if (bytes.length >= 13) decoded.p = ((bytes[9]) | (bytes[10] << 8 ) | (bytes[11] << 16 ) | (bytes[12] << 24)) / 100.0; + + // BME280 + Brightness (int16_t) + if (bytes.length == 15) + decoded.b = ((bytes[13]) | (bytes[14] << 8 )); } return decoded; diff --git a/Firmware/src/main.cpp b/Firmware/src/main.cpp index 9e0a51a..67769c7 100644 --- a/Firmware/src/main.cpp +++ b/Firmware/src/main.cpp @@ -31,9 +31,10 @@ #include #include #include -#include #include + + // secconfig.h Configures RF Module, TTN Keys / RF Networks and used Sensor #include "secconfig.h" @@ -41,6 +42,7 @@ #ifdef RF_LORA // Include LoRaWAN #include + #include // For Storing Frame Counter #define DIO0 PIN_B0 #define NSS PIN_B1 RFM95 rfm(DIO0,NSS);