made GPS a static class
This commit is contained in:
@@ -16,13 +16,13 @@ class GPS extends CLIAppBase {
|
||||
|
||||
var pos: Pos3 = new Vec3<Float>(x, y, z);
|
||||
|
||||
kernel.gps.GPS.instance.setManualPosition(pos);
|
||||
kernel.gps.GPS.setManualPosition(pos);
|
||||
|
||||
return true;
|
||||
},"<x> <y> <z>");
|
||||
|
||||
registerSyncSubcommand("status",(args)->{
|
||||
var pos = kernel.gps.GPS.instance.getPosition();
|
||||
var pos = kernel.gps.GPS.getPosition();
|
||||
if (pos != null) {
|
||||
handle.writeLine('Position x:${pos.x} y:${pos.y} z:${pos.z}');
|
||||
} else {
|
||||
@@ -30,7 +30,7 @@ class GPS extends CLIAppBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
var acc = kernel.gps.GPS.instance.getAccuracy();
|
||||
var acc = kernel.gps.GPS.getAccuracy();
|
||||
if (acc == 1){
|
||||
handle.writeLine("Accuracy: Low");
|
||||
} else if (acc == 2){
|
||||
@@ -50,7 +50,7 @@ class GPS extends CLIAppBase {
|
||||
});
|
||||
|
||||
registerAsyncSubcommand("locate",(args)->{
|
||||
return kernel.gps.GPS.instance.locate().map((pos)->{
|
||||
return kernel.gps.GPS.locate().map((pos)->{
|
||||
if (pos != null) {
|
||||
handle.writeLine('Position x:${pos.x} y:${pos.y} z:${pos.z}');
|
||||
} else {
|
||||
|
||||
@@ -35,14 +35,14 @@ class PFClient implements Process {
|
||||
}
|
||||
|
||||
private function render() {
|
||||
var acc = kernel.gps.GPS.instance.getAccuracy();
|
||||
var pos: Pos3 = kernel.gps.GPS.instance.getPosition() ?? {x: 0, y: 0, z: 0};
|
||||
var acc = kernel.gps.GPS.getAccuracy();
|
||||
var pos: Pos3 = kernel.gps.GPS.getPosition() ?? {x: 0, y: 0, z: 0};
|
||||
|
||||
var childre: Array<UIElement> = [
|
||||
new TextElement('Acc: ${acc}'),
|
||||
new TextElement('Pos: X:${pos.x} Y:${pos.y} Z:${pos.z}'),
|
||||
new TextElement('UPDATE', { style: {bgColor: Gray}, uiEvents: {onClick: () -> {
|
||||
kernel.gps.GPS.instance.locate().handle((pos) ->{
|
||||
kernel.gps.GPS.locate().handle((pos) ->{
|
||||
this.requestRender();
|
||||
});
|
||||
}}}),
|
||||
|
||||
Reference in New Issue
Block a user