From da72a24199341bd51f34b2fe70640a71c6737241 Mon Sep 17 00:00:00 2001 From: frederic wagner Date: Tue, 26 Jul 2022 16:59:04 +0200 Subject: [PATCH] bugfix for speed --- apps/gipy/ChangeLog | 3 +++ apps/gipy/TODO | 5 ++++- apps/gipy/app.js | 10 ++++------ apps/gipy/metadata.json | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/gipy/ChangeLog b/apps/gipy/ChangeLog index e44322007..1bfac278c 100644 --- a/apps/gipy/ChangeLog +++ b/apps/gipy/ChangeLog @@ -38,3 +38,6 @@ * Display direction to nearest point when lost. * Display average speed. * Turn off gps when locked and between points + +0.12: + * Bugfix in speed computation. diff --git a/apps/gipy/TODO b/apps/gipy/TODO index 88b2e3f6c..ac0b7416b 100644 --- a/apps/gipy/TODO +++ b/apps/gipy/TODO @@ -1,8 +1,11 @@ * bugs -- meters seem to be a bit too long - segment detection could be better ? +-----> we need to display debug info like which nearest point on which segment + very often you jump to next segment while still on current one +- it does not buzz very often on turns + * additional features diff --git a/apps/gipy/app.js b/apps/gipy/app.js index c8ca09791..c266532b1 100644 --- a/apps/gipy/app.js +++ b/apps/gipy/app.js @@ -200,7 +200,8 @@ class Status { } } display_stats() { - let rounded_distance = Math.round(this.remaining_distance() / 100) / 10; + let remaining_distance = this.remaining_distance(); + let rounded_distance = Math.round(remaining_distance / 100) / 10; let total = Math.round(this.remaining_distances[0] / 100) / 10; let now = new Date(); let minutes = now.getMinutes().toString(); @@ -213,12 +214,9 @@ class Status { .setColor(g.theme.fg) .drawString(hours + ":" + minutes, g.getWidth(), g.getHeight() - 15); - let done_distance = - this.remaining_distances[0] - - this.remaining_distances[this.current_segment + 1] - - this.distance_to_next_point; + let done_distance = this.remaining_distances[0] - remaining_distance; let done_in = getTime() - this.starting_time; - let approximate_speed = Math.round(done_distance / done_in); + let approximate_speed = Math.round((done_distance * 3.6) / done_in); g.setFont("6x15") .setFontAlign(-1, -1, 0) .drawString("s." + approximate_speed + "km/h", 0, g.getHeight() - 49); diff --git a/apps/gipy/metadata.json b/apps/gipy/metadata.json index b2357490c..2c31b1317 100644 --- a/apps/gipy/metadata.json +++ b/apps/gipy/metadata.json @@ -2,7 +2,7 @@ "id": "gipy", "name": "Gipy", "shortName": "Gipy", - "version": "0.11", + "version": "0.12", "description": "Follow gpx files", "allow_emulator":false, "icon": "gipy.png",