Skip to content

Commit

Permalink
fix: remove unnecessary assignment of variables after undefined check…
Browse files Browse the repository at this point in the history
… in haltian thingsee enviornment device

fix: milesight WS136 non-standard hex utils invocation
fix: hex utils to behave the same way as in script-runner
fix: add dotenv dependency (still doesn't work on jetbrains IDEs though)
  • Loading branch information
Biglr committed Oct 10, 2023
1 parent 427729a commit cc7b0dd
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/hex/hex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Creating little endian hex DCBA
exports.hexLittleEndianToBigEndian = (hex, signed) => {
exports.hexLittleEndianToBigEndian = (hex, signed = true) => {
const hexArray = [];
let tempHex = hex;
while (tempHex.length >= 2) {
Expand Down
1 change: 1 addition & 0 deletions lib/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require("fs");
const chai = require("chai");
const request = require("sync-request");
const { validate } = require("jsonschema");
require('dotenv').config()

const { assert } = chai;
const bits = require("bits");
Expand Down
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
"rewire": "^5.0.0",
"sync-request": "^6.1.0",
"test-utils": "file:lib/test"
},
"dependencies": {
"dotenv": "^16.3.1"
}
}
10 changes: 0 additions & 10 deletions types/haltian/thingseeEnvironment/uplink.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ function consume(event) {
sample.neighRadioPowerDbm = neighRadioPowerDbm;
}

sample.rssiDbm = rssiDbm;
sample.neighNodeInfo = neighNodeInfo;
sample.neighRadioPower = neighRadioPower;
sample.neighRadioPowerDbm = neighRadioPowerDbm;

break;
}
case 1312: {
Expand Down Expand Up @@ -125,11 +120,6 @@ function consume(event) {
sample.light = light;
}

sample.pressure = pressure;
sample.humidity = humidity;
sample.temperature = temperature;
sample.light = light;

break;
}
case 12101: {
Expand Down
2 changes: 1 addition & 1 deletion types/milesight/WS136/uplink.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function consume(event) {
// PRESS STATE
else if (channelId === 0xff && channelType === 0x34) {
data.buttonNumber = bytes[i];
data.command = Hex.hexLittleEndianToBigEndian(payload.substr(++i * 2, 4));
data.command = Hex.hexLittleEndianToBigEndian(payload.substr(++i * 2, 4), false);
i += 1;
} else {
break;
Expand Down

0 comments on commit cc7b0dd

Please sign in to comment.