From b47b5f5a4f7184b662b6d1d4b187cf065720c7e7 Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 01:00:49 +0800 Subject: [PATCH 01/11] Update stopwatch.js --- apps/swatch/stopwatch.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/swatch/stopwatch.js b/apps/swatch/stopwatch.js index 6886bc697..dc79b34da 100644 --- a/apps/swatch/stopwatch.js +++ b/apps/swatch/stopwatch.js @@ -22,7 +22,12 @@ function updateLabels() { g.setFont("6x8",1); g.setFontAlign(-1,-1); for (var i in lapTimes) { - g.drawString(i+": "+timeToText(lapTimes[i]),10,timeY + 30 + i*8); + if (i<18) + {g.drawString(lapTimes.length-i+": "+timeToText(lapTimes[i]),8,timeY + 30 + i*8);} + else if (i<36) + {g.drawString(lapTimes.length-i+": "+timeToText(lapTimes[i]),80,timeY + 30 + (i-18)*8);} + else + {g.drawString(lapTimes.length-i+": "+timeToText(lapTimes[i]),152,timeY + 30 + (i-36)*8);} } drawsecs(); } From ad67db1a4abbcf51f1dd18c0c2e317e03cfb113c Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 01:07:24 +0800 Subject: [PATCH 02/11] Update stopwatch.js Made lap entries count up from 1 Made lap entries scroll to 2nd column after 18th entry to allow for 36 lap entries before scrolling off-screen --- apps/swatch/stopwatch.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/swatch/stopwatch.js b/apps/swatch/stopwatch.js index dc79b34da..ed087e66f 100644 --- a/apps/swatch/stopwatch.js +++ b/apps/swatch/stopwatch.js @@ -23,11 +23,9 @@ function updateLabels() { g.setFontAlign(-1,-1); for (var i in lapTimes) { if (i<18) - {g.drawString(lapTimes.length-i+": "+timeToText(lapTimes[i]),8,timeY + 30 + i*8);} - else if (i<36) - {g.drawString(lapTimes.length-i+": "+timeToText(lapTimes[i]),80,timeY + 30 + (i-18)*8);} - else - {g.drawString(lapTimes.length-i+": "+timeToText(lapTimes[i]),152,timeY + 30 + (i-36)*8);} + {g.drawString(lapTimes.length-i+": "+timeToText(lapTimes[i]),35,timeY + 30 + i*8);} + else + {g.drawString(lapTimes.length-i+": "+timeToText(lapTimes[i]),125,timeY + 30 + (i-18)*8);} } drawsecs(); } From 4696f7e4ecb557281727ec3569e9c0a3d8566cad Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 01:10:45 +0800 Subject: [PATCH 03/11] Create ChangeLog Changelog for updated Lap logging feature --- apps/swatch/ChangeLog | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 apps/swatch/ChangeLog diff --git a/apps/swatch/ChangeLog b/apps/swatch/ChangeLog new file mode 100644 index 000000000..86f584836 --- /dev/null +++ b/apps/swatch/ChangeLog @@ -0,0 +1,3 @@ +0.01 Original App +0.02 Lap log now counts up from 1 + Lap log now scrolls into 2nd column after 18th entry, able to display 36 entries before going off screen From 30912d6825d9efe1f800cd1a00c8eedc5a040e07 Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 01:13:27 +0800 Subject: [PATCH 04/11] Update apps.json Updated Stopwatch app version --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 15acb3b20..44a30c1f9 100644 --- a/apps.json +++ b/apps.json @@ -355,7 +355,7 @@ { "id": "swatch", "name": "Stopwatch", "icon": "stopwatch.png", - "version":"0.01", + "version":"0.02", "description": "Simple stopwatch with Lap Time recording", "tags": "health", "allow_emulator":true, From 2c5983e3c14ed57161708c4b0af2a2500d6880c3 Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 11:07:14 +0800 Subject: [PATCH 05/11] Update stopwatch.js - Remove ability to lap while stopped - Added ability to save log of laps as dated json array while stopped --- apps/swatch/stopwatch.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/swatch/stopwatch.js b/apps/swatch/stopwatch.js index ed087e66f..ac1cc0d5b 100644 --- a/apps/swatch/stopwatch.js +++ b/apps/swatch/stopwatch.js @@ -4,6 +4,7 @@ var started = false; var timeY = 60; var hsXPos = 0; var lapTimes = []; +var saveTimes = []; var displayInterval; function timeToText(t) { @@ -18,7 +19,7 @@ function updateLabels() { g.setFontAlign(0,0,3); g.drawString(started?"STOP":"GO",230,120); if (!started) g.drawString("RESET",230,50); - g.drawString("LAP",230,190); + g.drawString(started?"LAP":"SAVE",230,190); g.setFont("6x8",1); g.setFontAlign(-1,-1); for (var i in lapTimes) { @@ -50,6 +51,11 @@ function drawms() { g.clearRect(hsXPos,timeY,220,timeY+20); g.drawString("."+("0"+hs).substr(-2),hsXPos,timeY+10); } +function saveconvert() { + for (var v in lapTimes){ + saveTimes[v]=v+1+"-"+timeToText(lapTimes[(lapTimes.length-1)-v]); + } +} setWatch(function() { // Start/stop started = !started; @@ -85,6 +91,12 @@ setWatch(function() { // Lap if (started) tCurrent = Date.now(); lapTimes.unshift(tCurrent-tStart); tStart = tCurrent; + if (!started) + { + var timenow= Date(); + saveconvert(); + require("Storage").writeJSON("StpWch-"+timenow.toString(), saveTimes); + } updateLabels(); }, BTN3, {repeat:true}); From 661eaa7c3a02127a8fd46ada3b058c2db4970a30 Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 11:57:32 +0800 Subject: [PATCH 06/11] Update ChangeLog --- apps/swatch/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/swatch/ChangeLog b/apps/swatch/ChangeLog index 86f584836..119333d94 100644 --- a/apps/swatch/ChangeLog +++ b/apps/swatch/ChangeLog @@ -1,3 +1,4 @@ 0.01 Original App 0.02 Lap log now counts up from 1 Lap log now scrolls into 2nd column after 18th entry, able to display 36 entries before going off screen +0.03 Added ability to save Lap log as a date named JSON file into memory From 72d0de30a52fe7490010d1e02de493eb0e96edc5 Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 11:58:14 +0800 Subject: [PATCH 07/11] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 44a30c1f9..a8083c619 100644 --- a/apps.json +++ b/apps.json @@ -355,7 +355,7 @@ { "id": "swatch", "name": "Stopwatch", "icon": "stopwatch.png", - "version":"0.02", + "version":"0.03", "description": "Simple stopwatch with Lap Time recording", "tags": "health", "allow_emulator":true, From be539e59932c7627cf91e3709082fbc709ce8a7d Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 12:12:22 +0800 Subject: [PATCH 08/11] Update stopwatch.js -Swapped functions of BN1 and BN3 --- apps/swatch/stopwatch.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/swatch/stopwatch.js b/apps/swatch/stopwatch.js index ac1cc0d5b..73cf0adfc 100644 --- a/apps/swatch/stopwatch.js +++ b/apps/swatch/stopwatch.js @@ -18,8 +18,8 @@ function updateLabels() { g.setFont("6x8",2); g.setFontAlign(0,0,3); g.drawString(started?"STOP":"GO",230,120); - if (!started) g.drawString("RESET",230,50); - g.drawString(started?"LAP":"SAVE",230,190); + if (!started) g.drawString("RESET",230,190); + g.drawString(started?"LAP":"SAVE",230,50); g.setFont("6x8",1); g.setFontAlign(-1,-1); for (var i in lapTimes) { @@ -78,14 +78,6 @@ setWatch(function() { // Start/stop drawms(); }, 20); }, BTN2, {repeat:true}); -setWatch(function() { // Reset - Bangle.beep(); - if (!started) { - tStart = tCurrent = Date.now(); - } - lapTimes = []; - updateLabels(); -}, BTN1, {repeat:true}); setWatch(function() { // Lap Bangle.beep(); if (started) tCurrent = Date.now(); @@ -98,6 +90,14 @@ setWatch(function() { // Lap require("Storage").writeJSON("StpWch-"+timenow.toString(), saveTimes); } updateLabels(); +}, BTN1, {repeat:true}); +setWatch(function() { // Reset + Bangle.beep(); + if (!started) { + tStart = tCurrent = Date.now(); + } + lapTimes = []; + updateLabels(); }, BTN3, {repeat:true}); updateLabels(); From 06b98f0043e99446c5c77b82b3d974ff38fa2c56 Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 12:14:40 +0800 Subject: [PATCH 09/11] Update stopwatch.js Fixed bug where one could reset lap log even though timer is running --- apps/swatch/stopwatch.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/swatch/stopwatch.js b/apps/swatch/stopwatch.js index 73cf0adfc..d4136d8ed 100644 --- a/apps/swatch/stopwatch.js +++ b/apps/swatch/stopwatch.js @@ -92,11 +92,11 @@ setWatch(function() { // Lap updateLabels(); }, BTN1, {repeat:true}); setWatch(function() { // Reset - Bangle.beep(); if (!started) { - tStart = tCurrent = Date.now(); - } + Bangle.beep(); + tStart = tCurrent = Date.now(); lapTimes = []; + } updateLabels(); }, BTN3, {repeat:true}); From 7bbc2e7eb14b4101d3b2f67b765f3eebd6c98959 Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 12:21:58 +0800 Subject: [PATCH 10/11] Update ChangeLog --- apps/swatch/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/swatch/ChangeLog b/apps/swatch/ChangeLog index 119333d94..d907766c1 100644 --- a/apps/swatch/ChangeLog +++ b/apps/swatch/ChangeLog @@ -2,3 +2,4 @@ 0.02 Lap log now counts up from 1 Lap log now scrolls into 2nd column after 18th entry, able to display 36 entries before going off screen 0.03 Added ability to save Lap log as a date named JSON file into memory + Fixed bug from 0.01 where BN1 (reset) could clear the lap log when timer is running From 11bf84f583bf8b4a00dfdb9d74d46b3067786fc3 Mon Sep 17 00:00:00 2001 From: Red-The-Hunter <62763030+Red-The-Hunter@users.noreply.github.com> Date: Sat, 28 Mar 2020 16:03:37 +0800 Subject: [PATCH 11/11] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index a8083c619..0cdd8fd3b 100644 --- a/apps.json +++ b/apps.json @@ -356,7 +356,7 @@ "name": "Stopwatch", "icon": "stopwatch.png", "version":"0.03", - "description": "Simple stopwatch with Lap Time recording", + "description": "Simple stopwatch with Lap Time logging to a JSON file", "tags": "health", "allow_emulator":true, "storage": [