Change turnOnForever and turnOff behavior for power = 0 case.

This commit is contained in:
Evelyn Eastmond 2019-04-23 19:22:01 -04:00
parent 6326694bff
commit f0edd10346

View file

@ -496,7 +496,10 @@ class BoostMotor {
* @param {boolean} [resetState=true] - whether to reset the state of the motor when running this command. * @param {boolean} [resetState=true] - whether to reset the state of the motor when running this command.
*/ */
turnOnForever (resetState = true){ turnOnForever (resetState = true){
if (this.power === 0) return; if (this.power === 0) {
this.turnOff(false);
}
if (resetState) this.status = BoostMotorState.ON_FOREVER; if (resetState) this.status = BoostMotorState.ON_FOREVER;
this._turnOn(); this._turnOn();
} }
@ -552,7 +555,7 @@ class BoostMotor {
* @param {boolean} [useLimiter=true] - if true, use the rate limiter * @param {boolean} [useLimiter=true] - if true, use the rate limiter
*/ */
turnOff (useLimiter = true) { turnOff (useLimiter = true) {
if (this.power === 0) return; // if (this.power === 0) return;
const cmd = this._parent.generateOutputCommand( const cmd = this._parent.generateOutputCommand(
this._index, this._index,