updated readme.md and payload decoders for new test monitor function
This commit is contained in:
1 parent
a030918f91
commit
08a4370141
3 files changed
+38
-1
No files matched your search
@@ -31,6 +31,17 @@ function Decoder(bytes, port) {
|
||||
// gps data
|
||||
return decode(bytes, [latLng, latLng, uint8, hdop, uint16], ['latitude', 'longitude', 'sats', 'hdop', 'altitude']);
|
||||
}
|
||||
|
||||
if (port === 5) {
|
||||
// button pressed
|
||||
return decode(bytes, [uint8], ['button']);
|
||||
}
|
||||
|
||||
if (port === 6) {
|
||||
// beacon proximity alarm
|
||||
return decode(bytes, [uint8, uint8], ['rssi', 'beacon']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,5 +19,25 @@ function Decoder(bytes, port) {
|
||||
}
|
||||
}
|
||||
|
||||
if (port === 2) {
|
||||
var i = 0;
|
||||
decoded.battery = ((bytes[i++] << 8) | bytes[i++]);
|
||||
decoded.uptime = ((bytes[i++] << 56) | (bytes[i++] << 48) | (bytes[i++] << 40) | (bytes[i++] << 32) |
|
||||
(bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
||||
decoded.temp = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
||||
}
|
||||
|
||||
if (port === 5) {
|
||||
var i = 0;
|
||||
decoded.button = (bytes[i++]);
|
||||
}
|
||||
|
||||
if (port === 6) {
|
||||
var i = 0;
|
||||
decoded.rssi = (bytes[i++]);
|
||||
decoded.beacon = (bytes[i++]);
|
||||
}
|
||||
|
||||
return decoded;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user