More calibration?
This commit is contained in:
		@@ -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>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user