From 361ae7a2d2d12b5ac1adc94d9411a74ed68c481e Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 17 Sep 2019 11:23:40 -0700 Subject: [PATCH] adding a few pause to allow motors to settle --- libs/core/output.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/core/output.ts b/libs/core/output.ts index 13bc7f02..984772c1 100644 --- a/libs/core/output.ts +++ b/libs/core/output.ts @@ -123,7 +123,8 @@ namespace motors { //% help=motors/stop-all export function stopAll() { const b = mkCmd(Output.ALL, DAL.opOutputStop, 0) - writePWM(b) + writePWM(b); + pause(1); } /** @@ -132,6 +133,7 @@ namespace motors { //% group="Move" export function resetAllMotors() { reset(Output.ALL) + pause(1); } interface MoveSchedule { @@ -259,6 +261,8 @@ namespace motors { // allow 500ms for robot to settle if (this._brake && this._brakeSettleTime > 0) pause(this._brakeSettleTime); + else + pause(1); // give a tiny breather } protected pauseOnRun(stepsOrTime: number) { @@ -337,6 +341,7 @@ namespace motors { // special: 0 is infinity if (schedule.steps[0] + schedule.steps[1] + schedule.steps[2] == 0) { this._run(schedule.speed); + pause(1); return; } @@ -700,7 +705,7 @@ namespace motors { this.init(); speed = Math.clamp(-100, 100, speed >> 0); if (!speed) { - stop(this._port, this._brake); + this.stop(); return; }