Playing with power states while we figure out the design.

This commit is contained in:
Evelyn Eastmond 2019-04-26 16:35:43 -04:00
parent 597bd68c0d
commit 270a445703

View file

@ -510,7 +510,9 @@ 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.
*/ */
turnOnFor (milliseconds, resetState = true) { turnOnFor (milliseconds, resetState = true) {
if (this.power === 0) return; if (this.power === 0) {
this.turnOff(false);
}
milliseconds = Math.max(0, milliseconds); milliseconds = Math.max(0, milliseconds);
if (resetState) this.status = BoostMotorState.ON_FOR_TIME; if (resetState) this.status = BoostMotorState.ON_FOR_TIME;
@ -525,10 +527,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.
*/ */
turnOnForDegrees (degrees, direction, resetState = true) { turnOnForDegrees (degrees, direction, resetState = true) {
if (this.power === 0) { /* if (this.power === 0) {
this._clearRotationState(); this._clearRotationState();
return; return;
} }*/
degrees = Math.max(0, degrees); degrees = Math.max(0, degrees);