From cbfbc5d600bfa2e1f57a925bfde831be8a21c1cf Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford Date: Thu, 11 May 2017 22:39:24 -0700 Subject: [PATCH] Convert motor duration: seconds -> milliseconds The block takes seconds, whereas the device takes milliseconds. Turning on a motor for 1 millisecond isn't very dramatic. --- src/blocks/scratch3_wedo2.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/blocks/scratch3_wedo2.js b/src/blocks/scratch3_wedo2.js index bd9e6c119..d79ef9096 100644 --- a/src/blocks/scratch3_wedo2.js +++ b/src/blocks/scratch3_wedo2.js @@ -456,13 +456,14 @@ class Scratch3WeDo2Blocks { * @return {Promise} - a promise which will resolve at the end of the duration. */ motorOnFor (args) { + const durationMS = args.DURATION * 1000; return new Promise(resolve => { this._forEachMotor(args.MOTOR_ID, motorIndex => { - this._device.motor(motorIndex).setMotorOnFor(args.DURATION); + this._device.motor(motorIndex).setMotorOnFor(durationMS); }); // Ensure this block runs for a fixed amount of time even when no device is connected. - setTimeout(resolve, args.DURATION); + setTimeout(resolve, durationMS); }); }