From 81252d1dc6bf056b52d92d07f19a3088b29f2a46 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 10 Nov 2021 14:55:08 +0000 Subject: [PATCH] recorder 0.03: Fix theme and maps/graphing if no GPS --- apps.json | 2 +- apps/recorder/ChangeLog | 1 + apps/recorder/app.js | 64 ++++++++++++++++++++---------------- apps/recorder/interface.html | 8 ++--- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/apps.json b/apps.json index a09997f7d..89d06093a 100644 --- a/apps.json +++ b/apps.json @@ -657,7 +657,7 @@ "id": "recorder", "name": "Recorder (BETA)", "shortName": "Recorder", - "version": "0.02", + "version": "0.03", "description": "Record GPS position, heart rate and more in the background, then download to your PC.", "icon": "app.png", "tags": "tool,outdoors,gps,widget", diff --git a/apps/recorder/ChangeLog b/apps/recorder/ChangeLog index bf90d0384..2ea6e9fa8 100644 --- a/apps/recorder/ChangeLog +++ b/apps/recorder/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02: Use 'recorder.log..' rather than 'record.log..' Fix interface.html +0.03: Fix theme and maps/graphing if no GPS diff --git a/apps/recorder/app.js b/apps/recorder/app.js index ac3e391fc..d29959e25 100644 --- a/apps/recorder/app.js +++ b/apps/recorder/app.js @@ -140,10 +140,10 @@ function getTrackInfo(filename) { } // pushed this loop together to try and bump loading speed a little while(l!==undefined) { - ++nl;c=l.split(","); + ++nl;c=l.split(",");l = f.readLine(f); + if (c[latIdx]=="")continue; n = +c[latIdx];if(n>maxLat)maxLat=n;if(nmaxLong)maxLong=n;if(n 100) { g.flip();i=0; } } - g.setColor(1,0,0); + g.setColor("#f00"); g.fillCircle(ox,oy,5); - if (info.qOSTM) g.setColor(0, 0, 0); - else g.setColor(1,1,1); + if (info.qOSTM) g.setColor("#000"); + else g.setColor(g.theme.fg); g.drawString(require("locale").distance(dist),120,220); g.setFont("6x8",2); g.setFontAlign(0,0,3); @@ -340,16 +340,22 @@ function plotGraph(info, style) { title = "Altitude (m)"; var altIdx = info.fields.indexOf("Altitude"); while(l!==undefined) { - ++nl;c=l.split(","); + ++nl;c=l.split(",");l = f.readLine(f); + if (c[altIdx]=="") continue; i = Math.round(80*(c[timeIdx] - strt)/dur); infn[i]+=+c[altIdx]; infc[i]++; - l = f.readLine(f); } } else if (style=="Speed") { title = "Speed (m/s)"; var latIdx = info.fields.indexOf("Latitude"); var lonIdx = info.fields.indexOf("Longitude"); + // skip until we find our first data + while(l!==undefined && c[latIdx]=="") { + c = l.split(","); + l = f.readLine(f); + } + // now iterate var p,lp = Bangle.project({lat:c[1],lon:c[2]}); var t,dx,dy,d,lt = c[timeIdx]; while(l!==undefined) { diff --git a/apps/recorder/interface.html b/apps/recorder/interface.html index eca13d263..ad0de4887 100644 --- a/apps/recorder/interface.html +++ b/apps/recorder/interface.html @@ -62,7 +62,7 @@ function saveGPX(track, title) { - + ${title} @@ -74,9 +74,7 @@ function saveGPX(track, title) { - ${pt.Heartrate ? `${pt.Heartrate}`:``} - ${""/*...*/} - ${""/* 65 */} + ${pt.Heartrate ? `${pt.Heartrate}`:``}${""/*...65*/} `; @@ -189,7 +187,7 @@ ${trackData.Latitude ? ` width="100%" height="250" frameborder="0" style="border:0" - src="https://www.google.com/maps/embed/v1/place?key=AIzaSyBxTcwrrVOh2piz7EmIs1Xn4FsRxJWeVH4&q=${track.lat},${track.lon}&zoom=10" allowfullscreen> + src="https://www.google.com/maps/embed/v1/place?key=AIzaSyBxTcwrrVOh2piz7EmIs1Xn4FsRxJWeVH4&q=${trackData.Latitude},${trackData.Longitude}&zoom=10" allowfullscreen>
` : `
No GPS info
`}