More calibration?

This commit is contained in:
Zakary Timson 2019-09-02 23:04:59 -04:00
parent a3bdfed596
commit 1b6f98f283
3 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@
</div> </div>
</div> </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> <mat-slider class="w-100" [max]="180" [min]="-180" [step]="1" [tickInterval]="90" [thumbLabel]="true" [ngModel]="calibration" (input)="calibration = $event.value"></mat-slider>
</div> </div>
</div> </div>
<mat-divider class="mb-1"></mat-divider> <mat-divider class="mb-1"></mat-divider>

View File

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

View File

@ -52,7 +52,7 @@ export class PhysicsService {
this.requireCalibration.emit(); this.requireCalibration.emit();
} }
info.heading = -(data[1] ? data[1].alpha : 0) - (data[2] == Infinity ? 0 : data[2]); info.heading = -(data[1] ? data[1].alpha : 0) + (data[2] == Infinity ? 0 : data[2]);
if(info.heading < 0) info.heading += 360; if(info.heading < 0) info.heading += 360;
if(info.heading >= 360) info.heading -= 360; if(info.heading >= 360) info.heading -= 360;
} }