waypoints: cleanups, use gps handling from library

pull/3671/head
Pavel Machek 2024-11-20 22:43:18 +01:00
parent 33a8e7672b
commit f799d7752c
1 changed files with 5 additions and 10 deletions

View File

@ -394,7 +394,7 @@ function updateGoto() {
function stopGps() { function stopGps() {
cancel_gps = true; cancel_gps = true;
Bangle.setGPSPower(0, "waypoints"); gps.stop_gps();
} }
function confirmGps(s) { function confirmGps(s) {
@ -418,7 +418,7 @@ function confirmGps(s) {
function markGps() { function markGps() {
cancel_gps = false; cancel_gps = false;
Bangle.setGPSPower(1, "waypoints"); gps.start_gps();
require("textinput").input({text:"wp"}).then(key => { require("textinput").input({text:"wp"}).then(key => {
confirmGps(key); confirmGps(key);
}); });
@ -494,8 +494,7 @@ function showNumpad(text, key_, callback) {
function goTo() { function goTo() {
cancel_gps = false; cancel_gps = false;
Bangle.setGPSPower(1, "waypoints"); gps.start_gps();
gps.gps_start = getTime();
var la = new Layout ( var la = new Layout (
{type:"v", c: [ {type:"v", c: [
@ -557,10 +556,8 @@ function remove(c) {
if (v) { if (v) {
wp.splice(c, 1); wp.splice(c, 1);
writeWP(); writeWP();
mainMenu();
} else {
mainMenu();
} }
mainMenu();
}); });
} }
@ -590,10 +587,7 @@ function ask01(t, cb) {
la.render(); la.render();
} }
var res;
function askCoordinate(t1, t2, callback) { function askCoordinate(t1, t2, callback) {
//let sign = 1;
ask01(t1, function(sign) { ask01(t1, function(sign) {
let d, m, s; let d, m, s;
switch (fmt.geo_mode) { switch (fmt.geo_mode) {
@ -602,6 +596,7 @@ function askCoordinate(t1, t2, callback) {
case 2: s = "DDD MM'ss"+'"'; break; case 2: s = "DDD MM'ss"+'"'; break;
} }
showNumpad(s, t2, function() { showNumpad(s, t2, function() {
let res = 0;
switch (fmt.geo_mode) { switch (fmt.geo_mode) {
case 0: case 0:
res = parseFloat(key); res = parseFloat(key);