Update plain_decoder.js
the old version had problems while using wifi and gps but not bluetooth added battery monitor
This commit is contained in:
parent
4b1223816f
commit
16cebd418a
@ -10,7 +10,7 @@ function Decoder(bytes, port) {
|
||||
if (bytes.length >= 2) {
|
||||
decoded.wifi = (bytes[i++] << 8) | bytes[i++];}
|
||||
|
||||
if (bytes.length >= 4) {
|
||||
if (bytes.length === 4 || bytes.length > 15) {
|
||||
decoded.ble = (bytes[i++] << 8) | bytes[i++];}
|
||||
|
||||
if (bytes.length > 4) {
|
||||
@ -61,6 +61,12 @@ function Decoder(bytes, port) {
|
||||
decoded.air = ((bytes[i++] << 8) | bytes[i++]);
|
||||
}
|
||||
|
||||
if (port === 8) {
|
||||
var i = 0;
|
||||
if (bytes.length >= 2) {
|
||||
decoded.battery = (bytes[i++] << 8) | bytes[i++];}
|
||||
}
|
||||
|
||||
return decoded;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user