Merge pull request #2139 from evhan55/bugfix/2135

Reverse the sign on Boost Motor A position reporter
This commit is contained in:
Evelyn Eastmond 2019-04-25 11:14:14 -04:00 committed by GitHub
commit 6326694bff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1888,7 +1888,13 @@ class Scratch3BoostBlocks {
return false;
}
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;
}