[] waypoints: use fmt to format position.
parent
75f64e8004
commit
f55056b69c
|
|
@ -178,7 +178,7 @@ function updateGps() {
|
||||||
|
|
||||||
function stopGps() {
|
function stopGps() {
|
||||||
cancel_gps=true;
|
cancel_gps=true;
|
||||||
Bangle.setGPSPower(0, "waypoint_editor");
|
Bangle.setGPSPower(0, "waypoints");
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmGps(s) {
|
function confirmGps(s) {
|
||||||
|
|
@ -202,7 +202,7 @@ function confirmGps(s) {
|
||||||
|
|
||||||
function markGps() {
|
function markGps() {
|
||||||
cancel_gps = false;
|
cancel_gps = false;
|
||||||
Bangle.setGPSPower(1, "waypoint_editor");
|
Bangle.setGPSPower(1, "waypoints");
|
||||||
gps_start = getTime();
|
gps_start = getTime();
|
||||||
require("textinput").input({text:"wp"}).then(key => {
|
require("textinput").input({text:"wp"}).then(key => {
|
||||||
confirmGps(key);
|
confirmGps(key);
|
||||||
|
|
@ -221,53 +221,6 @@ function setFormat() {
|
||||||
la.render();
|
la.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
function format(x) {
|
|
||||||
switch (fmt.geo_mode) {
|
|
||||||
case 0:
|
|
||||||
return "" + x;
|
|
||||||
case 1:
|
|
||||||
d = Math.floor(x);
|
|
||||||
m = x - d;
|
|
||||||
m = m*60;
|
|
||||||
return "" + d + " " + m + "'";
|
|
||||||
case 2:
|
|
||||||
d = Math.floor(x);
|
|
||||||
m = x - d;
|
|
||||||
m = m*60;
|
|
||||||
mf = Math.floor(m);
|
|
||||||
s = m - mf;
|
|
||||||
s = s*60;
|
|
||||||
return "" + d + " " + mf + "'" + s + '"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function lat(x) {
|
|
||||||
c = "N";
|
|
||||||
if (x<0) {
|
|
||||||
c = "S";
|
|
||||||
x = -x;
|
|
||||||
}
|
|
||||||
return c+format(x);
|
|
||||||
}
|
|
||||||
function lon(x) {
|
|
||||||
c = "E";
|
|
||||||
if (x<0) {
|
|
||||||
c = "W";
|
|
||||||
x = -x;
|
|
||||||
}
|
|
||||||
return c+format(x);
|
|
||||||
}
|
|
||||||
|
|
||||||
function show(pin) {
|
|
||||||
var i = wp[pin];
|
|
||||||
var l = lat(i["lat"]) + "\n" + lon(i["lon"]);
|
|
||||||
E.showPrompt(l,{
|
|
||||||
title:i["name"],
|
|
||||||
buttons : {"Ok":true}
|
|
||||||
}).then(function(v) {
|
|
||||||
mainMenu();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showNumpad(text, key_, callback) {
|
function showNumpad(text, key_, callback) {
|
||||||
key = key_;
|
key = key_;
|
||||||
E.showMenu();
|
E.showMenu();
|
||||||
|
|
@ -324,6 +277,17 @@ function showNumpad(text, key_, callback) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function show(pin) {
|
||||||
|
var i = wp[pin];
|
||||||
|
var l = fmt.fmtPos(i);
|
||||||
|
E.showPrompt(l,{
|
||||||
|
title:i["name"],
|
||||||
|
buttons : {"Ok":true}
|
||||||
|
}).then(function(v) {
|
||||||
|
mainMenu();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function showCard() {
|
function showCard() {
|
||||||
var menu = {
|
var menu = {
|
||||||
"" : {title : "Select WP"},
|
"" : {title : "Select WP"},
|
||||||
|
|
@ -355,9 +319,8 @@ function remove(pin)
|
||||||
} else {
|
} else {
|
||||||
mainMenu();
|
mainMenu();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function removeCard() {
|
function removeCard() {
|
||||||
var menu = {
|
var menu = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue