gpsmagcourse: settings changes

pull/2581/head
Erik Andresen 2023-02-19 19:15:26 +01:00
parent fab9e85cc3
commit 78fd64bf3f
3 changed files with 10 additions and 10 deletions

View File

@ -42,7 +42,6 @@ On Bangle.js 2 a click on the widget does reset the built-in compass.
- GPS on - GPS on
## TODO: ## TODO:
- Add Settings
- Document settings with defaults - Document settings with defaults
- Check magnav dependency in settings - Check magnav dependency in settings
- note magnav silently downgrade - note magnav silently downgrade

View File

@ -1,7 +1,7 @@
{ {
"id": "gpsmagcourse", "id": "gpsmagcourse",
"name": "GPS Compass heading switcher", "name": "GPS Compass course switcher",
"shortName":"GPS/Comp. course", "shortName":"GPS/Compass course",
"icon": "app.png", "icon": "app.png",
"version":"0.01", "version":"0.01",
"description": "Replace GPS heading with compass heading when speed is slow or standing still to avoid the heading from jumping around randomly.", "description": "Replace GPS heading with compass heading when speed is slow or standing still to avoid the heading from jumping around randomly.",
@ -11,7 +11,8 @@
"readme": "README.md", "readme": "README.md",
"storage": [ "storage": [
{"name":"gpsmagcourse.boot.js","url":"boot.js"}, {"name":"gpsmagcourse.boot.js","url":"boot.js"},
{"name":"gpsmagcourse.wid.js","url":"widget.js"} {"name":"gpsmagcourse.wid.js","url":"widget.js"},
{"name":"gpsmagcourse.settings.js","url":"settings.js"}
], ],
"data": [{"name":"gpsmagcourse.json"}] "data": [{"name":"gpsmagcourse.json"}]
} }

View File

@ -27,9 +27,9 @@
settings.tiltCompensation = false; settings.tiltCompensation = false;
} }
} }
const compassSrcOpts = ["off", "built-in"]; const compassSrcOpts = [/*LANG*/"off", /*LANG*/"built-in"];
if (magnavInstalled) { if (magnavInstalled) {
compassSrcOpts.push("magnav"); compassSrcOpts.push(/*LANG*/"magnav");
} }
function writeSettings() { function writeSettings() {
@ -37,11 +37,11 @@
} }
const menu = { const menu = {
"" : { "title" : /*LANG*/"GPS/Comp. course" }, "" : { "title" : /*LANG*/"GPS/Com.course" },
"< Back" : () => back(), "< Back" : () => back(),
/*LANG*/'Speed threshold': { /*LANG*/'Speed threshold': {
value: settings.speed, value: settings.speed,
min: 1, max: 20, min: 1, max: 20, step: 0.5,
onchange: v => { onchange: v => {
settings.speed = v; settings.speed = v;
writeSettings(); writeSettings();
@ -67,7 +67,7 @@
/*LANG*/'Show Widget': { /*LANG*/'Show Widget': {
value: settings.showWidget, value: settings.showWidget,
min: 0, max: 2, min: 0, max: 2,
format: v => ["Never", "Active", "GPS on"][v], format: v => [/*LANG*/"Never", /*LANG*/"Active", /*LANG*/"GPS on"][v],
onchange: v => { onchange: v => {
settings.showWidget = v; settings.showWidget = v;
writeSettings(); writeSettings();
@ -88,4 +88,4 @@
// Show the menu // Show the menu
E.showMenu(menu); E.showMenu(menu);
})(load); })