added free memory to device status query

This commit is contained in:
Klaus K Wilting committed 2018-08-04 22:49:12 +02:00
1 parent 9b472780da
commit 0a52b16c78
5 files changed
+32 -39

No files matched your search

+11 -3
View File
@@ -18,7 +18,7 @@ function Decoder(bytes, port) {
if (port === 2) {
// device status data
return decode(bytes, [uint16, uptime, temperature], ['voltage', 'uptime', 'cputemp']);
return decode(bytes, [uint16, uptime, temperature, uint32], ['voltage', 'uptime', 'cputemp', 'memory']);
}
@@ -66,7 +66,7 @@ uptime.BYTES = 4;
var uint8 = function (bytes) {
if (bytes.length !== uint8.BYTES) {
throw new Error('int must have exactly 1 byte');
throw new Error('uint8 must have exactly 1 byte');
}
return bytesToInt(bytes);
};
@@ -74,12 +74,20 @@ uint8.BYTES = 1;
var uint16 = function (bytes) {
if (bytes.length !== uint16.BYTES) {
throw new Error('int must have exactly 2 bytes');
throw new Error('uint16 must have exactly 2 bytes');
}
return bytesToInt(bytes);
};
uint16.BYTES = 2;
var uint32 = function (bytes) {
if (bytes.length !== uint32.BYTES) {
throw new Error('uint32 must have exactly 4 bytes');
}
return bytesToInt(bytes);
};
uint32.BYTES = 4;
var latLng = function (bytes) {
if (bytes.length !== latLng.BYTES) {
throw new Error('Lat/Long must have exactly 4 bytes');