diff --git a/apps.json b/apps.json index 611edb53a..1e2612fce 100644 --- a/apps.json +++ b/apps.json @@ -511,7 +511,7 @@ { "id": "gpsrec", "name": "GPS Recorder", "icon": "app.png", - "version":"0.23", + "version":"0.24", "interface": "interface.html", "description": "Application that allows you to record a GPS track. Can run in background", "tags": "tool,outdoors,gps,widget", @@ -687,7 +687,7 @@ { "id": "widbt", "name": "Bluetooth Widget", "icon": "widget.png", - "version":"0.05", + "version":"0.06", "description": "Show the current Bluetooth connection status in the top right of the clock", "tags": "widget,bluetooth,b2", "type":"widget", @@ -1316,7 +1316,7 @@ { "id": "widid", "name": "Bluetooth ID Widget", "icon": "widget.png", - "version":"0.02", + "version":"0.03", "description": "Display the last two tuple of your Bangle.js MAC address in the widget section. This is useful for figuring out which Bangle.js to connect to if you have more than one Bangle.js!", "tags": "widget,address,mac", "type":"widget", diff --git a/apps/gpsrec/ChangeLog b/apps/gpsrec/ChangeLog index 8d13df000..c91003914 100644 --- a/apps/gpsrec/ChangeLog +++ b/apps/gpsrec/ChangeLog @@ -25,3 +25,4 @@ 0.21: Fix issue where a period of 1s recorded every 2s, 5s every 6s, and so on 0.22: Ensure Bangle.setGPSPower uses 'gpsrec' as a tag 0.23: Fix issue where tracks wouldn't record when running from OpenStMap if a period hadn't been set up first +0.24: Better support for Bangle.js 2, avoid widget area for Graphs, smooth graphs more diff --git a/apps/gpsrec/app.js b/apps/gpsrec/app.js index 29594289d..164124257 100644 --- a/apps/gpsrec/app.js +++ b/apps/gpsrec/app.js @@ -102,7 +102,8 @@ function getTrackInfo(fn) { var lfactor = Math.cos(minLat*Math.PI/180); var ylen = (maxLat-minLat); var xlen = (maxLong-minLong)* lfactor; - var scale = xlen>ylen ? 200/xlen : 200/ylen; + var screenSize = g.getHeight()-48; // 24 for widgets, plus a border + var scale = xlen>ylen ? screenSize/xlen : screenSize/ylen; return { fn : fn, filename : filename, @@ -110,6 +111,7 @@ function getTrackInfo(fn) { records : nl, minLat : minLat, maxLat : maxLat, minLong : minLong, maxLong : maxLong, + lat : (minLat+maxLat)/2, lon : (minLong+maxLong)/2, lfactor : lfactor, scale : scale, duration : Math.round(duration/1000) @@ -180,16 +182,18 @@ function plotTrack(info) { getMapXY = osm.latLonToXY.bind(osm); } else { getMapXY = function(lat, lon) { "ram" - var ix = 30 + Math.round((long - info.minLong)*info.lfactor*info.scale); - var iy = 210 - Math.round((lat - info.minLat)*info.scale); - return {x:ix, y:iy}; + return {x:cx + Math.round((long - info.lon)*info.lfactor*info.scale), + y:cy + Math.round((info.lat - lat)*info.scale)}; } } E.showMenu(); // remove menu + E.showMessage("Drawing...","GPS Track "+info.fn); + g.flip(); // on buffered screens, draw a not saying we're busy + g.clear(1); var s = require("Storage"); var cx = g.getWidth()/2; - var cy = g.getHeight()/2; + var cy = 24 + (g.getHeight()-24)/2; g.setColor(1,0.5,0.5); g.setFont("Vector",16); g.drawString("Track"+info.fn.toString()+" - Loading",10,220); @@ -203,8 +207,8 @@ function plotTrack(info) { g.drawString("N",2,40); g.setColor(1,1,1); } else { - osm.lat = (info.minLat+info.maxLat)/2; - osm.lon = (info.minLong+info.maxLong)/2; + osm.lat = info.lat; + osm.lon = info.lon; osm.draw(); g.setColor(0, 0, 0); } @@ -251,7 +255,8 @@ function plotTrack(info) { g.drawString("Back",230,200); setWatch(function() { viewTrack(info.fn, info); - }, BTN3); + }, global.BTN3||BTN1); + Bangle.drawWidgets(); g.flip(); } @@ -260,8 +265,8 @@ function plotGraph(info, style) { E.showMenu(); // remove menu E.showMessage("Calculating...","GPS Track "+info.fn); var filename = getFN(info.fn); - var infn = new Float32Array(200); - var infc = new Uint16Array(200); + var infn = new Float32Array(80); + var infc = new Uint16Array(80); var title; var lt = 0; // last time var tn = 0; // count for each time period @@ -278,7 +283,7 @@ function plotGraph(info, style) { title = "Altitude (m)"; while(l!==undefined) { ++nl;c=l.split(","); - i = Math.round(200*(c[0]/1000 - strt)/dur); + i = Math.round(80*(c[0]/1000 - strt)/dur); infn[i]+=+c[3]; infc[i]++; l = f.readLine(f); @@ -289,7 +294,7 @@ function plotGraph(info, style) { var t,dx,dy,d,lt = c[0]/1000; while(l!==undefined) { ++nl;c=l.split(","); - i = Math.round(200*(c[0]/1000 - strt)/dur); + i = Math.round(80*(c[0]/1000 - strt)/dur); t = c[0]/1000; p = Bangle.project({lat:c[1],lon:c[2]}); dx = p.x-lp.x; @@ -320,9 +325,9 @@ function plotGraph(info, style) { // draw g.clear(1).setFont("6x8",1); var r = require("graph").drawLine(g, infn, { - x:4,y:0, + x:4,y:24, width: g.getWidth()-24, - height: g.getHeight()-8, + height: g.getHeight()-(24+8), axes : true, gridy : grid, gridx : 50, @@ -334,7 +339,7 @@ function plotGraph(info, style) { g.drawString("Back",230,200); setWatch(function() { viewTrack(info.fn, info); - }, BTN3); + }, global.BTN3||BTN1); g.flip(); } diff --git a/apps/widbt/ChangeLog b/apps/widbt/ChangeLog index e639f4044..4509487ac 100644 --- a/apps/widbt/ChangeLog +++ b/apps/widbt/ChangeLog @@ -2,3 +2,4 @@ 0.03: Ensure redrawing works with variable size widget system 0.04: Fix automatic update of Bluetooth connection status 0.05: Make Bluetooth widget thinner, and when on a bright theme use light grey for disabled color +0.06: Tweaking colors for dark/light themes and low bpp screens diff --git a/apps/widbt/widget.js b/apps/widbt/widget.js index 89a3cbdb8..a25d2c21c 100644 --- a/apps/widbt/widget.js +++ b/apps/widbt/widget.js @@ -2,9 +2,9 @@ function draw() { g.reset(); if (NRF.getSecurityStatus().connected) - g.setColor("#07f"); + g.setColor((g.getBPP()>8) ? "#07f" : (g.theme.dark ? "#0ff" : "#00f")); else - g.setColor(g.theme.bg ? "#AAA" : "#555"); + g.setColor(g.theme.dark ? "#666" : "#999"); g.drawImage(atob("CxQBBgDgFgJgR4jZMawfAcA4D4NYybEYIwTAsBwDAA=="),2+this.x,2+this.y); } function changed() { diff --git a/apps/widid/ChangeLog b/apps/widid/ChangeLog index 4152a8406..56f114d5f 100644 --- a/apps/widid/ChangeLog +++ b/apps/widid/ChangeLog @@ -1,2 +1,3 @@ 0.01: New Widget! 0.02: Tweaks for variable size widget system +0.03: Tweaking colors for dark/light themes diff --git a/apps/widid/widget.js b/apps/widid/widget.js index d4f4d6386..1c7a721bc 100644 --- a/apps/widid/widget.js +++ b/apps/widid/widget.js @@ -1,8 +1,7 @@ -/* jshint esversion: 6 */ (() => { function draw() { var id = NRF.getAddress().substr().substr(12).split(":"); - g.reset().setColor(0, 0.49, 1).setFont("6x8", 1); + g.reset().setColor(g.theme.dark ? "#0ff" : "#00f").setFont("6x8", 1); g.drawString(id[0], this.x+2, this.y+4, true); g.drawString(id[1], this.x+2, this.y+14, true); }