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