diff --git a/boosthub.js b/boosthub.js index 89116de..d021c8a 100644 --- a/boosthub.js +++ b/boosthub.js @@ -284,7 +284,7 @@ class BoostHub extends Hub { distance += 1 / partial; } - this.emit("distance", port.id, Math.floor(distance * 25.4)); + this.emit("distance", port.id, Math.floor(distance * 25.4) - 20); break; } case Consts.Devices.WEDO2_TILT: diff --git a/test.js b/test.js index 8c693d8..1efbfa9 100644 --- a/test.js +++ b/test.js @@ -18,7 +18,7 @@ lpf2.on("discover", (hub) => { moveHub.on("distance", (port, distance) => { console.log(`Distance ${distance} received on port ${port}`); - if (distance < 80) { + if (distance < 100) { moveHub.setMotorSpeed("D", 40); } else { moveHub.setMotorSpeed("D", 0); @@ -31,7 +31,7 @@ lpf2.on("discover", (hub) => { wedoHub.on("distance", (port, distance) => { console.log(`Distance ${distance} received on port ${port}`); - if (distance < 80) { + if (distance < 100) { wedoHub.setMotorSpeed("B", 40); } else { wedoHub.setMotorSpeed("B", 0);