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); }