This commit is contained in:
Zakary Timson 2019-07-11 18:54:44 -04:00
parent 3153d94c3d
commit 187d937958
3 changed files with 16 additions and 9 deletions

View File

@ -1,9 +1,18 @@
<div>
<div>
<mat-form-field appearance="fill">
<mat-label>Calibrate</mat-label>
<input matInput type="number" min="-180" max="180" [(ngModel)]="calibration">
</mat-form-field>
<div class="row">
<div class="col-5 pr-0">
<mat-form-field appearance="fill" class="w-100">
<mat-label>Shift +/-</mat-label>
<input matInput type="number" min="-180" max="180" [(ngModel)]="calibration">
</mat-form-field>
</div>
<div class="col-2 text-center"><h1> = </h1></div>
<div class="col-5 pl-0">
<mat-form-field appearance="fill" class="w-100">
<mat-label>Heading</mat-label>
<input matInput type="number" [ngModel]="(physicsService.info | async)?.heading" readonly>
</mat-form-field>
</div>
</div>
<div>
<mat-slider class="w-100" [max]="180" [min]="-180" [step]="1" [tickInterval]="90" [thumbLabel]="true" [(ngModel)]="calibration" (input)="calibration = $event.value"></mat-slider>

View File

@ -25,9 +25,9 @@ export class CalibrateComponent {
setN() {
let currentHeading = this.physicsService.orientation.value.alpha;
if(currentHeading <= 180) {
this.calibration = -currentHeading;
this.calibration = 360 - Math.round(currentHeading);
} else {
this.calibration = 360 - currentHeading;
this.calibration = -Math.round(currentHeading);
}
}
}

View File

@ -64,8 +64,6 @@ export class PhysicsService {
}
info.heading = -data[1].alpha + (data[2] == Infinity ? 0 : data[2]);
if(info.heading > 360) info.heading -= 360;
if(info.heading < 0) info.heading += 360;
}
if(info.speed == null && !!data[3]) info.speed = Math.sqrt(data[3].x**2 + data[3].y**2 + data[3].z**2);