sixths: Get my location from... mylocation.

master
Pavel Machek 2024-07-27 19:06:35 +02:00
parent d9fa77f818
commit fda027fa18
2 changed files with 8 additions and 14 deletions

View File

@ -33,7 +33,8 @@ I -- "Info", toggle info display
M -- "Mark", create mark from current position M -- "Mark", create mark from current position
N -- "Note", take a note and write it to the log. N -- "Note", take a note and write it to the log.
O -- "Orloj", run orloj app O -- "Orloj", run orloj app
R -- "Run", run "runplus" app P -- "runPlus", run "runplus" app
R -- "Reset" daily statistics
S -- "Speed", enable GPS for 30 minutes in high power mode. S -- "Speed", enable GPS for 30 minutes in high power mode.
G -- "Get time", buzz current time G -- "Get time", buzz current time
U -- "Up", next waypoint U -- "Up", next waypoint
@ -44,6 +45,7 @@ to communicate back to the user.
B -- battery low. B -- battery low.
E -- acknowledge, gesture understood. E -- acknowledge, gesture understood.
I -- unknown gesture.
T -- start of new hour. T -- start of new hour.
Three colored dots may appear on display. North is on the 12 o'clock Three colored dots may appear on display. North is on the 12 o'clock
@ -73,14 +75,6 @@ Todo:
*) only turn on compass when needed *) only turn on compass when needed
*) rename "show" to something else -- it collides with built-in
*) adjust clock according to GPS
*) show something more reasonable than (NOTEHERE).
*) hide messages after timeout.
*) implement longer recording than "G". *) implement longer recording than "G".
*) allow setting up home altitude, or at least disable auto-calibration *) allow setting up home altitude, or at least disable auto-calibration

View File

@ -1,8 +1,7 @@
// Sixth sense // Sixth sense
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
// Options you'll want to edit var location;
const rest_altitude = 354;
const W = g.getWidth(); const W = g.getWidth();
const H = g.getHeight(); const H = g.getHeight();
@ -12,7 +11,7 @@ var buzz = "", /* Set this to transmit morse via vibrations */
inm = "", l = "", /* For incoming morse handling */ inm = "", l = "", /* For incoming morse handling */
in_str = "", in_str = "",
note = "", note = "",
debug = "v0.05.1", debug2 = "(otherdb)", debug3 = "(short)"; debug = "v0.05.2", debug2 = "(otherdb)", debug3 = "(short)";
var note_limit = 0; var note_limit = 0;
var mode = 0, mode_time = 0; // 0 .. normal, 1 .. note, 2.. mark name var mode = 0, mode_time = 0; // 0 .. normal, 1 .. note, 2.. mark name
var disp_mode = 0; // 0 .. normal, 1 .. small time var disp_mode = 0; // 0 .. normal, 1 .. small time
@ -597,14 +596,14 @@ function draw() {
} }
if (getTime() - last_active > 15*60) { if (getTime() - last_active > 15*60) {
let alt_adjust = cur_altitude - rest_altitude; let alt_adjust = cur_altitude - location.alt;
let abs = Math.abs(alt_adjust); let abs = Math.abs(alt_adjust);
print("adj", alt_adjust); print("adj", alt_adjust);
let o = Bangle.getOptions(); let o = Bangle.getOptions();
if (abs > 10 && abs < 150) { if (abs > 10 && abs < 150) {
let a = 0.01; let a = 0.01;
// FIXME: draw is called often compared to alt reading // FIXME: draw is called often compared to alt reading
if (cur_altitude > rest_altitude) if (cur_altitude > location.alt)
a = -a; a = -a;
o.seaLevelPressure = o.seaLevelPressure + a; o.seaLevelPressure = o.seaLevelPressure + a;
Bangle.setOptions(o); Bangle.setOptions(o);
@ -789,6 +788,7 @@ function start() {
} }
draw(); draw();
location = require("Storage").readJSON("mylocation.json",1)||{"lat":50,"lon":14.45,"alt":354,"location":"Woods"};
loadWPs(); loadWPs();
buzzTask(); buzzTask();
if (0) if (0)