From a42c8036e3cddf24560ad352ca0f8232df7e7e06 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 31 May 2024 19:20:13 +0200 Subject: [PATCH 01/11] [] sixths: Cleanups, use let where possible. --- apps/sixths/README.md | 2 - apps/sixths/sixths.app.js | 78 +++++++++++++++++++-------------------- 2 files changed, 37 insertions(+), 43 deletions(-) diff --git a/apps/sixths/README.md b/apps/sixths/README.md index 17369c7a07..58f7045125 100644 --- a/apps/sixths/README.md +++ b/apps/sixths/README.md @@ -54,5 +54,3 @@ possibly allowing scrolling). Todo: *) only turn on compass when needed - -*) adjust draw timeouts to save power \ No newline at end of file diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index 00c83153f0..96f50c04bd 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -3,13 +3,11 @@ // Options you'll want to edit const rest_altitude = 354; -const geoid_to_sea_level = 0; // Maybe BangleJS2 already compensates? const W = g.getWidth(); const H = g.getHeight(); -var cx = 100, cy = 105, sc = 70, -temp = 0, alt = 0, bpm = 0; +var cx = 100, cy = 105, sc = 70, temp = 0, alt = 0, bpm = 0; var buzz = "", /* Set this to transmit morse via vibrations */ inm = "", l = "", /* For incoming morse handling */ in_str = "", @@ -45,15 +43,15 @@ var cur_mark = null; // Icons var icon_alt = "\0\x08\x1a\1\x00\x00\x00\x20\x30\x78\x7C\xFE\xFF\x00\xC3\xE7\xFF\xDB\xC3\xC3\xC3\xC3\x00\x00\x00\x00\x00\x00\x00\x00"; -var icon_m = "\0\x08\x1a\1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC3\xE7\xFF\xDB\xC3\xC3\xC3\xC3\x00\x00\x00\x00\x00\x00\x00\x00"; +//var icon_m = "\0\x08\x1a\1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC3\xE7\xFF\xDB\xC3\xC3\xC3\xC3\x00\x00\x00\x00\x00\x00\x00\x00"; var icon_km = "\0\x08\x1a\1\xC3\xC6\xCC\xD8\xF0\xD8\xCC\xC6\xC3\x00\xC3\xE7\xFF\xDB\xC3\xC3\xC3\xC3\x00\x00\x00\x00\x00\x00\x00\x00"; var icon_kph = "\0\x08\x1a\1\xC3\xC6\xCC\xD8\xF0\xD8\xCC\xC6\xC3\x00\xC3\xE7\xFF\xDB\xC3\xC3\xC3\xC3\x00\xFF\x00\xC3\xC3\xFF\xC3\xC3"; var icon_c = "\0\x08\x1a\1\x00\x00\x60\x90\x90\x60\x00\x7F\xFF\xC0\xC0\xC0\xC0\xC0\xFF\x7F\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; function toMorse(x) { - var r = ""; + let r = ""; for (var i = 0; i < x.length; i++) { - var c = x[i]; + let c = x[i]; if (c == " ") { r += " "; continue; @@ -113,20 +111,15 @@ function gpsHandleFix(fix) { doBuzz(" ."); prev_fix = fix; } - if (0) { - /* GPS altitude fluctuates a lot, not really usable */ - alt_adjust = cur_altitude - (fix.alt + geoid_to_sea_level); - alt_adjust_mode = "g"; - } if (1) { let now1 = Date(); let now2 = fix.time; - var n1 = now1.getMinutes() * 60 + now1.getSeconds(); - var n2 = now2.getMinutes() * 60 + now2.getSeconds(); + let n1 = now1.getMinutes() * 60 + now1.getSeconds(); + let n2 = now2.getMinutes() * 60 + now2.getSeconds(); debug2 = "te "+(n2-n1)+"s"; } loggps(fix); - var d = calcDistance(fix, prev_fix); + let d = calcDistance(fix, prev_fix); if (d > 30) { prev_fix = fix; gps_dist += d/1000; @@ -135,7 +128,7 @@ function gpsHandleFix(fix) { function gpsHandle() { let msg = ""; if (!last_restart) { - var d = (getTime()-last_pause); + let d = (getTime()-last_pause); if (last_fix) msg = "PL"+ fmtTimeDiff(getTime()-last_fix); else @@ -146,7 +139,7 @@ function gpsHandle() { gpsRestart(); } } else { - var fix = Bangle.getGPSFix(); + let fix = Bangle.getGPSFix(); if (fix && fix.fix && fix.lat) { gpsHandleFix(fix); msg = fix.speed.toFixed(1) + icon_kph; @@ -167,8 +160,8 @@ function gpsHandle() { } } - var d = (getTime()-last_restart); - var d2 = (getTime()-last_fstart); + let d = (getTime()-last_restart); + let d2 = (getTime()-last_fstart); print("gps on, restarted ", d, gps_needed, d2, fix.lat); if (getTime() > gps_speed_limit && (d > gps_needed || (last_fstart && d2 > 10))) { @@ -192,7 +185,7 @@ function markNew() { } function markHandle() { let m = cur_mark; - var msg = m.name + ">" + fmtTimeDiff(getTime()- m.time); + let msg = m.name + ">" + fmtTimeDiff(getTime()- m.time); if (m.fix && m.fix.fix) { let s = fmtDist(calcDistance(m.fix, prev_fix)/1000) + icon_km; msg += " " + s; @@ -230,9 +223,9 @@ function inputHandler(s) { return; } switch(s) { - case 'B': + case 'B': { s = ' B'; - var bat = E.getBattery(); + let bat = E.getBattery(); if (bat > 45) s += 'E'; else @@ -240,6 +233,7 @@ function inputHandler(s) { doBuzz(toMorse(s)); show("Bat "+bat+"%", 60); break; + } case 'F': gpsOff(); show("GPS off", 3); break; case 'G': gpsOn(); gps_limit = getTime() + 60*60*4; show("GPS on", 3); break; case 'I': @@ -253,13 +247,14 @@ function inputHandler(s) { case 'N': mode = 1; show(">", 10); mode_time = getTime(); break; case 'O': aload("orloj.app.js"); break; case 'S': gpsOn(); gps_limit = getTime() + 60*30; gps_speed_limit = gps_limit; show("GPS on", 3); break; - case 'T': + case 'T': { s = ' T'; - var d = new Date(); + let d = new Date(); s += d.getHours() % 10; s += add0(d.getMinutes()); doBuzz(toMorse(s)); break; + } case 'R': aload("run.app.js"); break; case 'Y': doBuzz(buzz); Bangle.resetCompass(); break; } @@ -378,7 +373,7 @@ function loggps(fix) { } function hourly() { print("hourly"); - var s = ' T'; + let s = ' T'; if (is_active) doBuzz(toMorse(s)); logstamp(""); @@ -388,8 +383,8 @@ function show(msg, timeout) { } function fivemin() { print("fivemin"); - var s = ' B'; - var bat = E.getBattery(); + let s = ' B'; + let bat = E.getBattery(); if (bat < 25) { if (is_active) doBuzz(toMorse(s)); @@ -470,7 +465,7 @@ function drawDot(h, d, s) { g.fillCircle(x,y, 10); } function drawBackground() { - var acc = Bangle.getAccel(); + let acc = Bangle.getAccel(); is_level = (acc.z < -0.95); if (is_level) { let obj = Bangle.getCompass(); @@ -551,7 +546,7 @@ function draw() { let alt_adjust = cur_altitude - rest_altitude; let abs = Math.abs(alt_adjust); print("adj", alt_adjust); - var o = Bangle.getOptions(); + let o = Bangle.getOptions(); if (abs > 10 && abs < 150) { let a = 0.01; // FIXME: draw is called often compared to alt reading @@ -588,16 +583,16 @@ function draw_all() { let now = new Date(); g.drawString(now.getHours() + ":" + add0(now.getMinutes()) + ":" + add0(now.getSeconds()), 10, 40); - var acc = Bangle.getAccel(); + let acc = Bangle.getAccel(); let ax = 0 + acc.x, ay = 0.75 + acc.y, az = 0.75 + acc.y; let diff = ax * ax + ay * ay + az * az; diff = diff * 3; if (diff > 1) diff = 1; - var co = Bangle.getCompass(); - var step = Bangle.getStepCount(); - var bat = E.getBattery(); + let co = Bangle.getCompass(); + let step = Bangle.getStepCount(); + let bat = E.getBattery(); Bangle.getPressure().then((x) => { alt = x.altitude; temp = x.temperature; }, print); @@ -618,7 +613,7 @@ function draw_all() { g.fillCircle(cx + sc * co.dx / 300, cy + sc * co.dz / 400, 5); } if (1) { - h = co.heading / 360 * 2 * Math.PI; + let h = co.heading / 360 * 2 * Math.PI; g.setColor(0, 0, 0.5); g.fillCircle(cx + sc * Math.sin(h), cy + sc * Math.cos(h), 5); } @@ -635,10 +630,10 @@ function draw_all() { queueDraw(); } function accelTask() { - var tm = 100; - var acc = Bangle.getAccel(); - var en = !Bangle.isLocked(); - var msg; + let tm = 100; + let acc = Bangle.getAccel(); + let en = !Bangle.isLocked(); + let msg = ""; if (en && acc.z < -0.95) { msg = "Level"; doBuzz(".-.."); @@ -654,14 +649,14 @@ function accelTask() { doBuzz("..-"); tm = 3000; } - + print(msg); setTimeout(accelTask, tm); } function buzzTask() { if (buzz != "") { - var now = buzz[0]; + let now = buzz[0]; buzz = buzz.substring(1); - var dot = 100; + let dot = 100; if (now == " ") { setTimeout(buzzTask, 300); } else if (now == ".") { @@ -730,7 +725,8 @@ function start() { draw(); buzzTask(); - //accelTask(); + if (0) + accelTask(); if (1) { last_acc = Bangle.getAccel(); From dc3742508ed546192393de2cd2e8c184b6fe14e6 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sun, 2 Jun 2024 22:37:38 +0200 Subject: [PATCH 02/11] [] sixths: reduce logging to reduce flash wear. --- apps/sixths/sixths.app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index 96f50c04bd..66c411e639 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -376,7 +376,7 @@ function hourly() { let s = ' T'; if (is_active) doBuzz(toMorse(s)); - logstamp(""); + //logstamp(""); } function show(msg, timeout) { note = msg; From f8505a93554dd832b62363d178d1d5f816c1333d Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sun, 2 Jun 2024 23:12:06 +0200 Subject: [PATCH 03/11] [] sixths: start implementing reading waypoints from disk --- apps/sixths/README.md | 4 ++++ apps/sixths/sixths.app.js | 40 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/apps/sixths/README.md b/apps/sixths/README.md index 58f7045125..e738249ad8 100644 --- a/apps/sixths/README.md +++ b/apps/sixths/README.md @@ -54,3 +54,7 @@ possibly allowing scrolling). Todo: *) only turn on compass when needed + +*) only warn about battery low when it crosses thresholds, update battery low message. + +*) rename "show" to something else -- it collides with built-in \ No newline at end of file diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index 66c411e639..24ea60657b 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -185,8 +185,11 @@ function markNew() { } function markHandle() { let m = cur_mark; - let msg = m.name + ">" + fmtTimeDiff(getTime()- m.time); - if (m.fix && m.fix.fix) { + let msg = m.name + ">"; + if (m.time) { + msg += fmtTimeDiff(getTime()- m.time); + } + if (prev_fix && prev_fix.fix && m.fix && m.fix.fix) { let s = fmtDist(calcDistance(m.fix, prev_fix)/1000) + icon_km; msg += " " + s; debug = "wp>" + s; @@ -207,6 +210,34 @@ function entryDone() { in_str = 0; mode = 0; } +var waypoints = [], sel_wp = 0; +function loadWPs() { + waypoints = require("Storage").readJSON(`waypoints.json`)||[{}]; + print("Have waypoints", waypoints); +} +function saveWPs() { + require("Storage").writeJSON(`waypoints.json`,waypoints); +} +function selectWP(i) { + sel_wp += i; + if (sel_wp < 0) + sel_wp = 0; + if (sel_wp >= waypoints.length) + sel_wp = waypoints.length - 1; + if (sel_wp < 0) { + show("No WPs", 60); + } + let wp = waypoints[sel_wp]; + cur_mark = {}; + cur_mark.name = wp.name; + cur_mark.gps_dist = 0; /* HACK */ + cur_mark.fix = {}; + cur_mark.fix.fix = 1; + cur_mark.fix.lat = wp.lat; + cur_mark.fix.lon = wp.lon; + show("WP:"+wp.name, 60); + print("Select waypoint: ", cur_mark); +} function inputHandler(s) { print("Ascii: ", s, s[0], s[1]); if (s[0] == '^') { @@ -234,6 +265,7 @@ function inputHandler(s) { show("Bat "+bat+"%", 60); break; } + case 'D': selectWP(1); break; case 'F': gpsOff(); show("GPS off", 3); break; case 'G': gpsOn(); gps_limit = getTime() + 60*60*4; show("GPS on", 3); break; case 'I': @@ -256,6 +288,7 @@ function inputHandler(s) { break; } case 'R': aload("run.app.js"); break; + case 'U': selectWP(-1); break; case 'Y': doBuzz(buzz); Bangle.resetCompass(); break; } } @@ -695,7 +728,7 @@ function lockHandler(locked) { } function queueDraw() { - if (getTime() - last_unlocked > 5*60) + if (getTime() - last_unlocked > 3*60) next = 60000; else next = 1000; @@ -724,6 +757,7 @@ function start() { } draw(); + loadWPs(); buzzTask(); if (0) accelTask(); From f9ed954f5eb50469c7a9d7473538e2ec90c1ae42 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sat, 15 Jun 2024 00:21:48 +0200 Subject: [PATCH 04/11] [] sixths: update documentation, update version. --- apps/sixths/README.md | 33 +++++++++++++++++++++++++++------ apps/sixths/sixths.app.js | 4 ++-- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/apps/sixths/README.md b/apps/sixths/README.md index e738249ad8..1998d3d143 100644 --- a/apps/sixths/README.md +++ b/apps/sixths/README.md @@ -24,17 +24,35 @@ minutes, real distance will be usually higher than approximation. Useful gestures: -F -- disable GPS. -G -- enable GPS for 4 hours in low power mode. -N -- take a note and write it to the log. -S -- enable GPS for 30 minutes in high power mode. + B -- "Battery", show/buzz battery info +D -- "Down", previous waypoint +F -- "oFf", disable GPS. +G -- "Gps", enable GPS for 4 hours in low power mode. +I -- "Info", toggle info display + L -- "aLtimeter", load altimeter app +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 +S -- "Speed", enable GPS for 30 minutes in high power mode. + T -- "Time", buzz current time +U -- "Up", next waypoint +Y -- "compass", reset compass When application detects watch is being worn, it will use vibrations to communicate back to the user. +B -- battery low. E -- acknowledge, gesture understood. T -- start of new hour. +Three colored dots may appear on display. North is on the 12 o'clock +position (top of the display). + +red: this is direction to the waypoint. +green: this is direction you are moving into, according to GPS. +blue: this is direction top of watch faces, according to the compass. + Written by: [Pavel Machek](https://github.com/pavelmachek) ## Future Development @@ -55,6 +73,9 @@ Todo: *) only turn on compass when needed -*) only warn about battery low when it crosses thresholds, update battery low message. +*) only warn about battery low when it crosses thresholds, update +battery low message + +*) rename "show" to something else -- it collides with built-in -*) rename "show" to something else -- it collides with built-in \ No newline at end of file +*) adjust clock according to gps \ No newline at end of file diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index 24ea60657b..7f71818d2c 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -12,7 +12,7 @@ var buzz = "", /* Set this to transmit morse via vibrations */ inm = "", l = "", /* For incoming morse handling */ in_str = "", note = "(NOTEHERE)", - debug = "v1119", debug2 = "(otherdb)", debug3 = "(short)"; + debug = "v0.04.1", debug2 = "(otherdb)", debug3 = "(short)"; var mode = 0, mode_time = 0; // 0 .. normal, 1 .. note, 2.. mark name var disp_mode = 0; // 0 .. normal, 1 .. small time @@ -278,6 +278,7 @@ function inputHandler(s) { case 'M': mode = 2; show("M>", 10); cur_mark = markNew(); mode_time = getTime(); break; case 'N': mode = 1; show(">", 10); mode_time = getTime(); break; case 'O': aload("orloj.app.js"); break; + case 'R': aload("runplus.app.js"); break; case 'S': gpsOn(); gps_limit = getTime() + 60*30; gps_speed_limit = gps_limit; show("GPS on", 3); break; case 'T': { s = ' T'; @@ -287,7 +288,6 @@ function inputHandler(s) { doBuzz(toMorse(s)); break; } - case 'R': aload("run.app.js"); break; case 'U': selectWP(-1); break; case 'Y': doBuzz(buzz); Bangle.resetCompass(); break; } From 51bd82014907e1d41f85568e1ca4fd2519612ca2 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Wed, 19 Jun 2024 00:25:13 +0200 Subject: [PATCH 05/11] [] sixths: more todo items --- apps/sixths/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/sixths/README.md b/apps/sixths/README.md index 1998d3d143..2adc66f82c 100644 --- a/apps/sixths/README.md +++ b/apps/sixths/README.md @@ -78,4 +78,8 @@ battery low message *) rename "show" to something else -- it collides with built-in -*) adjust clock according to gps \ No newline at end of file +*) adjust clock according to GPS + +*) show something more reasonable than (NOTEHERE). + +*) hide messages after timeout. \ No newline at end of file From 3cd24a2d9c3e5679c37c07fde93cd106c2389923 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Mon, 24 Jun 2024 19:25:13 +0200 Subject: [PATCH 06/11] [] sixths: make compass & battery usable. --- apps/sixths/sixths.app.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index 7f71818d2c..e1c1afbae2 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -407,6 +407,10 @@ function loggps(fix) { function hourly() { print("hourly"); let s = ' T'; + if (bat < 25) { + s = ' B'; + show("Bat "+bat+"%", 60); + } if (is_active) doBuzz(toMorse(s)); //logstamp(""); @@ -418,11 +422,6 @@ function fivemin() { print("fivemin"); let s = ' B'; let bat = E.getBattery(); - if (bat < 25) { - if (is_active) - doBuzz(toMorse(s)); - show("Bat "+bat+"%", 60); - } try { Bangle.getPressure().then((x) => { cur_altitude = x.altitude; cur_temperature = x.temperature; }, @@ -500,6 +499,7 @@ function drawDot(h, d, s) { function drawBackground() { let acc = Bangle.getAccel(); is_level = (acc.z < -0.95); + Bangle.setCompassPower(!!is_level, "sixths"); if (is_level) { let obj = Bangle.getCompass(); if (obj) { @@ -745,7 +745,7 @@ function start() { Bangle.on("drag", touchHandler); Bangle.on("lock", lockHandler); if (0) - Bangle.on("accel", accelHandler); + Bangle.on("accel", accelHandler); if (0) { Bangle.setCompassPower(1, "sixths"); Bangle.setBarometerPower(1, "sixths"); From 998d1206851ab9afb841e10478fa1a29a2c93fe2 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Wed, 26 Jun 2024 23:29:48 +0200 Subject: [PATCH 07/11] [] sixths: broken battery reading broke everything, fix it. --- apps/sixths/sixths.app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index e1c1afbae2..935a9e4684 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -407,6 +407,7 @@ function loggps(fix) { function hourly() { print("hourly"); let s = ' T'; + let bat = E.getBattery(); if (bat < 25) { s = ' B'; show("Bat "+bat+"%", 60); @@ -421,7 +422,6 @@ function show(msg, timeout) { function fivemin() { print("fivemin"); let s = ' B'; - let bat = E.getBattery(); try { Bangle.getPressure().then((x) => { cur_altitude = x.altitude; cur_temperature = x.temperature; }, From f2efe03f2cd015801b42e8f72e2ed4b9db2803b8 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Wed, 26 Jun 2024 23:40:06 +0200 Subject: [PATCH 08/11] [] sixths: start displaying hPa instead of (msghere). --- apps/sixths/sixths.app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index 935a9e4684..4332b3645d 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -11,7 +11,7 @@ var cx = 100, cy = 105, sc = 70, temp = 0, alt = 0, bpm = 0; var buzz = "", /* Set this to transmit morse via vibrations */ inm = "", l = "", /* For incoming morse handling */ in_str = "", - note = "(NOTEHERE)", + note = "", debug = "v0.04.1", debug2 = "(otherdb)", debug3 = "(short)"; var mode = 0, mode_time = 0; // 0 .. normal, 1 .. note, 2.. mark name var disp_mode = 0; // 0 .. normal, 1 .. small time @@ -553,7 +553,11 @@ function draw() { if (gps_on) { msg = gpsHandle(); } else { - msg = note; + let o = Bangle.getOptions(); + msg = o.seaLevelPressure.toFixed(1) + "hPa"; + if (note != "") { + msg = note; + } } drawBackground(); From 4c83a6345a39a6515e12ac8e2839e33a0e81b229 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 5 Jul 2024 22:39:33 +0200 Subject: [PATCH 09/11] [] sixths: more todo items. --- apps/sixths/README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/sixths/README.md b/apps/sixths/README.md index 2adc66f82c..18aa85bebb 100644 --- a/apps/sixths/README.md +++ b/apps/sixths/README.md @@ -82,4 +82,18 @@ battery low message *) show something more reasonable than (NOTEHERE). -*) hide messages after timeout. \ No newline at end of file +*) hide messages after timeout. + +*) show route lengths after the fact + +*) implement longer recording than "G". + +*) Probably T should be G. + +*) sum gps distances for a day + +*) allow setting up home altitude, or at least disable auto-calibration + +*) show time-to-sunset / sunrise? + +*) one-second updates when gps is active \ No newline at end of file From 068e49f1b1128093bd333a7ecbcdb531c7f552c9 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sat, 13 Jul 2024 12:01:44 +0200 Subject: [PATCH 10/11] [] sixths: mark this as 0.05 --- apps/sixths/ChangeLog | 1 + apps/sixths/metadata.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/sixths/ChangeLog b/apps/sixths/ChangeLog index 08c4b83b02..510748fb31 100644 --- a/apps/sixths/ChangeLog +++ b/apps/sixths/ChangeLog @@ -2,3 +2,4 @@ 0.02: better GPS support, adding altitude and temperature support 0.03: minor code improvements 0.04: make height auto-calibration useful and slow ticks to save power +0.05: add ability to navigate to waypoints, better documentation diff --git a/apps/sixths/metadata.json b/apps/sixths/metadata.json index 91492fe1ce..585f23170e 100644 --- a/apps/sixths/metadata.json +++ b/apps/sixths/metadata.json @@ -1,6 +1,6 @@ { "id": "sixths", "name": "Sixth sense", - "version": "0.04", + "version": "0.05", "description": "Clock for outdoor use with GPS support", "icon": "app.png", "readme": "README.md", From 2de968aa9c80f4b9660ce5ef96794cdb77c6d571 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Sat, 13 Jul 2024 12:15:51 +0200 Subject: [PATCH 11/11] [] sixths: attempt to fix warnings --- apps/sixths/sixths.app.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/apps/sixths/sixths.app.js b/apps/sixths/sixths.app.js index 4332b3645d..c5fb3b9cf8 100644 --- a/apps/sixths/sixths.app.js +++ b/apps/sixths/sixths.app.js @@ -530,13 +530,6 @@ function drawTime(now) { dot = "."; g.drawString(now.getHours() + dot + add0(now.getMinutes()), W, 90); } -function adjPressure(a) { - var o = Bangle.getOptions(); - print(o); - o.seaLevelPressure = o.seaLevelPressure * m + a; - Bangle.setOptions(o); - var avr = []; -} function draw() { if (disp_mode == 2) { draw_all(); @@ -707,13 +700,14 @@ function buzzTask() { } else print("Unknown character -- ", now, buzz); } } +var last_acc; function aliveTask() { function cmp(s) { let d = acc[s] - last_acc[s]; return d < -0.03 || d > 0.03; } // HRM seems to detect hand quite nicely - acc = Bangle.getAccel(); + let acc = Bangle.getAccel(); is_active = false; if (cmp("x") || cmp("y") || cmp("z")) { print("active"); @@ -732,6 +726,7 @@ function lockHandler(locked) { } function queueDraw() { + let next; if (getTime() - last_unlocked > 3*60) next = 60000; else @@ -748,8 +743,6 @@ function start() { Bangle.on("drag", touchHandler); Bangle.on("lock", lockHandler); - if (0) - Bangle.on("accel", accelHandler); if (0) { Bangle.setCompassPower(1, "sixths"); Bangle.setBarometerPower(1, "sixths");