From 9ca06bbfca16aa315da6784bd7e6045fd362ee39 Mon Sep 17 00:00:00 2001 From: frederic wagner Date: Sat, 8 Jul 2023 11:46:38 +0200 Subject: [PATCH] gipy : lcd power saving + settings --- apps/gipy/ChangeLog | 3 ++- apps/gipy/README.md | 15 ++++++++++----- apps/gipy/TODO | 3 --- apps/gipy/app.js | 24 +++++++++++++++--------- apps/gipy/settings.js | 9 +++++++++ 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/apps/gipy/ChangeLog b/apps/gipy/ChangeLog index c2e9a21b4..e8055100a 100644 --- a/apps/gipy/ChangeLog +++ b/apps/gipy/ChangeLog @@ -92,6 +92,7 @@ * Large display for instant speed * Bugfix for negative coordinates * Disable menu while the map is not loaded - * Turn screen off while idling to save battery + * Turn screen off while idling to save battery (with setting) * New setting : disable buzz on turns * New setting : turn bluetooth off to save battery + * Color change for lost direction (now purple) diff --git a/apps/gipy/README.md b/apps/gipy/README.md index 242282dbf..d75cd5d6f 100644 --- a/apps/gipy/README.md +++ b/apps/gipy/README.md @@ -18,8 +18,8 @@ It provides the following features : - display the path with current position from gps - display a local map around you, downloaded from openstreetmap - detects and buzzes if you leave the path -- buzzes before sharp turns -- buzzes before waypoints +- (optional) buzzes before sharp turns +- (optional) buzzes before waypoints (for example when you need to turn in https://mapstogpx.com/) - display instant / average speed - display distance to next point @@ -51,8 +51,8 @@ Your path will be displayed in svg. ### Starting Gipy At start you will have a menu for selecting your trace (if more than one). -Choose the one you want and you will reach the splash screen where you'll wait for the gps signal. -Once you have a signal you will reach the main screen: +Choose the one you want and you will reach the splash screen where you'll wait for the map. +Once the map is loaded you will reach the main screen: ![Screenshot](legend.png) @@ -83,7 +83,7 @@ On your screen you can see: ### Lost If you stray away from path we will rescale the display to continue displaying nearby segments and -display the direction to follow as a black segment. +display the direction to follow as a purple segment. Note that while lost, the app will slow down a lot since it will start scanning all possible points to figure out where you are. On path it just needed to scan a few points ahead and behind. @@ -100,6 +100,10 @@ If you click the button you'll reach a menu where you can currently zoom out to Few settings for now (feel free to suggest me more) : - lost distance : at which distance from path are you considered to be lost ? +- buzz on turns : should the watch buzz when reaching a waypoint ? +- disable bluetooth : turn bluetooth off completely to try to save some power. +- power lcd off : turn lcd off after 30 seconds to save power. the watch will wake up when reaching waypoints +and when you touch the screen. ### Caveats @@ -121,5 +125,6 @@ Feel free to give me feedback : is it useful for you ? what other features would If you want to raise issues the main repository is [https://github.com/wagnerf42/BangleApps](here) and the rust code doing the actual map computations is located [https://github.com/wagnerf42/gps](here). +You can try the cutting edge version at [https://wagnerf42.github.io/BangleApps/](https://wagnerf42.github.io/BangleApps/) frederic.wagner@imag.fr diff --git a/apps/gipy/TODO b/apps/gipy/TODO index c94211c1d..0c25f7d0b 100644 --- a/apps/gipy/TODO +++ b/apps/gipy/TODO @@ -1,8 +1,5 @@ -+ disable backlight during day ? + put back foot only ways -+ disable bluetooth -+ disable lcd completely + try fiddling with jit + put back street names + put back shortest paths but with points cache this time and jit diff --git a/apps/gipy/app.js b/apps/gipy/app.js index 866849efc..a39062aa9 100644 --- a/apps/gipy/app.js +++ b/apps/gipy/app.js @@ -20,6 +20,7 @@ var settings = Object.assign({ lost_distance: 50, buzz_on_turns: false, disable_bluetooth: true, + power_lcd_off: true, }, s.readJSON("gipy.json", true) || {} ); @@ -815,7 +816,7 @@ class Status { } // abort most frames if locked - if (Bangle.isLocked() && this.gps_coordinates_counter % 5 != 0) { + if (!Bangle.isLocked() && this.gps_coordinates_counter % 5 != 0) { return; } @@ -1087,7 +1088,7 @@ class Status { let rotated_y = tx * sin + ty * cos; let x = half_width - Math.round(rotated_x); // x is inverted let y = half_height + Math.round(rotated_y); - g.setColor(g.theme.fgH).drawLine(half_width, half_height, x, y); + g.setColor(1, 0, 1).drawLine(half_width, half_height, x, y); } // display current-segment's projection @@ -1386,12 +1387,17 @@ function start(fn) { function start_gipy(path, maps, interests) { console.log("starting"); - Bangle.setOptions({ - lockTimeout: 10000, - backlightTimeout: 20000, - lcdPowerTimeout: 30000, - hrmSportMode: 2, - }); + if (settings.power_lcd_off) { + Bangle.setOptions({ + lockTimeout: 10000, + backlightTimeout: 20000, + lcdPowerTimeout: 30000, + hrmSportMode: 2, + wakeOnTwist: false, // if true watch will never sleep due to speed and road bumps. tried several tresholds. + wakeOnFaceUp: false, + wakeOnTouch: true, + }); + } if (!simulated && settings.disable_bluetooth) { NRF.sleep(); // disable bluetooth completely } @@ -1531,4 +1537,4 @@ if (files.length <= 1) { } } else { drawMenu(); -} \ No newline at end of file +} diff --git a/apps/gipy/settings.js b/apps/gipy/settings.js index ecbcb267e..37b299815 100644 --- a/apps/gipy/settings.js +++ b/apps/gipy/settings.js @@ -5,6 +5,7 @@ lost_distance: 50, buzz_on_turns: false, disable_bluetooth: true, + power_lcd_off: true, }, require("Storage").readJSON(FILE, true) || {} ); @@ -44,5 +45,13 @@ writeSettings(); }, }, + "power lcd off": { + value: !!settings.power_lcd_off, // !! converts undefined to false + format: (v) => (v ? "Yes" : "No"), + onchange: (v) => { + settings.power_lcd_off = v; + writeSettings(); + } + }, }); });