From fda027fa18c107f11f158bc7c097000b5f0cd04e Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sat, 27 Jul 2024 19:06:35 +0200 Subject: [PATCH] sixths: Get my location from... mylocation. --- apps/sixths/README.md | 12 +++--------- apps/sixths/sixths.app.js | 10 +++++----- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/apps/sixths/README.md b/apps/sixths/README.md index 9c5d25b36..939d162e6 100644 --- a/apps/sixths/README.md +++ b/apps/sixths/README.md @@ -33,7 +33,8 @@ I -- "Info", toggle info display M -- "Mark", create mark from current position N -- "Note", take a note and write it to the log. 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. G -- "Get time", buzz current time U -- "Up", next waypoint @@ -44,6 +45,7 @@ to communicate back to the user. B -- battery low. E -- acknowledge, gesture understood. +I -- unknown gesture. T -- start of new hour. 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 -*) 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". *) allow setting up home altitude, or at least disable auto-calibration diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index e779c08f1..83631522f 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -1,8 +1,7 @@ // Sixth sense /* eslint-disable no-unused-vars */ -// Options you'll want to edit -const rest_altitude = 354; +var location; const W = g.getWidth(); const H = g.getHeight(); @@ -12,7 +11,7 @@ var buzz = "", /* Set this to transmit morse via vibrations */ inm = "", l = "", /* For incoming morse handling */ in_str = "", note = "", - debug = "v0.05.1", debug2 = "(otherdb)", debug3 = "(short)"; + debug = "v0.05.2", debug2 = "(otherdb)", debug3 = "(short)"; var note_limit = 0; var mode = 0, mode_time = 0; // 0 .. normal, 1 .. note, 2.. mark name var disp_mode = 0; // 0 .. normal, 1 .. small time @@ -597,14 +596,14 @@ function draw() { } 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); print("adj", alt_adjust); let o = Bangle.getOptions(); if (abs > 10 && abs < 150) { let a = 0.01; // FIXME: draw is called often compared to alt reading - if (cur_altitude > rest_altitude) + if (cur_altitude > location.alt) a = -a; o.seaLevelPressure = o.seaLevelPressure + a; Bangle.setOptions(o); @@ -789,6 +788,7 @@ function start() { } draw(); + location = require("Storage").readJSON("mylocation.json",1)||{"lat":50,"lon":14.45,"alt":354,"location":"Woods"}; loadWPs(); buzzTask(); if (0)