From ba4eab2a3ea90b44d9729c4e210683f5dc9bd7ea Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 15 Oct 2020 13:53:42 +0100 Subject: [PATCH 01/10] add docs re #454 --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 688518bb0..c9322b12a 100644 --- a/apps.json +++ b/apps.json @@ -1941,7 +1941,7 @@ "shortName":"Vertical Face", "icon": "app.png", "version":"0.06", - "description": "A simple vertical watch face with the date.", + "description": "A simple vertical watch face with the date. Heart rate monitor is toggled with BTN1", "tags": "clock", "type":"clock", "allow_emulator":true, From 315e7c6bc133f1a2c2ab362e16f7c5dc38e0b7b8 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 15 Oct 2020 14:09:45 +0100 Subject: [PATCH 02/10] simpletimer: Fix buzz error, remove '+' when timer running and add 'back' text (fix #577) --- apps.json | 2 +- apps/simpletimer/ChangeLog | 1 + apps/simpletimer/app.js | 21 ++++++++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps.json b/apps.json index c9322b12a..3cafdae78 100644 --- a/apps.json +++ b/apps.json @@ -1718,7 +1718,7 @@ "id": "simpletimer", "name": "Timer", "icon": "app.png", - "version": "0.05", + "version": "0.06", "description": "Simple timer, useful when playing board games or cooking", "tags": "timer", "readme": "README.md", diff --git a/apps/simpletimer/ChangeLog b/apps/simpletimer/ChangeLog index e548d90fa..0a0d47126 100644 --- a/apps/simpletimer/ChangeLog +++ b/apps/simpletimer/ChangeLog @@ -3,3 +3,4 @@ 0.03: BTN2 to open launcher 0.04: Remember last set time 0.05: Fix buzz that doesn't stop (fix #521) +0.06: Fix buzz error, remove '+' when timer running and add 'back' text (fix #577) diff --git a/apps/simpletimer/app.js b/apps/simpletimer/app.js index 75c118980..f6332a8b7 100644 --- a/apps/simpletimer/app.js +++ b/apps/simpletimer/app.js @@ -1,6 +1,6 @@ let counter = 0; let setValue = 0; -let counterInterval; +let counterInterval, alarmInterval; let state; let saved = require("Storage").readJSON("simpletimer.json",true) || {}; @@ -19,7 +19,8 @@ function outOfTime() { g.drawString("Time UP!", 120, 50); counter = setValue; buzzAndBeep(); - setInterval(() => { + if (alarmInterval) clearInterval(alarmInterval); + alarmInterval = setInterval(() => { g.clearRect(0, 70, 220, 160); setTimeout(draw, 200); }, 400); @@ -55,7 +56,9 @@ function countDown() { } function clearIntervals() { - clearInterval(); + if (alarmInterval) clearInterval(alarmInterval); + if (counterInterval) clearInterval(counterInterval); + alarmInterval = undefined; counterInterval = undefined; } @@ -93,16 +96,21 @@ const stateMap = { function changeState() { if (stateMap[state]) stateMap[state](); + drawLabels(); + draw(); } function drawLabels() { g.clear(); g.setFontAlign(-1, 0); g.setFont("6x8", 7); - g.drawString(`+ +`, 35, 180); + if (state != "started") // only when not runnung + g.drawString(`+ +`, 35, 180); g.setFontAlign(0, 0, 3); g.setFont("6x8", 1); - g.drawString(`reset (re)start`, 230, 120); + g.drawString("Reset (re)start", 230, 120); + if (state != "started") // only when not runnung + g.drawString("Back", 230, 120); } function resetTimer(value) { @@ -130,8 +138,7 @@ function addWatch() { { repeat: false, edge: "falling", - }, - ); + }); setWatch( () => { resetTimer(0); From 326db60aada6df7c402e34516a232671f5340c64 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 15 Oct 2020 17:22:43 +0100 Subject: [PATCH 03/10] Added customised welcome screen - christmas only for now --- apps.json | 18 +++ apps/mywelcome/ChangeLog | 13 ++ apps/mywelcome/app-icon.js | 1 + apps/mywelcome/app.js | 298 +++++++++++++++++++++++++++++++++++++ apps/mywelcome/app.png | Bin 0 -> 1939 bytes apps/mywelcome/boot.js | 9 ++ apps/mywelcome/custom.html | 78 ++++++++++ apps/mywelcome/settings.js | 18 +++ 8 files changed, 435 insertions(+) create mode 100644 apps/mywelcome/ChangeLog create mode 100644 apps/mywelcome/app-icon.js create mode 100644 apps/mywelcome/app.js create mode 100644 apps/mywelcome/app.png create mode 100644 apps/mywelcome/boot.js create mode 100644 apps/mywelcome/custom.html create mode 100644 apps/mywelcome/settings.js diff --git a/apps.json b/apps.json index 3cafdae78..5939740ef 100644 --- a/apps.json +++ b/apps.json @@ -118,6 +118,24 @@ {"name":"welcome.json"} ] }, + { "id": "mywelcome", + "name": "Customised Welcome", + "shortname": "My Welcome", + "icon": "app.png", + "version":"0.09", + "description": "Appears at first boot and explains how to use Bangle.js. Like 'Welcome', but can be customised with a greeting", + "tags": "start,welcome", + "custom":"custom.html", + "storage": [ + {"name":"mywelcome.boot.js","url":"boot.js"}, + {"name":"mywelcome.app.js","url":"app.js"}, + {"name":"mywelcome.settings.js","url":"settings.js"}, + {"name":"mywelcome.img","url":"app-icon.js","evaluate":true} + ], + "data": [ + {"name":"mywelcome.json"} + ] + }, { "id": "gbridge", "name": "Gadgetbridge", "icon": "app.png", diff --git a/apps/mywelcome/ChangeLog b/apps/mywelcome/ChangeLog new file mode 100644 index 000000000..9545dbbfa --- /dev/null +++ b/apps/mywelcome/ChangeLog @@ -0,0 +1,13 @@ +0.01: New App! +0.02: Animate balloon intro +0.03: BTN3 now won't restart when at the end +0.04: Fix regression after tweaks to Storage.readJSON +0.05: Move configuration into App/widget settings +0.06: Move loader into welcome.boot.js +0.07: Run again when updated + Don't run again when settings app is updated (or absent) + Add "Run Now" option to settings +0.08: Don't overwrite existing settings on app update +0.09: Allow welcome to run after a fresh install + More useful app menu + BTN2 now goes to menu on release diff --git a/apps/mywelcome/app-icon.js b/apps/mywelcome/app-icon.js new file mode 100644 index 000000000..5c1373e17 --- /dev/null +++ b/apps/mywelcome/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+AH4A/AH4AU5gAEFtoxnEwXN53WAAXO5oJB42Wy26AAIueFoPXFggAD4AwEGTQiB6otBFgwAD3QvFGC5dCFxiRGGClhrdbv67BXAIuLMBIwPsIABF4OpLwXOFxjBCF6gtBw2r1mHXoXWFxqQWFwOH62rL4IeB6xeOAAIvHGBYuC6+rR4QvCXpovXw3X1i/DR4QuPR5AvKFQOs6+GF4eod4IvPd5AvLwvWLwQvCv4fBR54vURwOHF4iQCX0yOCF4aQBX0QvHSAoAN3SOSd4WyF4yQPLyhgD1YvDMCJeIFxhgCF47BN4BeHFxpgDSAiRORpAuPMIYAFGBYuaF5aSHFwQvEFqQwOeggSBLa4xNF4X+4wAC/xeCFjIADrYwGBIIvlMQiPDBAOk0gDBz2XF8BlEF4eIxADFF8lcF9n+wIrFF05bHF9AsGF9wupGAYv/F8QupGAov/F/4wOF1gA/AH4Ap")) diff --git a/apps/mywelcome/app.js b/apps/mywelcome/app.js new file mode 100644 index 000000000..fcd193ce2 --- /dev/null +++ b/apps/mywelcome/app.js @@ -0,0 +1,298 @@ +// exec each function from seq one after the other +function animate(seq,period) { + var i = setInterval(function() { + if (seq.length) { + var f = seq.shift(); + if (f) f(); + } else clearInterval(i); + },period); +} + +// Fade in to FG color with angled lines +function fade(callback) { + var n = 0; + function f() { + for (var i=n;i<240;i+=10) { + g.drawLine(i,0,0,i); + g.drawLine(i,240,240,i); + } + g.flip(); + n++; + if (n<10) setTimeout(f,0); + else callback(); + } + f(); +} + + +var scenes = [ + function() { + g.clear(1); + eval(require("Storage").read("mywelcome.custom.js")); + },function() { + g.clear(1); + g.setFont("4x6",2); + var n=0; + var i = setInterval(function() { + n+=0.04; + g.setColor(n,n,n); + g.drawImage(Bangle.getLogo(),(240-222)/2,(240-100)/2); + if (n>=1) { + clearInterval(i); + setTimeout(()=>g.drawString("Open",34,144), 500); + setTimeout(()=>g.drawString("Hackable",34,156), 1000); + setTimeout(()=>g.drawString("Smart Watch",34,168), 1500); + } + },50); + },function() { + var img = require("heatshrink").decompress(atob("ptRxH+qYAfvl70mj5gAC0ekvd8FkAAdz3HJAYAH4+eJXWkJJYAF0hK2vfNJaIAB5t7S3fN5/V6wAD6vOTg9SumXy2W3QAB3eXul2JdnO63XAApPEVYvAJQIACJoRQDzBLoJQ3W5/NIwr4GJohMFAAROgJYvVJQiPG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AFJgjl/TQpBBI4jl/AAN8TQhHDcv4ADcJBMDvpM+IYaeDAAhL+qd9SgycEJn7iEAA18Jf7nEcv4AIrJLIcv6aMcv4ADvhMHrJJ/AAbl/c6ZM/AAt9cv7nSIv7nLcv4AHrLl/TRpJBvgnjA==")); + g.reset(); + g.setColor("#6633ff"); + g.setBgColor("#6633ff"); + var y = 240, speed = 5; + function balloon(callback) { + y-=speed; + var x = (240-77)/2; + g.drawImage(img,x,y); + g.clearRect(x,y+81,x+77,y+81+speed); + if (y>60) setTimeout(balloon,0,callback); + else callback(); + } + fade(function() { + balloon(function() { + g.setColor(-1); + g.setFont("6x8",3); + g.setFontAlign(0,0); + g.drawString("Welcome.",120,160); + }); + }); + setTimeout(function() { + var n=0; + var i = setInterval(function() { + n+=5; + g.scroll(0,-5); + if (n>170) + clearInterval(i); + },20); + },3500); + + },function() { + g.reset(); + g.setBgColor("#ffa800");g.clear(); + g.setFont("6x8",2); + g.setFontAlign(0,0); + var x = 80, y = 35, h=35; + animate([ + ()=>g.drawString("Your",x,y+=h), + ()=>g.drawString("Bangle.js",x,y+=h), + ()=>g.drawString("has",x,y+=h), + ()=>g.drawString("3 buttons",x,y+=h), + ()=>{g.setFont("Vector",36);g.drawString("1",200,40);}, + ()=>g.drawString("2",200,120), + ()=>g.drawString("3",200,200) + ],200); + }, + function() { + g.reset(); + g.setBgColor("#00a8ff");g.clear(); + g.setFontAlign(0,0); + g.setFont("Vector",48); + g.drawString("1",200,40); + g.setFontAlign(-1,-1); + g.setFont("6x8",2); + g.drawString("Move up\nin menus\n\nTurn Bangle.js on\nif it was off", 20,40); + }, + function() { + g.reset(); + g.setBgColor("#00a8ff");g.clear(); + g.setFontAlign(0,0); + g.setFont("Vector",48); + g.drawString("2",200,120); + g.setFontAlign(-1,-1); + g.setFont("6x8",2); + g.drawString("Select menu\nitem\n\nLaunch app\nwhen watch\nis showing", 20,70); + }, + function() { + g.reset(); + g.setBgColor("#00a8ff");g.clear(); + g.setFontAlign(0,0); + g.setFont("Vector",48); + g.drawString("3",200,200); + g.setFontAlign(-1,-1); + g.setFont("6x8",2); + g.drawString("Move down\nin menus\n\nLong press\nto exit app\nand go back\nto clock", 20,100); + }, + function() { + g.reset(); + g.setBgColor("#ff3300");g.clear(); + g.setFontAlign(0,0); + g.setFont("Vector",48); + g.drawString("1",200,40); + g.drawString("2",200,120); + g.setFontAlign(-1,-1); + g.setFont("6x8",2); + g.drawString("If Bangle.js\never stops,\nhold buttons\n1 and 2 for\naround six\nseconds.\n\n\n\nBangle.js will\nthen reboot.", 20,20); + }, + function() { + g.reset(); + g.setBgColor("#00a8ff");g.clear(); + g.setFont("6x8",2); + g.setFontAlign(0,0); + var x = 120, y = 10, h=21; + animate([ + ()=>{g.drawString("Bangle.js has a",x,y+=h); + g.drawString("simple touchscreen",x,y+=h);}, + 0,0, + ()=>{g.drawString("It'll detect touch",x,y+=h*2); + g.drawString("on left and right",x,y+=h);}, + 0,0, + ()=>{g.drawString("Horizontal swipes",x,y+=h*2); + g.drawString("work too. Try now",x,y+=h); + g.drawString("to change page.",x,y+=h);} + ],300); + }, + function() { + g.reset(); + g.setBgColor("#339900");g.clear(); + g.setFont("6x8",2); + g.setFontAlign(0,0); + var x = 120, y = 10, h=21; + animate([ + ()=>{g.drawString("Bangle.js",x,y+=h); + g.drawString("comes with",x,y+=h); + g.drawString("a few simple",x,y+=h); + g.drawString("apps installed",x,y+=h);}, + 0,0, + ()=>{g.drawString("To add more, visit",x,y+=h*2); + g.drawString("banglejs.com/apps",x,y+=h); + g.drawString("with a Bluetooth",x,y+=h); + g.drawString("capable device",x,y+=h);}, + ],400); + }, + function() { + g.reset(); + g.setBgColor("#990066");g.clear(); + g.setFont("6x8",2); + g.setFontAlign(0,0); + var x = 120, y = 10, h=21; + g.drawString("You can also make",x,y+=h); + g.drawString("your own apps!",x,y+=h); + y=160; + g.drawString("Check out",x,y+=h); + g.drawString("banglejs.com",x,y+=h); + + var rx = 0, ry = 0; + var h = Graphics.createArrayBuffer(96,96,1,{msb:true}); + // draw a cube + function draw() { + // rotate + rx += 0.1; + ry += 0.11; + var rcx=Math.cos(rx), + rsx=Math.sin(rx), + rcy=Math.cos(ry), + rsy=Math.sin(ry); + // Project 3D coordinates into 2D + function p(x,y,z) { + var t; + t = x*rcy + z*rsy; + z = z*rcy - x*rsy; + x=t; + t = y*rcx + z*rsx; + z = z*rcx - y*rsx; + y=t; + z += 4; + return [96*(0.5+x/z), 96*(0.5+y/z)]; + } + + var a; + // draw a series of lines to make up our cube + h.clear(); + a = p(-1,-1,-1); h.moveTo(a[0],a[1]); + a = p(1,-1,-1); h.lineTo(a[0],a[1]); + a = p(1,1,-1); h.lineTo(a[0],a[1]); + a = p(-1,1,-1); h.lineTo(a[0],a[1]); + a = p(-1,-1,-1); h.lineTo(a[0],a[1]); + a = p(-1,-1,1); h.moveTo(a[0],a[1]); + a = p(1,-1,1); h.lineTo(a[0],a[1]); + a = p(1,1,1); h.lineTo(a[0],a[1]); + a = p(-1,1,1); h.lineTo(a[0],a[1]); + a = p(-1,-1,1); h.lineTo(a[0],a[1]); + a = p(-1,-1,-1); h.moveTo(a[0],a[1]); + a = p(-1,-1,1); h.lineTo(a[0],a[1]); + a = p(1,-1,-1); h.moveTo(a[0],a[1]); + a = p(1,-1,1); h.lineTo(a[0],a[1]); + a = p(1,1,-1); h.moveTo(a[0],a[1]); + a = p(1,1,1); h.lineTo(a[0],a[1]); + a = p(-1,1,-1); h.moveTo(a[0],a[1]); + a = p(-1,1,1); h.lineTo(a[0],a[1]); + g.drawImage({width:96,height:96,buffer:h.buffer},(240-96)/2,68); + } + + setInterval(draw,50); + }, + function() { + g.reset(); + g.setBgColor("#660099");g.clear(); + g.setFontAlign(0,0); + g.setFont("Vector",36); + g.drawString("2",200,120); + g.setFont("6x8",2); + + var x = 90, y = 30, h=21; + animate([ + ()=>g.drawString("That's it!",x,y+=h), + ()=>{g.drawString("Press",x,y+=h*3); + g.drawString("Button 2",x,y+=h); + g.drawString("to start",x,y+=h); + g.drawString("Bangle.js",x,y+=h);} + ],400); + } +]; + +var sceneNumber = 0; + +function move(dir) { + if (dir>0 && sceneNumber+1 == scenes.length) return; // at the end + sceneNumber = (sceneNumber+dir)%scenes.length; + if (sceneNumber<0) sceneNumber=0; + clearInterval(); + Bangle.setLCDMode(); + g.clear(); + scenes[sceneNumber](); + if (sceneNumber>1) { + var l = scenes.length; + for (var i=0;imove(1), BTN3, {repeat:true}); +setWatch(()=>{ + // If we're on the last page + if (sceneNumber == scenes.length-1) { + load(); + } +}, BTN2, {repeat:true,edge:"falling"}); +setWatch(()=>move(-1), BTN1, {repeat:true}); + +Bangle.setLCDTimeout(0); +Bangle.setLCDPower(1); +move(0); diff --git a/apps/mywelcome/app.png b/apps/mywelcome/app.png new file mode 100644 index 0000000000000000000000000000000000000000..ebbf254bd7c3546e8337c97648a7eb56747c81ac GIT binary patch literal 1939 zcmV;E2WP)^Vse?M*ABwfS z8MZ{CGrE{9Te8V!(51`XGM!;roJ%xW2E^g2NO{qXsim}(VOBaof>d5Dolx3xFQxb1 z-nZxMkEd_+KDRC9c8eL`e{OQldCvKM@9+H1@Ao`#6F2ey4asCOZNf#^U4iltNGVVP zD9{Fa2%!dFY=)EdIoSdkU1+ff<1#70}x@Hu6Kz{*xG?E@iS0CV6Z_UXTXX+c`#EfepLM z7bkj*!-~A7=*pg+Sbi*K%7RHf4giWO!Qq3`KOGl&fb97ejd1$m`W-Ff7CVP?6!NP@ z*#dZSJOwP6bwBxEm_^gcdS*L+X9eY#LFhPi?iv?)0Qct&s7(@2rVYtLc?9_Na7Wq| z*s!a7VL$mhO77$FB^z-&y=>gMfp-sY$1lBBpl3RC?8G{+#s}vNi$-#!6vBPB&)OMR zSFd&$bZt`bEWGtWzIxkQ4xXu@;q+gK#Us}SYaD|6$H%;%Ti;I9kp;}PGuy7fJm2Nj z3iFC{=TP>!hdI^J%>L8W066-F^;LCQ!M&eAbbP(vkK`q5{1_wcNTtxuZ2ySr8h}N& zRszc2md$8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7V#$X$n89sf7V!{MeE?v?nqF**mb8fyw8z-vHP29u{ Z;y>o9o!*JS4-fzV002ovPDHLkV1gG+pke?3 literal 0 HcmV?d00001 diff --git a/apps/mywelcome/boot.js b/apps/mywelcome/boot.js new file mode 100644 index 000000000..84d235bc5 --- /dev/null +++ b/apps/mywelcome/boot.js @@ -0,0 +1,9 @@ +(function() { + let s = require('Storage').readJSON('mywelcome.json', 1) || {}; + if (!s.welcomed) { + setTimeout(() => { + require('Storage').write('mywelcome.json', {welcomed: true}) + load('mywelcome.app.js') + }) + } +})() diff --git a/apps/mywelcome/custom.html b/apps/mywelcome/custom.html new file mode 100644 index 000000000..87713e7a2 --- /dev/null +++ b/apps/mywelcome/custom.html @@ -0,0 +1,78 @@ + + + + + + +

