Lokaler Tracker funktionsfähig. Bugfixes.

This commit is contained in:
2025-09-22 14:27:05 +02:00
parent f0ebdd0201
commit e7a96390f2
6 changed files with 150 additions and 44 deletions

View File

@@ -33,14 +33,16 @@ class RaceTracker(Page):
self.bv_lat = boatdata.getRef("LAT")
self.bv_lon = boatdata.getRef("LON")
self.bv_sog = boatdata.getRef("SOG")
self.bv_hdop = boatdata.getRef("HDOP")
self.races = None
self.raceid = None
if self.ttype == 'HERO':
self.raceid = self.app.track.hero_raceid # Ausgewählte Regatta
self.buttonlabel[1] = 'MODE'
self.buttonlabel[2] = 'INFO'
self.buttonlabel[5] = 'ABORT'
else:
self.raceid = None
elif self.ttype in ('LOCAL','SDCARD'):
self.buttonlabel[5] = 'ON'
self.menupos = 0
self.mode = 'N' # (N)ormal, (C)onfiguration, (M)itteilung
self.query_active = False
@@ -92,6 +94,8 @@ class RaceTracker(Page):
self.buttonlabel = self.savebuttons.copy()
return True
if buttonid == 1:
if not self.ttype == 'HERO':
return False
# Modus umschalten
if self.mode == 'N':
self.mode = 'C'
@@ -110,6 +114,8 @@ class RaceTracker(Page):
self.buttonlabel[5] = 'ABORT'
return True
elif buttonid == 2:
if not self.ttype == 'HERO':
return False
if self.mode == 'N':
self.mode = 'M' # Nachrichten der Wettfahrtleitung
self.buttonlabel[2] = ''
@@ -140,15 +146,26 @@ class RaceTracker(Page):
return True
elif buttonid == 5:
if self.mode == 'N':
self.query_active = True;
self.savebuttons = self.buttonlabel.copy()
self.buttonlabel[1] = ""
self.buttonlabel[2] = "YES"
self.buttonlabel[3] = ""
self.buttonlabel[4] = ""
self.buttonlabel[5] = "NO"
self.buttonlabel[6] = ""
# Taste 2 = JA, Taste 5 = NEIN
if self.ttype in ('LOCAL','SDCARD'):
# Tracking ein/-ausschalten
if self.app.track.is_active():
self.app.track.set_active(False)
self.buttonlabel[5] = 'ON'
else:
self.app.track.set_active(True)
self.buttonlabel[5] = 'OFF'
else:
if self.ttype == ('HERO'):
# Rennabbruch verarbeiten
self.query_active = True;
self.savebuttons = self.buttonlabel.copy()
self.buttonlabel[1] = ""
self.buttonlabel[2] = "YES"
self.buttonlabel[3] = ""
self.buttonlabel[4] = ""
self.buttonlabel[5] = "NO"
self.buttonlabel[6] = ""
# Taste 2 = JA, Taste 5 = NEIN
elif self.mode == 'C':
# Tracking ein/-ausschalten
if self.app.track.is_active():
@@ -180,16 +197,22 @@ class RaceTracker(Page):
ctx.set_font_size(16)
ctx.move_to(x, y)
ctx.show_text("Disabled by 'NONE in configuration'.")
y += 40
y += 30
ctx.move_to(x, y)
ctx.show_text("Currently only tracker type 'HERO' is")
ctx.show_text("Currently only tracker types 'HERO' and 'LOCAL'")
y += 20
ctx.move_to(x, y)
ctx.show_text("implemented. Please visit the Regatta")
ctx.show_text("are implemented.")
y += 30
ctx.move_to(x, y)
ctx.show_text("'LOCAL' tracks positions in file system.")
y += 30
ctx.move_to(x, y)
ctx.show_text("For 'HERO' pleast visit the Regatta Hero")
y += 20
ctx.move_to(x, y)
ctx.show_text("Hero web page for detailed description.")
y += 40
ctx.show_text("web page for detailed description.")
y += 20
ctx.move_to(x, y)
ctx.show_text("Additionally you should contact your local")
y += 20
@@ -198,19 +221,61 @@ class RaceTracker(Page):
def draw_local(self, ctx):
x = 8
x1 = 130
y = 50
ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
ctx.set_font_size(24)
ctx.move_to(x, y)
ctx.show_text("Local Tracking")
ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
ctx.set_font_size(16)
y += 30
ctx.move_to(x, y)
ctx.show_text("Activated: ")
ctx.show_text("Yes" if self.app.track.is_active() else "No")
y += 20
ctx.move_to(x, y)
ctx.show_text(f"Log interval: {self.app.track.local_dt} seconds")
#ctx.show_text(str(self.app.track.local_dt))
y += 20
ctx.move_to(x, y)
ctx.show_text("Log entries written: ")
ctx.show_text(str(self.app.track.local_lfdno))
# Anzeige
# - LAT, LON
# - bisher gespeicherte Anzahl Positionen
# - Zeitabstand zwischen den einzelnen Messungen
# - Hinweis wo gespeichert wird
y += 30
ctx.move_to(x, y)
ctx.show_text("Latitude: ")
ctx.move_to(x1, y)
ctx.show_text(self.bv_lat.format())
y += 20
ctx.move_to(x, y)
ctx.show_text("Longitude: ")
ctx.move_to(x1, y)
ctx.show_text(self.bv_lon.format())
y += 20
ctx.move_to(x, y)
ctx.show_text("HDOP: ")
ctx.move_to(x1, y)
ctx.show_text(self.bv_hdop.format() or '---')
y += 20
ctx.move_to(x, y)
ctx.show_text("Speed: ")
ctx.move_to(x1, y)
ctx.show_text(self.bv_sog.format())
def draw_normal(self, ctx):
def draw_hero(self, ctx):
"""
Regatta Hero Normalansicht
TODO
racephase anzeige zu Debuggingzwecken
"""
ctx.select_font_face("DSEG7 Classic")
ctx.set_font_size(80)
@@ -448,10 +513,12 @@ class RaceTracker(Page):
def draw(self, ctx):
if self.mode == 'N':
if self.ttype == 'NONE':
self.draw_none(ctx)
if self.ttype in ('LOCAL', 'SDCARD'):
self.draw_local(ctx)
elif self.ttype == 'HERO':
self.draw_hero(ctx)
else:
self.draw_normal(ctx)
self.draw_none(ctx)
elif self.mode == 'C':
self.draw_config(ctx)
else: