Skip to content

Commit 6326694

Browse files
authored
Merge pull request #2139 from evhan55/bugfix/2135
Reverse the sign on Boost Motor A position reporter
2 parents b80b05e + a0f0a40 commit 6326694

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/extensions/scratch3_boost/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,13 @@ class Scratch3BoostBlocks {
18881888
return false;
18891889
}
18901890
if (portID && this._peripheral.motor(portID)) {
1891-
return MathUtil.wrapClamp(this._peripheral.motor(portID).position, 0, 360);
1891+
let val = this._peripheral.motor(portID).position;
1892+
// Boost motor A position direction is reversed by design
1893+
// so we have to reverse the position here
1894+
if (portID === BoostPort.A) {
1895+
val *= -1;
1896+
}
1897+
return MathUtil.wrapClamp(val, 0, 360);
18921898
}
18931899
return 0;
18941900
}

0 commit comments

Comments
 (0)