Add Alarm Function to Example Decoder

This commit is contained in:
seiichiro 2020-06-13 11:02:51 +02:00
parent 58f24c54c1
commit e9a12cb02b
1 changed files with 4 additions and 0 deletions

View File

@ -25,6 +25,10 @@ function Decoder(bytes, port) {
// We always have Battery Voltage (uint8_t)
decoded.v = (bytes[0] * 20) / 1000.0;
// Alarm Triggered (uint8_t)
if (bytes.length == 2)
decoded.a = bytes(1);
// Temperature (int32_t)
if (bytes.length >= 5)
decoded.t = ((bytes[1]) | (bytes[2] << 8 ) | (bytes[3] << 16 ) | (bytes[4] << 24)) / 100.0;