This commit is contained in:
tpsnt 2025-05-04 02:06:24 +00:00 committed by GitHub
commit 7cf372148f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1375,7 +1375,11 @@ class Scratch3WeDo2Blocks {
this._forEachMotor(args.MOTOR_ID, motorIndex => {
const motor = this._peripheral.motor(motorIndex);
if (motor) {
motor.power = MathUtil.clamp(Cast.toNumber(args.POWER), 0, 100);
const power = MathUtil.clamp(Cast.toNumber(args.POWER), 0, 100);
if (power === 0) {
motor.turnOff();
}
motor.power = power;
motor.turnOn();
}
});