change default to bluetooth disabled

This commit is contained in:
Klaus K Wilting committed 2018-12-02 14:08:50 +01:00
1 parent 8d22695114
commit decb8b7181
18 files changed
+163 -49

No files matched your search

+8 -1
View File
@@ -4,9 +4,16 @@
function Converter(decoded, port) {
var converted = decoded;
var pax = 0;
if (port === 1) {
converted.pax = converted.ble + converted.wifi;
for (var x in converted) {
pax += converted[x];
}
converted.pax = pax;
}
if (port === 2) {
+5 -1
View File
@@ -6,7 +6,11 @@ function Decoder(bytes, port) {
var decoded = {};
if (port === 1) {
// only counter data, no gps
// only wifi counter data, no gps
if (bytes.length === 2) {
return decode(bytes, [uint16], ['wifi']);
}
// wifi + ble counter data, no gps
if (bytes.length === 4) {
return decode(bytes, [uint16, uint16], ['wifi', 'ble']);
}
+5 -2
View File
@@ -7,8 +7,11 @@ function Decoder(bytes, port) {
if (port === 1) {
var i = 0;
decoded.wifi = (bytes[i++] << 8) | bytes[i++];
decoded.ble = (bytes[i++] << 8) | bytes[i++];
if (bytes.length >= 2) {
decoded.wifi = (bytes[i++] << 8) | bytes[i++];}
if (bytes.length >= 4) {
decoded.ble = (bytes[i++] << 8) | bytes[i++];}
if (bytes.length > 4) {
decoded.latitude = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);