gotoPhysicalZero fix
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nathan Kellenicki 2020-05-24 15:53:18 -07:00
parent bcc59ce81c
commit 6decc7139b

View File

@ -84,9 +84,7 @@ export class AbsoluteMotor extends TachoMotor {
return new Promise((resolve) => {
const oldMode = this.mode;
let calibrated = false;
this.requestUpdate();
this.on("absolute", async ({ angle }) => {
console.log(angle);
if (!calibrated) {
calibrated = true;
if (angle < 0) {
@ -94,7 +92,6 @@ export class AbsoluteMotor extends TachoMotor {
} else {
speed = -speed;
}
console.log(angle, speed);
await this.rotateByDegrees(angle, speed);
if (oldMode) {
this.subscribe(oldMode);
@ -102,6 +99,7 @@ export class AbsoluteMotor extends TachoMotor {
return resolve();
}
});
this.requestUpdate();
});
}