Line 1:

+

Line 2:

+

Line 3 (smaller):

+

Line 4 (smaller):

+

+

+

This is currently Christmas-themed, but more themes will be added in the future.

+ + + + + + diff --git a/apps/mywelcome/settings.js b/apps/mywelcome/settings.js new file mode 100644 index 000000000..cf7208d65 --- /dev/null +++ b/apps/mywelcome/settings.js @@ -0,0 +1,18 @@ +(function(back) { + let settings = require('Storage').readJSON('mywelcome.json', 1) + || require('Storage').readJSON('setting.json', 1) || {} + E.showMenu({ + '': { 'title': 'Welcome App' }, + 'Run next boot': { + value: !settings.welcomed, + format: v => v ? 'Yes' : 'No', + onchange: v => require('Storage').write('mywelcome.json', {welcomed: !v}), + }, + 'Run Now': () => load('mywelcome.app.js'), + 'Turn off & run next': () => { + require('Storage').write('mywelcome.json', {welcomed: false}); + Bangle.off(); + }, + '< Back': back, + }) +}) From 624bc9d6044e054503ef73ee74ae5008cff714a3 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 15 Oct 2020 17:36:22 +0100 Subject: [PATCH 04/10] minor tweaks --- apps/mywelcome/app.js | 14 +++++++------- apps/mywelcome/custom.html | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/mywelcome/app.js b/apps/mywelcome/app.js index fcd193ce2..23cdd0d49 100644 --- a/apps/mywelcome/app.js +++ b/apps/mywelcome/app.js @@ -9,12 +9,12 @@ function animate(seq,period) { } // Fade in to FG color with angled lines -function fade(callback) { +function fade(col, callback) { var n = 0; function f() { + g.setColor(col); for (var i=n;i<240;i+=10) { - g.drawLine(i,0,0,i); - g.drawLine(i,240,240,i); + g.drawLine(i,0,0,i).drawLine(i,240,240,i); } g.flip(); n++; @@ -27,6 +27,7 @@ function fade(callback) { var scenes = [ function() { + console.log("Start app"); g.clear(1); eval(require("Storage").read("mywelcome.custom.js")); },function() { @@ -47,7 +48,6 @@ var scenes = [ },function() { var img = require("heatshrink").decompress(atob("ptRxH+qYAfvl70mj5gAC0ekvd8FkAAdz3HJAYAH4+eJXWkJJYAF0hK2vfNJaIAB5t7S3fN5/V6wAD6vOTg9SumXy2W3QAB3eXul2JdnO63XAApPEVYvAJQIACJoRQDzBLoJQ3W5/NIwr4GJohMFAAROgJYvVJQiPGABZNN3bsdvYyESwnWJSIAC3RNM3V1JjZAES4nVJSYAB4xMNJrbkE56WD5xLVdB5NbFofNJbgABJh26qREPrFXrlbAAWjFgfWJgRLaTQhMLy5KNJINhsJLDrYrD5xLC6pLa5nGTR7oLq9bJQJMKTAXWJbbnR3RLJSoRMHv4pC5rkec6SaIrBLGw2r2XW1epcoqYeJiOXJYziEsOH2RBBw7lF56Yg5nGc6FScZOGJQPX2TmDFIfVTEBMSc4hLEw5KB6+rsJMH63X6pMf5hMQzBLCq5LD1ZLEJhTlfJiWXTA2GJYpMIcwPNc2O6TAuGRIPX1igDJg/PJmyYDcgXWwxMH1ApC53XcsHAJiVYcg2HJYZME0YpC5vWJkhLNJgLlDTAeFJhF/FQfVJkG6JiGXcomyJgOrJYhMErYqD53NJj7lRzBMDcoeGJhzoBJb3GJiN1qZBCJgWyJYpNF1LigAAXAJiNSJgzlGJgt/JkZLRy9TJgeHJhznFcuSZGw5MHJomjcuhLBqdcJiSaiTChMV1CYxy5LCqdXIAWy6+rJhCalTCN2JgdYH4WHJiGpTF7kDc43W2RMJTUZLQzBLFc4mr6+GJh2jTFmXJYyaEwuyc5Sag4xLZTQmG2WFJhxNaJYZMLJZSaEJoOHTR9/Ja+6JbdTqRNETRRNF1JLV4BLcAANYI5ToK1BLYJhWYJZwABq5NoJZ91JaAABdAZNS0ZLey9SJaRNYv5KM426JZmXuxKUJrKcL0lTzBLKzBKYJrVXvfGSol7EYWXJI27zF1JLQADq5NUrgYB4wAEEIV0comXI7wAFrCcPJgYWBTIIAETIN2JYmWuhMkdSdYCgOeJgueqRLFyzhfTi9bq4TC45MF49TuuXJlpONcogAC0hKB0gHDvZMEqRMpAANSq9crlbJAYADqwRDxGk0mIA4eCTQOeveXJdYAHqxNFdAeIAAQGCrOI0oHEAGVXTRJMGvgGCwRM7TAZMHwQGCvhM1rBMERIhMGAwdZJmtSqVTwNcwJEDJg19cvIADa4d9JhANDJnSLHJgrl6AAhFFAwpZDegjn7vhMGcvwABrJAFJgjl/TQpBBI4jl/AAN8TQhHDcv4ADcJBMDvpM+IYaeDAAhL+qd9SgycEJn7iEAA18Jf7nEcv4AIrJLIcv6aMcv4ADvhMHrJJ/AAbl/c6ZM/AAt9cv7nSIv7nLcv4AHrLl/TRpJBvgnjA==")); g.reset(); - g.setColor("#6633ff"); g.setBgColor("#6633ff"); var y = 240, speed = 5; function balloon(callback) { @@ -58,7 +58,7 @@ var scenes = [ if (y>60) setTimeout(balloon,0,callback); else callback(); } - fade(function() { + fade("#6633ff", function() { balloon(function() { g.setColor(-1); g.setFont("6x8",3); @@ -260,7 +260,7 @@ function move(dir) { Bangle.setLCDMode(); g.clear(); scenes[sceneNumber](); - if (sceneNumber>1) { + if (sceneNumber>2) { var l = scenes.length; for (var i=0;i Date: Thu, 15 Oct 2020 17:38:53 +0100 Subject: [PATCH 05/10] fix sanitycheck error --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 5939740ef..d60d81dd1 100644 --- a/apps.json +++ b/apps.json @@ -120,7 +120,7 @@ }, { "id": "mywelcome", "name": "Customised Welcome", - "shortname": "My Welcome", + "shortName": "My Welcome", "icon": "app.png", "version":"0.09", "description": "Appears at first boot and explains how to use Bangle.js. Like 'Welcome', but can be customised with a greeting", From 2eb134a8f0afefe8b8b9845c3fcc17f9c7ef3d91 Mon Sep 17 00:00:00 2001 From: Malte Kiefer <59220985+MalteKiefer@users.noreply.github.com> Date: Fri, 16 Oct 2020 07:33:29 +0200 Subject: [PATCH 06/10] added leading zero to hours and minutes --- apps/verticalface/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/verticalface/app.js b/apps/verticalface/app.js index 8503265ca..f9138335f 100644 --- a/apps/verticalface/app.js +++ b/apps/verticalface/app.js @@ -6,6 +6,14 @@ let currentHRM = "CALC"; function drawTimeDate() { var d = new Date(); var h = d.getHours(), m = d.getMinutes(), day = d.getDate(), month = d.getMonth(), weekDay = d.getDay(); + + if (h < 10) { + h = "0" + h; + } + + if (m < 10) { + m = "0" + h; + } var daysOfWeek = ["SUN", "MON", "TUE","WED","THU","FRI","SAT"]; var hours = (" "+h).substr(-2); From 7ab729ec7f7927cf1f3cca7d551ef48e7083a533 Mon Sep 17 00:00:00 2001 From: Malte Kiefer <59220985+MalteKiefer@users.noreply.github.com> Date: Fri, 16 Oct 2020 07:34:53 +0200 Subject: [PATCH 07/10] Update ChangeLog --- apps/verticalface/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/verticalface/ChangeLog b/apps/verticalface/ChangeLog index 4ba4f7ec4..e26120599 100644 --- a/apps/verticalface/ChangeLog +++ b/apps/verticalface/ChangeLog @@ -1,3 +1,4 @@ 0.04: Fixed day being displayed 0.05: Stop hours being displayed wrong if moving from 2 digits to 1 (fix #516) 0.06: Tweak sizing to allow widgets at top, and add widgets (fix #567) +0.07: Added leading zero to hours and minutes From f49ac99d00a821aebfdb7b2905a2fb3326ab1e2f Mon Sep 17 00:00:00 2001 From: Malte Kiefer <59220985+MalteKiefer@users.noreply.github.com> Date: Fri, 16 Oct 2020 07:36:04 +0200 Subject: [PATCH 08/10] Update apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index d60d81dd1..0e0320bd7 100644 --- a/apps.json +++ b/apps.json @@ -1958,7 +1958,7 @@ "name": "Vertical watch face", "shortName":"Vertical Face", "icon": "app.png", - "version":"0.06", + "version":"0.07", "description": "A simple vertical watch face with the date. Heart rate monitor is toggled with BTN1", "tags": "clock", "type":"clock", From 991cd17f0082b68ff38b2ab467d251f0f6fd0f5d Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 16 Oct 2020 09:34:48 +0100 Subject: [PATCH 09/10] simpletimer: Fix buzz regression from 0.06 --- apps.json | 2 +- apps/simpletimer/ChangeLog | 1 + apps/simpletimer/app.js | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index d60d81dd1..1d2c2ccd7 100644 --- a/apps.json +++ b/apps.json @@ -1736,7 +1736,7 @@ "id": "simpletimer", "name": "Timer", "icon": "app.png", - "version": "0.06", + "version": "0.07", "description": "Simple timer, useful when playing board games or cooking", "tags": "timer", "readme": "README.md", diff --git a/apps/simpletimer/ChangeLog b/apps/simpletimer/ChangeLog index 0a0d47126..f1f3a1ec0 100644 --- a/apps/simpletimer/ChangeLog +++ b/apps/simpletimer/ChangeLog @@ -4,3 +4,4 @@ 0.04: Remember last set time 0.05: Fix buzz that doesn't stop (fix #521) 0.06: Fix buzz error, remove '+' when timer running and add 'back' text (fix #577) +0.07: Fix buzz regression from 0.06 diff --git a/apps/simpletimer/app.js b/apps/simpletimer/app.js index f6332a8b7..e99761810 100644 --- a/apps/simpletimer/app.js +++ b/apps/simpletimer/app.js @@ -1,15 +1,19 @@ let counter = 0; let setValue = 0; -let counterInterval, alarmInterval; +let counterInterval, alarmInterval, buzzInterval; let state; let saved = require("Storage").readJSON("simpletimer.json",true) || {}; const DEBOUNCE = 50; function buzzAndBeep() { + buzzInterval = -1; return Bangle.buzz(1000, 1) .then(() => Bangle.beep(200, 3000)) - .then(() => setTimeout(buzzAndBeep, 5000)); + .then(() => { + if (buzzInterval==-1) + buzzInterval = setTimeout(buzzAndBeep, 5000); + }); } function outOfTime() { @@ -58,8 +62,10 @@ function countDown() { function clearIntervals() { if (alarmInterval) clearInterval(alarmInterval); if (counterInterval) clearInterval(counterInterval); + if (buzzInterval>0) clearTimeout(buzzInterval); alarmInterval = undefined; counterInterval = undefined; + buzzInterval = undefined; } function set(delta) { From c95069a5b6749a076c9896d75099a8e170380851 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 16 Oct 2020 11:42:33 +0100 Subject: [PATCH 10/10] mywelcome: Add birthday style --- apps.json | 2 +- apps/mywelcome/ChangeLog | 1 + apps/mywelcome/custom.html | 65 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/apps.json b/apps.json index 0c34f382d..9ecda0aa5 100644 --- a/apps.json +++ b/apps.json @@ -122,7 +122,7 @@ "name": "Customised Welcome", "shortName": "My Welcome", "icon": "app.png", - "version":"0.09", + "version":"0.10", "description": "Appears at first boot and explains how to use Bangle.js. Like 'Welcome', but can be customised with a greeting", "tags": "start,welcome", "custom":"custom.html", diff --git a/apps/mywelcome/ChangeLog b/apps/mywelcome/ChangeLog index 9545dbbfa..15a286604 100644 --- a/apps/mywelcome/ChangeLog +++ b/apps/mywelcome/ChangeLog @@ -11,3 +11,4 @@ 0.09: Allow welcome to run after a fresh install More useful app menu BTN2 now goes to menu on release +0.10: Add birthday style diff --git a/apps/mywelcome/custom.html b/apps/mywelcome/custom.html index 933a82e25..d0bb13538 100644 --- a/apps/mywelcome/custom.html +++ b/apps/mywelcome/custom.html @@ -3,11 +3,17 @@ - +
+

