From 35a2411f9277fa4cad42d7e304d9ca5711ed704f Mon Sep 17 00:00:00 2001 From: Evelyn Eastmond Date: Wed, 15 Aug 2018 14:01:08 -0400 Subject: [PATCH] Fixing motor direction block to also work when the motor is on indefinitely. --- src/extensions/scratch3_wedo2/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/extensions/scratch3_wedo2/index.js b/src/extensions/scratch3_wedo2/index.js index 1d7b6e7ad..f4528b601 100644 --- a/src/extensions/scratch3_wedo2/index.js +++ b/src/extensions/scratch3_wedo2/index.js @@ -995,9 +995,13 @@ class Scratch3WeDo2Blocks { log.warn(`Unknown motor direction in setMotorDirection: ${args.DIRECTION}`); break; } - // keep the motor on if it's running, and update the pending timeout - if (motor.isOn && motor.pendingTimeoutDelay) { - motor.setMotorOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now()); + // keep the motor on if it's running, and update the pending timeout if needed + if (motor.isOn) { + if (motor.pendingTimeoutDelay) { + motor.setMotorOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now()); + } else { + motor.setMotorOn(); + } } } });