From 526dfa58bea77123f31e1be4e02ce1c0cbd60bb3 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:02:29 +1300 Subject: [PATCH 001/114] Create app.js Initial import --- apps/speedalt2/app.js | 609 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 609 insertions(+) create mode 100644 apps/speedalt2/app.js diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js new file mode 100644 index 000000000..f96c1c320 --- /dev/null +++ b/apps/speedalt2/app.js @@ -0,0 +1,609 @@ +/* +Speed and Altitude [speedalt2] +Mike Bennett mike[at]kereru.com +0.01 : Initial +*/ +var v = '0.01a'; + +/*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ +var KalmanFilter = (function () { + 'use strict'; + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + /** + * KalmanFilter + * @class + * @author Wouter Bulten + * @see {@link http://github.com/wouterbulten/kalmanjs} + * @version Version: 1.0.0-beta + * @copyright Copyright 2015-2018 Wouter Bulten + * @license MIT License + * @preserve + */ + var KalmanFilter = + /*#__PURE__*/ + function () { + /** + * Create 1-dimensional kalman filter + * @param {Number} options.R Process noise + * @param {Number} options.Q Measurement noise + * @param {Number} options.A State vector + * @param {Number} options.B Control vector + * @param {Number} options.C Measurement vector + * @return {KalmanFilter} + */ + function KalmanFilter() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$R = _ref.R, + R = _ref$R === void 0 ? 1 : _ref$R, + _ref$Q = _ref.Q, + Q = _ref$Q === void 0 ? 1 : _ref$Q, + _ref$A = _ref.A, + A = _ref$A === void 0 ? 1 : _ref$A, + _ref$B = _ref.B, + B = _ref$B === void 0 ? 0 : _ref$B, + _ref$C = _ref.C, + C = _ref$C === void 0 ? 1 : _ref$C; + + _classCallCheck(this, KalmanFilter); + + this.R = R; // noise power desirable + + this.Q = Q; // noise power estimated + + this.A = A; + this.C = C; + this.B = B; + this.cov = NaN; + this.x = NaN; // estimated signal without noise + } + /** + * Filter a new value + * @param {Number} z Measurement + * @param {Number} u Control + * @return {Number} + */ + + + _createClass(KalmanFilter, [{ + key: "filter", + value: function filter(z) { + var u = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + if (isNaN(this.x)) { + this.x = 1 / this.C * z; + this.cov = 1 / this.C * this.Q * (1 / this.C); + } else { + // Compute prediction + var predX = this.predict(u); + var predCov = this.uncertainty(); // Kalman gain + + var K = predCov * this.C * (1 / (this.C * predCov * this.C + this.Q)); // Correction + + this.x = predX + K * (z - this.C * predX); + this.cov = predCov - K * this.C * predCov; + } + + return this.x; + } + /** + * Predict next value + * @param {Number} [u] Control + * @return {Number} + */ + + }, { + key: "predict", + value: function predict() { + var u = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + return this.A * this.x + this.B * u; + } + /** + * Return uncertainty of filter + * @return {Number} + */ + + }, { + key: "uncertainty", + value: function uncertainty() { + return this.A * this.cov * this.A + this.R; + } + /** + * Return the last filtered measurement + * @return {Number} + */ + + }, { + key: "lastMeasurement", + value: function lastMeasurement() { + return this.x; + } + /** + * Set measurement noise Q + * @param {Number} noise + */ + + }, { + key: "setMeasurementNoise", + value: function setMeasurementNoise(noise) { + this.Q = noise; + } + /** + * Set the process noise R + * @param {Number} noise + */ + + }, { + key: "setProcessNoise", + value: function setProcessNoise(noise) { + this.R = noise; + } + }]); + + return KalmanFilter; + }(); + + return KalmanFilter; + +}()); + + +var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); + +// Load fonts +require("Font7x11Numeric7Seg").add(Graphics); + +var lf = {fix:0,satellites:0}; +var showMax = 0; // 1 = display the max values. 0 = display the cur fix +var pwrSav = 1; // 1 = default power saving with watch screen off and GPS to PMOO mode. 0 = screen kept on. +var canDraw = 1; +var time = ''; // Last time string displayed. Re displayed in background colour to remove before drawing new time. +var tmrLP; // Timer for delay in switching to low power after screen turns off + +var max = {}; +max.spd = 0; +max.alt = 0; +max.n = 0; // counter. Only start comparing for max after a certain number of fixes to allow kalman filter to have smoohed the data. + +var emulator = (process.env.BOARD=="EMSCRIPTEN")?1:0; // 1 = running in emulator. Supplies test values; + +var wp = {}; // Waypoint to use for distance from cur position. + +function nxtWp(inc){ + cfg.wp+=inc; + loadWp(); +} + +function loadWp() { + var w = require("Storage").readJSON('waypoints.json')||[{name:"NONE"}]; + if (cfg.wp>=w.length) cfg.wp=0; + if (cfg.wp<0) cfg.wp = w.length-1; + savSettings(); + wp = w[cfg.wp]; +} + +function radians(a) { + return a*Math.PI/180; +} + +function distance(a,b){ + var x = radians(a.lon-b.lon) * Math.cos(radians((a.lat+b.lat)/2)); + var y = radians(b.lat-a.lat); + + // Distance in selected units + var d = Math.sqrt(x*x + y*y) * 6371000; + d = (d/parseFloat(cfg.dist)).toFixed(2); + if ( d >= 100 ) d = parseFloat(d).toFixed(1); + if ( d >= 1000 ) d = parseFloat(d).toFixed(0); + + return d; +} + +function drawScrn(dat) { + + if (!canDraw) return; + + buf.clear(); + + var n; + n = dat.val.toString(); + + var s=40; // Font size + var l=n.length; + + if ( l <= 7 ) s=48; + if ( l <= 6 ) s=55; + if ( l <= 5 ) s=68; + if ( l <= 4 ) s=90; + if ( l <= 3 ) s=110; + + buf.setFontAlign(0,-1); //Centre + buf.setColor(1); + buf.setFontVector(s); + buf.drawString(n,110,-0); + + // Primary Units + buf.setFontAlign(-1,1); //left, bottom + buf.setColor(2); + buf.setFontVector(35); + buf.drawString(dat.unit,5,164); + + if ( dat.max ) drawMax(); // MAX display indicator + if ( dat.wp ) drawWP(); // Waypoint name + + //Sats + if ( dat.sat ) { + if ( dat.age > 10 ) { + if ( dat.age > 90 ) dat.age = '>90'; + drawSats('Age:'+dat.age); + } + else drawSats('Sats:'+dat.sats); + } + + g.reset(); + g.drawImage(img,0,40); + +} + +function drawClock() { + if (!canDraw) return; + buf.clear(); + var x, y; + x=120; + y=0; + buf.setFontAlign(0,-1); + buf.setFontVector(80); + time = require("locale").time(new Date(),1); + buf.setColor(3); + buf.drawString(time,x,y); + + g.reset(); + g.drawImage(img,0,40); +} + +function drawWP() { + var nm = wp.name; + if ( nm == undefined || nm == 'NONE' || cfg.modeA ==1 ) nm = ''; + buf.setColor(2); + + buf.setFontAlign(0,1); //left, bottom + buf.setFontVector(48); + buf.drawString(nm.substring(0,8),120,140); + +} + +function drawSats(sats) { + buf.setColor(3); + buf.setFont("6x8", 2); + buf.setFontAlign(1,1); //right, bottom + buf.drawString(sats,240,160); +} + +function drawMax() { + buf.setFontVector(30); + buf.setColor(2); + buf.setFontAlign(0,1); //centre, bottom + buf.drawString('MAX',120,164); +} + +function onGPS(fix) { + + if ( emulator ) { + fix.fix = 1; + fix.speed = 10 + (Math.random()*5); + fix.alt = 354 + (Math.random()*50); + fix.lat = -38.92; + fix.lon = 175.7613350; + fix.course = 245; + fix.satellites = 12; + fix.time = new Date(); + fix.smoothed = 0; + } + + var m; + + var sp = '---'; + var al = '---'; + var di = '---'; + var age = '---'; + + if (fix.fix) lf = fix; + + if (lf.fix) { + + // Smooth data + if ( lf.smoothed !== 1 ) { + if ( cfg.spdFilt ) lf.speed = spdFilter.filter(lf.speed); + if ( cfg.altFilt ) lf.alt = altFilter.filter(lf.alt); + lf.smoothed = 1; + if ( max.n <= 15 ) max.n++; + } + + + // Speed + if ( cfg.spd == 0 ) { + m = require("locale").speed(lf.speed).match(/([0-9,\.]+)(.*)/); // regex splits numbers from units + sp = parseFloat(m[1]); + cfg.spd_unit = m[2]; + } + else sp = parseFloat(lf.speed)/parseFloat(cfg.spd); // Calculate for selected units + + if ( sp < 10 ) sp = sp.toFixed(1); + else sp = Math.round(sp); + if (parseFloat(sp) > parseFloat(max.spd) && max.n > 15 ) max.spd = parseFloat(sp); + + // Altitude + al = lf.alt; + al = Math.round(parseFloat(al)/parseFloat(cfg.alt)); + if (parseFloat(al) > parseFloat(max.alt) && max.n > 15 ) max.alt = parseFloat(al); + + // Distance to waypoint + di = distance(lf,wp); + if (isNaN(di)) di = 0; + + // Age of last fix (secs) + age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); + } + + if ( cfg.modeA == 0 ) { + // Speed +// if ( di <= 0 ) +// drawScrn({ +// val:sp, +// unit:cfg.spd_unit, +// sats:lf.satellites, +// age:age, +// fix:lf.fix +// }); // No WP selected +// else + if ( showMax ) + drawScrn({ + val:max.spd, + unit:cfg.spd_unit, + sats:lf.satellites, + age:age, + fix:lf.fix, + max:true, + wp:false, + sat:true + }); // Speed maximums + else + drawScrn({ + val:sp, + unit:cfg.spd_unit, + sats:lf.satellites, + age:age, + fix:lf.fix, + max:false, + wp:false, + sat:true + }); + } + + if ( cfg.modeA == 1 ) { + // Alt + if ( showMax ) + drawScrn({ + val:max.alt, + unit:cfg.alt_unit, + sats:lf.satellites, + age:age, + fix:lf.fix, + max:true, + wp:false, + sat:true + }); // Alt maximums + else + drawScrn({ + val:al, + unit:cfg.alt_unit, + sats:lf.satellites, + age:age, + fix:lf.fix, + max:false, + wp:false, + sat:true + }); + } + + if ( cfg.modeA == 2 ) { + // Dist + drawScrn({ + val:di, + unit:cfg.dist_unit, + sats:lf.satellites, + age:age, + fix:lf.fix, + max:false, + wp:true, + sat:true + }); + } + + if ( cfg.modeA == 3 ) { + // Large clock + drawClock(); + } + +} + +function setButtons(){ + + // BTN1 - Max speed/alt or next waypoint + setWatch(function(e) { + var dur = e.time - e.lastTime; + if ( cfg.modeA == 0 || cfg.modeA == 1 ) { + // Spd+Alt mode - Switch between fix and MAX + if ( dur < 2 ) showMax = !showMax; // Short press toggle fix/max display + else { max.spd = 0; max.alt = 0; } // Long press resets max values. + } + else if ( cfg.modeA == 2) nxtWp(1); // Dist mode - Select next waypoint + onGPS(lf); + }, BTN1, { edge:"falling",repeat:true}); + + // Power saving on/off + setWatch(function(e){ + pwrSav=!pwrSav; + if ( pwrSav ) { + LED1.reset(); + var s = require('Storage').readJSON('setting.json',1)||{}; + var t = s.timeout||10; + Bangle.setLCDTimeout(t); + } + else { + Bangle.setLCDTimeout(0); + Bangle.setLCDPower(1); + LED1.set(); + } + }, BTN2, {repeat:true,edge:"falling"}); + + // BTN3 - next screen + setWatch(function(e){ + cfg.modeA = cfg.modeA+1; + if ( cfg.modeA > 3 ) cfg.modeA = 0; + savSettings(); + onGPS(lf); + }, BTN3, {repeat:true,edge:"falling"}); + +/* + // Touch left screen to toggle display + setWatch(function(e){ + cfg.primSpd = !cfg.primSpd; + savSettings(); + onGPS(lf); // Update display + }, BTN4, {repeat:true,edge:"falling"}); +*/ + +} + +function updateClock() { + if (!canDraw) return; +// drawTime(); + g.reset(); + g.drawImage(img,0,40); + if ( emulator ) {max.spd++;max.alt++;} +} + +function startDraw(){ + canDraw=true; + setLpMode('SuperE'); // off + g.clear(); + Bangle.drawWidgets(); + onGPS(lf); // draw app screen +} + +function stopDraw() { + canDraw=false; + if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO');}, 10000); //Drop to low power in 10 secs. Keep lp mode off until we have a first fix. +} + +function savSettings() { + require("Storage").write('speedalt.json',cfg); +} + +function setLpMode(m) { + if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power + if ( !gpssetup ) return; + gpssetup.setPowerMode({power_mode:m}); +} + +// =Main Prog + +// Read settings. +let cfg = require('Storage').readJSON('speedalt.json',1)||{}; + +cfg.spd = cfg.spd||0; // Multiplier for speed unit conversions. 0 = use the locale values for speed +cfg.spd_unit = cfg.spd_unit||''; // Displayed speed unit +cfg.alt = cfg.alt||0.3048;// Multiplier for altitude unit conversions. +cfg.alt_unit = cfg.alt_unit||'feet'; // Displayed altitude units +cfg.dist = cfg.dist||1000;// Multiplier for distnce unit conversions. +cfg.dist_unit = cfg.dist_unit||'km'; // Displayed altitude units +cfg.colour = cfg.colour||0; // Colour scheme. +cfg.wp = cfg.wp||0; // Last selected waypoint for dist +cfg.modeA = cfg.modeA||0; // 0=Speed 1=Alt 2=Dist 3=Clock [0 = [D]ist, 1 = [A]ltitude, 2 = [C]lock] +cfg.primSpd = cfg.primSpd||0; // 1 = Spd in primary, 0 = Spd in secondary + +cfg.spdFilt = cfg.spdFilt==undefined?true:cfg.spdFilt; +cfg.altFilt = cfg.altFilt==undefined?true:cfg.altFilt; + +if ( cfg.spdFilt ) var spdFilter = new KalmanFilter({R: 0.1 , Q: 1 }); +if ( cfg.altFilt ) var altFilter = new KalmanFilter({R: 0.01, Q: 2 }); + +loadWp(); + +/* +Colour Pallet Idx +0 : Background (black) +1 : Speed/Alt +2 : Units +3 : Sats +*/ +var img = { + width:buf.getWidth(), + height:buf.getHeight(), + bpp:2, + buffer:buf.buffer, + palette:new Uint16Array([0,0x4FE0,0xEFE0,0x07DB]) +}; + +if ( cfg.colour == 1 ) img.palette = new Uint16Array([0,0xFFFF,0xFFF6,0xDFFF]); +if ( cfg.colour == 2 ) img.palette = new Uint16Array([0,0xFF800,0xFAE0,0xF813]); + +var SCREENACCESS = { + withApp:true, + request:function(){this.withApp=false;stopDraw();}, + release:function(){this.withApp=true;startDraw();} +}; + +Bangle.on('lcdPower',function(on) { + if (!SCREENACCESS.withApp) return; + if (on) startDraw(); + else stopDraw(); +}); + +var gpssetup; +try { + gpssetup = require("gpssetup"); +} catch(e) { + gpssetup = false; +} + +// All set up. Lets go. +g.clear(); +Bangle.loadWidgets(); +Bangle.drawWidgets(); +onGPS(lf); +Bangle.setGPSPower(1); + +if ( gpssetup ) { + gpssetup.setPowerMode({power_mode:"SuperE"}).then(function() { Bangle.setGPSPower(1); }); +} +else { + Bangle.setGPSPower(1); +} + +Bangle.on('GPS', onGPS); + +setButtons(); +setInterval(updateClock, 10000); From d18acdcee8cc0692ee1f3e5d376578a3a1dba73a Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:04:27 +1300 Subject: [PATCH 002/114] Create ChangeLog --- apps/speedalt2/ChangeLog | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/speedalt2/ChangeLog diff --git a/apps/speedalt2/ChangeLog b/apps/speedalt2/ChangeLog new file mode 100644 index 000000000..6876bcec9 --- /dev/null +++ b/apps/speedalt2/ChangeLog @@ -0,0 +1 @@ +0.01: Initial import. From 62fcb5b9714bd4095db66e5f3664d629165bdb6a Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:06:26 +1300 Subject: [PATCH 003/114] Create README.md --- apps/speedalt2/README.md | 150 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 apps/speedalt2/README.md diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md new file mode 100644 index 000000000..24596e512 --- /dev/null +++ b/apps/speedalt2/README.md @@ -0,0 +1,150 @@ +# GPS Speed, Altimeter and Distance to Waypoint + +You can switch between three display modes. One showing speed and altitude (A), one showing speed and distance to waypoint (D) and a large dispay of time and selected waypoint. + +Within the [A]ltitude and [D]istance displays modes one figure is displayed on the watch face using the largest possible characters depending on the number of digits. The other is in a smaller characters below that. Both are always visible. You can display the current or maximum observed speed/altitude values. Current time is always displayed. + +The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. + +## Buttons and Controls + +BTN3 : Cycles the modes between Speed+[A]ltitude, Speed+[D]istance and large Time/Waypoint + +### [A]ltitude mode + +BTN1 : Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded. + +BTN1 : Long press > 2 secs resets the recorded maximum values. + +### [D]istance mode + +BTN1 : Select next waypoint. Last fix distance from selected waypoint is displayed. + +### Large mode + +BTN1 : Select next waypoint. + +### All modes + +BTN2 : Disables/Restores power saving timeout. Locks the screen on and GPS in SuperE mode to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Press again to restore power saving timeouts. + +BTN3 : Long press exit and return to watch. + +BTN4 : Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. + +## App Settings + +Select the desired display units. Speed can be as per the default locale, kph, knots, mph or m/s. Distance can be km, miles or nautical miles. Altitude can be feet or metres. Select one of three colour schemes. Default (three colours), high contrast (all white on black) or night ( all red on black ). + +## Kalman Filter + +This filter smooths the altitude and the speed values and reduces these values 'jumping around' from one GPS fix to the next. The down side of this is that if these values change rapidly ( eg. a quick change in altitude ) then it can take a few GPS fixes for the values to move to the new vlaues. Disabling the Kalman filter in the settings will cause the raw values to be displayed from each GPS fix as they are found. + +## Loss of fix + +When the GPS obtains a fix the number of satellites is displayed as 'Sats:nn'. When unable to obtain a fix then the last known fix is used and the age of that fix in seconds is displayed as 'Age:nn'. Seeing 'Sats' or 'Age' indicates whether the GPS has a current fix or not. + +## Screens + +Speed and Altitude:
+![](screen1.png)

+Left tap swaps displays:
+![](screen2.png)

+Distance to waypoint DeltaW:
+![](screen5.png)

+MAX Values instead:
+![](screen3.png)

+Settings:
+![](screen4.png)

+ +## Power Saving + +The The GPS Adv Sport app obeys the watch screen off timeouts as a power saving measure. Restore the screen as per any of the colck/watch apps. Use BTN2 to lock the screen on but doing this will use more battery. + +This app will work quite happily on its own but will use the [GPS Setup App](https://banglejs.com/apps/#gps%20setup) if it is installed. You may choose to use the GPS Setup App to gain significantly longer battery life while the GPS is on. Please read the Low Power GPS Setup App Readme to understand what this does. + +When using the GPS Setup App this app switches the GPS to SuperE (default) mode while the display is lit and showing fix information. This ensures that that fixes are updated every second or so. 10 seconds after the display is blanked by the watch this app will switch the GPS to PSMOO mode and will only attempt to get a fix every two minutes. This improves power saving while the display is off and the delay gives an opportunity to restore the display before the GPS power mode is switched. + +The MAX values continue to be collected with the display off so may appear a little odd after the intermittent fixes of the low power mode. + +## Waypoints + +Waypoints are used in [D]istance mode. Create a file waypoints.json and write to storage on the Bangle.js using the IDE. The first 6 characters of the name are displayed in Speed+[D]istance mode. + +The [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app in the App Loader has a really nice waypoints file editor. (Must be connected to your Bangle.JS and then click on the Download icon.) + +Sample waypoints.json (My sailing waypoints) + +

+[
+  {
+  "name":"NONE"
+  },
+  {
+  "name":"Omori",
+  "lat":-38.9058670,
+  "lon":175.7613350
+  },
+  {
+  "name":"DeltaW",
+  "lat":-38.9438550,
+  "lon":175.7676930
+  },
+  {
+  "name":"DeltaE",
+  "lat":-38.9395240,
+  "lon":175.7814420
+  },
+  {
+  "name":"BtClub",
+  "lat":-38.9446020,
+  "lon":175.8475720
+  },
+  {
+  "name":"Hapua",
+  "lat":-38.8177750,
+  "lon":175.8088720
+  },
+  {
+  "name":"Nook",
+  "lat":-38.7848090,
+  "lon":175.7839440
+  },
+  {
+  "name":"ChryBy",
+  "lat":-38.7975050,
+  "lon":175.7551960
+  },
+  {
+  "name":"Waiha",
+  "lat":-38.7219630,
+  "lon":175.7481520
+  },
+  {
+  "name":"KwaKwa",
+  "lat":-38.6632310,
+  "lon":175.8670320
+  },
+  {
+  "name":"Hatepe",
+  "lat":-38.8547420,
+  "lon":176.0089124
+  },
+  {
+  "name":"Kinloc",
+  "lat":-38.6614442,
+  "lon":175.9161607
+  }
+]
+
+ +## Comments and Feedback + +Developed for my use in sailing, cycling and motorcycling. If you find this software useful or have feedback drop me a line mike[at]kereru.com. Enjoy! + +## Thanks + +Many thanks to Gordon Williams. Awesome job. + +Special thanks also to @jeffmer, for the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app and @hughbarney for the Low power GPS code development and Wouter Bulten for the Kalman filter code. + From 54bb8b56607264d5f2794ed4402b6cc91ca280f1 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:07:32 +1300 Subject: [PATCH 004/114] Create app-icon.js --- apps/speedalt2/app-icon.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/speedalt2/app-icon.js diff --git a/apps/speedalt2/app-icon.js b/apps/speedalt2/app-icon.js new file mode 100644 index 000000000..f4f24a18b --- /dev/null +++ b/apps/speedalt2/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+AH4A/AE+sFtoABF12swItsF9QuFR4IwmFwwvnFw4vCGEYuIF4JgjFxIvkFxQvCGBfOAAQvqFwYwRFxYvDGBIvUFxgv/F6IuNF4n+0nB4TvXFxwvF4XBAALlPF7ZfBGC4uPF4rABGAYAGTQwvad4YwKFzYvIGBQvfFwgAE3Qvt4IvEFzgvCLxO7Lx7vULzIzTFwIvgGZheFRAiNRGSQvpGYouesYAGmQAKq3CE4PIC4wviq2eFwPCroveCRSGEC6Qv0DAwRLcoouWC4VdVYQXkr1eAgVdAoIABroNEB4gHHC5QvHwQSDAAOCA74vH1uICQIABxGtA74vIAEwv/F/4vXAH4A/AHY")) From 76d2616a6bb196fbb71facccb96c65f9e8a8251e Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:08:43 +1300 Subject: [PATCH 005/114] Add files via upload --- apps/speedalt2/app.png | Bin 0 -> 1639 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/speedalt2/app.png diff --git a/apps/speedalt2/app.png b/apps/speedalt2/app.png new file mode 100644 index 0000000000000000000000000000000000000000..93d8e57dcbfaf905321fffcf06df042aa49d7dc8 GIT binary patch literal 1639 zcmV-t2AKJYP)@pC8}P=li+m^Env72)@5?yIePa+S>ZbmYsjOa=2m` z!{OB3)^@Gi>3mz!4w$0Hsk)+sbUjipG!&a5|mi z0)`wD_))?j-{$=p(Hmdb{pQ4>#*6Vi6tc_Zs;~=3feFd%R;{|DPtl#K#zRAi7Y`X1 z;B-32+0egXk^BI1gjay&Ter42GL0Dz85MB$^yxyo$U$Iys+>m`&vy%a=qU``n@P+> zNP8DjRdIK?-TImuq^&ql&*I#FWmi3gE><5sB1FaOuOpr#vV?n<_ z(dFmE1qqjs%jGHp7J&{q>2Qby*D7qRpED;gC=2aCEBXiDExut%@3&{)$jNhX)r2YG z^dnNg&zDjGMkx7$Y$pHGo;N24gYr|qS+FpfUBG`~4S=I0`nS$#h_+3*gamysqb!pk zXv%7YEpd4d5ubDqMVujc>)h5J>qvFn-dc4qzLwO;v4OF4uHK zDiy5+ZXrpN_sZ@=#Xj{d&k>z5AX5;YnD;7bECtO;8eHUgNwAw_bgd#HLExkQ@!Xj+ zXB>X7_a+mwQjkhu24U}4pZZo9%HcI2rhoVL=_y*H6IEB8WWWn~`V z-Tpy)d;4g+$ZY~Y$B;^am0~yN4W?9AbqDCW6kH$2X1iauedJGMVA;$qJ+`S27!^;a zLFHfD)9b&=?EzjY{WpaYdh*?c4qo{24Fn`I6~AH7lb74K>t{82$^4}<13f@#JcasV z&KF6MZz%O8J%h>nRCsynRJse|UsOmac2ZauAatVf3o!C+e}8AsYqKqV^h0Z_b|Kt1 z@O_l9{PWVHU!u&4Ymd6Dd|G#zCMOdsSK06%Q^1oACnNf8o85N^@B&=+bs3j^T{fWdc+A|x(cEZ$IG!5wbnEk_ zzpY`zq1m!&pEnc#(LQ5#p(i)~!vyvkhHU0Pfl~n8(?8u^c&_xWf^(r)p||8Ly(MS& zk3BghbW*$AKFu`sF)m((MDVTj>G)q)J0s$u#}x4D?$7k|?)Yu_xT{0E#ii6gwD`J+ zoMU#ODHE@txF{F*m*+X}3AOBn4m;z^3mIFQ4{*u#;fR@m_fLG4-4jffF?;5ih@6Mz lPrm;rMhY0g2u5&e@jt$gS?$`E2( Date: Tue, 19 Oct 2021 14:15:17 +1300 Subject: [PATCH 006/114] Added speedalt2 Alternative version of the original speedalt. --- apps.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps.json b/apps.json index d16213364..957bf723b 100644 --- a/apps.json +++ b/apps.json @@ -2896,6 +2896,25 @@ {"name":"speedalt.json"} ] }, +{ "id": "speedalt2", + "name": "GPS Adventure Sports II", + "shortName":"GPS Adv Sport", + "icon": "app.png", + "version":"0.01", + "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", + "tags": "tool,outdoors", + "type":"app", + "allow_emulator":true, + "readme": "README.md", + "storage": [ + {"name":"speedalt.app.js","url":"app.js"}, + {"name":"speedalt.img","url":"app-icon.js","evaluate":true}, + {"name":"speedalt.settings.js","url":"settings.js"} + ], + "data": [ + {"name":"speedalt.json"} + ] +}, { "id": "de-stress", "name": "De-Stress", "shortName":"De-Stress", From 1218892d1c8ff0601760450ad5820e9a533ff110 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:16:57 +1300 Subject: [PATCH 007/114] Create settings.js --- apps/speedalt2/settings.js | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 apps/speedalt2/settings.js diff --git a/apps/speedalt2/settings.js b/apps/speedalt2/settings.js new file mode 100644 index 000000000..488ba3b81 --- /dev/null +++ b/apps/speedalt2/settings.js @@ -0,0 +1,89 @@ +(function(back) { + + let settings = require('Storage').readJSON('speedalt.json',1)||{}; + //settings.buzz = settings.buzz||1; + + function writeSettings() { + require('Storage').write('speedalt.json',settings); + } + + function setUnits(m,u) { + settings.spd = m; + settings.spd_unit = u; + writeSettings(); + } + + function setUnitsAlt(m,u) { + settings.alt = m; + settings.alt_unit = u; + writeSettings(); + } + + function setUnitsDist(d,u) { + settings.dist = d; + settings.dist_unit = u; + writeSettings(); + } + + function setColour(c) { + settings.colour = c; + writeSettings(); + } + + + const appMenu = { + '': {'title': 'GPS Speed Alt'}, + '< Back': back, + '< Load GPS Adv Sport': ()=>{load('speedalt.app.js');}, + 'Units' : function() { E.showMenu(unitsMenu); }, + 'Colours' : function() { E.showMenu(colMenu); }, + 'Kalman Filter' : function() { E.showMenu(kalMenu); }/*, + 'Vibrate' : { + value : settings.buzz, + format : v => v?"On":"Off", + onchange : () => { settings.buzz = !settings.buzz; writeSettings(); } + }*/ + }; + + const unitsMenu = { + '': {'title': 'Units'}, + '< Back': function() { E.showMenu(appMenu); }, + 'default (spd)' : function() { setUnits(0,''); }, + 'Kph (spd)' : function() { setUnits(1,'kph'); }, + 'Knots (spd)' : function() { setUnits(1.852,'kts'); }, + 'Mph (spd)' : function() { setUnits(1.60934,'mph'); }, + 'm/s (spd)' : function() { setUnits(3.6,'m/s'); }, + 'Km (dist)' : function() { setUnitsDist(1000,'km'); }, + 'Miles (dist)' : function() { setUnitsDist(1609.344,'mi'); }, + 'Nm (dist)' : function() { setUnitsDist(1852.001,'nm'); }, + 'Meters (alt)' : function() { setUnitsAlt(1,'m'); }, + 'Feet (alt)' : function() { setUnitsAlt(0.3048,'ft'); } + }; + + const colMenu = { + '': {'title': 'Colours'}, + '< Back': function() { E.showMenu(appMenu); }, + 'Default' : function() { setColour(0); }, + 'Hi Contrast' : function() { setColour(1); }, + 'Night' : function() { setColour(2); } + }; + + const kalMenu = { + '': {'title': 'Kalman Filter'}, + '< Back': function() { E.showMenu(appMenu); }, + 'Speed' : { + value : settings.spdFilt, + format : v => v?"On":"Off", + onchange : () => { settings.spdFilt = !settings.spdFilt; writeSettings(); } + }, + 'Altitude' : { + value : settings.altFilt, + format : v => v?"On":"Off", + onchange : () => { settings.altFilt = !settings.altFilt; writeSettings(); } + } + }; + + + E.showMenu(appMenu); + +}); From 9c4b020dc259b1c0c4a8ccbcb3522d3cfcd4c00f Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:25:25 +1300 Subject: [PATCH 008/114] Update README.md --- apps/speedalt2/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index 24596e512..f918a7c12 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -1,5 +1,10 @@ # GPS Speed, Altimeter and Distance to Waypoint +What is the difference between GPS Adventure Sports and GPS Adventure Sports II ? +GPS Adventure Sports has 3 screens, each of which display different sets of information. +GPS Adventure Sports II has 4 screens, each of which displays just one of Speed, Altitude, Distance to waypoint or Time. +Use [BTN3] to cycle through the screens. + You can switch between three display modes. One showing speed and altitude (A), one showing speed and distance to waypoint (D) and a large dispay of time and selected waypoint. Within the [A]ltitude and [D]istance displays modes one figure is displayed on the watch face using the largest possible characters depending on the number of digits. The other is in a smaller characters below that. Both are always visible. You can display the current or maximum observed speed/altitude values. Current time is always displayed. From 1a487fa7d81c470cdfb834d8115ef8cd643582d9 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:32:12 +1300 Subject: [PATCH 009/114] Update README.md --- apps/speedalt2/README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index f918a7c12..96deac7d3 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -1,9 +1,12 @@ # GPS Speed, Altimeter and Distance to Waypoint -What is the difference between GPS Adventure Sports and GPS Adventure Sports II ? -GPS Adventure Sports has 3 screens, each of which display different sets of information. -GPS Adventure Sports II has 4 screens, each of which displays just one of Speed, Altitude, Distance to waypoint or Time. -Use [BTN3] to cycle through the screens. +What is the difference between [GPS Adventure Sports] and [GPS Adventure Sports II] ? + +[GPS Adventure Sports] has 3 screens, each of which display different sets of information. + +[GPS Adventure Sports II] has 4 screens, each of which displays just one of Speed, Altitude, Distance to waypoint or Time. + +In all other respect they perform the same functions. Use BTN3 to cycle through the screens. You can switch between three display modes. One showing speed and altitude (A), one showing speed and distance to waypoint (D) and a large dispay of time and selected waypoint. From 3be92b67865bf0aa6b8bfde03763250f294f40cd Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:50:15 +1300 Subject: [PATCH 010/114] Update settings.js --- apps/speedalt2/settings.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/speedalt2/settings.js b/apps/speedalt2/settings.js index 488ba3b81..2b3de16d3 100644 --- a/apps/speedalt2/settings.js +++ b/apps/speedalt2/settings.js @@ -1,10 +1,10 @@ (function(back) { - let settings = require('Storage').readJSON('speedalt.json',1)||{}; + let settings = require('Storage').readJSON('speedalt2.json',1)||{}; //settings.buzz = settings.buzz||1; function writeSettings() { - require('Storage').write('speedalt.json',settings); + require('Storage').write('speedalt2.json',settings); } function setUnits(m,u) { @@ -34,7 +34,7 @@ const appMenu = { '': {'title': 'GPS Speed Alt'}, '< Back': back, - '< Load GPS Adv Sport': ()=>{load('speedalt.app.js');}, + '< Load GPS Adv Sport': ()=>{load('speedalt2.app.js');}, 'Units' : function() { E.showMenu(unitsMenu); }, 'Colours' : function() { E.showMenu(colMenu); }, 'Kalman Filter' : function() { E.showMenu(kalMenu); }/*, From 23f28c1698be53d32698de1af00d564ed3ea7470 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:52:54 +1300 Subject: [PATCH 011/114] Update apps.json --- apps.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps.json b/apps.json index 957bf723b..30ba692fc 100644 --- a/apps.json +++ b/apps.json @@ -2907,12 +2907,12 @@ "allow_emulator":true, "readme": "README.md", "storage": [ - {"name":"speedalt.app.js","url":"app.js"}, - {"name":"speedalt.img","url":"app-icon.js","evaluate":true}, - {"name":"speedalt.settings.js","url":"settings.js"} + {"name":"speedalt2.app.js","url":"app.js"}, + {"name":"speedalt2.img","url":"app-icon.js","evaluate":true}, + {"name":"speedalt2.settings.js","url":"settings.js"} ], "data": [ - {"name":"speedalt.json"} + {"name":"speedalt2.json"} ] }, { "id": "de-stress", From 893a4f66f920c64a1e5f310ffab75c8c0de7261a Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:56:23 +1300 Subject: [PATCH 012/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 30ba692fc..514b75313 100644 --- a/apps.json +++ b/apps.json @@ -2898,7 +2898,7 @@ }, { "id": "speedalt2", "name": "GPS Adventure Sports II", - "shortName":"GPS Adv Sport", + "shortName":"GPS Adv Sport II", "icon": "app.png", "version":"0.01", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", From 39a4cb8e174c57511f0bfe0763f9786d2d0c6a2b Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 14:59:20 +1300 Subject: [PATCH 013/114] Update settings.js --- apps/speedalt2/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/settings.js b/apps/speedalt2/settings.js index 2b3de16d3..26ae010bb 100644 --- a/apps/speedalt2/settings.js +++ b/apps/speedalt2/settings.js @@ -32,7 +32,7 @@ const appMenu = { - '': {'title': 'GPS Speed Alt'}, + '': {'title': 'GPS Adv Sprt II'}, '< Back': back, '< Load GPS Adv Sport': ()=>{load('speedalt2.app.js');}, 'Units' : function() { E.showMenu(unitsMenu); }, From 8b6dadc3fbcafe0387db022605b65d5ce82ee00b Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 15:00:09 +1300 Subject: [PATCH 014/114] Update settings.js --- apps/speedalt/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt/settings.js b/apps/speedalt/settings.js index 488ba3b81..63d77971e 100644 --- a/apps/speedalt/settings.js +++ b/apps/speedalt/settings.js @@ -32,7 +32,7 @@ const appMenu = { - '': {'title': 'GPS Speed Alt'}, + '': {'title': 'GPS Adv Sprt'}, '< Back': back, '< Load GPS Adv Sport': ()=>{load('speedalt.app.js');}, 'Units' : function() { E.showMenu(unitsMenu); }, From b5e41bc3964c1f1810aa7074fecca12736585fa0 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 15:01:11 +1300 Subject: [PATCH 015/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 514b75313..1b5e6470b 100644 --- a/apps.json +++ b/apps.json @@ -2900,7 +2900,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.01", + "version":"0.02", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 10ad5074d2eba1ec6216e6848ded17ebcfa7bba7 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 15:14:44 +1300 Subject: [PATCH 016/114] Update app.js --- apps/speedalt2/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index f96c1c320..ba5a6768c 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -3,7 +3,7 @@ Speed and Altitude [speedalt2] Mike Bennett mike[at]kereru.com 0.01 : Initial */ -var v = '0.01a'; +var v = '0.03a'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -519,7 +519,7 @@ function stopDraw() { } function savSettings() { - require("Storage").write('speedalt.json',cfg); + require("Storage").write('speedalt2.json',cfg); } function setLpMode(m) { @@ -531,7 +531,7 @@ function setLpMode(m) { // =Main Prog // Read settings. -let cfg = require('Storage').readJSON('speedalt.json',1)||{}; +let cfg = require('Storage').readJSON('speedalt2.json',1)||{}; cfg.spd = cfg.spd||0; // Multiplier for speed unit conversions. 0 = use the locale values for speed cfg.spd_unit = cfg.spd_unit||''; // Displayed speed unit From b3a4bde0ea15cf7a04d82249bdc61da035abb994 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 15:16:04 +1300 Subject: [PATCH 017/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 1b5e6470b..1488aa4bc 100644 --- a/apps.json +++ b/apps.json @@ -2900,7 +2900,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.02", + "version":"0.03", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From b9672a18dc652d024986f47ff9b5e8552762bbf0 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 15:29:48 +1300 Subject: [PATCH 018/114] Update README.md --- apps/speedalt2/README.md | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index 96deac7d3..ab2047af6 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -8,37 +8,19 @@ What is the difference between [GPS Adventure Sports] and [GPS Adventure Sports In all other respect they perform the same functions. Use BTN3 to cycle through the screens. -You can switch between three display modes. One showing speed and altitude (A), one showing speed and distance to waypoint (D) and a large dispay of time and selected waypoint. - -Within the [A]ltitude and [D]istance displays modes one figure is displayed on the watch face using the largest possible characters depending on the number of digits. The other is in a smaller characters below that. Both are always visible. You can display the current or maximum observed speed/altitude values. Current time is always displayed. - The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. ## Buttons and Controls -BTN3 : Cycles the modes between Speed+[A]ltitude, Speed+[D]istance and large Time/Waypoint +BTN1 ( Speed and Altitude ) Short press < 2 secs toggles the display between last reading and maximum recorded. Long press > 2 secs resets the recorded maximum values. -### [A]ltitude mode - -BTN1 : Short press < 2 secs toggles the displays between showing the current speed/alt values or the maximum speed/alt values recorded. - -BTN1 : Long press > 2 secs resets the recorded maximum values. - -### [D]istance mode - -BTN1 : Select next waypoint. Last fix distance from selected waypoint is displayed. - -### Large mode - -BTN1 : Select next waypoint. - -### All modes +BTN1 ( Distance ) Select next waypoint. Last fix distance from selected waypoint is displayed. BTN2 : Disables/Restores power saving timeout. Locks the screen on and GPS in SuperE mode to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Press again to restore power saving timeouts. -BTN3 : Long press exit and return to watch. +BTN3 : Cycles the modes between Speed, Altitude, Distance to waypoint and Time -BTN4 : Left Display Tap : Swaps which figure is in the large display. You can have either speed or [A]ltitude/[D]istance on the large primary display. +BTN3 : Long press exit and return to watch. ## App Settings @@ -52,19 +34,6 @@ This filter smooths the altitude and the speed values and reduces these values ' When the GPS obtains a fix the number of satellites is displayed as 'Sats:nn'. When unable to obtain a fix then the last known fix is used and the age of that fix in seconds is displayed as 'Age:nn'. Seeing 'Sats' or 'Age' indicates whether the GPS has a current fix or not. -## Screens - -Speed and Altitude:
-![](screen1.png)

-Left tap swaps displays:
-![](screen2.png)

-Distance to waypoint DeltaW:
-![](screen5.png)

-MAX Values instead:
-![](screen3.png)

-Settings:
-![](screen4.png)

- ## Power Saving The The GPS Adv Sport app obeys the watch screen off timeouts as a power saving measure. Restore the screen as per any of the colck/watch apps. Use BTN2 to lock the screen on but doing this will use more battery. From 47979bc979a36fe19215514e2ca6fa20fcc23e2b Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 15:32:12 +1300 Subject: [PATCH 019/114] Update README.md --- apps/speedalt2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index ab2047af6..236558916 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -28,7 +28,7 @@ Select the desired display units. Speed can be as per the default locale, kph, k ## Kalman Filter -This filter smooths the altitude and the speed values and reduces these values 'jumping around' from one GPS fix to the next. The down side of this is that if these values change rapidly ( eg. a quick change in altitude ) then it can take a few GPS fixes for the values to move to the new vlaues. Disabling the Kalman filter in the settings will cause the raw values to be displayed from each GPS fix as they are found. +This filter smooths the altitude and the speed values and reduces these values 'jumping around' from one GPS fix to the next. The down side of this is that if these values change rapidly ( eg. a quick change in altitude ) then it can take a few GPS fixes for the values to move to the new values. Disabling the Kalman filter in the settings will cause the raw values to be displayed from each GPS fix as they are found. ## Loss of fix From 8f2d849be6a209a250ad12903da9cf27c8d39ebf Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 16:09:29 +1300 Subject: [PATCH 020/114] Update app.js --- apps/speedalt2/app.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index ba5a6768c..e4557b05d 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -3,7 +3,7 @@ Speed and Altitude [speedalt2] Mike Bennett mike[at]kereru.com 0.01 : Initial */ -var v = '0.03a'; +var v = '0.04'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -229,20 +229,21 @@ function drawScrn(dat) { var n; n = dat.val.toString(); - var s=40; // Font size + var s=50; // Font size var l=n.length; - if ( l <= 7 ) s=48; - if ( l <= 6 ) s=55; - if ( l <= 5 ) s=68; - if ( l <= 4 ) s=90; - if ( l <= 3 ) s=110; + if ( l <= 7 ) s=55; + if ( l <= 6 ) s=60; + if ( l <= 5 ) s=80; + if ( l <= 4 ) s=100; + if ( l <= 3 ) s=120; - buf.setFontAlign(0,-1); //Centre + buf.setFontAlign(0,0); //Centre buf.setColor(1); buf.setFontVector(s); - buf.drawString(n,110,-0); - + buf.drawString(n,126,52); + + // Primary Units buf.setFontAlign(-1,1); //left, bottom buf.setColor(2); @@ -263,7 +264,7 @@ function drawScrn(dat) { g.reset(); g.drawImage(img,0,40); - + } function drawClock() { From ac366472544d9ee1350d7bb6b9cc3da19c844908 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 16:10:37 +1300 Subject: [PATCH 021/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 1488aa4bc..09565b6e8 100644 --- a/apps.json +++ b/apps.json @@ -2900,7 +2900,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.03", + "version":"0.04", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From a6df5ca41a506e62169735b7cb377f2804adee95 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 16:58:58 +1300 Subject: [PATCH 022/114] Update app.js --- apps/speedalt2/app.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index e4557b05d..7bb76d8aa 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -3,7 +3,7 @@ Speed and Altitude [speedalt2] Mike Bennett mike[at]kereru.com 0.01 : Initial */ -var v = '0.04'; +var v = '0.05'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -264,6 +264,9 @@ function drawScrn(dat) { g.reset(); g.drawImage(img,0,40); + + if ( pwrSav ) LED1.reset(); + else LED1.set(); } @@ -369,15 +372,6 @@ function onGPS(fix) { if ( cfg.modeA == 0 ) { // Speed -// if ( di <= 0 ) -// drawScrn({ -// val:sp, -// unit:cfg.spd_unit, -// sats:lf.satellites, -// age:age, -// fix:lf.fix -// }); // No WP selected -// else if ( showMax ) drawScrn({ val:max.spd, From 3f52cffd823cb69c7c957e50a24cab66b77289f4 Mon Sep 17 00:00:00 2001 From: nujw Date: Tue, 19 Oct 2021 16:59:42 +1300 Subject: [PATCH 023/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 09565b6e8..ed4d38dd0 100644 --- a/apps.json +++ b/apps.json @@ -2900,7 +2900,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.04", + "version":"0.05", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 0fc03f77f983be6e0b30459bfa067c5cd429fa41 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 14:39:46 +1300 Subject: [PATCH 024/114] Update app.js --- apps/speedalt2/app.js | 94 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 80 insertions(+), 14 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 7bb76d8aa..89ab09a56 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -2,8 +2,9 @@ Speed and Altitude [speedalt2] Mike Bennett mike[at]kereru.com 0.01 : Initial +0.06 : Add Posn screen */ -var v = '0.05'; +var v = '0.06'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -270,17 +271,71 @@ function drawScrn(dat) { } +function drawPosn(dat) { + if (!canDraw) return; + buf.clear(); + ///////// + + var x, y; + x=210; + y=0; + buf.setFontAlign(1,-1); + buf.setFontVector(60); + buf.setColor(1); + + var lat = dat.lat; + var lon = dat.lon; + + var ns = 'N'; + if ( lat < 0 ) ns = 'S'; + lat = Math.abs(lat.toFixed(2)); + + var ew = 'E'; + if ( lon < 0 ) ew = 'W'; + lon = Math.abs(lon.toFixed(2)); + + buf.drawString(lat,x,y); + buf.drawString(lon,x,y+70); + + x = 240; + buf.setColor(2); + buf.setFontVector(40); + buf.drawString(ns,x,y); + buf.drawString(ew,x,y+70); + + + //// + //Sats + if ( dat.sat ) { + if ( dat.age > 10 ) { + if ( dat.age > 90 ) dat.age = '>90'; + drawSats('Age:'+dat.age); + } + else drawSats('Sats:'+dat.sats); + } + + g.reset(); + g.drawImage(img,0,40); + + if ( pwrSav ) LED1.reset(); + else LED1.set(); + +} + function drawClock() { if (!canDraw) return; buf.clear(); var x, y; - x=120; + x=185; y=0; - buf.setFontAlign(0,-1); - buf.setFontVector(80); + buf.setFontAlign(1,-1); + buf.setFontVector(94); time = require("locale").time(new Date(),1); - buf.setColor(3); - buf.drawString(time,x,y); + + buf.setColor(3); + + buf.drawString(time.substring(0,2),x,y); + buf.drawString(time.substring(3,5),x,y+80); g.reset(); g.drawImage(img,0,40); @@ -378,7 +433,7 @@ function onGPS(fix) { unit:cfg.spd_unit, sats:lf.satellites, age:age, - fix:lf.fix, + // fix:lf.fix, max:true, wp:false, sat:true @@ -389,7 +444,7 @@ function onGPS(fix) { unit:cfg.spd_unit, sats:lf.satellites, age:age, - fix:lf.fix, +// fix:lf.fix, max:false, wp:false, sat:true @@ -404,7 +459,7 @@ function onGPS(fix) { unit:cfg.alt_unit, sats:lf.satellites, age:age, - fix:lf.fix, + // fix:lf.fix, max:true, wp:false, sat:true @@ -415,7 +470,7 @@ function onGPS(fix) { unit:cfg.alt_unit, sats:lf.satellites, age:age, - fix:lf.fix, +// fix:lf.fix, max:false, wp:false, sat:true @@ -429,14 +484,25 @@ function onGPS(fix) { unit:cfg.dist_unit, sats:lf.satellites, age:age, - fix:lf.fix, +// fix:lf.fix, max:false, wp:true, sat:true }); } + + if ( cfg.modeA == 3 ) { + // Position + drawPosn({ + sats:lf.satellites, + age:age, + lat:lf.lat, + lon:lf.lon, + sat:true + }); + } - if ( cfg.modeA == 3 ) { + if ( cfg.modeA == 4 ) { // Large clock drawClock(); } @@ -476,7 +542,7 @@ function setButtons(){ // BTN3 - next screen setWatch(function(e){ cfg.modeA = cfg.modeA+1; - if ( cfg.modeA > 3 ) cfg.modeA = 0; + if ( cfg.modeA > 4 ) cfg.modeA = 0; savSettings(); onGPS(lf); }, BTN3, {repeat:true,edge:"falling"}); @@ -536,7 +602,7 @@ cfg.dist = cfg.dist||1000;// Multiplier for distnce unit conversions. cfg.dist_unit = cfg.dist_unit||'km'; // Displayed altitude units cfg.colour = cfg.colour||0; // Colour scheme. cfg.wp = cfg.wp||0; // Last selected waypoint for dist -cfg.modeA = cfg.modeA||0; // 0=Speed 1=Alt 2=Dist 3=Clock [0 = [D]ist, 1 = [A]ltitude, 2 = [C]lock] +cfg.modeA = cfg.modeA||0; // 0=Speed 1=Alt 2=Dist 3=Position 4=Clock cfg.primSpd = cfg.primSpd||0; // 1 = Spd in primary, 0 = Spd in secondary cfg.spdFilt = cfg.spdFilt==undefined?true:cfg.spdFilt; From de8e308023b015c1ffbd5e8cbd8597d413212346 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 14:44:35 +1300 Subject: [PATCH 025/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index ed4d38dd0..cd46a56f9 100644 --- a/apps.json +++ b/apps.json @@ -2900,7 +2900,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.05", + "version":"0.06", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From d1eba1e40ff275b9bdc5c276364c7b6ea62e9830 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 14:55:05 +1300 Subject: [PATCH 026/114] Update README.md --- apps/speedalt2/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index 236558916..2d50f01e9 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -4,7 +4,7 @@ What is the difference between [GPS Adventure Sports] and [GPS Adventure Sports [GPS Adventure Sports] has 3 screens, each of which display different sets of information. -[GPS Adventure Sports II] has 4 screens, each of which displays just one of Speed, Altitude, Distance to waypoint or Time. +[GPS Adventure Sports II] has 5 screens, each of which displays just one of Speed, Altitude, Distance to waypoint, Position or Time. In all other respect they perform the same functions. Use BTN3 to cycle through the screens. @@ -18,7 +18,7 @@ BTN1 ( Distance ) Select next waypoint. Last fix distance from selected waypoint BTN2 : Disables/Restores power saving timeout. Locks the screen on and GPS in SuperE mode to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Press again to restore power saving timeouts. -BTN3 : Cycles the modes between Speed, Altitude, Distance to waypoint and Time +BTN3 : Cycles the screens between Speed, Altitude, Distance to waypoint, Position and Time BTN3 : Long press exit and return to watch. From e3975fc5c12b311a3ff4307fabf73f831a1c80b8 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 15:11:01 +1300 Subject: [PATCH 027/114] Update app.js --- apps/speedalt2/app.js | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 89ab09a56..3efa78cb9 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -3,8 +3,9 @@ Speed and Altitude [speedalt2] Mike Bennett mike[at]kereru.com 0.01 : Initial 0.06 : Add Posn screen +0.07 : Add swipe to change screens */ -var v = '0.06'; +var v = '0.07'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -509,6 +510,21 @@ function onGPS(fix) { } +function prevScrn() { + cfg.modeA = cfg.modeA-1; + if ( cfg.modeA < 0 ) cfg.modeA = 4; + savSettings(); + onGPS(lf); +} + +function nextScrn() { + cfg.modeA = cfg.modeA+1; + if ( cfg.modeA > 4 ) cfg.modeA = 0; + savSettings(); + onGPS(lf); +} + + function setButtons(){ // BTN1 - Max speed/alt or next waypoint @@ -541,10 +557,7 @@ function setButtons(){ // BTN3 - next screen setWatch(function(e){ - cfg.modeA = cfg.modeA+1; - if ( cfg.modeA > 4 ) cfg.modeA = 0; - savSettings(); - onGPS(lf); + nextScrn(); }, BTN3, {repeat:true,edge:"falling"}); /* @@ -643,6 +656,17 @@ Bangle.on('lcdPower',function(on) { else stopDraw(); }); +//Bangle.on('swipe', dir => { +// if(STATE.settings_open) return; +// if(dir == 1) prev(); +// else next(); +//}); + +Bangle.on('swipe',function(dir) { + if(dir == 1) prevScrn(); + else nextScrn(); +}); + var gpssetup; try { gpssetup = require("gpssetup"); From 37dc64d769c4df45d5843cdb5d8fee3b39bd07cf Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 15:34:44 +1300 Subject: [PATCH 029/114] Update app.js --- apps/speedalt2/app.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 3efa78cb9..f7c1acb8d 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens */ -var v = '0.07'; +var v = '0.07b'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -656,12 +656,6 @@ Bangle.on('lcdPower',function(on) { else stopDraw(); }); -//Bangle.on('swipe', dir => { -// if(STATE.settings_open) return; -// if(dir == 1) prev(); -// else next(); -//}); - Bangle.on('swipe',function(dir) { if(dir == 1) prevScrn(); else nextScrn(); From b5cd96d12120ec9ea0f42113bacb154d5b3eb0d4 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 15:36:22 +1300 Subject: [PATCH 030/114] Update README.md --- apps/speedalt2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index 2d50f01e9..511932298 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -6,7 +6,7 @@ What is the difference between [GPS Adventure Sports] and [GPS Adventure Sports [GPS Adventure Sports II] has 5 screens, each of which displays just one of Speed, Altitude, Distance to waypoint, Position or Time. -In all other respect they perform the same functions. Use BTN3 to cycle through the screens. +In all other respect they perform the same functions. Use BTN3 or swipe left/right to cycle through the screens. The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. From 17f006c9f0a5dcf0478162bdee7512f8178bc3fa Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 15:54:43 +1300 Subject: [PATCH 031/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index cd46a56f9..5ae4dd5da 100644 --- a/apps.json +++ b/apps.json @@ -2900,7 +2900,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.06", + "version":"0.07", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 0f8b915d26f1ce4823f61a69e97a93ec23ecadf8 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 15:55:37 +1300 Subject: [PATCH 032/114] Update ChangeLog --- apps/speedalt2/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/speedalt2/ChangeLog b/apps/speedalt2/ChangeLog index 6876bcec9..91f01988e 100644 --- a/apps/speedalt2/ChangeLog +++ b/apps/speedalt2/ChangeLog @@ -1 +1,2 @@ 0.01: Initial import. +0.07: Add swipe to change screens. From 24fe02336472ffc7112e99afffa18aa77d19e926 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 16:50:20 +1300 Subject: [PATCH 033/114] Update app.js --- apps/speedalt2/app.js | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index f7c1acb8d..86c2ef7d0 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -3,9 +3,10 @@ Speed and Altitude [speedalt2] Mike Bennett mike[at]kereru.com 0.01 : Initial 0.06 : Add Posn screen -0.07 : Add swipe to change screens +0.07 : Add swipe to change screens same as BTN3 +0.08 : Add dbl tap on front same as short BTN1 */ -var v = '0.07b'; +var v = '0.07c'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -524,12 +525,8 @@ function nextScrn() { onGPS(lf); } - -function setButtons(){ - - // BTN1 - Max speed/alt or next waypoint - setWatch(function(e) { - var dur = e.time - e.lastTime; +// Next function on a screen +nextFunc(dur) { if ( cfg.modeA == 0 || cfg.modeA == 1 ) { // Spd+Alt mode - Switch between fix and MAX if ( dur < 2 ) showMax = !showMax; // Short press toggle fix/max display @@ -537,6 +534,14 @@ function setButtons(){ } else if ( cfg.modeA == 2) nxtWp(1); // Dist mode - Select next waypoint onGPS(lf); +} + +function setButtons(){ + + // BTN1 - Max speed/alt or next waypoint + setWatch(function(e) { + var dur = e.time - e.lastTime; + nextFunc(dur); }, BTN1, { edge:"falling",repeat:true}); // Power saving on/off @@ -661,6 +666,20 @@ Bangle.on('swipe',function(dir) { else nextScrn(); }); +/* +dir : "left/right/top/bottom/front/back", + double : true/false // was this a double-tap? + x : -2 .. 2, // the axis of the tap + y : -2 .. 2, // the axis of the tap + z : -2 .. 2 // the axis of the tap +*/ + +Bangle.on('tap',function(tap) { + if ( tap.dir == 'front' && tap.double ) nextFunc(1); // Same as short BTN1 +}); + +//nextFunc(dur) + var gpssetup; try { gpssetup = require("gpssetup"); From 47b3e15826920f17ecbb36edcb616265e1cad2c7 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 16:50:49 +1300 Subject: [PATCH 034/114] Update app.js --- apps/speedalt2/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 86c2ef7d0..61c67f017 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -6,7 +6,7 @@ Mike Bennett mike[at]kereru.com 0.07 : Add swipe to change screens same as BTN3 0.08 : Add dbl tap on front same as short BTN1 */ -var v = '0.07c'; +var v = '0.08a'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { From 69dec737cf91c0fe6459e3c54e47ead25938dd53 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 16:51:48 +1300 Subject: [PATCH 035/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 3c2458a67..d7f6cea69 100644 --- a/apps.json +++ b/apps.json @@ -2901,7 +2901,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.07", + "version":"0.08", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 51d47cf7c442493edf5d4bfd804157544b1b926b Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 17:01:09 +1300 Subject: [PATCH 036/114] Update app.js --- apps/speedalt2/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 61c67f017..27ff0c886 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -526,7 +526,7 @@ function nextScrn() { } // Next function on a screen -nextFunc(dur) { +function nextFunc(dur) { if ( cfg.modeA == 0 || cfg.modeA == 1 ) { // Spd+Alt mode - Switch between fix and MAX if ( dur < 2 ) showMax = !showMax; // Short press toggle fix/max display From a51d090276186e034c756196939cb49dd3c4d2be Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 17:17:48 +1300 Subject: [PATCH 037/114] Update app.js --- apps/speedalt2/app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 27ff0c886..6c03c14cc 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -662,6 +662,7 @@ Bangle.on('lcdPower',function(on) { }); Bangle.on('swipe',function(dir) { + console.log('Swipe : '+dir); if(dir == 1) prevScrn(); else nextScrn(); }); @@ -675,6 +676,7 @@ dir : "left/right/top/bottom/front/back", */ Bangle.on('tap',function(tap) { + console.log('Tap : '+tap.dir); if ( tap.dir == 'front' && tap.double ) nextFunc(1); // Same as short BTN1 }); From 3de91e1e8c8ba2ef0147cf7fd8a04db5214b67ed Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 17:18:03 +1300 Subject: [PATCH 038/114] Update app.js --- apps/speedalt2/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 6c03c14cc..d6e94a489 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -6,7 +6,7 @@ Mike Bennett mike[at]kereru.com 0.07 : Add swipe to change screens same as BTN3 0.08 : Add dbl tap on front same as short BTN1 */ -var v = '0.08a'; +var v = '0.08b'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { From 470e0cd1e5c9a3020e61804d0505e31bf8501e53 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 17:33:24 +1300 Subject: [PATCH 039/114] Update app.js --- apps/speedalt2/app.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index d6e94a489..82bd8525f 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -6,7 +6,7 @@ Mike Bennett mike[at]kereru.com 0.07 : Add swipe to change screens same as BTN3 0.08 : Add dbl tap on front same as short BTN1 */ -var v = '0.08b'; +var v = '0.08d'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -566,12 +566,13 @@ function setButtons(){ }, BTN3, {repeat:true,edge:"falling"}); /* - // Touch left screen to toggle display + // Touch screen same as BTN1 short setWatch(function(e){ - cfg.primSpd = !cfg.primSpd; - savSettings(); - onGPS(lf); // Update display + nextFunc(1); // Same as BTN1 short }, BTN4, {repeat:true,edge:"falling"}); + setWatch(function(e){ + nextFunc(1); // Same as BTN1 short + }, BTN5, {repeat:true,edge:"falling"}); */ } @@ -673,14 +674,14 @@ dir : "left/right/top/bottom/front/back", x : -2 .. 2, // the axis of the tap y : -2 .. 2, // the axis of the tap z : -2 .. 2 // the axis of the tap -*/ + Bangle.on('tap',function(tap) { console.log('Tap : '+tap.dir); if ( tap.dir == 'front' && tap.double ) nextFunc(1); // Same as short BTN1 }); -//nextFunc(dur) +*/ var gpssetup; try { From 6a3d25b3f14f8d1885f337115fb6928cb9e11e82 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 18:12:03 +1300 Subject: [PATCH 040/114] Update app.js --- apps/speedalt2/app.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 82bd8525f..ff58eeab8 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -4,9 +4,8 @@ Mike Bennett mike[at]kereru.com 0.01 : Initial 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 -0.08 : Add dbl tap on front same as short BTN1 */ -var v = '0.08d'; +var v = '0.08e'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -326,6 +325,7 @@ function drawPosn(dat) { function drawClock() { if (!canDraw) return; + buf.clear(); var x, y; x=185; @@ -334,7 +334,7 @@ function drawClock() { buf.setFontVector(94); time = require("locale").time(new Date(),1); - buf.setColor(3); + buf.setColor(1); buf.drawString(time.substring(0,2),x,y); buf.drawString(time.substring(3,5),x,y+80); @@ -579,9 +579,8 @@ function setButtons(){ function updateClock() { if (!canDraw) return; -// drawTime(); - g.reset(); - g.drawImage(img,0,40); + if ( cfg.modeA != 4 ) return; + drawClock(); if ( emulator ) {max.spd++;max.alt++;} } @@ -663,7 +662,6 @@ Bangle.on('lcdPower',function(on) { }); Bangle.on('swipe',function(dir) { - console.log('Swipe : '+dir); if(dir == 1) prevScrn(); else nextScrn(); }); @@ -674,13 +672,10 @@ dir : "left/right/top/bottom/front/back", x : -2 .. 2, // the axis of the tap y : -2 .. 2, // the axis of the tap z : -2 .. 2 // the axis of the tap - - Bangle.on('tap',function(tap) { console.log('Tap : '+tap.dir); if ( tap.dir == 'front' && tap.double ) nextFunc(1); // Same as short BTN1 }); - */ var gpssetup; From f074db47980b077aef299dce5c9df881e66ed512 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 18:13:15 +1300 Subject: [PATCH 041/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index d7f6cea69..efa712416 100644 --- a/apps.json +++ b/apps.json @@ -2901,7 +2901,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.08", + "version":"0.09", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From fa30fa1cd090d8071c08f85638ae9a6748d3806f Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 18:23:43 +1300 Subject: [PATCH 042/114] Update app.js --- apps/speedalt2/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index ff58eeab8..546e58e63 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '0.08e'; +var v = '0.08f'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -341,6 +341,9 @@ function drawClock() { g.reset(); g.drawImage(img,0,40); + + if ( pwrSav ) LED1.reset(); + else LED1.set(); } function drawWP() { From b80da3682e360955cd2b72322cf645c03258e520 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 18:24:09 +1300 Subject: [PATCH 043/114] Update app.js --- apps/speedalt2/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 546e58e63..221b7ab3f 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '0.08f'; +var v = '0.09a'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { From 6b28026c3397ce43154f36bef946e23d736a3d1c Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 18:24:52 +1300 Subject: [PATCH 044/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index efa712416..3db371108 100644 --- a/apps.json +++ b/apps.json @@ -2901,7 +2901,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"0.09", + "version":"1.00", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 0c853240ab7da180f9f020c81d09648eff64227f Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 18:25:09 +1300 Subject: [PATCH 045/114] Update app.js --- apps/speedalt2/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 221b7ab3f..dcde220ec 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '0.09a'; +var v = '1.00'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { From 3564483406b8f7b01f0420e2101aea7b7c0ffe41 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 19:47:15 +1300 Subject: [PATCH 046/114] Update app.js --- apps/speedalt2/app.js | 60 +++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index dcde220ec..adb2d3d66 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '1.00'; +var v = '1.00b'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -174,7 +174,7 @@ var KalmanFilter = (function () { var buf = Graphics.createArrayBuffer(240,160,2,{msb:true}); // Load fonts -require("Font7x11Numeric7Seg").add(Graphics); +//require("Font7x11Numeric7Seg").add(Graphics); var lf = {fix:0,satellites:0}; var showMax = 0; // 1 = display the max values. 0 = display the cur fix @@ -275,7 +275,6 @@ function drawScrn(dat) { function drawPosn(dat) { if (!canDraw) return; buf.clear(); - ///////// var x, y; x=210; @@ -283,29 +282,17 @@ function drawPosn(dat) { buf.setFontAlign(1,-1); buf.setFontVector(60); buf.setColor(1); - - var lat = dat.lat; - var lon = dat.lon; - - var ns = 'N'; - if ( lat < 0 ) ns = 'S'; - lat = Math.abs(lat.toFixed(2)); - - var ew = 'E'; - if ( lon < 0 ) ew = 'W'; - lon = Math.abs(lon.toFixed(2)); - - buf.drawString(lat,x,y); - buf.drawString(lon,x,y+70); + + buf.drawString(dat.lat,x,y); + buf.drawString(dat.lon,x,y+70); x = 240; buf.setColor(2); buf.setFontVector(40); - buf.drawString(ns,x,y); - buf.drawString(ew,x,y+70); + buf.drawString(dat.ns,x,y); + buf.drawString(dat.ew,x,y+70); - //// //Sats if ( dat.sat ) { if ( dat.age > 10 ) { @@ -314,10 +301,10 @@ function drawPosn(dat) { } else drawSats('Sats:'+dat.sats); } - + g.reset(); g.drawImage(img,0,40); - + if ( pwrSav ) LED1.reset(); else LED1.set(); @@ -391,6 +378,11 @@ function onGPS(fix) { var al = '---'; var di = '---'; var age = '---'; + var lat = '---.--'; + var ns = ''; + var ew = ''; + var lon = '---.--'; + if (fix.fix) lf = fix; @@ -403,8 +395,8 @@ function onGPS(fix) { lf.smoothed = 1; if ( max.n <= 15 ) max.n++; } - - + + // Speed if ( cfg.spd == 0 ) { m = require("locale").speed(lf.speed).match(/([0-9,\.]+)(.*)/); // regex splits numbers from units @@ -412,7 +404,7 @@ function onGPS(fix) { cfg.spd_unit = m[2]; } else sp = parseFloat(lf.speed)/parseFloat(cfg.spd); // Calculate for selected units - + if ( sp < 10 ) sp = sp.toFixed(1); else sp = Math.round(sp); if (parseFloat(sp) > parseFloat(max.spd) && max.n > 15 ) max.spd = parseFloat(sp); @@ -428,8 +420,18 @@ function onGPS(fix) { // Age of last fix (secs) age = Math.max(0,Math.round(getTime())-(lf.time.getTime()/1000)); + + // Lat / Lon + ns = 'N'; + if ( lf.lat < 0 ) ns = 'S'; + lat = Math.abs(lf.lat.toFixed(2)); + + ew = 'E'; + if ( lf.lon < 0 ) ew = 'W'; + lon = Math.abs(lf.lon.toFixed(2)); + } - + if ( cfg.modeA == 0 ) { // Speed if ( showMax ) @@ -501,8 +503,10 @@ function onGPS(fix) { drawPosn({ sats:lf.satellites, age:age, - lat:lf.lat, - lon:lf.lon, + lat:lat, + lon:lon, + ns:ns, + ew:ew, sat:true }); } From 08f78e5fe141e2cd2057e6246496264454d91f8b Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 19:47:38 +1300 Subject: [PATCH 047/114] Update app.js --- apps/speedalt2/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index adb2d3d66..886c6ab70 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '1.00b'; +var v = '1.01'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { From dac990e410fc43657f44649f365561bb085a7b78 Mon Sep 17 00:00:00 2001 From: nujw Date: Wed, 20 Oct 2021 19:48:33 +1300 Subject: [PATCH 048/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 3db371108..153f026da 100644 --- a/apps.json +++ b/apps.json @@ -2901,7 +2901,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"1.00", + "version":"1.01", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From d64f120cbd7ce98c6b20a76f8eac185c2ebe3dc1 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 08:16:59 +1300 Subject: [PATCH 049/114] Update app.js --- apps/speedalt2/app.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 886c6ab70..a4f0216b5 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '1.01'; +var v = '1.01b'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -440,7 +440,6 @@ function onGPS(fix) { unit:cfg.spd_unit, sats:lf.satellites, age:age, - // fix:lf.fix, max:true, wp:false, sat:true @@ -451,7 +450,6 @@ function onGPS(fix) { unit:cfg.spd_unit, sats:lf.satellites, age:age, -// fix:lf.fix, max:false, wp:false, sat:true @@ -466,7 +464,6 @@ function onGPS(fix) { unit:cfg.alt_unit, sats:lf.satellites, age:age, - // fix:lf.fix, max:true, wp:false, sat:true @@ -477,7 +474,6 @@ function onGPS(fix) { unit:cfg.alt_unit, sats:lf.satellites, age:age, -// fix:lf.fix, max:false, wp:false, sat:true @@ -491,7 +487,6 @@ function onGPS(fix) { unit:cfg.dist_unit, sats:lf.satellites, age:age, -// fix:lf.fix, max:false, wp:true, sat:true @@ -562,7 +557,7 @@ function setButtons(){ } else { Bangle.setLCDTimeout(0); - Bangle.setLCDPower(1); +// Bangle.setLCDPower(1); LED1.set(); } }, BTN2, {repeat:true,edge:"falling"}); From 633552e0a3ad455b01e784fb4de8c20b6413a05f Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 08:30:07 +1300 Subject: [PATCH 050/114] Update app.js --- apps/speedalt2/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index a4f0216b5..b21e8120e 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '1.01b'; +var v = '1.02'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { From cc4f93d246a0a67e2d3f5f28b2ab94e9c91f5b4b Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 08:30:43 +1300 Subject: [PATCH 051/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 153f026da..07bf11c6d 100644 --- a/apps.json +++ b/apps.json @@ -2901,7 +2901,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"1.01", + "version":"1.02", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 0e52707ac5de98681910a29e2699e8107b8db8fd Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 09:48:36 +1300 Subject: [PATCH 052/114] Update app.js --- apps/speedalt2/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index b21e8120e..4fbe458db 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -588,9 +588,9 @@ function updateClock() { function startDraw(){ canDraw=true; - setLpMode('SuperE'); // off g.clear(); Bangle.drawWidgets(); + setLpMode('SuperE'); // off onGPS(lf); // draw app screen } From 78cc981126b7190d26e42bef7f48e65721034999 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 09:50:30 +1300 Subject: [PATCH 053/114] Create app.js --- apps/speedclock/app.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/speedclock/app.js diff --git a/apps/speedclock/app.js b/apps/speedclock/app.js new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/speedclock/app.js @@ -0,0 +1 @@ + From abab41825589f6cb368f6f2020b49925da7883ad Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 09:52:17 +1300 Subject: [PATCH 054/114] Update app.js --- apps/speedclock/app.js | 317 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 317 insertions(+) diff --git a/apps/speedclock/app.js b/apps/speedclock/app.js index 8b1378917..4c74ce1be 100644 --- a/apps/speedclock/app.js +++ b/apps/speedclock/app.js @@ -1 +1,318 @@ +// Morphing Clock + +// Modifies original Morphing Clock to make seconds and date more readable, and adds a simple stopwatch +// Icon by https://icons8.com +var is12Hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]; +var locale = require("locale"); +var CHARW = 28; // how tall are digits? +var CHARP = 2; // how chunky are digits? +var Y = 50; // start height +// Offscreen buffer +var buf = Graphics.createArrayBuffer(CHARW+CHARP*2,CHARW*2 + CHARP*2,1,{msb:true}); +var bufimg = {width:buf.getWidth(),height:buf.getHeight(),buffer:buf.buffer}; +// The last time that we displayed +var lastTime = "-----"; +// If animating, this is the interval's id +var animInterval; +var timeInterval; +// Variables for the stopwatch +var counter = -1; // Counts seconds +var oldDate = new Date(2020,0,1); // Initialize to a past date +var swInterval; // The interval's id +var B3 = 0; // Flag to track BTN3's current function +var w1; // watch id for BTN1 +var w3; // watch id for BTN3 +/* Get array of lines from digit d to d+1. + n is the amount (0..1) + maxFive is true is this digit only counts 0..5 */ +const DIGITS = { + " ":n=>[], + "0":n=>[ + [n,0,1,0], + [1,0,1,1], + [1,1,1,2], + [n,2,1,2], + [n,1,n,2], + [n,0,n,1]], + "1":n=>[ + [1-n,0,1,0], + [1,0,1,1], + [1-n,1,1,1], + [1-n,1,1-n,2], + [1-n,2,1,2]], + "2":n=>[ + [0,0,1,0], + [1,0,1,1], + [0,1,1,1], + [0,1+n,0,2], + [1,2-n,1,2], + [0,2,1,2]], + "3":n=>[ + [0,0,1-n,0], + [0,0,0,n], + [1,0,1,1], + [0,1,1,1], + [1,1,1,2], + [n,2,1,2]], + "4":n=>[ + [0,0,0,1], + [1,0,1-n,0], + [1,0,1,1-n], + [0,1,1,1], + [1,1,1,2], + [1-n,2,1,2]], + "5to0": n=>[ // 5 -> 0 + [0,0,0,1], + [0,0,1,0], + [n,1,1,1], + [1,1,1,2], + [0,2,1,2], + [0,2,0,2], + [1,1-n,1,1], + [0,1,0,1+n]], + "5to6": n=>[ // 5 -> 6 + [0,0,0,1], + [0,0,1,0], + [0,1,1,1], + [1,1,1,2], + [0,2,1,2], + [0,2-n,0,2]], + "6":n=>[ + [0,0,0,1-n], + [0,0,1,0], + [n,1,1,1], + [1,1-n,1,1], + [1,1,1,2], + [n,2,1,2], + [0,1-n,0,2-2*n]], + "7":n=>[ + [0,0,0,n], + [0,0,1,0], + [1,0,1,1], + [1-n,1,1,1], + [1,1,1,2], + [1-n,2,1,2], + [1-n,1,1-n,2]], + "8":n=>[ + [0,0,0,1], + [0,0,1,0], + [1,0,1,1], + [0,1,1,1], + [1,1,1,2], + [0,2,1,2], + [0,1,0,2-n]], + "9":n=>[ + [0,0,0,1], + [0,0,1,0], + [1,0,1,1], + [0,1,1-n,1], + [0,1,0,1+n], + [1,1,1,2], + [0,2,1,2]], + ":":n=>[ + [0.4,0.4,0.6,0.4], + [0.6,0.4,0.6,0.6], + [0.6,0.6,0.4,0.6], + [0.4,0.4,0.4,0.6], + [0.4,1.4,0.6,1.4], + [0.6,1.4,0.6,1.6], + [0.6,1.6,0.4,1.6], + [0.4,1.4,0.4,1.6]] +}; + +/* Draw a transition between lastText and thisText. + 'n' is the amount - 0..1 */ +function drawDigits(lastText,thisText,n) { + "ram" + const p = CHARP; // padding around digits + const s = CHARW; // character size + var x = 16; // x offset + g.reset(); + for (var i=0;i{ + if (c[0]!=c[2]) // horiz + buf.fillRect(p+c[0]*s,c[1]*s,p+c[2]*s,2*p+c[3]*s); + else if (c[1]!=c[3]) // vert + buf.fillRect(c[0]*s,p+c[1]*s,2*p+c[2]*s,p+c[3]*s); + }); + g.drawImage(bufimg,x,Y); + } + if (thisCh==":") x-=4; + x+=s+p+7; + } +} +function drawDate() { + var x = (CHARW + CHARP + 8)*5; + var y = Y + 2*CHARW + CHARP; + var d = new Date(); + // meridian + g.reset(); + g.setFont("6x8",2); + g.setFontAlign(-1,-1); + if (is12Hour) g.drawString((d.getHours() < 12) ? "AM" : "PM", x+8, Y+0, true); + // date + g.setFont("Vector16"); + g.setFontAlign(0,-1); + // Only draw the date if it has changed: + if ((d.getDate()!=oldDate.getDate())||(d.getMonth()!=oldDate.getMonth())||(d.getFullYear()!=oldDate.getFullYear())) { + var date = locale.date(d,false); + g.clearRect(1,y+8,g.getWidth(),y+24); + g.drawString(date, g.getWidth()/2, y+8, true); + oldDate = d; + } +} + +function drawSeconds() { + var x = (CHARW + CHARP + 8)*5; + var y = Y + 2*CHARW + CHARP; + var d = new Date(); + // seconds + g.reset(); + g.setFont("6x8",2); + g.setFontAlign(-1,-1); + g.drawString(("0"+d.getSeconds()).substr(-2), x+8, y-12, true); +} + +/* Show the current time, and animate if needed */ +function showTime() { + if (animInterval) return; // in animation - quit + var d = new Date(); + var hours = d.getHours(); + if (is12Hour) hours = ((hours + 11) % 12) + 1; + var t = (" "+hours).substr(-2)+":"+ + ("0"+d.getMinutes()).substr(-2); + var l = lastTime; + // same - don't animate + if (t==l || l=="-----") { + drawDigits(l,t,0); + drawDate(); + drawSeconds(); + lastTime = t; + return; + } + var n = 0; + animInterval = setInterval(function() { + n += 1/10; + if (n>=1) { + n=1; + clearInterval(animInterval); + animInterval = undefined; + } + drawDigits(l,t,n); + drawSeconds(); + }, 20); + lastTime = t; +} + +function stopWatch() { + + counter++; + + var hrs = Math.floor(counter/3600); + var mins = Math.floor((counter-hrs*3600)/60); + var secs = counter - mins*60 - hrs*3600; + + // When starting the stopwatch: + if (B3) { + // Set BTN3 to stop the stopwatch and bind itself to restart it: + w3=setWatch(() => {clearInterval(swInterval); + swInterval=undefined; + if (w3) {clearWatch(w3);w3=undefined;} + setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, + BTN3, {repeat:false,edge:"falling"}); + B3 = 1;}, + BTN3, {repeat:false,edge:"falling"}); + B3 = 0; // BTN3 is bound to stop the stopwatch + } + + // Bind BTN1 to call the reset function: + if (!w1) w1 = setWatch(resetStopWatch, BTN1, {repeat:false,edge:"falling"}); + + // Draw elapsed time: + g.reset(); + g.setColor(0.0,0.5,1.0).setFontAlign(0,-1).setFont("Vector24"); + g.clearRect(1,180,g.getWidth(),210); + if (hrs>0) { + g.drawString(("0"+parseInt(hrs)).substr(-2), g.getWidth()/2 - 72, 180, true); + g.drawString( ":", g.getWidth()/2 - 48, 180, true); + } + g.drawString(("0"+parseInt(mins)).substr(-2), g.getWidth()/2 - 24, 180, true); + g.drawString( ":", g.getWidth()/2, 180, true); + g.drawString(("0"+parseInt(secs)).substr(-2), g.getWidth()/2 + 24, 180, true); + +} + +function resetStopWatch() { + + // Stop the interval if necessary: + if (swInterval) { + clearInterval(swInterval); + swInterval=undefined; + } + + // Clear the stopwatch: + g.clearRect(1,180,g.getWidth(),210); + + // Reset the counter: + counter = -1; + + // Set BTN3 to start the stopwatch again: + if (!B3) { + // In case the stopwatch is reset while still running, the watch on BTN3 is still active, so we need to reset it manually: + if (w3) {clearWatch(w3);w3=undefined;} + // Set BTN3 to start the watch again: + setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); + B3 = 1; // BTN3 is bound to start the stopwatch + } + + // Reset watch on BTN1: + if (w1) {clearWatch(w1);w1=undefined;} +} + + +Bangle.on('lcdPower',function(on) { + if (animInterval) { + clearInterval(animInterval); + animInterval = undefined; + } + if (timeInterval) { + clearInterval(timeInterval); + timeInterval = undefined; + } + if (on) { + showTime(); + timeInterval = setInterval(showTime, 1000); + } else { + lastTime = "-----"; + } +}); + +g.clear(); +Bangle.loadWidgets(); +Bangle.drawWidgets(); +// Update time once a second +timeInterval = setInterval(showTime, 1000); +showTime(); + +// Show launcher when button pressed +Bangle.setUI("clock"); + +// Start stopwatch when BTN3 is pressed +setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); +B3 = 1; // BTN3 is bound to start the stopwatch From 551f6e38a7e6779a0c2ad7fa2ddac76e509c1993 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 09:53:37 +1300 Subject: [PATCH 055/114] Create ChangeLog --- apps/speedclock/ChangeLog | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/speedclock/ChangeLog diff --git a/apps/speedclock/ChangeLog b/apps/speedclock/ChangeLog new file mode 100644 index 000000000..c31405e08 --- /dev/null +++ b/apps/speedclock/ChangeLog @@ -0,0 +1 @@ +0.01: Created app From 4e28f9f3e7f59d7ebc21fc64b97c6f7691d99cfe Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 09:54:42 +1300 Subject: [PATCH 056/114] Create README.md --- apps/speedclock/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 apps/speedclock/README.md diff --git a/apps/speedclock/README.md b/apps/speedclock/README.md new file mode 100644 index 000000000..b4a3c83a7 --- /dev/null +++ b/apps/speedclock/README.md @@ -0,0 +1,21 @@ +# Morphing Clock Plus + +Based on Morphing Clock with more readable seconds and date, and an additional simple stopwatch. + +![](Screenshot.JPG) + +## Usage + +In addition to the Morphing Clock, a simple stopwatch can be started in the lower part of the display. + +BTN3 starts and stops the stopwatch. + +BTN1 resets/clears the stopwatch. + +## Requests + +Please leave bug reports and requests by raising an issue [here](https://github.com/skauertz/BangleApps). + +## Creator + +Sebastian Kauertz https://github.com/skauertz From 462537385a5afc0ec1851a02077b3ee5704976e0 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 09:55:51 +1300 Subject: [PATCH 057/114] Create icon.js --- apps/speedclock/icon.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/speedclock/icon.js diff --git a/apps/speedclock/icon.js b/apps/speedclock/icon.js new file mode 100644 index 000000000..41a59f503 --- /dev/null +++ b/apps/speedclock/icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwkEogA/AFGIAAQVVDKQWHDB1IC5OECx8z///mYYOBoWDCoIADnBJLFwQWGDAgwIEYU/CQXwh4EC+YwKBIOPFQYXE//4C5BGCIQgXF/5IILo4XGMIQXHLoYXIMIRGMC45IHC4KkGC45IBC4yNEC5KRBC7h2HC5B4GC5EggQXOBwvygEAl6QHC4sikRGEhGAJAgNBC75HIgZHNO48AgIJER54xCiYXKa5AxCGAjvPGA4XIwYXHbQs4C46QGGAbZDB4IXEPBQAEOwwXDJBJGEC4xILIxQwDSJCNDFwwXDMIh0ELoQXIJARhDC4hdCIw4wEDAQXDCwQuIGAgABmYXBmYHDFxIYGAAoWLJIgAGCxgYJCxwZGCqIA/AC4A=")) From 04359031900f3bbc3b0b7fae993714f24ac7b0ba Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 09:57:17 +1300 Subject: [PATCH 058/114] Add files via upload --- apps/speedclock/app.png | Bin 0 -> 1639 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/speedclock/app.png diff --git a/apps/speedclock/app.png b/apps/speedclock/app.png new file mode 100644 index 0000000000000000000000000000000000000000..93d8e57dcbfaf905321fffcf06df042aa49d7dc8 GIT binary patch literal 1639 zcmV-t2AKJYP)@pC8}P=li+m^Env72)@5?yIePa+S>ZbmYsjOa=2m` z!{OB3)^@Gi>3mz!4w$0Hsk)+sbUjipG!&a5|mi z0)`wD_))?j-{$=p(Hmdb{pQ4>#*6Vi6tc_Zs;~=3feFd%R;{|DPtl#K#zRAi7Y`X1 z;B-32+0egXk^BI1gjay&Ter42GL0Dz85MB$^yxyo$U$Iys+>m`&vy%a=qU``n@P+> zNP8DjRdIK?-TImuq^&ql&*I#FWmi3gE><5sB1FaOuOpr#vV?n<_ z(dFmE1qqjs%jGHp7J&{q>2Qby*D7qRpED;gC=2aCEBXiDExut%@3&{)$jNhX)r2YG z^dnNg&zDjGMkx7$Y$pHGo;N24gYr|qS+FpfUBG`~4S=I0`nS$#h_+3*gamysqb!pk zXv%7YEpd4d5ubDqMVujc>)h5J>qvFn-dc4qzLwO;v4OF4uHK zDiy5+ZXrpN_sZ@=#Xj{d&k>z5AX5;YnD;7bECtO;8eHUgNwAw_bgd#HLExkQ@!Xj+ zXB>X7_a+mwQjkhu24U}4pZZo9%HcI2rhoVL=_y*H6IEB8WWWn~`V z-Tpy)d;4g+$ZY~Y$B;^am0~yN4W?9AbqDCW6kH$2X1iauedJGMVA;$qJ+`S27!^;a zLFHfD)9b&=?EzjY{WpaYdh*?c4qo{24Fn`I6~AH7lb74K>t{82$^4}<13f@#JcasV z&KF6MZz%O8J%h>nRCsynRJse|UsOmac2ZauAatVf3o!C+e}8AsYqKqV^h0Z_b|Kt1 z@O_l9{PWVHU!u&4Ymd6Dd|G#zCMOdsSK06%Q^1oACnNf8o85N^@B&=+bs3j^T{fWdc+A|x(cEZ$IG!5wbnEk_ zzpY`zq1m!&pEnc#(LQ5#p(i)~!vyvkhHU0Pfl~n8(?8u^c&_xWf^(r)p||8Ly(MS& zk3BghbW*$AKFu`sF)m((MDVTj>G)q)J0s$u#}x4D?$7k|?)Yu_xT{0E#ii6gwD`J+ zoMU#ODHE@txF{F*m*+X}3AOBn4m;z^3mIFQ4{*u#;fR@m_fLG4-4jffF?;5ih@6Mz lPrm;rMhY0g2u5&e@jt$gS?$`E2( Date: Fri, 22 Oct 2021 10:00:04 +1300 Subject: [PATCH 059/114] Update and rename icon.js to app-icon.js --- apps/speedclock/app-icon.js | 1 + apps/speedclock/icon.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 apps/speedclock/app-icon.js delete mode 100644 apps/speedclock/icon.js diff --git a/apps/speedclock/app-icon.js b/apps/speedclock/app-icon.js new file mode 100644 index 000000000..f4f24a18b --- /dev/null +++ b/apps/speedclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+AH4A/AE+sFtoABF12swItsF9QuFR4IwmFwwvnFw4vCGEYuIF4JgjFxIvkFxQvCGBfOAAQvqFwYwRFxYvDGBIvUFxgv/F6IuNF4n+0nB4TvXFxwvF4XBAALlPF7ZfBGC4uPF4rABGAYAGTQwvad4YwKFzYvIGBQvfFwgAE3Qvt4IvEFzgvCLxO7Lx7vULzIzTFwIvgGZheFRAiNRGSQvpGYouesYAGmQAKq3CE4PIC4wviq2eFwPCroveCRSGEC6Qv0DAwRLcoouWC4VdVYQXkr1eAgVdAoIABroNEB4gHHC5QvHwQSDAAOCA74vH1uICQIABxGtA74vIAEwv/F/4vXAH4A/AHY")) diff --git a/apps/speedclock/icon.js b/apps/speedclock/icon.js deleted file mode 100644 index 41a59f503..000000000 --- a/apps/speedclock/icon.js +++ /dev/null @@ -1 +0,0 @@ -require("heatshrink").decompress(atob("mEwwkEogA/AFGIAAQVVDKQWHDB1IC5OECx8z///mYYOBoWDCoIADnBJLFwQWGDAgwIEYU/CQXwh4EC+YwKBIOPFQYXE//4C5BGCIQgXF/5IILo4XGMIQXHLoYXIMIRGMC45IHC4KkGC45IBC4yNEC5KRBC7h2HC5B4GC5EggQXOBwvygEAl6QHC4sikRGEhGAJAgNBC75HIgZHNO48AgIJER54xCiYXKa5AxCGAjvPGA4XIwYXHbQs4C46QGGAbZDB4IXEPBQAEOwwXDJBJGEC4xILIxQwDSJCNDFwwXDMIh0ELoQXIJARhDC4hdCIw4wEDAQXDCwQuIGAgABmYXBmYHDFxIYGAAoWLJIgAGCxgYJCxwZGCqIA/AC4A=")) From 0e396563e81ef01ea1e762a9b523c818798d7286 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 10:59:37 +1300 Subject: [PATCH 060/114] Update app.js --- apps/speedalt2/app.js | 123 ++++++++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 53 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 4fbe458db..8203988f4 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '1.02'; +var v = '1.03'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -407,12 +407,14 @@ function onGPS(fix) { if ( sp < 10 ) sp = sp.toFixed(1); else sp = Math.round(sp); - if (parseFloat(sp) > parseFloat(max.spd) && max.n > 15 ) max.spd = parseFloat(sp); + + if (parseFloat(sp) > parseFloat(max.spd) && max.n > 15 ) max.spd = sp; // Altitude al = lf.alt; al = Math.round(parseFloat(al)/parseFloat(cfg.alt)); - if (parseFloat(al) > parseFloat(max.alt) && max.n > 15 ) max.alt = parseFloat(al); + + if (parseFloat(al) > parseFloat(max.alt) && max.n > 15 ) max.alt = al; // Distance to waypoint di = distance(lf,wp); @@ -538,6 +540,39 @@ function nextFunc(dur) { onGPS(lf); } + +function updateClock() { + if (!canDraw) return; + if ( cfg.modeA != 4 ) return; + drawClock(); + if ( emulator ) {max.spd++;max.alt++;} +} + +function startDraw(){ + canDraw=true; + g.clear(); + Bangle.drawWidgets(); + setLpMode('SuperE'); // off + onGPS(lf); // draw app screen +} + +function stopDraw() { + canDraw=false; + if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO');}, 10000); //Drop to low power in 10 secs. Keep lp mode off until we have a first fix. +} + +function savSettings() { + require("Storage").write('speedalt2.json',cfg); +} + +function setLpMode(m) { + if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power + if ( !gpssetup ) return; + gpssetup.setPowerMode({power_mode:m}); +} + +// == Events + function setButtons(){ // BTN1 - Max speed/alt or next waypoint @@ -579,37 +614,42 @@ function setButtons(){ } -function updateClock() { - if (!canDraw) return; - if ( cfg.modeA != 4 ) return; - drawClock(); - if ( emulator ) {max.spd++;max.alt++;} -} +Bangle.on('lcdPower',function(on) { + if (!SCREENACCESS.withApp) return; + if (on) startDraw(); + else stopDraw(); +}); -function startDraw(){ - canDraw=true; - g.clear(); - Bangle.drawWidgets(); - setLpMode('SuperE'); // off - onGPS(lf); // draw app screen -} +Bangle.on('swipe',function(dir) { + if(dir == 1) { +console.log('RIGHT'); + prevScrn(); + } + else { +console.log('LEFT'); + nextScrn(); + } +}); -function stopDraw() { - canDraw=false; - if (!tmrLP) tmrLP=setInterval(function () {if (lf.fix) setLpMode('PSMOO');}, 10000); //Drop to low power in 10 secs. Keep lp mode off until we have a first fix. -} +Bangle.on('touch', function(button){ + switch(button){ + case 1: // BTN4 +console.log('BTN4'); + prevScrn(); + break; + case 2: // BTN5 +console.log('BTN5'); + nextScrn(); + break; + case 3: +console.log('MDL'); + nextFunc(0); // Centre - same function as short BTN1 + break; + } + }); -function savSettings() { - require("Storage").write('speedalt2.json',cfg); -} -function setLpMode(m) { - if (tmrLP) {clearInterval(tmrLP);tmrLP = false;} // Stop any scheduled drop to low power - if ( !gpssetup ) return; - gpssetup.setPowerMode({power_mode:m}); -} - -// =Main Prog +// == Main Prog // Read settings. let cfg = require('Storage').readJSON('speedalt2.json',1)||{}; @@ -657,29 +697,6 @@ var SCREENACCESS = { release:function(){this.withApp=true;startDraw();} }; -Bangle.on('lcdPower',function(on) { - if (!SCREENACCESS.withApp) return; - if (on) startDraw(); - else stopDraw(); -}); - -Bangle.on('swipe',function(dir) { - if(dir == 1) prevScrn(); - else nextScrn(); -}); - -/* -dir : "left/right/top/bottom/front/back", - double : true/false // was this a double-tap? - x : -2 .. 2, // the axis of the tap - y : -2 .. 2, // the axis of the tap - z : -2 .. 2 // the axis of the tap -Bangle.on('tap',function(tap) { - console.log('Tap : '+tap.dir); - if ( tap.dir == 'front' && tap.double ) nextFunc(1); // Same as short BTN1 -}); -*/ - var gpssetup; try { gpssetup = require("gpssetup"); From 0d79ca3f0cd9f584b97f9ea6d1af2dd69a92e324 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 11:00:31 +1300 Subject: [PATCH 061/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 07bf11c6d..70b7d3086 100644 --- a/apps.json +++ b/apps.json @@ -2901,7 +2901,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"1.02", + "version":"1.03", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From e797480d166bbc6bcd890430e3656ed1b3a11e2a Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 11:14:38 +1300 Subject: [PATCH 062/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 70b7d3086..1ec109fbc 100644 --- a/apps.json +++ b/apps.json @@ -2901,7 +2901,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"1.03", + "version":"1.04", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 4088f7ec768bc86f440e3f9564420f4bc43649c0 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 11:16:13 +1300 Subject: [PATCH 063/114] Update app.js --- apps/speedalt2/app.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 8203988f4..6bd967b1b 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '1.03'; +var v = '1.04'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -621,17 +621,13 @@ Bangle.on('lcdPower',function(on) { }); Bangle.on('swipe',function(dir) { - if(dir == 1) { -console.log('RIGHT'); - prevScrn(); - } - else { -console.log('LEFT'); - nextScrn(); - } + if(dir == 1) prevScrn(); + else nextScrn(); }); Bangle.on('touch', function(button){ + nextFunc(0); // Same function as short BTN1 +/* switch(button){ case 1: // BTN4 console.log('BTN4'); @@ -646,9 +642,11 @@ console.log('MDL'); nextFunc(0); // Centre - same function as short BTN1 break; } +*/ }); + // == Main Prog // Read settings. From 70202e32ea27cc5b1745ac933c91c8fcd4735f99 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 14:46:37 +1300 Subject: [PATCH 064/114] Update app.js --- apps/speedclock/app.js | 371 ++++++++++++++--------------------------- 1 file changed, 128 insertions(+), 243 deletions(-) diff --git a/apps/speedclock/app.js b/apps/speedclock/app.js index 4c74ce1be..ed4e2b47e 100644 --- a/apps/speedclock/app.js +++ b/apps/speedclock/app.js @@ -1,19 +1,9 @@ -// Morphing Clock + -// Modifies original Morphing Clock to make seconds and date more readable, and adds a simple stopwatch -// Icon by https://icons8.com -var is12Hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]; -var locale = require("locale"); -var CHARW = 28; // how tall are digits? -var CHARP = 2; // how chunky are digits? -var Y = 50; // start height -// Offscreen buffer -var buf = Graphics.createArrayBuffer(CHARW+CHARP*2,CHARW*2 + CHARP*2,1,{msb:true}); -var bufimg = {width:buf.getWidth(),height:buf.getHeight(),buffer:buf.buffer}; -// The last time that we displayed -var lastTime = "-----"; -// If animating, this is the interval's id -var animInterval; -var timeInterval; + +var v='0.01'; + +// timeout used to update every minute +var drawTimeout; +var x,y,w,h; // Variables for the stopwatch var counter = -1; // Counts seconds var oldDate = new Date(2020,0,1); // Initialize to a past date @@ -22,206 +12,25 @@ var B3 = 0; // Flag to track BTN3's current function var w1; // watch id for BTN1 var w3; // watch id for BTN3 -/* Get array of lines from digit d to d+1. - n is the amount (0..1) - maxFive is true is this digit only counts 0..5 */ -const DIGITS = { - " ":n=>[], - "0":n=>[ - [n,0,1,0], - [1,0,1,1], - [1,1,1,2], - [n,2,1,2], - [n,1,n,2], - [n,0,n,1]], - "1":n=>[ - [1-n,0,1,0], - [1,0,1,1], - [1-n,1,1,1], - [1-n,1,1-n,2], - [1-n,2,1,2]], - "2":n=>[ - [0,0,1,0], - [1,0,1,1], - [0,1,1,1], - [0,1+n,0,2], - [1,2-n,1,2], - [0,2,1,2]], - "3":n=>[ - [0,0,1-n,0], - [0,0,0,n], - [1,0,1,1], - [0,1,1,1], - [1,1,1,2], - [n,2,1,2]], - "4":n=>[ - [0,0,0,1], - [1,0,1-n,0], - [1,0,1,1-n], - [0,1,1,1], - [1,1,1,2], - [1-n,2,1,2]], - "5to0": n=>[ // 5 -> 0 - [0,0,0,1], - [0,0,1,0], - [n,1,1,1], - [1,1,1,2], - [0,2,1,2], - [0,2,0,2], - [1,1-n,1,1], - [0,1,0,1+n]], - "5to6": n=>[ // 5 -> 6 - [0,0,0,1], - [0,0,1,0], - [0,1,1,1], - [1,1,1,2], - [0,2,1,2], - [0,2-n,0,2]], - "6":n=>[ - [0,0,0,1-n], - [0,0,1,0], - [n,1,1,1], - [1,1-n,1,1], - [1,1,1,2], - [n,2,1,2], - [0,1-n,0,2-2*n]], - "7":n=>[ - [0,0,0,n], - [0,0,1,0], - [1,0,1,1], - [1-n,1,1,1], - [1,1,1,2], - [1-n,2,1,2], - [1-n,1,1-n,2]], - "8":n=>[ - [0,0,0,1], - [0,0,1,0], - [1,0,1,1], - [0,1,1,1], - [1,1,1,2], - [0,2,1,2], - [0,1,0,2-n]], - "9":n=>[ - [0,0,0,1], - [0,0,1,0], - [1,0,1,1], - [0,1,1-n,1], - [0,1,0,1+n], - [1,1,1,2], - [0,2,1,2]], - ":":n=>[ - [0.4,0.4,0.6,0.4], - [0.6,0.4,0.6,0.6], - [0.6,0.6,0.4,0.6], - [0.4,0.4,0.4,0.6], - [0.4,1.4,0.6,1.4], - [0.6,1.4,0.6,1.6], - [0.6,1.6,0.4,1.6], - [0.4,1.4,0.4,1.6]] -}; - -/* Draw a transition between lastText and thisText. - 'n' is the amount - 0..1 */ -function drawDigits(lastText,thisText,n) { - "ram" - const p = CHARP; // padding around digits - const s = CHARW; // character size - var x = 16; // x offset - g.reset(); - for (var i=0;i{ - if (c[0]!=c[2]) // horiz - buf.fillRect(p+c[0]*s,c[1]*s,p+c[2]*s,2*p+c[3]*s); - else if (c[1]!=c[3]) // vert - buf.fillRect(c[0]*s,p+c[1]*s,2*p+c[2]*s,p+c[3]*s); - }); - g.drawImage(bufimg,x,Y); - } - if (thisCh==":") x-=4; - x+=s+p+7; - } -} -function drawDate() { - var x = (CHARW + CHARP + 8)*5; - var y = Y + 2*CHARW + CHARP; - var d = new Date(); - // meridian - g.reset(); - g.setFont("6x8",2); - g.setFontAlign(-1,-1); - if (is12Hour) g.drawString((d.getHours() < 12) ? "AM" : "PM", x+8, Y+0, true); - // date - g.setFont("Vector16"); - g.setFontAlign(0,-1); - // Only draw the date if it has changed: - if ((d.getDate()!=oldDate.getDate())||(d.getMonth()!=oldDate.getMonth())||(d.getFullYear()!=oldDate.getFullYear())) { - var date = locale.date(d,false); - g.clearRect(1,y+8,g.getWidth(),y+24); - g.drawString(date, g.getWidth()/2, y+8, true); - oldDate = d; - } +// schedule a draw for the next minute +function queueDraw() { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); } -function drawSeconds() { - var x = (CHARW + CHARP + 8)*5; - var y = Y + 2*CHARW + CHARP; - var d = new Date(); - // seconds - g.reset(); - g.setFont("6x8",2); - g.setFontAlign(-1,-1); - g.drawString(("0"+d.getSeconds()).substr(-2), x+8, y-12, true); -} +function stopWatch(clear) { -/* Show the current time, and animate if needed */ -function showTime() { - if (animInterval) return; // in animation - quit - var d = new Date(); - var hours = d.getHours(); - if (is12Hour) hours = ((hours + 11) % 12) + 1; - var t = (" "+hours).substr(-2)+":"+ - ("0"+d.getMinutes()).substr(-2); - var l = lastTime; - // same - don't animate - if (t==l || l=="-----") { - drawDigits(l,t,0); - drawDate(); - drawSeconds(); - lastTime = t; - return; - } - var n = 0; - animInterval = setInterval(function() { - n += 1/10; - if (n>=1) { - n=1; - clearInterval(animInterval); - animInterval = undefined; - } - drawDigits(l,t,n); - drawSeconds(); - }, 20); - lastTime = t; -} - -function stopWatch() { + x = 240; + y = 200; + w = 110; + h = 24; + g.clearRect(x-w,y-h,x,y); // clear the background + if (clear) return; + counter++; var hrs = Math.floor(counter/3600); @@ -240,21 +49,22 @@ function stopWatch() { BTN3, {repeat:false,edge:"falling"}); B3 = 0; // BTN3 is bound to stop the stopwatch } - + // Bind BTN1 to call the reset function: if (!w1) w1 = setWatch(resetStopWatch, BTN1, {repeat:false,edge:"falling"}); // Draw elapsed time: + g.reset(); - g.setColor(0.0,0.5,1.0).setFontAlign(0,-1).setFont("Vector24"); - g.clearRect(1,180,g.getWidth(),210); - if (hrs>0) { - g.drawString(("0"+parseInt(hrs)).substr(-2), g.getWidth()/2 - 72, 180, true); - g.drawString( ":", g.getWidth()/2 - 48, 180, true); - } - g.drawString(("0"+parseInt(mins)).substr(-2), g.getWidth()/2 - 24, 180, true); - g.drawString( ":", g.getWidth()/2, 180, true); - g.drawString(("0"+parseInt(secs)).substr(-2), g.getWidth()/2 + 24, 180, true); + g.setColor(0.0,0.5,1.0); + g.setFontAlign(1,1); + g.setFont("Vector24"); + + var swStr = ("0"+parseInt(mins)).substr(-2) + ':' + ("0"+parseInt(secs)).substr(-2); + + if (hrs>0) swStr = ("0"+parseInt(hrs)).substr(-2) + ':' + swStr; + + g.drawString(swStr, x, y, true); } @@ -267,7 +77,8 @@ function resetStopWatch() { } // Clear the stopwatch: - g.clearRect(1,180,g.getWidth(),210); + stopWatch(true); +// g.clearRect(1,180,g.getWidth(),210); // Reset the counter: counter = -1; @@ -286,33 +97,107 @@ function resetStopWatch() { } -Bangle.on('lcdPower',function(on) { - if (animInterval) { - clearInterval(animInterval); - animInterval = undefined; +function drawDate() { + // draw date + x = 0; + y = 200; + w = 70; + h = 10; + + var date = new Date(); + var dateStr = require("locale").date(date); + g.reset(); + + g.clearRect(x,y-h,x+w,y); // clear the background + + g.setFontAlign(-1,1).setFont("6x8"); + g.drawString(dateStr,x,y); + +} + + +function drawTime() { + x = 120; + y = 107; + w = 120; + h = 134; + + var date = new Date(); + var timeStr = require("locale").time(date,1); + g.reset(); + + g.clearRect(x-(w/2),y-(h/2),x+(w/2),y+(h/2)); // clear the background + + g.setFontAlign(0,0); + g.setFontVector(85); +// g.setColor(0.5,0.5,0.5); + g.drawString(timeStr.substring(0,2),x,y-30); + g.drawString(timeStr.substring(3,5),x,y+38); +// g.drawString(timeStr,x,y); +} + +function resetStopWatch() { + + // Stop the interval if necessary: + if (swInterval) { + clearInterval(swInterval); + swInterval=undefined; } - if (timeInterval) { - clearInterval(timeInterval); - timeInterval = undefined; + + // Clear the stopwatch: + stopWatch(true); + + // Reset the counter: + counter = -1; + + // Set BTN3 to start the stopwatch again: + if (!B3) { + // In case the stopwatch is reset while still running, the watch on BTN3 is still active, so we need to reset it manually: + if (w3) {clearWatch(w3);w3=undefined;} + // Set BTN3 to start the watch again: + setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); + B3 = 1; // BTN3 is bound to start the stopwatch } + + // Reset watch on BTN1: + if (w1) {clearWatch(w1);w1=undefined;} +} + +function draw() { + x = g.getWidth()/2; + y = g.getHeight()/2; + g.reset(); + + + drawTime(); + drawDate(); + + // queue draw in one minute + queueDraw(); +} + +// Clear the screen once, at startup +g.clear(); + +// draw immediately at first, queue update +draw(); + +// Stop updates when LCD is off, restart when on +Bangle.on('lcdPower',on=>{ if (on) { - showTime(); - timeInterval = setInterval(showTime, 1000); - } else { - lastTime = "-----"; + draw(); // draw immediately, queue redraw + } else { // stop draw timer + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; } }); - -g.clear(); -Bangle.loadWidgets(); -Bangle.drawWidgets(); -// Update time once a second -timeInterval = setInterval(showTime, 1000); -showTime(); - -// Show launcher when button pressed +// Show launcher when middle button pressed Bangle.setUI("clock"); // Start stopwatch when BTN3 is pressed setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); B3 = 1; // BTN3 is bound to start the stopwatch + +// Load widgets +Bangle.loadWidgets(); +Bangle.drawWidgets(); From 49600be430a30f1ee5e9bff06d4c765944743cbf Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 16:01:48 +1300 Subject: [PATCH 065/114] Update app.js --- apps/speedclock/app.js | 84 +++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 50 deletions(-) diff --git a/apps/speedclock/app.js b/apps/speedclock/app.js index ed4e2b47e..28e9494f4 100644 --- a/apps/speedclock/app.js +++ b/apps/speedclock/app.js @@ -1,9 +1,15 @@ +/* +Simple watch [speedwatch] +Mike Bennett mike[at]kereru.com +0.01 : Initial +*/ var v='0.01'; // timeout used to update every minute var drawTimeout; var x,y,w,h; + // Variables for the stopwatch var counter = -1; // Counts seconds var oldDate = new Date(2020,0,1); // Initialize to a past date @@ -12,6 +18,11 @@ var B3 = 0; // Flag to track BTN3's current function var w1; // watch id for BTN1 var w3; // watch id for BTN3 +// Colours +var colTime = 0x4FE0; +var colDate = 0xEFE0; +var colSW = 0x1DFD; + // schedule a draw for the next minute function queueDraw() { if (drawTimeout) clearTimeout(drawTimeout); @@ -23,12 +34,14 @@ function queueDraw() { function stopWatch(clear) { - x = 240; + x = 120; y = 200; - w = 110; - h = 24; + w = 240; + h = 25; - g.clearRect(x-w,y-h,x,y); // clear the background + g.reset(); + g.setColor(colSW); + g.clearRect(x-(w/2),y-h,x+(w/2),y); // clear the background if (clear) return; counter++; @@ -54,10 +67,7 @@ function stopWatch(clear) { if (!w1) w1 = setWatch(resetStopWatch, BTN1, {repeat:false,edge:"falling"}); // Draw elapsed time: - - g.reset(); - g.setColor(0.0,0.5,1.0); - g.setFontAlign(1,1); + g.setFontAlign(0,1); g.setFont("Vector24"); var swStr = ("0"+parseInt(mins)).substr(-2) + ':' + ("0"+parseInt(secs)).substr(-2); @@ -78,7 +88,9 @@ function resetStopWatch() { // Clear the stopwatch: stopWatch(true); -// g.clearRect(1,180,g.getWidth(),210); + + // Restore the date + drawDate(); // Reset the counter: counter = -1; @@ -99,18 +111,20 @@ function resetStopWatch() { function drawDate() { // draw date - x = 0; + x = 120; y = 200; - w = 70; - h = 10; + w = 240; + h = 25; - var date = new Date(); - var dateStr = require("locale").date(date); g.reset(); - - g.clearRect(x,y-h,x+w,y); // clear the background + g.setColor(colDate); + g.clearRect(x-(w/2),y-h,x+(w/2),y); // clear the background - g.setFontAlign(-1,1).setFont("6x8"); + var date = new Date(); +// var dateStr = require("locale").date(date,1); + var dateStr = date.getDate() + ' ' +require("locale").month(date,1); + g.setFontAlign(0,1); + g.setFont("Vector24"); g.drawString(dateStr,x,y); } @@ -125,42 +139,12 @@ function drawTime() { var date = new Date(); var timeStr = require("locale").time(date,1); g.reset(); - g.clearRect(x-(w/2),y-(h/2),x+(w/2),y+(h/2)); // clear the background - g.setFontAlign(0,0); g.setFontVector(85); -// g.setColor(0.5,0.5,0.5); + g.setColor(colTime); g.drawString(timeStr.substring(0,2),x,y-30); g.drawString(timeStr.substring(3,5),x,y+38); -// g.drawString(timeStr,x,y); -} - -function resetStopWatch() { - - // Stop the interval if necessary: - if (swInterval) { - clearInterval(swInterval); - swInterval=undefined; - } - - // Clear the stopwatch: - stopWatch(true); - - // Reset the counter: - counter = -1; - - // Set BTN3 to start the stopwatch again: - if (!B3) { - // In case the stopwatch is reset while still running, the watch on BTN3 is still active, so we need to reset it manually: - if (w3) {clearWatch(w3);w3=undefined;} - // Set BTN3 to start the watch again: - setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); - B3 = 1; // BTN3 is bound to start the stopwatch - } - - // Reset watch on BTN1: - if (w1) {clearWatch(w1);w1=undefined;} } function draw() { @@ -168,9 +152,8 @@ function draw() { y = g.getHeight()/2; g.reset(); - drawTime(); - drawDate(); + if ( counter < 0 ) drawDate(); // Only draw date when SW is not running. // queue draw in one minute queueDraw(); @@ -191,6 +174,7 @@ Bangle.on('lcdPower',on=>{ drawTimeout = undefined; } }); + // Show launcher when middle button pressed Bangle.setUI("clock"); From 314d0cf3b0dc700852f970f71e1a69d75175e0ee Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 16:20:51 +1300 Subject: [PATCH 066/114] Update app-icon.js --- apps/speedclock/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedclock/app-icon.js b/apps/speedclock/app-icon.js index f4f24a18b..22e264124 100644 --- a/apps/speedclock/app-icon.js +++ b/apps/speedclock/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("mEwxH+AH4A/AE+sFtoABF12swItsF9QuFR4IwmFwwvnFw4vCGEYuIF4JgjFxIvkFxQvCGBfOAAQvqFwYwRFxYvDGBIvUFxgv/F6IuNF4n+0nB4TvXFxwvF4XBAALlPF7ZfBGC4uPF4rABGAYAGTQwvad4YwKFzYvIGBQvfFwgAE3Qvt4IvEFzgvCLxO7Lx7vULzIzTFwIvgGZheFRAiNRGSQvpGYouesYAGmQAKq3CE4PIC4wviq2eFwPCroveCRSGEC6Qv0DAwRLcoouWC4VdVYQXkr1eAgVdAoIABroNEB4gHHC5QvHwQSDAAOCA74vH1uICQIABxGtA74vIAEwv/F/4vXAH4A/AHY")) +require("heatshrink").decompress(atob("oFAwhC/ABOIABgfymYAKD+Z/9hGDL5c4wAf/XzjASTxqgQhAfPMB2IPxiACIBo+BDxqACIBg+CLxpANHwQPBABgvCIBT8CJ5owDD5iPOOAQfLBojiDCYQGFGIQfICIQfdBYJNMOI6SHD8jeNOIYzID8hfRD9LfEAoTdFBIifLAAIffBoQRBAJpxMD84JCD+S/GL56fID8ALBb6ZhID8qtJCZ4fgT4YDBABq/PD7RNEL6IRKD8WID5pfCD5kzNhKSFmYfMBwSeOGBoPDABgvCJ5wAON5pADABivPIAIAOd5xABABweOD4J+OD58IQBj8LD/6gUDyAfhXzgfiP/wA2")) From eeab8a5397102cfe02b5eeaa4e0cafd8679cab9f Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 16:21:27 +1300 Subject: [PATCH 067/114] Add files via upload --- apps/speedclock/watch.png | Bin 0 -> 1439 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/speedclock/watch.png diff --git a/apps/speedclock/watch.png b/apps/speedclock/watch.png new file mode 100644 index 0000000000000000000000000000000000000000..b77f302d5291d39650ffd4c5400d0a7dd3e30d70 GIT binary patch literal 1439 zcmV;Q1z`G#P)ZZKIyp>XUbK#j8aEHE7Ds0zs-Qe=?maLsuD zcwH7zo-85*pPUNHrrgZ`eM~B!Lz#R329Fd4q?A-M035B_i!(14%b?7NZzmsOB(?~JQq2Hvi}HypfQSL?Z2&l2ULZ_o zg+qaL8-!-vwitv1pv#|LDDtV;SL79?vqWW)7sdH`07Fnl8VCo#kpJO8fxNdW6EFY= z%l80)kp{wij?s8|GN7v7I{+#~JK_+3YT9bUtq*JBP6-?m=93VkXj=a=!t=$vcL13+R`L*M8e?$7=E zR0)1v31I3q9xl!|L4C>F+7N)>qhMlw8GU1O(1^eoyEN2R*(Kxs+`J3Kj`vPq)QCE- zj?bf|t_%lC^U>N6z^B7A;9ZtGng#qG{kDPV0<@Hi&I15rG}Knv#TdJ!r3eGjg-w0p zg{1;ccK=qJf^vcwJDGmXkbS!Iq41PxAR--ATaG=p?_-RHh`K^Ou};y{GYvo}92?X? zr!86Bc=B7>3{MHuSSUbuzV5jKR2Td3_5FWrk!E_r+jU<$(v)Pne`qUl&K@eoD;0&p z9m^6-_YbA)2Uz8<+c5Se?d(qF_5@{+$jV(_$WWfG09?B_kLqHdsI46d^8he52%0NtVRREr&>#+Z@)vNV}NW(Tno5*=D%GKUkmWOTLadkx!v}5ucsrMYk}ePKP={9tMkm8@Yd~E zwU<=~WQN=|V{8idvY={d+dx^FjR^heGZAfZwtTQ-FP;P>i> zqQ`ruFS;6p_0yq^eQ*j#0Z1fM0Dz|25~vCT5p}v2gmveMs8dxKnrcfn^@$f;9X8em z0l(+}^TEl5W%T_rhc$9{B2XE_J9VXascesaLVPEVcp?da-HLPskJ;tnQh=tdyaix1 zo=D=epW}G4qM@cFAMe(e2}_X&ey@s_`m(3a-_@Nbuqa47%frPj+0d2Qa;zn@ULXO; zsS= z_SOj-_-5iEZci_Q7%mLASA8tPC0;4Ylzsphk1xTEiI4#NI=5sP?-%704#3T}eLn*1 zkH;$-rXR10(ph5W(JCG-YXBiO+)??HD4+ORfH4B-O8~eRw>~}-#rWU44N`DbMrDee z?**9BuTbjzNNf=!u|*k_c8m(kACUFg91#ok#GJj1J4B>CsO%U8Y%ExE?W-|Kg;}{h tLD__^eKjTtG8N$3{-Nx%fgE--{sVHTSvKO1ec%89002ovPDHLkV1gjPojw2n literal 0 HcmV?d00001 From 642efb242e8a52c9f7a34aa61ac3de8982dad444 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 16:22:17 +1300 Subject: [PATCH 068/114] Delete app.png --- apps/speedclock/app.png | Bin 1639 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 apps/speedclock/app.png diff --git a/apps/speedclock/app.png b/apps/speedclock/app.png deleted file mode 100644 index 93d8e57dcbfaf905321fffcf06df042aa49d7dc8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1639 zcmV-t2AKJYP)@pC8}P=li+m^Env72)@5?yIePa+S>ZbmYsjOa=2m` z!{OB3)^@Gi>3mz!4w$0Hsk)+sbUjipG!&a5|mi z0)`wD_))?j-{$=p(Hmdb{pQ4>#*6Vi6tc_Zs;~=3feFd%R;{|DPtl#K#zRAi7Y`X1 z;B-32+0egXk^BI1gjay&Ter42GL0Dz85MB$^yxyo$U$Iys+>m`&vy%a=qU``n@P+> zNP8DjRdIK?-TImuq^&ql&*I#FWmi3gE><5sB1FaOuOpr#vV?n<_ z(dFmE1qqjs%jGHp7J&{q>2Qby*D7qRpED;gC=2aCEBXiDExut%@3&{)$jNhX)r2YG z^dnNg&zDjGMkx7$Y$pHGo;N24gYr|qS+FpfUBG`~4S=I0`nS$#h_+3*gamysqb!pk zXv%7YEpd4d5ubDqMVujc>)h5J>qvFn-dc4qzLwO;v4OF4uHK zDiy5+ZXrpN_sZ@=#Xj{d&k>z5AX5;YnD;7bECtO;8eHUgNwAw_bgd#HLExkQ@!Xj+ zXB>X7_a+mwQjkhu24U}4pZZo9%HcI2rhoVL=_y*H6IEB8WWWn~`V z-Tpy)d;4g+$ZY~Y$B;^am0~yN4W?9AbqDCW6kH$2X1iauedJGMVA;$qJ+`S27!^;a zLFHfD)9b&=?EzjY{WpaYdh*?c4qo{24Fn`I6~AH7lb74K>t{82$^4}<13f@#JcasV z&KF6MZz%O8J%h>nRCsynRJse|UsOmac2ZauAatVf3o!C+e}8AsYqKqV^h0Z_b|Kt1 z@O_l9{PWVHU!u&4Ymd6Dd|G#zCMOdsSK06%Q^1oACnNf8o85N^@B&=+bs3j^T{fWdc+A|x(cEZ$IG!5wbnEk_ zzpY`zq1m!&pEnc#(LQ5#p(i)~!vyvkhHU0Pfl~n8(?8u^c&_xWf^(r)p||8Ly(MS& zk3BghbW*$AKFu`sF)m((MDVTj>G)q)J0s$u#}x4D?$7k|?)Yu_xT{0E#ii6gwD`J+ zoMU#ODHE@txF{F*m*+X}3AOBn4m;z^3mIFQ4{*u#;fR@m_fLG4-4jffF?;5ih@6Mz lPrm;rMhY0g2u5&e@jt$gS?$`E2( Date: Fri, 22 Oct 2021 16:28:38 +1300 Subject: [PATCH 069/114] Update apps.json --- apps.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps.json b/apps.json index 1ec109fbc..062e363ba 100644 --- a/apps.json +++ b/apps.json @@ -2916,6 +2916,25 @@ {"name":"speedalt2.json"} ] }, +{ "id": "speedclock", + "name": "SloMo Clock", + "shortName":"SloMo Clock", + "icon": "watch.png", + "version":"0.01", + "description": "Simple clock face with large digits hour above minutes.", + "tags": "clock", + "type":"clock", + "allow_emulator":true, + "readme": "README.md", + "storage": [ + {"name":"speedclock.app.js","url":"app.js"}, + {"name":"speedclock.img","url":"app-icon.js","evaluate":true}, + {"name":"speedclock.settings.js","url":"settings.js"} + ], + "data": [ + {"name":"speedclock.json"} + ] +}, { "id": "de-stress", "name": "De-Stress", "shortName":"De-Stress", From 18d0e7e161fbc0dd85964fed10f47e1f89ab6d46 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 16:32:16 +1300 Subject: [PATCH 070/114] Update apps.json --- apps.json | 1 - 1 file changed, 1 deletion(-) diff --git a/apps.json b/apps.json index 062e363ba..f848201af 100644 --- a/apps.json +++ b/apps.json @@ -2929,7 +2929,6 @@ "storage": [ {"name":"speedclock.app.js","url":"app.js"}, {"name":"speedclock.img","url":"app-icon.js","evaluate":true}, - {"name":"speedclock.settings.js","url":"settings.js"} ], "data": [ {"name":"speedclock.json"} From e262d1bfdb2f38a7971ed6872a19555dfe048d56 Mon Sep 17 00:00:00 2001 From: nujw Date: Fri, 22 Oct 2021 16:34:33 +1300 Subject: [PATCH 071/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index f848201af..781a36434 100644 --- a/apps.json +++ b/apps.json @@ -2928,7 +2928,7 @@ "readme": "README.md", "storage": [ {"name":"speedclock.app.js","url":"app.js"}, - {"name":"speedclock.img","url":"app-icon.js","evaluate":true}, + {"name":"speedclock.img","url":"app-icon.js","evaluate":true} ], "data": [ {"name":"speedclock.json"} From 383f07606d2a3592229bf6d645492db4bb2227b8 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:15:45 +1300 Subject: [PATCH 072/114] Update apps.json --- apps.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps.json b/apps.json index 781a36434..e5577b0ce 100644 --- a/apps.json +++ b/apps.json @@ -2916,22 +2916,22 @@ {"name":"speedalt2.json"} ] }, -{ "id": "speedclock", +{ "id": "slomoclock", "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", "version":"0.01", - "description": "Simple clock face with large digits hour above minutes.", + "description": "Simple 24h clock face with large digits hours above minutes.", "tags": "clock", "type":"clock", "allow_emulator":true, "readme": "README.md", "storage": [ - {"name":"speedclock.app.js","url":"app.js"}, - {"name":"speedclock.img","url":"app-icon.js","evaluate":true} + {"name":"slomoclock.app.js","url":"app.js"}, + {"name":"slomoclock.img","url":"app-icon.js","evaluate":true} ], "data": [ - {"name":"speedclock.json"} + {"name":"slomoclock.json"} ] }, { "id": "de-stress", From d3519e4290c2893f06f5a9d736ed4d93f1099776 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:23:41 +1300 Subject: [PATCH 073/114] Update apps.json --- apps.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps.json b/apps.json index e5577b0ce..781a36434 100644 --- a/apps.json +++ b/apps.json @@ -2916,22 +2916,22 @@ {"name":"speedalt2.json"} ] }, -{ "id": "slomoclock", +{ "id": "speedclock", "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", "version":"0.01", - "description": "Simple 24h clock face with large digits hours above minutes.", + "description": "Simple clock face with large digits hour above minutes.", "tags": "clock", "type":"clock", "allow_emulator":true, "readme": "README.md", "storage": [ - {"name":"slomoclock.app.js","url":"app.js"}, - {"name":"slomoclock.img","url":"app-icon.js","evaluate":true} + {"name":"speedclock.app.js","url":"app.js"}, + {"name":"speedclock.img","url":"app-icon.js","evaluate":true} ], "data": [ - {"name":"slomoclock.json"} + {"name":"speedclock.json"} ] }, { "id": "de-stress", From 5e2a740f850605031ee2e033901a52c86af2cc7b Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:27:58 +1300 Subject: [PATCH 074/114] Create ChangeLog --- apps/slomoclock/ChangeLog | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/slomoclock/ChangeLog diff --git a/apps/slomoclock/ChangeLog b/apps/slomoclock/ChangeLog new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/slomoclock/ChangeLog @@ -0,0 +1 @@ + From 8671ff9ae80944efc06bcff2c86d74c6ccf5da77 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:29:33 +1300 Subject: [PATCH 075/114] Update ChangeLog --- apps/slomoclock/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/slomoclock/ChangeLog b/apps/slomoclock/ChangeLog index 8b1378917..c31405e08 100644 --- a/apps/slomoclock/ChangeLog +++ b/apps/slomoclock/ChangeLog @@ -1 +1 @@ - +0.01: Created app From 443afe923e761f0354158ef02c63e744c6ca4dbe Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:31:48 +1300 Subject: [PATCH 076/114] Create README.md --- apps/slomoclock/README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 apps/slomoclock/README.md diff --git a/apps/slomoclock/README.md b/apps/slomoclock/README.md new file mode 100644 index 000000000..9a6bbbdd2 --- /dev/null +++ b/apps/slomoclock/README.md @@ -0,0 +1,6 @@ +# SloMo Clock + +Simple 24h clock with large digits. + +![](Screenshot.JPG) + From 5b3310f9e7f1bd2373853b4a437297d1f5bea2de Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:32:35 +1300 Subject: [PATCH 077/114] Create app-icon.js --- apps/slomoclock/app-icon.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/slomoclock/app-icon.js diff --git a/apps/slomoclock/app-icon.js b/apps/slomoclock/app-icon.js new file mode 100644 index 000000000..22e264124 --- /dev/null +++ b/apps/slomoclock/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("oFAwhC/ABOIABgfymYAKD+Z/9hGDL5c4wAf/XzjASTxqgQhAfPMB2IPxiACIBo+BDxqACIBg+CLxpANHwQPBABgvCIBT8CJ5owDD5iPOOAQfLBojiDCYQGFGIQfICIQfdBYJNMOI6SHD8jeNOIYzID8hfRD9LfEAoTdFBIifLAAIffBoQRBAJpxMD84JCD+S/GL56fID8ALBb6ZhID8qtJCZ4fgT4YDBABq/PD7RNEL6IRKD8WID5pfCD5kzNhKSFmYfMBwSeOGBoPDABgvCJ5wAON5pADABivPIAIAOd5xABABweOD4J+OD58IQBj8LD/6gUDyAfhXzgfiP/wA2")) From 189444f74008b5f2cd55311165cac95d1d28f8e8 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:33:23 +1300 Subject: [PATCH 078/114] Create app.js --- apps/slomoclock/app.js | 187 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 apps/slomoclock/app.js diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js new file mode 100644 index 000000000..28e9494f4 --- /dev/null +++ b/apps/slomoclock/app.js @@ -0,0 +1,187 @@ +/* +Simple watch [speedwatch] +Mike Bennett mike[at]kereru.com +0.01 : Initial +*/ + +var v='0.01'; + +// timeout used to update every minute +var drawTimeout; +var x,y,w,h; + +// Variables for the stopwatch +var counter = -1; // Counts seconds +var oldDate = new Date(2020,0,1); // Initialize to a past date +var swInterval; // The interval's id +var B3 = 0; // Flag to track BTN3's current function +var w1; // watch id for BTN1 +var w3; // watch id for BTN3 + +// Colours +var colTime = 0x4FE0; +var colDate = 0xEFE0; +var colSW = 0x1DFD; + +// schedule a draw for the next minute +function queueDraw() { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); +} + +function stopWatch(clear) { + + x = 120; + y = 200; + w = 240; + h = 25; + + g.reset(); + g.setColor(colSW); + g.clearRect(x-(w/2),y-h,x+(w/2),y); // clear the background + if (clear) return; + + counter++; + + var hrs = Math.floor(counter/3600); + var mins = Math.floor((counter-hrs*3600)/60); + var secs = counter - mins*60 - hrs*3600; + + // When starting the stopwatch: + if (B3) { + // Set BTN3 to stop the stopwatch and bind itself to restart it: + w3=setWatch(() => {clearInterval(swInterval); + swInterval=undefined; + if (w3) {clearWatch(w3);w3=undefined;} + setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, + BTN3, {repeat:false,edge:"falling"}); + B3 = 1;}, + BTN3, {repeat:false,edge:"falling"}); + B3 = 0; // BTN3 is bound to stop the stopwatch + } + + // Bind BTN1 to call the reset function: + if (!w1) w1 = setWatch(resetStopWatch, BTN1, {repeat:false,edge:"falling"}); + + // Draw elapsed time: + g.setFontAlign(0,1); + g.setFont("Vector24"); + + var swStr = ("0"+parseInt(mins)).substr(-2) + ':' + ("0"+parseInt(secs)).substr(-2); + + if (hrs>0) swStr = ("0"+parseInt(hrs)).substr(-2) + ':' + swStr; + + g.drawString(swStr, x, y, true); + +} + +function resetStopWatch() { + + // Stop the interval if necessary: + if (swInterval) { + clearInterval(swInterval); + swInterval=undefined; + } + + // Clear the stopwatch: + stopWatch(true); + + // Restore the date + drawDate(); + + // Reset the counter: + counter = -1; + + // Set BTN3 to start the stopwatch again: + if (!B3) { + // In case the stopwatch is reset while still running, the watch on BTN3 is still active, so we need to reset it manually: + if (w3) {clearWatch(w3);w3=undefined;} + // Set BTN3 to start the watch again: + setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); + B3 = 1; // BTN3 is bound to start the stopwatch + } + + // Reset watch on BTN1: + if (w1) {clearWatch(w1);w1=undefined;} +} + + +function drawDate() { + // draw date + x = 120; + y = 200; + w = 240; + h = 25; + + g.reset(); + g.setColor(colDate); + g.clearRect(x-(w/2),y-h,x+(w/2),y); // clear the background + + var date = new Date(); +// var dateStr = require("locale").date(date,1); + var dateStr = date.getDate() + ' ' +require("locale").month(date,1); + g.setFontAlign(0,1); + g.setFont("Vector24"); + g.drawString(dateStr,x,y); + +} + + +function drawTime() { + x = 120; + y = 107; + w = 120; + h = 134; + + var date = new Date(); + var timeStr = require("locale").time(date,1); + g.reset(); + g.clearRect(x-(w/2),y-(h/2),x+(w/2),y+(h/2)); // clear the background + g.setFontAlign(0,0); + g.setFontVector(85); + g.setColor(colTime); + g.drawString(timeStr.substring(0,2),x,y-30); + g.drawString(timeStr.substring(3,5),x,y+38); +} + +function draw() { + x = g.getWidth()/2; + y = g.getHeight()/2; + g.reset(); + + drawTime(); + if ( counter < 0 ) drawDate(); // Only draw date when SW is not running. + + // queue draw in one minute + queueDraw(); +} + +// Clear the screen once, at startup +g.clear(); + +// draw immediately at first, queue update +draw(); + +// Stop updates when LCD is off, restart when on +Bangle.on('lcdPower',on=>{ + if (on) { + draw(); // draw immediately, queue redraw + } else { // stop draw timer + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}); + +// Show launcher when middle button pressed +Bangle.setUI("clock"); + +// Start stopwatch when BTN3 is pressed +setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); +B3 = 1; // BTN3 is bound to start the stopwatch + +// Load widgets +Bangle.loadWidgets(); +Bangle.drawWidgets(); From 85fd2b89673dd947d18d3503dd2488d1356e40d7 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:33:47 +1300 Subject: [PATCH 079/114] Add files via upload --- apps/slomoclock/watch.png | Bin 0 -> 1439 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/slomoclock/watch.png diff --git a/apps/slomoclock/watch.png b/apps/slomoclock/watch.png new file mode 100644 index 0000000000000000000000000000000000000000..b77f302d5291d39650ffd4c5400d0a7dd3e30d70 GIT binary patch literal 1439 zcmV;Q1z`G#P)ZZKIyp>XUbK#j8aEHE7Ds0zs-Qe=?maLsuD zcwH7zo-85*pPUNHrrgZ`eM~B!Lz#R329Fd4q?A-M035B_i!(14%b?7NZzmsOB(?~JQq2Hvi}HypfQSL?Z2&l2ULZ_o zg+qaL8-!-vwitv1pv#|LDDtV;SL79?vqWW)7sdH`07Fnl8VCo#kpJO8fxNdW6EFY= z%l80)kp{wij?s8|GN7v7I{+#~JK_+3YT9bUtq*JBP6-?m=93VkXj=a=!t=$vcL13+R`L*M8e?$7=E zR0)1v31I3q9xl!|L4C>F+7N)>qhMlw8GU1O(1^eoyEN2R*(Kxs+`J3Kj`vPq)QCE- zj?bf|t_%lC^U>N6z^B7A;9ZtGng#qG{kDPV0<@Hi&I15rG}Knv#TdJ!r3eGjg-w0p zg{1;ccK=qJf^vcwJDGmXkbS!Iq41PxAR--ATaG=p?_-RHh`K^Ou};y{GYvo}92?X? zr!86Bc=B7>3{MHuSSUbuzV5jKR2Td3_5FWrk!E_r+jU<$(v)Pne`qUl&K@eoD;0&p z9m^6-_YbA)2Uz8<+c5Se?d(qF_5@{+$jV(_$WWfG09?B_kLqHdsI46d^8he52%0NtVRREr&>#+Z@)vNV}NW(Tno5*=D%GKUkmWOTLadkx!v}5ucsrMYk}ePKP={9tMkm8@Yd~E zwU<=~WQN=|V{8idvY={d+dx^FjR^heGZAfZwtTQ-FP;P>i> zqQ`ruFS;6p_0yq^eQ*j#0Z1fM0Dz|25~vCT5p}v2gmveMs8dxKnrcfn^@$f;9X8em z0l(+}^TEl5W%T_rhc$9{B2XE_J9VXascesaLVPEVcp?da-HLPskJ;tnQh=tdyaix1 zo=D=epW}G4qM@cFAMe(e2}_X&ey@s_`m(3a-_@Nbuqa47%frPj+0d2Qa;zn@ULXO; zsS= z_SOj-_-5iEZci_Q7%mLASA8tPC0;4Ylzsphk1xTEiI4#NI=5sP?-%704#3T}eLn*1 zkH;$-rXR10(ph5W(JCG-YXBiO+)??HD4+ORfH4B-O8~eRw>~}-#rWU44N`DbMrDee z?**9BuTbjzNNf=!u|*k_c8m(kACUFg91#ok#GJj1J4B>CsO%U8Y%ExE?W-|Kg;}{h tLD__^eKjTtG8N$3{-Nx%fgE--{sVHTSvKO1ec%89002ovPDHLkV1gjPojw2n literal 0 HcmV?d00001 From cfbef5ae350a0ac8249a0a73f60768bcd6bd6cfa Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:35:33 +1300 Subject: [PATCH 080/114] Update apps.json --- apps.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps.json b/apps.json index 781a36434..22f75982a 100644 --- a/apps.json +++ b/apps.json @@ -2916,22 +2916,22 @@ {"name":"speedalt2.json"} ] }, -{ "id": "speedclock", +{ "id": "slomoclock", "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", "version":"0.01", - "description": "Simple clock face with large digits hour above minutes.", + "description": "Simple 24h clock face with large digits hour above minutes.", "tags": "clock", "type":"clock", "allow_emulator":true, "readme": "README.md", "storage": [ - {"name":"speedclock.app.js","url":"app.js"}, - {"name":"speedclock.img","url":"app-icon.js","evaluate":true} + {"name":"slomoclock.app.js","url":"app.js"}, + {"name":"slomoclock.img","url":"app-icon.js","evaluate":true} ], "data": [ - {"name":"speedclock.json"} + {"name":"slomoclock.json"} ] }, { "id": "de-stress", From 3ff66912860887546c6c52e704042a5d1872091b Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:36:23 +1300 Subject: [PATCH 081/114] Delete apps/speedclock directory --- apps/speedclock/ChangeLog | 1 - apps/speedclock/README.md | 21 ---- apps/speedclock/app-icon.js | 1 - apps/speedclock/app.js | 187 ------------------------------------ apps/speedclock/watch.png | Bin 1439 -> 0 bytes 5 files changed, 210 deletions(-) delete mode 100644 apps/speedclock/ChangeLog delete mode 100644 apps/speedclock/README.md delete mode 100644 apps/speedclock/app-icon.js delete mode 100644 apps/speedclock/app.js delete mode 100644 apps/speedclock/watch.png diff --git a/apps/speedclock/ChangeLog b/apps/speedclock/ChangeLog deleted file mode 100644 index c31405e08..000000000 --- a/apps/speedclock/ChangeLog +++ /dev/null @@ -1 +0,0 @@ -0.01: Created app diff --git a/apps/speedclock/README.md b/apps/speedclock/README.md deleted file mode 100644 index b4a3c83a7..000000000 --- a/apps/speedclock/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Morphing Clock Plus - -Based on Morphing Clock with more readable seconds and date, and an additional simple stopwatch. - -![](Screenshot.JPG) - -## Usage - -In addition to the Morphing Clock, a simple stopwatch can be started in the lower part of the display. - -BTN3 starts and stops the stopwatch. - -BTN1 resets/clears the stopwatch. - -## Requests - -Please leave bug reports and requests by raising an issue [here](https://github.com/skauertz/BangleApps). - -## Creator - -Sebastian Kauertz https://github.com/skauertz diff --git a/apps/speedclock/app-icon.js b/apps/speedclock/app-icon.js deleted file mode 100644 index 22e264124..000000000 --- a/apps/speedclock/app-icon.js +++ /dev/null @@ -1 +0,0 @@ -require("heatshrink").decompress(atob("oFAwhC/ABOIABgfymYAKD+Z/9hGDL5c4wAf/XzjASTxqgQhAfPMB2IPxiACIBo+BDxqACIBg+CLxpANHwQPBABgvCIBT8CJ5owDD5iPOOAQfLBojiDCYQGFGIQfICIQfdBYJNMOI6SHD8jeNOIYzID8hfRD9LfEAoTdFBIifLAAIffBoQRBAJpxMD84JCD+S/GL56fID8ALBb6ZhID8qtJCZ4fgT4YDBABq/PD7RNEL6IRKD8WID5pfCD5kzNhKSFmYfMBwSeOGBoPDABgvCJ5wAON5pADABivPIAIAOd5xABABweOD4J+OD58IQBj8LD/6gUDyAfhXzgfiP/wA2")) diff --git a/apps/speedclock/app.js b/apps/speedclock/app.js deleted file mode 100644 index 28e9494f4..000000000 --- a/apps/speedclock/app.js +++ /dev/null @@ -1,187 +0,0 @@ -/* -Simple watch [speedwatch] -Mike Bennett mike[at]kereru.com -0.01 : Initial -*/ - -var v='0.01'; - -// timeout used to update every minute -var drawTimeout; -var x,y,w,h; - -// Variables for the stopwatch -var counter = -1; // Counts seconds -var oldDate = new Date(2020,0,1); // Initialize to a past date -var swInterval; // The interval's id -var B3 = 0; // Flag to track BTN3's current function -var w1; // watch id for BTN1 -var w3; // watch id for BTN3 - -// Colours -var colTime = 0x4FE0; -var colDate = 0xEFE0; -var colSW = 0x1DFD; - -// schedule a draw for the next minute -function queueDraw() { - if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = setTimeout(function() { - drawTimeout = undefined; - draw(); - }, 60000 - (Date.now() % 60000)); -} - -function stopWatch(clear) { - - x = 120; - y = 200; - w = 240; - h = 25; - - g.reset(); - g.setColor(colSW); - g.clearRect(x-(w/2),y-h,x+(w/2),y); // clear the background - if (clear) return; - - counter++; - - var hrs = Math.floor(counter/3600); - var mins = Math.floor((counter-hrs*3600)/60); - var secs = counter - mins*60 - hrs*3600; - - // When starting the stopwatch: - if (B3) { - // Set BTN3 to stop the stopwatch and bind itself to restart it: - w3=setWatch(() => {clearInterval(swInterval); - swInterval=undefined; - if (w3) {clearWatch(w3);w3=undefined;} - setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, - BTN3, {repeat:false,edge:"falling"}); - B3 = 1;}, - BTN3, {repeat:false,edge:"falling"}); - B3 = 0; // BTN3 is bound to stop the stopwatch - } - - // Bind BTN1 to call the reset function: - if (!w1) w1 = setWatch(resetStopWatch, BTN1, {repeat:false,edge:"falling"}); - - // Draw elapsed time: - g.setFontAlign(0,1); - g.setFont("Vector24"); - - var swStr = ("0"+parseInt(mins)).substr(-2) + ':' + ("0"+parseInt(secs)).substr(-2); - - if (hrs>0) swStr = ("0"+parseInt(hrs)).substr(-2) + ':' + swStr; - - g.drawString(swStr, x, y, true); - -} - -function resetStopWatch() { - - // Stop the interval if necessary: - if (swInterval) { - clearInterval(swInterval); - swInterval=undefined; - } - - // Clear the stopwatch: - stopWatch(true); - - // Restore the date - drawDate(); - - // Reset the counter: - counter = -1; - - // Set BTN3 to start the stopwatch again: - if (!B3) { - // In case the stopwatch is reset while still running, the watch on BTN3 is still active, so we need to reset it manually: - if (w3) {clearWatch(w3);w3=undefined;} - // Set BTN3 to start the watch again: - setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); - B3 = 1; // BTN3 is bound to start the stopwatch - } - - // Reset watch on BTN1: - if (w1) {clearWatch(w1);w1=undefined;} -} - - -function drawDate() { - // draw date - x = 120; - y = 200; - w = 240; - h = 25; - - g.reset(); - g.setColor(colDate); - g.clearRect(x-(w/2),y-h,x+(w/2),y); // clear the background - - var date = new Date(); -// var dateStr = require("locale").date(date,1); - var dateStr = date.getDate() + ' ' +require("locale").month(date,1); - g.setFontAlign(0,1); - g.setFont("Vector24"); - g.drawString(dateStr,x,y); - -} - - -function drawTime() { - x = 120; - y = 107; - w = 120; - h = 134; - - var date = new Date(); - var timeStr = require("locale").time(date,1); - g.reset(); - g.clearRect(x-(w/2),y-(h/2),x+(w/2),y+(h/2)); // clear the background - g.setFontAlign(0,0); - g.setFontVector(85); - g.setColor(colTime); - g.drawString(timeStr.substring(0,2),x,y-30); - g.drawString(timeStr.substring(3,5),x,y+38); -} - -function draw() { - x = g.getWidth()/2; - y = g.getHeight()/2; - g.reset(); - - drawTime(); - if ( counter < 0 ) drawDate(); // Only draw date when SW is not running. - - // queue draw in one minute - queueDraw(); -} - -// Clear the screen once, at startup -g.clear(); - -// draw immediately at first, queue update -draw(); - -// Stop updates when LCD is off, restart when on -Bangle.on('lcdPower',on=>{ - if (on) { - draw(); // draw immediately, queue redraw - } else { // stop draw timer - if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = undefined; - } -}); - -// Show launcher when middle button pressed -Bangle.setUI("clock"); - -// Start stopwatch when BTN3 is pressed -setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); -B3 = 1; // BTN3 is bound to start the stopwatch - -// Load widgets -Bangle.loadWidgets(); -Bangle.drawWidgets(); diff --git a/apps/speedclock/watch.png b/apps/speedclock/watch.png deleted file mode 100644 index b77f302d5291d39650ffd4c5400d0a7dd3e30d70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1439 zcmV;Q1z`G#P)ZZKIyp>XUbK#j8aEHE7Ds0zs-Qe=?maLsuD zcwH7zo-85*pPUNHrrgZ`eM~B!Lz#R329Fd4q?A-M035B_i!(14%b?7NZzmsOB(?~JQq2Hvi}HypfQSL?Z2&l2ULZ_o zg+qaL8-!-vwitv1pv#|LDDtV;SL79?vqWW)7sdH`07Fnl8VCo#kpJO8fxNdW6EFY= z%l80)kp{wij?s8|GN7v7I{+#~JK_+3YT9bUtq*JBP6-?m=93VkXj=a=!t=$vcL13+R`L*M8e?$7=E zR0)1v31I3q9xl!|L4C>F+7N)>qhMlw8GU1O(1^eoyEN2R*(Kxs+`J3Kj`vPq)QCE- zj?bf|t_%lC^U>N6z^B7A;9ZtGng#qG{kDPV0<@Hi&I15rG}Knv#TdJ!r3eGjg-w0p zg{1;ccK=qJf^vcwJDGmXkbS!Iq41PxAR--ATaG=p?_-RHh`K^Ou};y{GYvo}92?X? zr!86Bc=B7>3{MHuSSUbuzV5jKR2Td3_5FWrk!E_r+jU<$(v)Pne`qUl&K@eoD;0&p z9m^6-_YbA)2Uz8<+c5Se?d(qF_5@{+$jV(_$WWfG09?B_kLqHdsI46d^8he52%0NtVRREr&>#+Z@)vNV}NW(Tno5*=D%GKUkmWOTLadkx!v}5ucsrMYk}ePKP={9tMkm8@Yd~E zwU<=~WQN=|V{8idvY={d+dx^FjR^heGZAfZwtTQ-FP;P>i> zqQ`ruFS;6p_0yq^eQ*j#0Z1fM0Dz|25~vCT5p}v2gmveMs8dxKnrcfn^@$f;9X8em z0l(+}^TEl5W%T_rhc$9{B2XE_J9VXascesaLVPEVcp?da-HLPskJ;tnQh=tdyaix1 zo=D=epW}G4qM@cFAMe(e2}_X&ey@s_`m(3a-_@Nbuqa47%frPj+0d2Qa;zn@ULXO; zsS= z_SOj-_-5iEZci_Q7%mLASA8tPC0;4Ylzsphk1xTEiI4#NI=5sP?-%704#3T}eLn*1 zkH;$-rXR10(ph5W(JCG-YXBiO+)??HD4+ORfH4B-O8~eRw>~}-#rWU44N`DbMrDee z?**9BuTbjzNNf=!u|*k_c8m(kACUFg91#ok#GJj1J4B>CsO%U8Y%ExE?W-|Kg;}{h tLD__^eKjTtG8N$3{-Nx%fgE--{sVHTSvKO1ec%89002ovPDHLkV1gjPojw2n From 91a5c56eeecede87d395fff331ea7707a34f47ee Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 21:55:48 +1300 Subject: [PATCH 082/114] Update app.js --- apps/slomoclock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 28e9494f4..c2b504a75 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -1,5 +1,5 @@ /* -Simple watch [speedwatch] +Simple watch [slomoclock] Mike Bennett mike[at]kereru.com 0.01 : Initial */ From d415356bb750356de2359496bfec6993c21a418a Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 22:52:09 +1300 Subject: [PATCH 083/114] Update app.js --- apps/slomoclock/app.js | 43 +++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index c2b504a75..b4c6727bd 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -4,7 +4,7 @@ Mike Bennett mike[at]kereru.com 0.01 : Initial */ -var v='0.01'; +var v='0.02'; // timeout used to update every minute var drawTimeout; @@ -32,6 +32,7 @@ function queueDraw() { }, 60000 - (Date.now() % 60000)); } +/* function stopWatch(clear) { x = 120; @@ -108,22 +109,23 @@ function resetStopWatch() { if (w1) {clearWatch(w1);w1=undefined;} } +*/ function drawDate() { // draw date - x = 120; - y = 200; - w = 240; - h = 25; + x = 240; + y = 40; + w = 25; + h = 90; g.reset(); g.setColor(colDate); - g.clearRect(x-(w/2),y-h,x+(w/2),y); // clear the background + g.clearRect(x-w,y,x,y+h); // clear the background var date = new Date(); // var dateStr = require("locale").date(date,1); var dateStr = date.getDate() + ' ' +require("locale").month(date,1); - g.setFontAlign(0,1); + g.setFontAlign(1,1,3); g.setFont("Vector24"); g.drawString(dateStr,x,y); @@ -132,19 +134,30 @@ function drawDate() { function drawTime() { x = 120; - y = 107; - w = 120; - h = 134; + y = 120; + w = 130; + h = 160; var date = new Date(); var timeStr = require("locale").time(date,1); + var t = parseFloat(timeStr); + + if ( t < 24 ) colTime = 0x01BD; + if ( t < 19 ) colTime = 0x701F; + if ( t < 18 ) colTime = 0xEC80; + if ( t < 17 ) colTime = 0xF780; + if ( t < 12 ) colTime = 0xAEC2; + if ( t < 7 ) colTime = 0x1EC2; + if ( t < 6 ) colTime = 0x01BD; + + g.reset(); g.clearRect(x-(w/2),y-(h/2),x+(w/2),y+(h/2)); // clear the background g.setFontAlign(0,0); - g.setFontVector(85); + g.setFontVector(100); g.setColor(colTime); - g.drawString(timeStr.substring(0,2),x,y-30); - g.drawString(timeStr.substring(3,5),x,y+38); + g.drawString(timeStr.substring(0,2),x,y-35); + g.drawString(timeStr.substring(3,5),x,y+49); } function draw() { @@ -179,8 +192,8 @@ Bangle.on('lcdPower',on=>{ Bangle.setUI("clock"); // Start stopwatch when BTN3 is pressed -setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); -B3 = 1; // BTN3 is bound to start the stopwatch +//setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); +//B3 = 1; // BTN3 is bound to start the stopwatch // Load widgets Bangle.loadWidgets(); From 96109735716f1de861c7b57c648b6341c2ce1425 Mon Sep 17 00:00:00 2001 From: nujw Date: Sat, 23 Oct 2021 22:52:49 +1300 Subject: [PATCH 084/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 22f75982a..d251f4193 100644 --- a/apps.json +++ b/apps.json @@ -2920,7 +2920,7 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.01", + "version":"0.02", "description": "Simple 24h clock face with large digits hour above minutes.", "tags": "clock", "type":"clock", From f5fa689b42849522626040e782ae47476591f8a0 Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 10:26:28 +1300 Subject: [PATCH 085/114] Update app.js --- apps/slomoclock/app.js | 208 ++++++++++------------------------------- 1 file changed, 47 insertions(+), 161 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index b4c6727bd..d9e0683c7 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -2,145 +2,41 @@ Simple watch [slomoclock] Mike Bennett mike[at]kereru.com 0.01 : Initial +0.03 : Use Layout library */ -var v='0.02'; +var v='0.03'; -// timeout used to update every minute -var drawTimeout; -var x,y,w,h; +var Layout = require("Layout"); +var layout = new Layout( { + type:"v", c: [ + {type:undefined, height:40 }, // Widgets top -// Variables for the stopwatch -var counter = -1; // Counts seconds -var oldDate = new Date(2020,0,1); // Initialize to a past date -var swInterval; // The interval's id -var B3 = 0; // Flag to track BTN3's current function -var w1; // watch id for BTN1 -var w3; // watch id for BTN3 + {type:"h", c: [ + {type:"v", c: [ + {type:"txt", font:"40%", label:"", id:"hour", valign:1}, + {type:"txt", font:"40%", label:"", id:"min", valign:-1}, + ]}, + {type:"v", c: [ + {type:"txt", font:"10%", label:"", id:"day", col:0xEFE0, halign:1}, + {type:"txt", font:"10%", label:"", id:"mon", col:0xEFE0, halign:1}, + ]} + ]}, -// Colours -var colTime = 0x4FE0; -var colDate = 0xEFE0; -var colSW = 0x1DFD; + {type:undefined, height:40 }, // Widgets bottom -// schedule a draw for the next minute -function queueDraw() { - if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = setTimeout(function() { - drawTimeout = undefined; - draw(); - }, 60000 - (Date.now() % 60000)); -} - -/* -function stopWatch(clear) { - - x = 120; - y = 200; - w = 240; - h = 25; - - g.reset(); - g.setColor(colSW); - g.clearRect(x-(w/2),y-h,x+(w/2),y); // clear the background - if (clear) return; + ] - counter++; +}, {lazy:true}); - var hrs = Math.floor(counter/3600); - var mins = Math.floor((counter-hrs*3600)/60); - var secs = counter - mins*60 - hrs*3600; - - // When starting the stopwatch: - if (B3) { - // Set BTN3 to stop the stopwatch and bind itself to restart it: - w3=setWatch(() => {clearInterval(swInterval); - swInterval=undefined; - if (w3) {clearWatch(w3);w3=undefined;} - setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, - BTN3, {repeat:false,edge:"falling"}); - B3 = 1;}, - BTN3, {repeat:false,edge:"falling"}); - B3 = 0; // BTN3 is bound to stop the stopwatch - } - - // Bind BTN1 to call the reset function: - if (!w1) w1 = setWatch(resetStopWatch, BTN1, {repeat:false,edge:"falling"}); - - // Draw elapsed time: - g.setFontAlign(0,1); - g.setFont("Vector24"); - - var swStr = ("0"+parseInt(mins)).substr(-2) + ':' + ("0"+parseInt(secs)).substr(-2); - - if (hrs>0) swStr = ("0"+parseInt(hrs)).substr(-2) + ':' + swStr; - - g.drawString(swStr, x, y, true); - -} - -function resetStopWatch() { - - // Stop the interval if necessary: - if (swInterval) { - clearInterval(swInterval); - swInterval=undefined; - } - - // Clear the stopwatch: - stopWatch(true); - - // Restore the date - drawDate(); - - // Reset the counter: - counter = -1; - - // Set BTN3 to start the stopwatch again: - if (!B3) { - // In case the stopwatch is reset while still running, the watch on BTN3 is still active, so we need to reset it manually: - if (w3) {clearWatch(w3);w3=undefined;} - // Set BTN3 to start the watch again: - setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); - B3 = 1; // BTN3 is bound to start the stopwatch - } - - // Reset watch on BTN1: - if (w1) {clearWatch(w1);w1=undefined;} -} - -*/ - -function drawDate() { - // draw date - x = 240; - y = 40; - w = 25; - h = 90; - - g.reset(); - g.setColor(colDate); - g.clearRect(x-w,y,x,y+h); // clear the background - +// update the screen +function draw() { var date = new Date(); -// var dateStr = require("locale").date(date,1); - var dateStr = date.getDate() + ' ' +require("locale").month(date,1); - g.setFontAlign(1,1,3); - g.setFont("Vector24"); - g.drawString(dateStr,x,y); -} - - -function drawTime() { - x = 120; - y = 120; - w = 130; - h = 160; - - var date = new Date(); + // Update time var timeStr = require("locale").time(date,1); var t = parseFloat(timeStr); + var colTime; if ( t < 24 ) colTime = 0x01BD; if ( t < 19 ) colTime = 0x701F; @@ -148,53 +44,43 @@ function drawTime() { if ( t < 17 ) colTime = 0xF780; if ( t < 12 ) colTime = 0xAEC2; if ( t < 7 ) colTime = 0x1EC2; - if ( t < 6 ) colTime = 0x01BD; + if ( t < 6 ) colTime = 0x01BD; + + layout.hour.label = timeStr.substring(0,2); + layout.min.label = timeStr.substring(3,5); + layout.hour.col = colTime; + layout.min.col = colTime; - - g.reset(); - g.clearRect(x-(w/2),y-(h/2),x+(w/2),y+(h/2)); // clear the background - g.setFontAlign(0,0); - g.setFontVector(100); - g.setColor(colTime); - g.drawString(timeStr.substring(0,2),x,y-35); - g.drawString(timeStr.substring(3,5),x,y+49); + // Update date + layout.day.label = date.getDate(); + layout.mon.label = require("locale").month(date,1); + + layout.render(); } -function draw() { - x = g.getWidth()/2; - y = g.getHeight()/2; - g.reset(); - - drawTime(); - if ( counter < 0 ) drawDate(); // Only draw date when SW is not running. - - // queue draw in one minute - queueDraw(); -} - -// Clear the screen once, at startup -g.clear(); - -// draw immediately at first, queue update -draw(); +// Events // Stop updates when LCD is off, restart when on Bangle.on('lcdPower',on=>{ + if (secondInterval) clearInterval(secondInterval); + secondInterval = undefined; if (on) { - draw(); // draw immediately, queue redraw - } else { // stop draw timer - if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = undefined; + secondInterval = setInterval(draw, 10000); + draw(); // draw immediately } }); +var secondInterval = setInterval(draw, 10000); + + + +// update time and draw +g.clear(); +draw(); + // Show launcher when middle button pressed Bangle.setUI("clock"); -// Start stopwatch when BTN3 is pressed -//setWatch(() => {swInterval=setInterval(stopWatch, 1000);stopWatch();}, BTN3, {repeat:false,edge:"falling"}); -//B3 = 1; // BTN3 is bound to start the stopwatch - // Load widgets Bangle.loadWidgets(); Bangle.drawWidgets(); From 13dc813cc14bbad52d6b7ef93452b1c7677be06b Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 10:28:11 +1300 Subject: [PATCH 086/114] Update apps.json --- apps.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index d251f4193..56c77d6e9 100644 --- a/apps.json +++ b/apps.json @@ -2920,8 +2920,8 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.02", - "description": "Simple 24h clock face with large digits hour above minutes.", + "version":"0.03", + "description": "Simple 24h clock face with large digits, hour above minute. Uses Layout library.", "tags": "clock", "type":"clock", "allow_emulator":true, From 81d34b22a4781cdef5f8c56e11f33f1ed66099b1 Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 12:23:11 +1300 Subject: [PATCH 087/114] Create settings.js --- apps/slomoclock/settings.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 apps/slomoclock/settings.js diff --git a/apps/slomoclock/settings.js b/apps/slomoclock/settings.js new file mode 100644 index 000000000..0485400fe --- /dev/null +++ b/apps/slomoclock/settings.js @@ -0,0 +1,18 @@ +(function(back) { + + let settings = require('Storage').readJSON('slomoclock.json',1)||{}; + + function writeSettings() { + require('Storage').write('slomoclock.json',settings); + } + + const appMenu = { + '': {'title': 'SloMo Clock'}, + '< Back': back, + 'Widget Space Top' : {value : settings.widTop, format : v => v?"On":"Off",onchange : () => { settings.widTop = !settings.widTop; writeSettings(); }, + 'Widget Space Bottom' : {value : settings.widBot, format : v => v?"On":"Off",onchange : () => { settings.widBot = !settings.widBot; writeSettings(); } + }; + + E.showMenu(appMenu); + +}); From a534b8c688b564899e798a4fd3a9d3aa32262543 Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 12:24:30 +1300 Subject: [PATCH 088/114] Update apps.json --- apps.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 56c77d6e9..e31fa73f7 100644 --- a/apps.json +++ b/apps.json @@ -2928,7 +2928,8 @@ "readme": "README.md", "storage": [ {"name":"slomoclock.app.js","url":"app.js"}, - {"name":"slomoclock.img","url":"app-icon.js","evaluate":true} + {"name":"slomoclock.img","url":"app-icon.js","evaluate":true}, + {"name":"slomoclock.settings.js","url":"settings.js"} ], "data": [ {"name":"slomoclock.json"} From 55cf1a1d64a4e59a6367caa745bfdf4a7c0953fc Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 12:29:58 +1300 Subject: [PATCH 089/114] Update app.js --- apps/slomoclock/app.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index d9e0683c7..96a269b4f 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -7,10 +7,15 @@ Mike Bennett mike[at]kereru.com var v='0.03'; +// Read settings. +let cfg = require('Storage').readJSON('slomoclock.json',1)||{}; +cfg.widTop = cfg.widTop==undefined?true:cfg.widTop; +cfg.widBot = cfg.widBot==undefined?true:cfg.widBot; + var Layout = require("Layout"); var layout = new Layout( { type:"v", c: [ - {type:undefined, height:40 }, // Widgets top + {type:undefined, height:widTop?40:0 }, // Widgets top {type:"h", c: [ {type:"v", c: [ @@ -23,7 +28,7 @@ var layout = new Layout( { ]} ]}, - {type:undefined, height:40 }, // Widgets bottom + {type:undefined, height:widBot?40:0 }, // Widgets bottom ] From 3ea42d0ab90df177e83fd66adb5eabc955cec6d7 Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 12:59:42 +1300 Subject: [PATCH 090/114] Update app.js --- apps/slomoclock/app.js | 61 ++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 96a269b4f..271974b98 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -5,19 +5,38 @@ Mike Bennett mike[at]kereru.com 0.03 : Use Layout library */ -var v='0.03'; +var v='0.04'; -// Read settings. -let cfg = require('Storage').readJSON('slomoclock.json',1)||{}; -cfg.widTop = cfg.widTop==undefined?true:cfg.widTop; -cfg.widBot = cfg.widBot==undefined?true:cfg.widBot; +// Colours +const col = []; +col[0]= 0x001F; +col[1]= 0x023F; +col[2]= 0x039F; +col[3]= 0x051F; +col[4]= 0x067F; +col[5]= 0x07FD; +col[6]= 0x07F6; +col[7]= 0x07EF; +col[8]= 0x07E8; +col[9]= 0x07E3; +col[10]= 0x07E0; +col[11]= 0x5FE0; +col[12]= 0x97E0; +col[13]= 0xCFE0; +col[14]= 0xFFE0; +col[15]= 0xFE60; +col[16]= 0xFC60; +col[17]= 0xFAA0; +col[18]= 0xF920; +col[19]= 0xF803; +col[20]= 0xF80E; +col[21]= 0xF817; +col[22]= 0xE81F; +col[23]= 0x801F; var Layout = require("Layout"); var layout = new Layout( { - type:"v", c: [ - {type:undefined, height:widTop?40:0 }, // Widgets top - - {type:"h", c: [ + type:"h", c: [ {type:"v", c: [ {type:"txt", font:"40%", label:"", id:"hour", valign:1}, {type:"txt", font:"40%", label:"", id:"min", valign:-1}, @@ -26,12 +45,7 @@ var layout = new Layout( { {type:"txt", font:"10%", label:"", id:"day", col:0xEFE0, halign:1}, {type:"txt", font:"10%", label:"", id:"mon", col:0xEFE0, halign:1}, ]} - ]}, - - {type:undefined, height:widBot?40:0 }, // Widgets bottom - - ] - + ] }, {lazy:true}); // update the screen @@ -40,21 +54,12 @@ function draw() { // Update time var timeStr = require("locale").time(date,1); - var t = parseFloat(timeStr); - var colTime; + var hh = parseFloat(timeStr.substring(0,2)); - if ( t < 24 ) colTime = 0x01BD; - if ( t < 19 ) colTime = 0x701F; - if ( t < 18 ) colTime = 0xEC80; - if ( t < 17 ) colTime = 0xF780; - if ( t < 12 ) colTime = 0xAEC2; - if ( t < 7 ) colTime = 0x1EC2; - if ( t < 6 ) colTime = 0x01BD; - layout.hour.label = timeStr.substring(0,2); layout.min.label = timeStr.substring(3,5); - layout.hour.col = colTime; - layout.min.col = colTime; + layout.hour.col = col[hh]; + layout.min.col = col[hh]; // Update date layout.day.label = date.getDate(); @@ -77,8 +82,6 @@ Bangle.on('lcdPower',on=>{ var secondInterval = setInterval(draw, 10000); - - // update time and draw g.clear(); draw(); From 6de5ba92321f635aea29d17a6e8fe55bb1c62da0 Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 13:00:59 +1300 Subject: [PATCH 091/114] Update apps.json --- apps.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index e31fa73f7..ffca3dfcd 100644 --- a/apps.json +++ b/apps.json @@ -2920,7 +2920,7 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.03", + "version":"0.04", "description": "Simple 24h clock face with large digits, hour above minute. Uses Layout library.", "tags": "clock", "type":"clock", @@ -2928,8 +2928,7 @@ "readme": "README.md", "storage": [ {"name":"slomoclock.app.js","url":"app.js"}, - {"name":"slomoclock.img","url":"app-icon.js","evaluate":true}, - {"name":"slomoclock.settings.js","url":"settings.js"} + {"name":"slomoclock.img","url":"app-icon.js","evaluate":true} ], "data": [ {"name":"slomoclock.json"} From e7e6b0db175a5281b102a38425f9c0ada0226c74 Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 21:12:19 +1300 Subject: [PATCH 092/114] Update app.js --- apps/slomoclock/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 271974b98..96bcc08a0 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -30,9 +30,9 @@ col[17]= 0xFAA0; col[18]= 0xF920; col[19]= 0xF803; col[20]= 0xF80E; -col[21]= 0xF817; -col[22]= 0xE81F; -col[23]= 0x801F; +col[21]= 0x981F; +col[22]= 0x681F; +col[23]= 0x301F; var Layout = require("Layout"); var layout = new Layout( { From 3151c6b3a0da2797466addd5188ec455122c7d45 Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 21:12:34 +1300 Subject: [PATCH 093/114] Update app.js --- apps/slomoclock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 96bcc08a0..73ad7ba7d 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.03 : Use Layout library */ -var v='0.04'; +var v='0.05'; // Colours const col = []; From ec65ca790b32c791f1487ef06a193e28abfd5f62 Mon Sep 17 00:00:00 2001 From: nujw Date: Sun, 24 Oct 2021 21:13:11 +1300 Subject: [PATCH 094/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index ffca3dfcd..5ad1d046d 100644 --- a/apps.json +++ b/apps.json @@ -2920,7 +2920,7 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.04", + "version":"0.05", "description": "Simple 24h clock face with large digits, hour above minute. Uses Layout library.", "tags": "clock", "type":"clock", From 474d705c300b29be00ce91b5d3cfeef1542d9015 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 08:55:35 +1300 Subject: [PATCH 095/114] Update settings.js --- apps/slomoclock/settings.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/apps/slomoclock/settings.js b/apps/slomoclock/settings.js index 0485400fe..abf767fdc 100644 --- a/apps/slomoclock/settings.js +++ b/apps/slomoclock/settings.js @@ -6,11 +6,29 @@ require('Storage').write('slomoclock.json',settings); } + function setColour(c) { + settings.colour = c; + writeSettings(); + } + const appMenu = { '': {'title': 'SloMo Clock'}, '< Back': back, - 'Widget Space Top' : {value : settings.widTop, format : v => v?"On":"Off",onchange : () => { settings.widTop = !settings.widTop; writeSettings(); }, - 'Widget Space Bottom' : {value : settings.widBot, format : v => v?"On":"Off",onchange : () => { settings.widBot = !settings.widBot; writeSettings(); } + 'Colours' : function() { E.showMenu(colMenu); } + //,'Widget Space Top' : {value : settings.widTop, format : v => v?"On":"Off",onchange : () => { settings.widTop = !settings.widTop; writeSettings(); } + //,'Widget Space Bottom' : {value : settings.widBot, format : v => v?"On":"Off",onchange : () => { settings.widBot = !settings.widBot; writeSettings(); } + }; + + const colMenu = { + '': {'title': 'Colours'}, + '< Back': function() { E.showMenu(appMenu); }, + 'Surprise' : function() { setColour(0); }, + 'Red' : function() { setColour(1); }, + 'Orange' : function() { setColour(2); }, + 'Yellow' : function() { setColour(3); }, + 'Green' : function() { setColour(4); }, + 'Blue' : function() { setColour(5); }, + 'Violet' : function() { setColour(6); } }; E.showMenu(appMenu); From 270e2f04733d9e2b25689dddc70b03939ebaf333 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 09:09:21 +1300 Subject: [PATCH 096/114] Update app.js --- apps/slomoclock/app.js | 66 +++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 73ad7ba7d..8956f37b6 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -5,34 +5,42 @@ Mike Bennett mike[at]kereru.com 0.03 : Use Layout library */ -var v='0.05'; +var v='0.06'; // Colours const col = []; -col[0]= 0x001F; -col[1]= 0x023F; -col[2]= 0x039F; -col[3]= 0x051F; -col[4]= 0x067F; -col[5]= 0x07FD; -col[6]= 0x07F6; -col[7]= 0x07EF; -col[8]= 0x07E8; -col[9]= 0x07E3; -col[10]= 0x07E0; -col[11]= 0x5FE0; -col[12]= 0x97E0; -col[13]= 0xCFE0; -col[14]= 0xFFE0; -col[15]= 0xFE60; -col[16]= 0xFC60; -col[17]= 0xFAA0; -col[18]= 0xF920; -col[19]= 0xF803; -col[20]= 0xF80E; -col[21]= 0x981F; -col[22]= 0x681F; -col[23]= 0x301F; +col[1] = 0xF800; +col[2] = 0xFAE0; +col[3] = 0xF7E0; +col[4] = 0x4FE0; +col[5] = 0x019F; +col[6] = 0x681F; + +const colH = []; +colH[0]= 0x001F; +colH[1]= 0x023F; +colH[2]= 0x039F; +colH[3]= 0x051F; +colH[4]= 0x067F; +colH[5]= 0x07FD; +colH[6]= 0x07F6; +colH[7]= 0x07EF; +colH[8]= 0x07E8; +colH[9]= 0x07E3; +colH[10]= 0x07E0; +colH[11]= 0x5FE0; +colH[12]= 0x97E0; +colH[13]= 0xCFE0; +colH[14]= 0xFFE0; +colH[15]= 0xFE60; +colH[16]= 0xFC60; +colH[17]= 0xFAA0; +colH[18]= 0xF920; +colH[19]= 0xF803; +colH[20]= 0xF80E; +colH[21]= 0x981F; +colH[22]= 0x681F; +colH[23]= 0x301F; var Layout = require("Layout"); var layout = new Layout( { @@ -58,8 +66,8 @@ function draw() { layout.hour.label = timeStr.substring(0,2); layout.min.label = timeStr.substring(3,5); - layout.hour.col = col[hh]; - layout.min.col = col[hh]; + layout.hour.col = cfg.colour==0 ? colH[hh] : col[cfg.colour]; + layout.min.col = cfg.colour==0 ? colH[hh] : col[cfg.colour]; // Update date layout.day.label = date.getDate(); @@ -82,6 +90,10 @@ Bangle.on('lcdPower',on=>{ var secondInterval = setInterval(draw, 10000); +// Configuration +let cfg = require('Storage').readJSON('slomoclock.json',1)||{}; +cfg.colour = cfg.colour||0; // Colours + // update time and draw g.clear(); draw(); From 0c9d200eb7a88e95d60f2342f46e9f584f3d9294 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 09:10:29 +1300 Subject: [PATCH 097/114] Update apps.json --- apps.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 5ad1d046d..15dc96926 100644 --- a/apps.json +++ b/apps.json @@ -2920,7 +2920,7 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.05", + "version":"0.06", "description": "Simple 24h clock face with large digits, hour above minute. Uses Layout library.", "tags": "clock", "type":"clock", @@ -2928,7 +2928,8 @@ "readme": "README.md", "storage": [ {"name":"slomoclock.app.js","url":"app.js"}, - {"name":"slomoclock.img","url":"app-icon.js","evaluate":true} + {"name":"slomoclock.img","url":"app-icon.js","evaluate":true}, + {"name":"slomoclock.settings.js","url":"settings.js"} ], "data": [ {"name":"slomoclock.json"} From 44259c6e151ddfd376c94b43619c3403e7b53c6a Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 09:20:36 +1300 Subject: [PATCH 098/114] Update settings.js --- apps/speedalt2/settings.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/speedalt2/settings.js b/apps/speedalt2/settings.js index 26ae010bb..96174a89b 100644 --- a/apps/speedalt2/settings.js +++ b/apps/speedalt2/settings.js @@ -37,12 +37,12 @@ '< Load GPS Adv Sport': ()=>{load('speedalt2.app.js');}, 'Units' : function() { E.showMenu(unitsMenu); }, 'Colours' : function() { E.showMenu(colMenu); }, - 'Kalman Filter' : function() { E.showMenu(kalMenu); }/*, - 'Vibrate' : { - value : settings.buzz, - format : v => v?"On":"Off", - onchange : () => { settings.buzz = !settings.buzz; writeSettings(); } - }*/ + 'Kalman Filter' : function() { E.showMenu(kalMenu); }, + 'Touch' : { + value : settings.touch, + format : v => v?"On":"Off", + onchange : () => { settings.touch = !settings.touch; writeSettings(); } + } }; const unitsMenu = { From 8d9966c2829300e2339a0a545f3f07d3663aed7c Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 09:25:06 +1300 Subject: [PATCH 099/114] Update app.js --- apps/speedalt2/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/speedalt2/app.js b/apps/speedalt2/app.js index 6bd967b1b..0db9629c7 100644 --- a/apps/speedalt2/app.js +++ b/apps/speedalt2/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.06 : Add Posn screen 0.07 : Add swipe to change screens same as BTN3 */ -var v = '1.04'; +var v = '1.05'; /*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */ var KalmanFilter = (function () { @@ -621,11 +621,13 @@ Bangle.on('lcdPower',function(on) { }); Bangle.on('swipe',function(dir) { + if ( ! cfg.touch ) return; if(dir == 1) prevScrn(); else nextScrn(); }); Bangle.on('touch', function(button){ + if ( ! cfg.touch ) return; nextFunc(0); // Same function as short BTN1 /* switch(button){ @@ -665,6 +667,7 @@ cfg.primSpd = cfg.primSpd||0; // 1 = Spd in primary, 0 = Spd in secondary cfg.spdFilt = cfg.spdFilt==undefined?true:cfg.spdFilt; cfg.altFilt = cfg.altFilt==undefined?true:cfg.altFilt; +cfg.touch = cfg.touch==undefined?true:cfg.touch; if ( cfg.spdFilt ) var spdFilter = new KalmanFilter({R: 0.1 , Q: 1 }); if ( cfg.altFilt ) var altFilter = new KalmanFilter({R: 0.01, Q: 2 }); From 167e068a9c0d8387de7ff3477503900033be8338 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 09:26:02 +1300 Subject: [PATCH 100/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 15dc96926..a354cde39 100644 --- a/apps.json +++ b/apps.json @@ -2901,7 +2901,7 @@ "name": "GPS Adventure Sports II", "shortName":"GPS Adv Sport II", "icon": "app.png", - "version":"1.04", + "version":"1.05", "description": "GPS speed, altitude and distance to waypoint display. Designed for easy viewing and use during outdoor activities such as para-gliding, hang-gliding, sailing, cycling etc.", "tags": "tool,outdoors", "type":"app", From 719dacb85f4ee968c024b641bb5e5babe544f6db Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 09:30:00 +1300 Subject: [PATCH 101/114] Update README.md --- apps/speedalt2/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index 511932298..24d21cbef 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -22,6 +22,13 @@ BTN3 : Cycles the screens between Speed, Altitude, Distance to waypoint, Positio BTN3 : Long press exit and return to watch. +[Touch Screen] If the 'Touch' setting is ON then : + +Swipe Left/Right cycles between the five screens. + +Touch functions as BTN1 short press. + + ## App Settings Select the desired display units. Speed can be as per the default locale, kph, knots, mph or m/s. Distance can be km, miles or nautical miles. Altitude can be feet or metres. Select one of three colour schemes. Default (three colours), high contrast (all white on black) or night ( all red on black ). From 24da4c609289ef5b14afa7aa656fb8ab3c0fc0ff Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 09:39:58 +1300 Subject: [PATCH 102/114] Update README.md --- apps/speedalt2/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index 24d21cbef..a39690338 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -1,10 +1,10 @@ # GPS Speed, Altimeter and Distance to Waypoint -What is the difference between [GPS Adventure Sports] and [GPS Adventure Sports II] ? +What is the difference between **GPS Adventure Sports** and **GPS Adventure Sports II** ? -[GPS Adventure Sports] has 3 screens, each of which display different sets of information. +**GPS Adventure Sports** has 3 screens, each of which display different sets of information. -[GPS Adventure Sports II] has 5 screens, each of which displays just one of Speed, Altitude, Distance to waypoint, Position or Time. +**GPS Adventure Sports II** has 5 screens, each of which displays just one of Speed, Altitude, Distance to waypoint, Position or Time. In all other respect they perform the same functions. Use BTN3 or swipe left/right to cycle through the screens. @@ -12,17 +12,17 @@ The waypoints list is the same as that used with the [GPS Navigation](https://ba ## Buttons and Controls -BTN1 ( Speed and Altitude ) Short press < 2 secs toggles the display between last reading and maximum recorded. Long press > 2 secs resets the recorded maximum values. +**BTN1** ( Speed and Altitude ) Short press < 2 secs toggles the display between last reading and maximum recorded. Long press > 2 secs resets the recorded maximum values. -BTN1 ( Distance ) Select next waypoint. Last fix distance from selected waypoint is displayed. +**BTN1** ( Distance ) Select next waypoint. Last fix distance from selected waypoint is displayed. -BTN2 : Disables/Restores power saving timeout. Locks the screen on and GPS in SuperE mode to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Press again to restore power saving timeouts. +**BTN2** : Disables/Restores power saving timeout. Locks the screen on and GPS in SuperE mode to enable reading for longer periods but uses maximum battery drain. Red LED (dot) at top of screen when screen is locked on. Press again to restore power saving timeouts. -BTN3 : Cycles the screens between Speed, Altitude, Distance to waypoint, Position and Time +**BTN3** : Cycles the screens between Speed, Altitude, Distance to waypoint, Position and Time -BTN3 : Long press exit and return to watch. +**BTN3** : Long press exit and return to watch. -[Touch Screen] If the 'Touch' setting is ON then : +**Touch Screen** If the 'Touch' setting is ON then : Swipe Left/Right cycles between the five screens. From 6bbec69ea994c8769948408d48aef3b3c2499673 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 09:41:05 +1300 Subject: [PATCH 103/114] Update README.md --- apps/speedalt2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/speedalt2/README.md b/apps/speedalt2/README.md index a39690338..30a706b7b 100644 --- a/apps/speedalt2/README.md +++ b/apps/speedalt2/README.md @@ -6,7 +6,7 @@ What is the difference between **GPS Adventure Sports** and **GPS Adventure Spor **GPS Adventure Sports II** has 5 screens, each of which displays just one of Speed, Altitude, Distance to waypoint, Position or Time. -In all other respect they perform the same functions. Use BTN3 or swipe left/right to cycle through the screens. +In all other respect they perform the same functions. The waypoints list is the same as that used with the [GPS Navigation](https://banglejs.com/apps/#gps%20navigation) app so the same set of waypoints can be used across both apps. Refer to that app for waypoint file information. From c23b3ce8e533087cd9261e45f90c083aca666298 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 16:37:57 +1300 Subject: [PATCH 104/114] Update settings.js --- apps/slomoclock/settings.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/slomoclock/settings.js b/apps/slomoclock/settings.js index abf767fdc..e073dda7e 100644 --- a/apps/slomoclock/settings.js +++ b/apps/slomoclock/settings.js @@ -22,13 +22,15 @@ const colMenu = { '': {'title': 'Colours'}, '< Back': function() { E.showMenu(appMenu); }, + 'Mysterion' : function() { setColour(0); }, 'Surprise' : function() { setColour(0); }, - 'Red' : function() { setColour(1); }, - 'Orange' : function() { setColour(2); }, - 'Yellow' : function() { setColour(3); }, - 'Green' : function() { setColour(4); }, - 'Blue' : function() { setColour(5); }, - 'Violet' : function() { setColour(6); } + 'Red' : function() { setColour(2); }, + 'Orange' : function() { setColour(3); }, + 'Yellow' : function() { setColour(4); }, + 'Green' : function() { setColour(5); }, + 'Blue' : function() { setColour(6); }, + 'Violet' : function() { setColour(7); }, + 'White' : function() { setColour(8); }\ }; E.showMenu(appMenu); From 3c5986b9869d197a53bbd3c1cb38bd271c4a5e00 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:06:26 +1300 Subject: [PATCH 105/114] Update app.js --- apps/slomoclock/app.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 8956f37b6..6afecc1fa 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -5,16 +5,17 @@ Mike Bennett mike[at]kereru.com 0.03 : Use Layout library */ -var v='0.06'; +var v='0.07'; // Colours const col = []; -col[1] = 0xF800; -col[2] = 0xFAE0; -col[3] = 0xF7E0; -col[4] = 0x4FE0; -col[5] = 0x019F; -col[6] = 0x681F; +col[2] = 0xF800; +col[3] = 0xFAE0; +col[4] = 0xF7E0; +col[5] = 0x4FE0; +col[6] = 0x019F; +col[7] = 0x681F; +col[8] = 0xFFFF; const colH = []; colH[0]= 0x001F; @@ -42,6 +43,9 @@ colH[21]= 0x981F; colH[22]= 0x681F; colH[23]= 0x301F; +// Colour incremented with every 10 sec timer event +var colNum = 0; + var Layout = require("Layout"); var layout = new Layout( { type:"h", c: [ @@ -60,14 +64,19 @@ var layout = new Layout( { function draw() { var date = new Date(); + // Surprise colours + colNum = (colNum+256)%65536; + // Update time var timeStr = require("locale").time(date,1); var hh = parseFloat(timeStr.substring(0,2)); layout.hour.label = timeStr.substring(0,2); layout.min.label = timeStr.substring(3,5); - layout.hour.col = cfg.colour==0 ? colH[hh] : col[cfg.colour]; - layout.min.col = cfg.colour==0 ? colH[hh] : col[cfg.colour]; + + // Mysterion (0) different colour each hour. Surprise (1) different colour every 10 secs. + layout.hour.col = cfg.colour==0 ? colH[hh] : cfg.colour==2 ? colNum : col[cfg.colour]; + layout.min.col = cfg.colour==0 ? colH[hh] : cfg.colour==2 ? colNum :col[cfg.colour]; // Update date layout.day.label = date.getDate(); From f826f9c2c47b171e57dc419120ddab90ed6e72fb Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:07:34 +1300 Subject: [PATCH 106/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index a354cde39..874ae3ae1 100644 --- a/apps.json +++ b/apps.json @@ -2920,7 +2920,7 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.06", + "version":"0.07", "description": "Simple 24h clock face with large digits, hour above minute. Uses Layout library.", "tags": "clock", "type":"clock", From 894676045954322c98bbf4dae81924119f9acb60 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:25:43 +1300 Subject: [PATCH 107/114] Update app.js --- apps/slomoclock/app.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 6afecc1fa..3bb67b0ca 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.03 : Use Layout library */ -var v='0.07'; +var v='0.08'; // Colours const col = []; @@ -45,6 +45,7 @@ colH[23]= 0x301F; // Colour incremented with every 10 sec timer event var colNum = 0; +var lastMin = -1; var Layout = require("Layout"); var layout = new Layout( { @@ -64,19 +65,21 @@ var layout = new Layout( { function draw() { var date = new Date(); - // Surprise colours - colNum = (colNum+256)%65536; - // Update time var timeStr = require("locale").time(date,1); var hh = parseFloat(timeStr.substring(0,2)); + var mm = parseFloat(timeStr.substring(3,5)); + + // Surprise colours + if ( lastMin != mm ) colNum = Math.floor(Math.random() * 24); + lastMin = mm; layout.hour.label = timeStr.substring(0,2); layout.min.label = timeStr.substring(3,5); // Mysterion (0) different colour each hour. Surprise (1) different colour every 10 secs. - layout.hour.col = cfg.colour==0 ? colH[hh] : cfg.colour==2 ? colNum : col[cfg.colour]; - layout.min.col = cfg.colour==0 ? colH[hh] : cfg.colour==2 ? colNum :col[cfg.colour]; + layout.hour.col = cfg.colour==0 ? colH[hh] : cfg.colour==2 ? colH[colNum] : col[cfg.colour]; + layout.min.col = cfg.colour==0 ? colH[hh] : cfg.colour==2 ? colH[colNum] :col[cfg.colour]; // Update date layout.day.label = date.getDate(); From d70a7eef542ab45f73d8eaeacc02b59fec975302 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:26:24 +1300 Subject: [PATCH 108/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 874ae3ae1..6e393b8aa 100644 --- a/apps.json +++ b/apps.json @@ -2920,7 +2920,7 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.07", + "version":"0.08", "description": "Simple 24h clock face with large digits, hour above minute. Uses Layout library.", "tags": "clock", "type":"clock", From 87c354e7b5572798ff4d579f30a804f3aa14315d Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:35:38 +1300 Subject: [PATCH 109/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 6e393b8aa..8aa251542 100644 --- a/apps.json +++ b/apps.json @@ -2920,7 +2920,7 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.08", + "version":"0.09", "description": "Simple 24h clock face with large digits, hour above minute. Uses Layout library.", "tags": "clock", "type":"clock", From 9d456a2c728e0426b9a06fe228632095d1b4b215 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:44:49 +1300 Subject: [PATCH 110/114] Update settings.js --- apps/slomoclock/settings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/slomoclock/settings.js b/apps/slomoclock/settings.js index e073dda7e..af67069dc 100644 --- a/apps/slomoclock/settings.js +++ b/apps/slomoclock/settings.js @@ -23,14 +23,14 @@ '': {'title': 'Colours'}, '< Back': function() { E.showMenu(appMenu); }, 'Mysterion' : function() { setColour(0); }, - 'Surprise' : function() { setColour(0); }, + 'Surprise' : function() { setColour(1); }, 'Red' : function() { setColour(2); }, 'Orange' : function() { setColour(3); }, 'Yellow' : function() { setColour(4); }, 'Green' : function() { setColour(5); }, 'Blue' : function() { setColour(6); }, 'Violet' : function() { setColour(7); }, - 'White' : function() { setColour(8); }\ + 'White' : function() { setColour(8); } }; E.showMenu(appMenu); From 0f23695bc671653943f9aaea7c7425635c8200e7 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:45:31 +1300 Subject: [PATCH 111/114] Update app.js --- apps/slomoclock/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 3bb67b0ca..8d830907e 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -78,8 +78,8 @@ function draw() { layout.min.label = timeStr.substring(3,5); // Mysterion (0) different colour each hour. Surprise (1) different colour every 10 secs. - layout.hour.col = cfg.colour==0 ? colH[hh] : cfg.colour==2 ? colH[colNum] : col[cfg.colour]; - layout.min.col = cfg.colour==0 ? colH[hh] : cfg.colour==2 ? colH[colNum] :col[cfg.colour]; + layout.hour.col = cfg.colour==0 ? colH[hh] : cfg.colour==1 ? colH[colNum] : col[cfg.colour]; + layout.min.col = cfg.colour==0 ? colH[hh] : cfg.colour==1 ? colH[colNum] :col[cfg.colour]; // Update date layout.day.label = date.getDate(); From c0f0ebbd60bed1d5a137b2204c4b0f3f531c2c92 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:45:50 +1300 Subject: [PATCH 112/114] Update app.js --- apps/slomoclock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/slomoclock/app.js b/apps/slomoclock/app.js index 8d830907e..e3933af1b 100644 --- a/apps/slomoclock/app.js +++ b/apps/slomoclock/app.js @@ -5,7 +5,7 @@ Mike Bennett mike[at]kereru.com 0.03 : Use Layout library */ -var v='0.08'; +var v='0.10'; // Colours const col = []; From f3168a43aab918d343a7a34b5b256e72f574bfe7 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:46:30 +1300 Subject: [PATCH 113/114] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 8aa251542..8c792a687 100644 --- a/apps.json +++ b/apps.json @@ -2920,7 +2920,7 @@ "name": "SloMo Clock", "shortName":"SloMo Clock", "icon": "watch.png", - "version":"0.09", + "version":"0.10", "description": "Simple 24h clock face with large digits, hour above minute. Uses Layout library.", "tags": "clock", "type":"clock", From 5eccc0ae0b3a5be62abd526067557b41ffe4e604 Mon Sep 17 00:00:00 2001 From: nujw Date: Mon, 25 Oct 2021 17:51:34 +1300 Subject: [PATCH 114/114] Update ChangeLog --- apps/slomoclock/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/slomoclock/ChangeLog b/apps/slomoclock/ChangeLog index c31405e08..cfab5da55 100644 --- a/apps/slomoclock/ChangeLog +++ b/apps/slomoclock/ChangeLog @@ -1 +1,2 @@ 0.01: Created app +0.10: Different colour schemes selectable in SloMo Clock settings.