Style: +

Line 1:

Line 2:

Line 3 (smaller):

Line 4 (smaller):

+

This is currently Christmas-themed, but more themes will be added in the future.

@@ -21,9 +27,62 @@ function getApp() { var line2 = document.getElementById("line2").value; var line3 = document.getElementById("line3").value; var line4 = document.getElementById("line4").value; + var style = document.getElementById("style").value; // build the app's text using a templated String - return ` - (function() { + if (style=="Birthday") return `(function() { + var ib = require("heatshrink").decompress(atob("jEtwgHEhOZzOQCQwJBAAYVHAAYZEAwOTn/znIYECwOT/84DAwEBBQoYCCwOf+YKFDAILBn4rCBY4WHBYI5B/ALHKAQiHAAWfxILKBRIjBBawAKUoxrGBarVGbIoLLEhDLCBZYkIfYYYGCwYLMEgwKEBgoKGEoYhFBggKJEgQLVgUgBZMzmALKBRILYgYvKgYwjBZQ7LgALLAAoA=")); +var ir = require("heatshrink").decompress(atob("jEtwgHEhvd7vQCQwJBAAYVHAAYZEAwPT///noYECwIKBmYYGAgP//oxGCwPf+YKFDAILBn4rCBY//BQwLBHIItGAAffEQ4LPBRILM6YLKABSlGNYwLVaozZFBZYkIZYQLLEhD7DDAwWDBZgkGBQgMFBQwlDEIoADhnABREA5nMBasCoALJmcwBZQKJBbEDF5UDGEYLKHZcABZYAF")); +var ig = require("heatshrink").decompress(atob("jEtwgHEg93u9wCQwJBAAYVHAAYZEAwNz///m4YECwIKBmYYGAgP/+QxGCwN/+YKFDAILBn4rCBY//BQwLBHIItGAAd/EQ4LPBRILMuYLKABSlGNYwLVaozZFBZYkIZYQLLEhD7DDAwWDBZgkGBQgMFBQwlDEIoMEBRIkCBasCkALJmcwBZQKJBbEDF5UDGEYLKHZcABZYAFA")); + var igift = require("heatshrink").decompress(atob("q1QxH+ADOi0QbZ5nMHDQAbKgIACKa4ACKnJWVKghW0KgxWTKgxWyKhBWRKhBWwKhRWPKhRWuKhhWNKhhWtKpxWKKhys8KxBU8Ky5U+KypU/KyhU/KyhU/KynGKn5WTKn5WUKmHCADpJJE7uYABZUfKuuYKv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/AAv+Kv5VT/wADyIAaKpIlbABZSEKv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/Kv5V/ADNtKv6rdKzZVwKhAABy5V/Khw")); + + var W=240,H=160; + var blns = []; + function updateFlake(f) { + f.im = [ir,ig,ib][Math.round(Math.random()*100)%3]; + f.s = 0.4+Math.random(); + } + + for (var i=0;i<6;i++) { + var f = { + y:Math.random()*H,x:(0.5+(i<3?i:i+3))*W/9, + v:1+Math.random(),r:0, + t:(0.5+Math.random())*0.2, + }; + updateFlake(f); + blns.push(f); + } + + function draw() { + blns.forEach(f=>{ + var s = f.s*18; + g.clearRect(f.x-s,f.y-s*2,f.x+s,f.y+s*2); + }); + blns.forEach(f=>{ + f.y-=f.v;f.r+=f.t; + if (f.y<-22) { + f.y=H+22; + updateFlake(f); + } + g.drawImage(f.im,f.x,f.y,{rotate:Math.sin(f.r)/2,scale:f.s}); + }); + var x = W/2, y = H/2; + g.drawImage(igift,x-43,y-80); + g.setFont("6x8",2).setFontAlign(0,0); + g.drawString(${JSON.stringify(line1)},x,y+=20); + g.drawString(${JSON.stringify(line2)},x,y+=20); + g.setFont("6x8"); + g.drawString(${JSON.stringify(line3)},x,y+=20); + g.drawString(${JSON.stringify(line4)},x,y+=10); + g.flip(); + } + + Bangle.setLCDMode("doublebuffered") + g.clear().flip(); + g.clear().flip(); + setInterval(draw,50); +})()`; + // if (style=="Christmas") + return `(function() { var isnow = require("heatshrink").decompress(atob("iUUxH+AA/X64KICA4SPCKI1KBAIKFCIwOCFw4FHA4QEIBZoALFYwGKM5YRdHhxPGBJB9Ua5IYGYpzpRNxISOCKI1KA==")) var itree = require("heatshrink").decompress(atob("mtWxH+ADHHDTI0aGuXH5vNGmhqvTYIzBGtoxF6fTG4g4oGgQyBAAZssGoI0Ga1g1FGdo01ZgIAEGmHHN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