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

@ -355,7 +355,11 @@ Hereafter described is the default *plain* format, which uses MSB bit numbering.
**Port #9:** Time/Date
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

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++];
}
}
if (port === 10) {
var i = 0;
if (bytes.length >= 2) {
decoded.ens = (bytes[i++] << 8) | bytes[i++];
}
}
return decoded;
}