ENS counter added to decoders

This commit is contained in:
Klaus K Wilting 2020-10-10 16:05:47 +02:00
parent 84a432a30f
commit 4833044df7
3 changed files with 18 additions and 1 deletions

View File

@ -357,6 +357,10 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering.
bytes 1-4: board's local time/date in UNIX epoch (number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds) bytes 1-4: board's local time/date in UNIX epoch (number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds)
**Ports #10, #11, #12:** User sensor data
Format is specified by user in function `sensor_read(uint8_t sensor)`, see `src/sensor.cpp`. Port #10 is also used for ENS counter (2 bytes = 16 bit), if ENS is compiled AND ENS data transfer is enabled
# Remote control # Remote control
The device listenes for remote control commands on LoRaWAN Port 2. Multiple commands per downlink are possible by concatenating them. The device listenes for remote control commands on LoRaWAN Port 2. Multiple commands per downlink are possible by concatenating them.

View File

@ -89,6 +89,11 @@ function Decoder(bytes, port) {
} }
} }
if (port === 10) {
// ENS count
return decode(bytes, [uint16], ['ens']);
}
} }

View File

@ -82,5 +82,13 @@ function Decoder(bytes, port) {
decoded.timestatus = bytes[i++]; decoded.timestatus = bytes[i++];
} }
} }
if (port === 10) {
var i = 0;
if (bytes.length >= 2) {
decoded.ens = (bytes[i++] << 8) | bytes[i++];
}
}
return decoded; return decoded;
} }