mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Moving position reversal back to reporter to avoid conflicts.
This commit is contained in:
parent
a61b01628e
commit
a0f0a4092c
1 changed files with 8 additions and 5 deletions
|
@ -1016,10 +1016,7 @@ class Boost {
|
||||||
break;
|
break;
|
||||||
case BoostIO.MOTOREXT:
|
case BoostIO.MOTOREXT:
|
||||||
case BoostIO.MOTORINT:
|
case BoostIO.MOTORINT:
|
||||||
// The motor position in port A is reversed by design, so we need
|
this.motor(portID).position = int32ArrayToNumber(data.slice(4, 8));
|
||||||
// to reverse it here so that all motors match
|
|
||||||
this.motor(portID).position = ((portID === BoostPort.A) ? -1 : 1) *
|
|
||||||
int32ArrayToNumber(data.slice(4, 8));
|
|
||||||
break;
|
break;
|
||||||
case BoostIO.CURRENT:
|
case BoostIO.CURRENT:
|
||||||
case BoostIO.VOLTAGE:
|
case BoostIO.VOLTAGE:
|
||||||
|
@ -1891,7 +1888,13 @@ class Scratch3BoostBlocks {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (portID && this._peripheral.motor(portID)) {
|
if (portID && this._peripheral.motor(portID)) {
|
||||||
return MathUtil.wrapClamp(this._peripheral.motor(portID).position, 0, 360);
|
let val = this._peripheral.motor(portID).position;
|
||||||
|
// Boost motor A position direction is reversed by design
|
||||||
|
// so we have to reverse the position here
|
||||||
|
if (portID === BoostPort.A) {
|
||||||
|
val *= -1;
|
||||||
|
}
|
||||||
|
return MathUtil.wrapClamp(val, 0, 360);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue