From 944098b9f962f9caed72c7a2a47254668f86d45d Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Sun, 17 Dec 2017 21:12:18 -0800 Subject: [PATCH] Minor refactor fix (#102) * Minor fix to a refactor of motor output this.brake to this._brake * No (_this) in global context * Minor fix --- libs/core/output.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/core/output.ts b/libs/core/output.ts index 72b3526b..0dd9ee93 100644 --- a/libs/core/output.ts +++ b/libs/core/output.ts @@ -200,7 +200,7 @@ namespace motors { */ private stop() { this.__init(); - stop(this._port); + stop(this._port, this._brake); } /** @@ -340,7 +340,7 @@ namespace motors { setSpeed(speed: number) { speed = Math.clamp(speed >> 0, -100, 100); if (!speed) { - stop(this._ports); + stop(this._ports, this._brake); return; } syncMotors(this._ports, { @@ -377,7 +377,7 @@ namespace motors { moveSteering(steering: number, speed: number, value: number, unit: MoveUnit) { speed = Math.clamp(-100, 100, speed >> 0); if (!speed) { - stop(this._ports); + stop(this._ports, this._brake); return; } @@ -513,9 +513,9 @@ namespace motors { writePWM(b); } - function stop(out: Output) { + function stop(out: Output, brake: boolean) { const b = mkCmd(out, DAL.opOutputStop, 1) - b.setNumber(NumberFormat.UInt8LE, 2, this.brake ? 1 : 0) + b.setNumber(NumberFormat.UInt8LE, 2, brake ? 1 : 0) writePWM(b); }