spacer: refactor

pull/3713/head
Pavel Machek 2025-01-06 14:22:32 +01:00
parent 641b43af60
commit ebb4cd7c27
1 changed files with 8 additions and 5 deletions

View File

@ -117,6 +117,7 @@ let skys = {
sats: [], sats: [],
snum: 0, snum: 0,
sats_used: 0, sats_used: 0,
sky_start: -1,
reset: function() { reset: function() {
this.snum = 0; this.snum = 0;
@ -203,10 +204,14 @@ let skys = {
let t = getTime() - s.start; let t = getTime() - s.start;
return "" + t; return "" + t;
}, },
onEnd: function () {
if (this.sats_used < 5)
this.sky_start = getTime();
this.reset();
},
}; };
let sky = { let sky = {
sky_start: -1,
this_usable: 0, this_usable: 0,
debug: 0, debug: 0,
all: skys, /* Sattelites from all systems */ all: skys, /* Sattelites from all systems */
@ -292,7 +297,7 @@ let sky = {
let r = this.all.qualest(); let r = this.all.qualest();
let r1 = this.all.goodest(); let r1 = this.all.goodest();
print(r, r1, this.old_msg.hdop, this.old_msg.quality); print(r, r1, this.old_msg.hdop, this.old_msg.quality);
ui.drawMsg(r + "\n" + r1 + "\n" + this.old_msg.hdop + "-" + this.old_msg.quality + "d\n" + (getTime() - this.sky_start)); ui.drawMsg(r + "\n" + r1 + "\n" + this.old_msg.hdop + "-" + this.old_msg.quality + "d\n" + (getTime() - this.all.sky_start));
}, },
onMessageEnd: function() {}, onMessageEnd: function() {},
messageEnd: function() { messageEnd: function() {
@ -304,9 +309,7 @@ let sky = {
this.onMessageEnd(); this.onMessageEnd();
this.all.trackSatelliteVisibility(); this.all.trackSatelliteVisibility();
//print(this.sats); //print(this.sats);
if (this.all.sats_used < 5) this.all.onEnd();
this.sky_start = getTime();
this.all.reset();
}, },
parseRaw: function(msg, lost) { parseRaw: function(msg, lost) {
//print(msg); //print(msg);