From 951b9be6e40f9b30c09d7c646b33beae1484adb3 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Wed, 10 Jan 2018 11:14:18 -0800 Subject: [PATCH] fixing motors --- libs/core/output.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/core/output.ts b/libs/core/output.ts index 3be020a4..90028164 100644 --- a/libs/core/output.ts +++ b/libs/core/output.ts @@ -216,10 +216,16 @@ namespace motors { setSpeed(speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) { this.init(); speed = Math.clamp(-100, 100, speed >> 0); + // stop if speed is 0 if (!speed) { this.stop(); return; } + // special: 0 is infinity + if (value == 0) { + this._setSpeed(speed); + return; + } let useSteps: boolean; let stepsOrTime: number; switch (unit) {