Add Alarm Function to Example Decoder
This commit is contained in:
parent
58f24c54c1
commit
e9a12cb02b
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue