diff --git a/apps/runplus/ChangeLog b/apps/runplus/ChangeLog index c50ee800f4..cdfc8559b7 100644 --- a/apps/runplus/ChangeLog +++ b/apps/runplus/ChangeLog @@ -33,3 +33,4 @@ Write to correct settings file, fixing settings not working. track screen state 0.30: Change the "time" stat to show active time (duration) rather than elapsed time (fix #3802), and sync with recorder on load +0.31: Add setting to show GPS strength bar on the left diff --git a/apps/runplus/README.md b/apps/runplus/README.md index ec503f4dbe..f4d6235a4e 100644 --- a/apps/runplus/README.md +++ b/apps/runplus/README.md @@ -4,8 +4,6 @@ Displays distance, time, steps, cadence, pace and heart rate for runners. Based It requires the input of your minimum and maximum heart rate in the settings for the app to work. You can come back to the initial run screen anytime by swiping left. To use it, start the app and press the middle button so that the red STOP in the bottom right turns to a green `RUN`. -To focus on a single stat, tap on the stat and it will take up the full screen. Tap again to return to the main screen. - ## Display 1st screen * `DIST` - the distance travelled based on the GPS (if you have a GPS lock). @@ -23,6 +21,8 @@ so if you have no GPS lock you just need to wait. * The current time is displayed right at the bottom of the screen * `RUN/STOP` - whether the distance for your run is being displayed or not +To focus on a single stat, tap on the stat and it will take up the full screen. Tap again to return to the main screen. + ## Display 2nd screen Unlock the screen and navigate between displays by swiping left or right. @@ -75,6 +75,7 @@ app loader, the module is automatically included in the app's source. However when developing via the IDE the module won't get pulled in by default. There are some options to fix this easily - please check out the [modules README.md file](https://github.com/espruino/BangleApps/blob/master/modules/README.md) + ## Contributors (Run and Run+) gfwilliams hughbarney @@ -82,3 +83,4 @@ GrandVizierOlaf BartS23 f-teacher thyttan +bobrippling diff --git a/apps/runplus/app.js b/apps/runplus/app.js index a35d0cc5ef..b754687903 100644 --- a/apps/runplus/app.js +++ b/apps/runplus/app.js @@ -28,6 +28,7 @@ let settings = Object.assign({ paceLength: 1000, alwaysResume: false, vibrate: false, + showSats: false, notify: { dist: { value: 0, @@ -197,9 +198,48 @@ lc.push({ type:"h", id:"bottom", filly:1, c:[ {type:"txt", font:fontHeading, label:"---", id:"status", fillx:1 } ]}); // Now calculate the layout -let layout = new Layout( { - type:"v", c: lc -},{lazy:true, btns:[{ label:"---", cb: onStartStop, id:"button"}]}); +let topLevel = { type:"v", c: lc }; +if(settings.showSats){ + const drawGpsLvl = l => { + const gps = l.gps; + const nsats = gps && gps.satellites || 0; + + if (!gps || !gps.fix) + g.setColor("#FF0000"); + else if (nsats < 4) + g.setColor("#FF5500"); + else if (nsats < 6) + g.setColor("#FF8800"); + else if (nsats < 8) + g.setColor("#FFCC00"); + else + g.setColor("#00FF00"); + + g.fillRect( + l.x, + l.y + l.h - 10 - (l.h - 10) * ((nsats > 12 ? 12 : nsats) / 12), + l.x + l.w - 1, + l.y + l.h - 1 + ); + }; + + topLevel = { + type: "h", + c: [ + { + type: "custom", + render: drawGpsLvl, + id: "gpslvl", + filly: 1, + width: 5, + bgCol: g.theme.bg, // automatically clears before render() + }, + topLevel, + ] + } +} +let layout = new Layout(topLevel, {lazy:true, btns:[{ label:"---", cb: onStartStop, id:"button"}]}); +delete topLevel; delete lc; setStatus(exs.state.active); layout.render(); diff --git a/apps/runplus/metadata.json b/apps/runplus/metadata.json index fc2f1ccec0..aeb4c1990e 100644 --- a/apps/runplus/metadata.json +++ b/apps/runplus/metadata.json @@ -1,7 +1,7 @@ { "id": "runplus", "name": "Run+", - "version": "0.30", + "version": "0.31", "author": "thyttan", "description": "Displays distance, time, steps, cadence, pace and more for runners. Based on the Run app, but extended with additional screens for heart rate interval training and individual stat focus.", "icon": "app.png", diff --git a/apps/runplus/settings.js b/apps/runplus/settings.js index d18833e1eb..75ca12c96d 100644 --- a/apps/runplus/settings.js +++ b/apps/runplus/settings.js @@ -19,6 +19,7 @@ paceLength: 1000, // TODO: Default to either 1km or 1mi based on locale alwaysResume: false, vibrate: false, + showSats: false, notify: { dist: { increment: 0, @@ -88,6 +89,13 @@ saveSettings(); }, }; + menu[/*LANG*/"Show satelite bar"] = { + value : settings.showSats, + onchange : v => { + settings.showSats = v; + saveSettings(); + }, + }; var notificationsMenu = { '< Back': function() { E.showMenu(menu) }, }