From 459df6ef4034ea01582594fcd389bd0f417bedd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Tue, 4 Feb 2020 22:47:28 +0100 Subject: [PATCH 01/63] Added jbm8b --- apps/jbm8b/Changelog | 2 + apps/jbm8b/add_to_apps.json | 23 ++++++++++ apps/jbm8b/app-icon.js | 1 + apps/jbm8b/app.js | 85 ++++++++++++++++++++++++++++++++++++ apps/jbm8b/app.json | 6 +++ apps/jbm8b/app.png | Bin 0 -> 2635 bytes 6 files changed, 117 insertions(+) create mode 100644 apps/jbm8b/Changelog create mode 100644 apps/jbm8b/add_to_apps.json create mode 100644 apps/jbm8b/app-icon.js create mode 100644 apps/jbm8b/app.js create mode 100644 apps/jbm8b/app.json create mode 100644 apps/jbm8b/app.png diff --git a/apps/jbm8b/Changelog b/apps/jbm8b/Changelog new file mode 100644 index 000000000..bd71ffcd5 --- /dev/null +++ b/apps/jbm8b/Changelog @@ -0,0 +1,2 @@ +0.01: First working version +0.02: Added delay in replying for dramatic effect \ No newline at end of file diff --git a/apps/jbm8b/add_to_apps.json b/apps/jbm8b/add_to_apps.json new file mode 100644 index 000000000..ffa033f75 --- /dev/null +++ b/apps/jbm8b/add_to_apps.json @@ -0,0 +1,23 @@ +{ + "id": "jbm8b", + "name": "Magic 8 Ball", + "icon": "app.png", + "description": "A simple fortune telling app", + "tags": "game", + "storage": [ + { + "name": "+jbm8b", + "url": "app.json" + }, + { + "name": "-jbm8b", + "url": "app.js" + }, + { + "name": "*jbm8b", + "url": "app-icon.js", + "evaluate": true + } + ], + "version": "1.1.0" +} \ No newline at end of file diff --git a/apps/jbm8b/app-icon.js b/apps/jbm8b/app-icon.js new file mode 100644 index 000000000..b2da211af --- /dev/null +++ b/apps/jbm8b/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("slkgRC/AF1a1WpoAWSgO//4AB/1QDCNvC4QZCGaELC4gAB/BITAAmAGCoyQGBAABMpkHC5P/8AYLl4YK/pJWPxkDC5ZLLj4YM/gYJv4YM/4YJC5v/4BiVMhUPDBz8IYpbJMPZx9JC559HPZ4AB6AYFg4YQ+CUVSxEfDCCWGn4YQSwytH/2V34YHoCtMRYMBBQ+AC4YNHLAcvZBcCBg30gFZgELZBbfH8DPB8ALHZAjfH4C2B/hWHDAg+HwC2B/yIHKwL4KoCsCDA76EDBYDDAAf8DAZaBDCy7HwF/JRLTDgBzBSox8KBAIYK6CuCdg4YM+DQBAQQAGDBZwBtVARA4YMSQILBSgwYFRgSWGgEBBQ4YMUQa6HDBnwSQPQPhgYH4CuKPhlAfJQYMCgeAHw4YK/ySD4AlIDBP8gYEC6CWG/wYP8D6GDAgkGDBjTDgALGDBn8DAcPBYzDDMY4YLSpn4DAcLUI+/cgoAD+gYDg75HIwJzBBY3wDAZ0DAAfAEIPgJwYYIOgYMFig9I6AYDEo67DVow9BDAZXH/+QEZH/wAYERIwAB1SXCUIwAEXYwAK/wYFLA4AJfAj6IABT4EcJIAJYwjIJABLGEV5QAIVoqvKVpoABl4XO/oYHhYYO+gYHgYYO8AYHPp57HAAM/C5n+C5D7Oe4ziRMRIAB34YLoAYKj7FTWB5JLAAN/JKr8LexB+PGBoABg4wWAAMvSSIAGt4XC/xIPAAkV1WVCyYA/AH4A/AH4Ai")) \ No newline at end of file diff --git a/apps/jbm8b/app.js b/apps/jbm8b/app.js new file mode 100644 index 000000000..0fd5a177c --- /dev/null +++ b/apps/jbm8b/app.js @@ -0,0 +1,85 @@ +const affirmative = [ + 'It is\ncertain.', + 'It is\ndicededly\nso.', + 'Without\na doubt.', + 'Yes\ndefinitely.', + 'You may\nrely\non it.', + 'As I see,\nit yes.', + 'Most\nlikely.', + 'Outlook\ngood.', + 'Yes.', + 'Signs point\nto yes.' +]; +const nonCommittal = [ + 'Reply hazy,\ntry again.', + 'Ask again\nlater.', + 'Better not\ntell you\nnow.', + 'Cannot\npredict\nnow.', + 'Concentrate\nand\nask again.' +]; +const negative = [ + 'Don\'t\ncount on it.', + 'My reply\nis no.', + 'My sources\nsay no.', + 'Outlook\nis not\nso\ngood.', + 'Very\ndoubtful.' +]; + +const title = 'Magic 8 Ball'; + +const answers = [affirmative, nonCommittal, negative]; + +function getRandomArbitrary(min, max) { + return Math.random() * (max - min) + min; +} + +function predict() { + // affirmative, negative or non-committal + let max = answers.length; + const a = Math.floor(getRandomArbitrary(0, max)); + // sets max compared to answer category + max = answers[a].length; + const b = Math.floor(getRandomArbitrary(0, max)); + // get the answer + const response = answers[a][b]; + return response; +} + +function draw(msg) { + // console.log(msg); + g.clear(); + E.showMessage(msg, title); +} + +function reply(button) { + const theButton = (typeof button === 'undefined' || isNaN(button)) ? 1 : button; + const timer = Math.floor(getRandomArbitrary(0, theButton) * 1000); + // Thinking... + draw('...'); + setTimeout('draw(predict());', timer); +} + +function ask() { + draw('Ask me a\nYes or No\nquestion\nand\ntouch the\nscreen'); +} + +g.clear(); + +Bangle.loadWidgets(); + +// Event Handlers + +Bangle.on('touch', (button) => reply(button)); + +setWatch(ask, BTN1, {repeat:true, edge:"falling"}); +setWatch(reply, BTN3, {repeat:true, edge:"falling"}); + +// Back to launcher +setWatch(Bangle.showLauncher, BTN2, {repeat:false, edge:"falling"}); + +Bangle.on('lcdPower', (on) => { + if (on) { + Bangle.drawWidgets(); + ask(); + } +}); \ No newline at end of file diff --git a/apps/jbm8b/app.json b/apps/jbm8b/app.json new file mode 100644 index 000000000..a378c4916 --- /dev/null +++ b/apps/jbm8b/app.json @@ -0,0 +1,6 @@ +{ + "name": "Magic 8 Ball", + "icon": "*jbm8b", + "src": "-jbm8b", + "version": "1.1.0" +} \ No newline at end of file diff --git a/apps/jbm8b/app.png b/apps/jbm8b/app.png new file mode 100644 index 0000000000000000000000000000000000000000..78128d47e33ce69755e21a155ee77979fa35f776 GIT binary patch literal 2635 zcmc&#_ct4gAB|bD#SV>!P$RL5SS_j8YDCoDjXh)bSv4C)?M*$Slv+V3+LEf#KBGmg zs{QO)wbxhwitp!~`?=?H&;9X!&P^~f&|;tk(*ghh1|4k_`i39>0S(2?)>6Sb-w>HU zTI&IzZisjN=Ad*zK12clgcQ092Py!70$`+%(fDH`BO@m#r=Xyqq@<*xqN1jzzIE#s z4Gj$t2&AQ@rK6*xr>AFNU|?iqWMX1sW@ct#VF7_atgNhTY;5f8>>L~%oSd9oTwL7T z++Z-6hlhukmlpzo@bmKv2nYxY3PPb!At51QVc|P>?udwph>3}bi;KfxFgP48DJdx> zB_$&xbNB9DIXO9bd3gi^p`f6ksHmu0K743sXlP_)ghr!HOiVBsjH#*VqeqX-%*@Qq%`Ge}EG;dq ztgNi9t!->B>fm$$dKpPwHNhx7OM z4-5ub93|Z^78ZZ3knK~ zii(Phi%UvMN=r-2%F4>i%PT7@U%!4`RaI48UH#_Go0^)M+S=N>y1M%M`i6!E0)f!j z*x1z6)ZE-mBobR%T3TCM-@bj@*4EbE-u~|0yUxzeuC6W;iPYWQ{pr)Eo}QlG-rl~x zzW)CH&!0bk`SN98U|?`?aA;^~czF2h*RNw^W8c4jA0Ho|n3$NHoSd4Pnx3Bi@#DwL z%*^cU?A+Yk{QUgF!ouR>;?mO6^78V^%F62M>e|}c`uh6D#>VF6=GNBM_V)J9&d%=c z?%v+s{{H^2U%w6x4u1dseRz0ybaZrle0*|pa(a4tc6N4tetvOrad~-pb#--peSH(c z|JRs*Uism17h=eohsy<|H=Xd!Y>QK2gjN-W!MCX z4Y08X`{_ZW-p;lMXid$8l8ShmswjlS=F7aP&dT7aDw`=q{~?E};u95>4tkfB%a_3` zMaq_Z*SFP}|N1B9MBRt{scNcxMDK{)Cc@088fJ%)RRZ=frwK+pJ%PYZmxD8md%KM? z&J4ZsivJT5(6a_G-{Y^ZmVT^=4+x*5F54tvea*VqU`cp z^MyZ8eg9c$A4-Zt6zaxG4?o1M(?PxDxLJFONUrCO2ok;29#_+IOOJsr&Ef`ox}(mm z(bCMCrp)fUyn!Aw5 z;RN{#1ezkCKBTOdA;L?#=tz%!bzkrOSulm@L?*lu zBx}PL4DC|rAV@H9l0KMJr)6#nrqjldYmDv9V+)giU;I!wSfbSS*dbLsu@uEA+Xy!z z7ie4x2-;`ZG>VM^grWB}FI*sHz0+_&4a4c4&SBuSOd>7EaO(;ZOhXZ?WfL zk|3OUT>~#!kf>c^ zf{+wyLs=?MltI9*NUB@Mt5TN(^)j;%&Jmx$%4C#Oh;VO4+6HZ}7-N9tZ9j&0{)g@kO^G{8n*m0#JEFcR$_v;RyxfHV=U=`5nM;7O3WlvK-pg8~!k zL-RER20|539AX*}juyc#lj=Qp((PM?Yzb0A<~B_jFPvT@3#7(!n!sYN=uygZKQ%_+ z4Mu>N9!F^mM=NS_e)dkxk6@ZV8a**Cf4s*a!}6W?lLtL{dFIt9_bJgh7gAL@gWRb^0UC&>X34ixSt&WuYucX$RUE~7HOeXy*Mck zPOBPCN}R1LlwO-lpvRFT#5JGir9s(v8}b&+bR5MgMVm$YEq)Fma^727wjEawen@L! zBrubVP2tfFap%+*gnNqRS@CiB3U*N!3C?C`+C-4bvn|_iEQMKCXHm5>EoBJIr5G7&s#rwzu>H>AuAKBYf@f`oFyUe z>~AOPmCrayM*9^;%#a3?cp>JyTYKC_JGu$CZARS literal 0 HcmV?d00001 From 67b2b08e0967e7c2a0523a855c6cb64f73b5e182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Tue, 4 Feb 2020 22:55:32 +0100 Subject: [PATCH 02/63] Added jbm8b to apps.json --- apps.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/apps.json b/apps.json index 76151a627..e02bc3d43 100644 --- a/apps.json +++ b/apps.json @@ -751,5 +751,31 @@ {"name":"*demoapp","url":"app-icon.js","evaluate":true} ], "sortorder" : -9 + }, + { + "id": "jbm8b", + "name": "Magic 8 Ball", + "icon": "app.png", + "description": "A simple fortune telling app", + "tags": "game", + "storage": [ + { + "name": "+jbm8b", + "url": "app.json" + }, + { + "name": "-jbm8b", + "url": "app.js" + }, + { + "name": "*jbm8b", + "url": "app-icon.js", + "evaluate": true + } + ], + "allow_emulator":true, + "type":"app", + "version": "0.01", + "sortorder" : -9 } ] From bfe298f615c819c19426a2d779434c7eb4c863fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Tue, 4 Feb 2020 23:02:54 +0100 Subject: [PATCH 03/63] Updated jbm8b --- apps.json | 2 +- apps/jbm8b/add_to_apps.json | 2 +- apps/jbm8b/app.js | 15 +++++---------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps.json b/apps.json index e02bc3d43..a9c40569a 100644 --- a/apps.json +++ b/apps.json @@ -775,7 +775,7 @@ ], "allow_emulator":true, "type":"app", - "version": "0.01", + "version": "0.02", "sortorder" : -9 } ] diff --git a/apps/jbm8b/add_to_apps.json b/apps/jbm8b/add_to_apps.json index ffa033f75..200ea5f65 100644 --- a/apps/jbm8b/add_to_apps.json +++ b/apps/jbm8b/add_to_apps.json @@ -19,5 +19,5 @@ "evaluate": true } ], - "version": "1.1.0" + "version": "0.02" } \ No newline at end of file diff --git a/apps/jbm8b/app.js b/apps/jbm8b/app.js index 0fd5a177c..53baa32e3 100644 --- a/apps/jbm8b/app.js +++ b/apps/jbm8b/app.js @@ -66,20 +66,15 @@ function ask() { g.clear(); Bangle.loadWidgets(); +Bangle.drawWidgets(); +ask(); // Event Handlers Bangle.on('touch', (button) => reply(button)); -setWatch(ask, BTN1, {repeat:true, edge:"falling"}); -setWatch(reply, BTN3, {repeat:true, edge:"falling"}); +setWatch(ask, BTN1, { repeat: true, edge: "falling" }); +setWatch(reply, BTN3, { repeat: true, edge: "falling" }); // Back to launcher -setWatch(Bangle.showLauncher, BTN2, {repeat:false, edge:"falling"}); - -Bangle.on('lcdPower', (on) => { - if (on) { - Bangle.drawWidgets(); - ask(); - } -}); \ No newline at end of file +setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" }); \ No newline at end of file From 0c3b38a4c2825f35348acc79912009f591b0b5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Wed, 5 Feb 2020 21:17:31 +0100 Subject: [PATCH 04/63] Fixed app.png for jbm8b --- apps/jbm8b/app-icon.js | 2 +- apps/jbm8b/app.png | Bin 2635 -> 1548 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/jbm8b/app-icon.js b/apps/jbm8b/app-icon.js index b2da211af..09bf032a6 100644 --- a/apps/jbm8b/app-icon.js +++ b/apps/jbm8b/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("slkgRC/AF1a1WpoAWSgO//4AB/1QDCNvC4QZCGaELC4gAB/BITAAmAGCoyQGBAABMpkHC5P/8AYLl4YK/pJWPxkDC5ZLLj4YM/gYJv4YM/4YJC5v/4BiVMhUPDBz8IYpbJMPZx9JC559HPZ4AB6AYFg4YQ+CUVSxEfDCCWGn4YQSwytH/2V34YHoCtMRYMBBQ+AC4YNHLAcvZBcCBg30gFZgELZBbfH8DPB8ALHZAjfH4C2B/hWHDAg+HwC2B/yIHKwL4KoCsCDA76EDBYDDAAf8DAZaBDCy7HwF/JRLTDgBzBSox8KBAIYK6CuCdg4YM+DQBAQQAGDBZwBtVARA4YMSQILBSgwYFRgSWGgEBBQ4YMUQa6HDBnwSQPQPhgYH4CuKPhlAfJQYMCgeAHw4YK/ySD4AlIDBP8gYEC6CWG/wYP8D6GDAgkGDBjTDgALGDBn8DAcPBYzDDMY4YLSpn4DAcLUI+/cgoAD+gYDg75HIwJzBBY3wDAZ0DAAfAEIPgJwYYIOgYMFig9I6AYDEo67DVow9BDAZXH/+QEZH/wAYERIwAB1SXCUIwAEXYwAK/wYFLA4AJfAj6IABT4EcJIAJYwjIJABLGEV5QAIVoqvKVpoABl4XO/oYHhYYO+gYHgYYO8AYHPp57HAAM/C5n+C5D7Oe4ziRMRIAB34YLoAYKj7FTWB5JLAAN/JKr8LexB+PGBoABg4wWAAMvSSIAGt4XC/xIPAAkV1WVCyYA/AH4A/AH4Ai")) \ No newline at end of file +require("heatshrink").decompress(atob("mEwhBC/AGMrq2B1gAEwNWlYthq2s64AKGYIydFpoAEGLUrFqIADqxcXFqhiDFymBFy7GCF1owTRjCSVlYudeiGsF7/XlaNqSKBeP1mBwJxQMBReO1gaEleBMDBLN1hAC1hhBAoIwNCwQAGlZINqxvFGAIXOSBAXQN4hPBC5yQIVBxfBCAgvQSBC+NFAYRDMwJHOF654DqxkBYooALF6+sbIhkEF8Z3CRIWBR6AvXFAzvQF6wnIYQJgNd5AWNdoLoGBBAvPO5pfYH4IvUUwS/GVBzXBYCpHCq2s1mBDwKOWDwRgNPAwVVMCRLCwIABCZ6OJJSAATLxZgRACJeLAAMrFz9WFxiRgRpoADwIub1guQGDmsXhqSfRiL0G1jqkMRYxRwKLUGK2sFryVEq2B1gAEwNWFkIA/AH4A/AH4AQ")) \ No newline at end of file diff --git a/apps/jbm8b/app.png b/apps/jbm8b/app.png index 78128d47e33ce69755e21a155ee77979fa35f776..24c3013de011db9c1517ed544e9d383f5c60378c 100644 GIT binary patch delta 1166 zcmV;91abSz6pRcZiBL{Q4GJ0x0000DNk~Le0000m0000m2m=5B0ASn+wUHrVe-#xK z7Z(>87#JBD85$ZI8yg!P9UUJZA0i?mBO@auBqSvzB_<{&D=RB3EG#W8EiW%GGBPqV zGczQb8~ZabaZ%lczJnwfPjF3fq{mG zhKGlTi;IhljEs$qjgF3vkdTm(k&%*;l9ZH`m6es5nVFoNoSmJWo}QkcpP!?nqot*# zrlzK+r>Ci@sj8}~tE;Q5tgNlAt*@`Iu&}VPv9YtWv$eIgx3{;sxw*T$f4jWAyuH1> zzP`S{zrVo1z{0}9!^6YH#l^dCU$jHda$;ryf%FD~k&CSiw(9qG*(bCe=)6>({ z)z#M4*4WtC+1c6J+S=UQ+}+*X-rnBg;^O1uFMg~>g((4?Ck9A?d|UF z?(gsK@bK{Q@$vKX^Yrxe4E6Q(_V)Jo_xJet_>;K;jg#O4W|QCoNPp6yd3yi=010qN zS#tmY79;=w79;_i6~+_*00NasL_t(YOWl>(U(-Mog=d;3l+e-^(Mm;BP!!x3R8&B~ z9T2IYsHiCJyTw9LDzbw)`4u7o8t=)C{Z{zV}z=orTuDO~IA} zn{O?G!GzQtXE2E*2g_g)kh_*)u#g&F3sVkKhs|;f*lRy*Sx)55uaUZ8uA}w`hVqbX z68EZP6a#sg+W;$v9wZJxu-&i|vP)c1J-Men zXVl6CE*OMhC*%wi9d?Lb)ao5|Ze7w9@WR+9$`fXJ$-K0;FLmAl2{p z>^TrnPm2?*EPuEWphTenHeTF^Sz2q-cIjQYG?-oQ0xui|o}Ge~C8nr$J_0O$YZ_ z+Rjfnb(EarfKtf#_xT)3{YKG@Sm z>=V|M><&;#arm3X&o<|J6aN%M9rop6cjxVoVq1vUz|3hBrm$ro_Y);<(_veguYwiq z$m!X3Bu|=JGHounC^l$m$Wq93Hw7Z))}Aki@-|Brsj&LfbF}`1!Nl^AO@0kpH)dDJ zT#EvO6-$5njHwc~*jHtr9;`bS$^M7fuZi;oe~KK}#)DVGV!Z delta 2407 zcmV-t37Gbb49gTDiBL{Q4GJ0x0000DNk~Le0001F0001F2m=5B07pD!W|1Lbe-soH z6%`d078Vy57Z?~A85tQG8X6lL8yp-Q9v&VcAt53nA|oRsBqSsyB_$>%CMPE+C@3f@ zDk>{0D=aK5EiElCFE21KFfuYSGcz+aH8nOiHa9mnI5;>tIXOByIy*Z%JUl!;K0ZG` zKR`f0K|w)7LqkMFL`FtNM@L6Ve@RJ7N=i#hOH52mO-)TtPft)#P*PG-Q&Uq^R8&<} zRaRD3S65e9SXfzESz20JTU%RPTwGmUU0+{cU|?WjVPRroVr6AzW@ct+XlQ9^X=-X} zY;0_8ZEbFDZgFvOa&mHWb8~fdb#``kcXxMqczAhvd3$?%e0+R;eSLm@e|~>|e}I61 zfq{X7f`WvEgoTBLhK7cSh=_@aiHnPijEszpjg5|uj*pLzkdTm(k&%*;l9Q8@l$4Z} zm6ev3mYA5BnVFfInwp!No1LAVpP!$hp`oIpqNAguq@<*$r>Cf>sHv%`s;a81tE;T6 ztgWrBuCA`HudlGMu(7eRf3mW&v$M0bw6wLgwYIjlx3{;rxVX8wxw^W#yu7@>zrVo1 zz`?=6!^6YG#KgtL#m2_Q$H&LW$jHgb$;!&g%*@Qq&CSlv&d<-!(9qD-)YR40)z;S5 z*VotB*x1?G+1lFL+uPgR+}z&Y-rwKf;Nall;o;)q;^X7v>D@000SaNLh0L02U`=AAoQAO9Ud5Fns~_(N|3 zfIpBne#X)@>o-?#sw`hrG&%{z5RoH(fcPFP`Q&$#QO3hillo6>nV;n)B1>EV5IrHU zsxf3ah;)767pCx6v+j*Cx*oR>kfAFtm{fn*j=>BBY8E8LS7(IWySZK1vjBZ+E*n7N z&>39SVG3gkxOufCQIv2A7>O^n2s5_u(*+(~6m$WQ(Z?wjHtgV>-T82!=DN;|g*Ti^ zgfY)ea_I{sZ8aGa#ht-u`(ii23^4E*vx-`4%)myUuwV=JzwFbZ@413A{$--Wb^(8q zbxss>4d0tAtk^(?pLf?9QE&AzQ9|SqoE@> z?JN?eEHMf?YI&j0RSvz3Qd(cNs4#Cv z>F2FBF~~c!EIjeliY#)N|Fa3W{=sz~(NpH1v2o{J3r{8nLRB5($4lIvTsncBM#rny?&2xl)8J!A5u?lI40TihM5;a#*gg z907JIUyFb10j>X^G%Q0|HEIs?cO@*~w50on0!W=wBmS~?<40bthyewc zVrIu2@x%&F>mMbA7@mQdX*j9qiDjL3yNl-T8jxdCf}PC38Eep*3x2ch=qwNZUf5>i zOH)jAW!s2c$^^}u-xPoD^X9=px<(e-tOy!nJQ=Di!Odv|U{afy4LJKD8H0F_dPz|q zjTL zdzwWe%zHRQ7Ai#^7Pce6Q>yT4!5s&j6p1h;SY5MJZE{Pp5gx2s+OZK>IcuUDK9GYV zt5hPjl7$3OEmAo~7s+mmntl)9_S5)Lq-5|7G7;4r#A^%!q?G>C8TqwQm>#2C*A{k< zErdL#5(yOJkm`S3+Y$DKUCPDj*Vv_smFuZ85nqF~3g_q3b?ki;zPN!a$nzCAe-VAU zY8d99%8qkEe_Qop^k8ZzjCJpQ^9yBt*UsWQ-$5T0By`2kwMO}Z0y0|w?m(d znJo%Gg29X4uADLG--!%z0yis0ikXol6dbUb;a5pwD+GTjv?<70-Oe|cy;@qi_o~gl zk+u%85W!JZErMZ%`v&~6JvpS6hJ}cx6)9&f7qn&yixNDC>|W6koRwSpfvqyOqc>F8 z*(8OCOaXMtk%y-G^_rz_mt-nG(H@KAfajnB^Fu2l^zinqdUju)n^0i!CevpeR0 z-oZg9@$G+$OQhUmFM@HLe%!&$j2s?V@9gjyP{n3wvVyY@60FCQyD`!a_so|&?>N5` zBzp4p9{9rjOFgnv8!L#XRJBNu!TFUb?(Vg4>U;7cb8%6_7(1FpViv!4K*q-|4vE># zGRL<-Q2>yFI_l_Ri!pQm11=gP8ZZ(|8Xb&eoYsF%@w%?5C{jurm~xn5)U27Qya2F= z5bx|ms_Wm@k8*qA9vhcR!(TaaD|DtJ?1n)X=#|}bWhae2fe@mnOsP27h|z|9wCjWU z&+T45F(LHt3?f&r0EA?WEtf$KKkh6e@4^( Z25u9%h&7af?>ztj002ovPDHLkV1l1vck=)M From b78c056b867ef205dd757c9d1ba7390cd1dd5039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Fri, 7 Feb 2020 22:22:50 +0100 Subject: [PATCH 05/63] adds icon for jbb --- apps.json | 26 +++++++++++++++++++ apps/jbb/ChangeLog | 2 ++ apps/jbb/add_to_apps.json | 23 +++++++++++++++++ apps/jbb/app-icon.js | 1 + apps/jbb/app.js | 53 ++++++++++++++++++++++++++++++++++++++ apps/jbb/app.json | 5 ++++ apps/jbb/app.png | Bin 0 -> 1673 bytes 7 files changed, 110 insertions(+) create mode 100644 apps/jbb/ChangeLog create mode 100644 apps/jbb/add_to_apps.json create mode 100644 apps/jbb/app-icon.js create mode 100644 apps/jbb/app.js create mode 100644 apps/jbb/app.json create mode 100644 apps/jbb/app.png diff --git a/apps.json b/apps.json index a9c40569a..6ca702fe7 100644 --- a/apps.json +++ b/apps.json @@ -778,4 +778,30 @@ "version": "0.02", "sortorder" : -9 } + { + "id": "jbb", + "name": "Battery Level", + "icon": "app.png", + "description": "Battery status and charging indicator", + "tags": "tool", + "storage": [ + { + "name": "+jbb", + "url": "app.json" + }, + { + "name": "-jbb", + "url": "app.js" + }, + { + "name": "*jbb", + "url": "app-icon.js", + "evaluate": true + } + ], + "allow_emulator":true, + "type":"app", + "version": "0.02", + "sortorder" : -9 + } ] diff --git a/apps/jbb/ChangeLog b/apps/jbb/ChangeLog new file mode 100644 index 000000000..b7359ee0e --- /dev/null +++ b/apps/jbb/ChangeLog @@ -0,0 +1,2 @@ +0.01: First version trying out stuff +0.02: First usable version \ No newline at end of file diff --git a/apps/jbb/add_to_apps.json b/apps/jbb/add_to_apps.json new file mode 100644 index 000000000..cc6483ac1 --- /dev/null +++ b/apps/jbb/add_to_apps.json @@ -0,0 +1,23 @@ +{ + "id": "jbb", + "name": "Battery Power", + "icon": "app.png", + "description": "Showing battery level and charging status", + "tags": "tool", + "storage": [ + { + "name": "+jbb", + "url": "app.json" + }, + { + "name": "-jbb", + "url": "app.js" + }, + { + "name": "*jbb", + "url": "app-icon.js", + "evaluate": true + } + ], + "version": "0.02" +} \ No newline at end of file diff --git a/apps/jbb/app-icon.js b/apps/jbb/app-icon.js new file mode 100644 index 000000000..8fbebe9df --- /dev/null +++ b/apps/jbb/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+AH4AvlYAVF7NVABdPAggublfVAAfU5gAKFzReCF4guL0RehFxZedF6Iu/F/hezF1AvB1YvOFzxevF54u/F6Qupqxe/FzovBLxougLxoOBACIvNwAuB6YvbXroANqqdQF4YuYLqBedDgNWdqYuZFp/+qwuC6i6nLzi6RF4nPF1peXFqgvCqouUXSheEABhrHRaovSFw9WFyo8O6vUXTb6SFodPF0xeCXTheVF1AvBwC6pLwjsBqoupF4SLqF2AvCFtYuvF4YurF4NWF1otsAH4AXA==")) \ No newline at end of file diff --git a/apps/jbb/app.js b/apps/jbb/app.js new file mode 100644 index 000000000..f39d06280 --- /dev/null +++ b/apps/jbb/app.js @@ -0,0 +1,53 @@ +/** + * draw the current level value + */ +function draw(level) { + console.log('draw', level); + // Clear the screen + g.clear(); + g.setFontAlign(0, 0); // center font + g.setFont("6x8", 8); // bitmap font, 8x magnified + g.drawString(level + "%", 120, 80); + g.setFont("6x8", 4); + g.drawString("power", 120, 130); +} + +function getBatteryLevel() { + level = E.getBattery(); + console.log('getBatteryLevel', level); + + draw(level); + + checkCharging(Bangle.isCharging()); + + // again, 10 secs later + setTimeout(getBatteryLevel, 10E3); +} + +function checkCharging(charging) { + console.log('checkCharging', charging); + // Green LED + //LED2.write(charging); + if (charging) { + g.setFontAlign(0, 0); // center font + g.setFont("6x8", 3); // bitmap font, 3x magnifier + g.drawString("charging", 120, 160); + } +} + +function main() { + console.log('starting jbb version 0.0.1'); + getBatteryLevel(); +} + +g.clear(); +g.flip(); +Bangle.loadWidgets(); +Bangle.drawWidgets(); + +Bangle.on('charging', checkCharging); + +main(); + +// Show launcher when middle button pressed +setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" }); diff --git a/apps/jbb/app.json b/apps/jbb/app.json new file mode 100644 index 000000000..9e4eb893c --- /dev/null +++ b/apps/jbb/app.json @@ -0,0 +1,5 @@ +{ + "name": "Battery Power", + "icon": "*jbb", + "src": "-jbb" +} \ No newline at end of file diff --git a/apps/jbb/app.png b/apps/jbb/app.png new file mode 100644 index 0000000000000000000000000000000000000000..6f58711b57c4be035b8368e4adbba1a5741e9532 GIT binary patch literal 1673 zcmV;426p+0P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1|CU7K~!i%)md9i z9Yq-a_j0b3mIMINK(MNr%4rG$tUw}>;CI)Rcch}=*!W8dih0DHfr39mRxN(i z7A>y9wG~tJrPFCgR`H~OZTIYIP1m~#2Z&JuZ%h@K-b={HWZFpJ( zME-$$?vPR*$jW<=CzK<0O8UQqO`?6ts`PlBQ`DHXxc z02Yg$=|OmGpb4^!I}RNiu025H4Ff{~`Q(F{)K{K7*@`a}84Noc2On}pp5RJ>j*bqF z^TF&`H~O&9`s!MjY?Z=X#IMsI<{^%j4;x`upp@Lfl>)TTrbb?sQXV$ZBYQxZmkk>@^W%e$h!pD9`hh; z6y|b6b`*lsG&1KC7-*0fh@l}WOPS^1$^-Ac^Q3H9;EI9#tPQ9HNKaWPjQi%nCUN&- zc^efe(AL%_n6w_hPslcu@1T!MuhM}q~S z{X!$CsD&S)W5clr48y=3H-oL*+oeTPo94m!wieQsVU#d6AoO&?d|Q{G!2*> z?Ey`-zRRz77kHxp^Jo(~$RLtKF;PO$98@ZcbyQR?(=)rz=0Y-E46~gbb|ja}TnBo9 z26?5oU6MD!$b7gbc`?5vzeS4}3pZNiG>Mtbind6>c~^cP$G8(0&O`GO=uV-xSK8gz z1ES{FvXK7zB|*$&nAb6FRt55$U?BaTk6PjKADZyUL8Zol9>}btg3_wmzttgctl$S7 zaX` zBl%7F#2dtM_!od3Q-##I77;!~d~9sYHF-jb0+hZQ9=r>g<8HWeO7?n(Hm|_RPmaP9 zZ#9TH{3heew%6W5Cg+emB&%wqCX)Lmt8 z>;i@iDoy#_@1kzsQo;#n!~1Te3jz$2`ue-F7s;=xz;K664a6{hyuCWv4`s8EQ`oOq z0=f=-Ek~YodA9#3q=wq6N}k|J0m7G`pT_d~4DJ~ypgIiGWMZfh{@SY9%{10Gs{_{x zko6TsgZkPHj6=Cg{~AQA<6`9@@t(h0hnReL^1w4s-w$x@MPYekQHA*VHq1IqSbcna zyz1l$t`;$EcFfcueeqs^8=peY>#gwfk}6J5)j0R=2Ui{-rMEXYu+7gP{#;y;r@os_ zo=~v@WPQ4S|J4uBaiSSFCk{0=HJ)G6x<$nyL<(4cLpwG*G~zZY@<3;2rzDTXnQ0t4 zc|t`B(0^tKl;3A(XAhk`q2e`AS66pa^1EYDNI1Fd*uT{-&&Awf!__`;>j2 Date: Fri, 7 Feb 2020 22:24:39 +0100 Subject: [PATCH 06/63] fixes apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 6ca702fe7..c9c59d34b 100644 --- a/apps.json +++ b/apps.json @@ -777,7 +777,7 @@ "type":"app", "version": "0.02", "sortorder" : -9 - } + }, { "id": "jbb", "name": "Battery Level", From fc356c31d7021bf6b71552128d54b741f3d9727a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Tue, 7 Apr 2020 22:20:15 +0200 Subject: [PATCH 07/63] Fixes corrupted app list --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index d8cdde0fc..c14fda261 100644 --- a/apps.json +++ b/apps.json @@ -1481,7 +1481,7 @@ "allow_emulator": true, "type": "app", "version": "0.02", - "sortorder": -9, + "sortorder": -9 }, { "id": "flagrse", From 86ad563bc2f4d8ec23aa3e8e3c8ac25590f3bda1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Fri, 10 Apr 2020 23:03:59 +0200 Subject: [PATCH 08/63] Fixes jbmb8 apps entry --- apps.json | 47 +++--------------------------- apps/_example_app/add_to_apps.json | 1 - apps/jbm8b/Changelog | 3 +- apps/jbm8b/add_to_apps.json | 18 +++--------- 4 files changed, 10 insertions(+), 59 deletions(-) diff --git a/apps.json b/apps.json index c14fda261..a82da04d2 100644 --- a/apps.json +++ b/apps.json @@ -1434,54 +1434,15 @@ { "id": "jbm8b", "name": "Magic 8 Ball", + "shortName": "Magic 8 Ball", "icon": "app.png", "description": "A simple fortune telling app", "tags": "game", "storage": [ - { - "name": "+jbm8b", - "url": "app.json" - }, - { - "name": "-jbm8b", - "url": "app.js" - }, - { - "name": "*jbm8b", - "url": "app-icon.js", - "evaluate": true - } + { "name": "jbm8b.app.js", "url": "app.js" }, + { "name": "jbm8b.img", "url": "app-icon.js", "evaluate": true } ], - "allow_emulator": true, - "type": "app", - "version": "0.02", - "sortorder": -9 - }, - { - "id": "jbb", - "name": "Battery Level", - "icon": "app.png", - "description": "Battery status and charging indicator", - "tags": "tool", - "storage": [ - { - "name": "+jbb", - "url": "app.json" - }, - { - "name": "-jbb", - "url": "app.js" - }, - { - "name": "*jbb", - "url": "app-icon.js", - "evaluate": true - } - ], - "allow_emulator": true, - "type": "app", - "version": "0.02", - "sortorder": -9 + "version": "0.03" }, { "id": "flagrse", diff --git a/apps/_example_app/add_to_apps.json b/apps/_example_app/add_to_apps.json index ca75a7bd8..dd66030b6 100644 --- a/apps/_example_app/add_to_apps.json +++ b/apps/_example_app/add_to_apps.json @@ -1,4 +1,3 @@ -// Create an entry in apps.json as follows: { "id": "7chname", "name": "My app's human readable name", "shortName":"Short Name", diff --git a/apps/jbm8b/Changelog b/apps/jbm8b/Changelog index bd71ffcd5..80d7de1d6 100644 --- a/apps/jbm8b/Changelog +++ b/apps/jbm8b/Changelog @@ -1,2 +1,3 @@ 0.01: First working version -0.02: Added delay in replying for dramatic effect \ No newline at end of file +0.02: Added delay in replying for dramatic effect +0.03: Fixed apps.json entry diff --git a/apps/jbm8b/add_to_apps.json b/apps/jbm8b/add_to_apps.json index 200ea5f65..8e28639e7 100644 --- a/apps/jbm8b/add_to_apps.json +++ b/apps/jbm8b/add_to_apps.json @@ -1,23 +1,13 @@ { "id": "jbm8b", "name": "Magic 8 Ball", + "shortName": "Magic 8 Ball", "icon": "app.png", "description": "A simple fortune telling app", "tags": "game", "storage": [ - { - "name": "+jbm8b", - "url": "app.json" - }, - { - "name": "-jbm8b", - "url": "app.js" - }, - { - "name": "*jbm8b", - "url": "app-icon.js", - "evaluate": true - } + { "name": "jbm8b.app.js", "url": "app.js" }, + { "name": "jbm8b.img", "url": "app-icon.js", "evaluate": true } ], - "version": "0.02" + "version": "0.03" } \ No newline at end of file From 4dd102a906abcd9a06b19a366e5ca28cda3677b8 Mon Sep 17 00:00:00 2001 From: msdeibel Date: Mon, 11 May 2020 20:48:50 +0200 Subject: [PATCH 09/63] BatteryChart 0.10 --- apps.json | 2 +- apps/batchart/ChangeLog | 3 ++- apps/batchart/widget.js | 48 ++++++++++++++++++++--------------------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/apps.json b/apps.json index 9caa60ee7..cc488ca10 100644 --- a/apps.json +++ b/apps.json @@ -1272,7 +1272,7 @@ "name": "Battery Chart", "shortName":"Battery Chart", "icon": "app.png", - "version":"0.09", + "version":"0.10", "readme": "README.md", "description": "A widget and an app for recording and visualizing battery percentage over time.", "tags": "app,widget,battery,time,record,chart,tool", diff --git a/apps/batchart/ChangeLog b/apps/batchart/ChangeLog index 66b40fbbf..31c386684 100644 --- a/apps/batchart/ChangeLog +++ b/apps/batchart/ChangeLog @@ -6,4 +6,5 @@ 0.06: Fixes widget events and charting of component states 0.07: Improve logging and charting of component states and add widget icon 0.08: Fix for Home button in the app and README added. -0.09: Fix failing dismissal of Gadgetbridge notifications, record (coarse) bluetooth state \ No newline at end of file +0.09: Fix failing dismissal of Gadgetbridge notifications, record (coarse) bluetooth state +0.10: Remove widget icon and improve listener and setInterval handling for widget (might help with https://github.com/espruino/BangleApps/issues/381) \ No newline at end of file diff --git a/apps/batchart/widget.js b/apps/batchart/widget.js index 96f8b4b25..4a116c990 100644 --- a/apps/batchart/widget.js +++ b/apps/batchart/widget.js @@ -1,6 +1,7 @@ (() => { + let recordingInterval = null; const Storage = require("Storage"); - + const switchableConsumers = { none: 0, lcd: 1, @@ -14,53 +15,44 @@ const recordingInterval10Min = 60 * 10 * 1000; const recordingInterval1Min = 60 * 1000; //For testing const recordingInterval10S = 10 * 1000; //For testing - var recordingInterval = null; var compassEventReceived = false; var gpsEventReceived = false; var hrmEventReceived = false; - // draw your widget function draw() { - let x = this.x; - let y = this.y; - - g.setColor(0, 1, 0); - g.fillPoly([x + 5, y, x + 5, y + 4, x + 1, y + 4, x + 1, y + 20, x + 18, y + 20, x + 18, y + 4, x + 13, y + 4, x + 13, y], true); - - g.setColor(0, 0, 0); - g.drawPoly([x + 5, y + 6, x + 8, y + 12, x + 13, y + 12, x + 16, y + 18], false); - - g.reset(); + // void } - function onMag() { + function batteryChartOnMag() { compassEventReceived = true; // Stop handling events when no longer necessarry - Bangle.removeListener("mag", onMag); + Bangle.removeListener("mag", batteryChartOnMag); } - function onGps() { + function batterChartOnGps() { gpsEventReceived = true; - Bangle.removeListener("GPS", onGps); + Bangle.removeListener("GPS", batterChartOnGps); } - function onHrm() { + function batteryChartOnHrm() { hrmEventReceived = true; - Bangle.removeListener("HRM", onHrm); + Bangle.removeListener("HRM", batteryChartOnHrm); } function getEnabledConsumersValue() { // Wait for an event from each of the devices to see if they are switched on var enabledConsumers = switchableConsumers.none; - Bangle.on('mag', onMag); - Bangle.on('GPS', onGps); - Bangle.on('HRM', onHrm); + Bangle.on('mag', batteryChartOnMag); + Bangle.on('GPS', batterChartOnGps); + Bangle.on('HRM', batteryChartOnHrm); // Wait two seconds, that should be enough for each of the events to get raised once setTimeout(() => { - Bangle.removeAllListeners(); + Bangle.removeListener('mag', batteryChartOnMag); + Bangle.removeListener('GPS', batterChartOnGps); + Bangle.removeListener('HRM', batteryChartOnHrm); }, 2000); if (Bangle.isLCDOn()) @@ -112,14 +104,20 @@ } function reload() { - WIDGETS["batchart"].width = 24; + console.log("Reloading BatteryChart widget"); + WIDGETS["batchart"].width = 0; + + if (recordingInterval) { + clearInterval(recordingInterval); + recordingInterval = null; + } recordingInterval = setInterval(logBatteryData, recordingInterval10Min); } // add the widget WIDGETS["batchart"] = { - area: "tl", width: 24, draw: draw, reload: reload + area: "tl", width: 0, draw: draw, reload: reload }; reload(); From 4391b48aeba58be376cb0c28e1c1c7576e3e4881 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 12 May 2020 08:08:19 +0100 Subject: [PATCH 10/63] Tweaks to appease the sanity checker --- README.md | 13 ++++++++----- apps.json | 20 +++++++++----------- apps/gallifr/app.js | 12 ++++++------ apps/gallifr/settings.js | 10 +++++----- apps/largeclock/ChangeLog | 1 + apps/largeclock/largeclock.js | 10 ++++------ apps/largeclock/settings.js | 2 +- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index a45647daf..04854c99e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Bangle.js App Loader (and Apps) * Try the **release version** at [banglejs.com/apps](https://banglejs.com/apps) * Try the **development version** at [github.io](https://espruino.github.io/BangleApps/) -**All software (including apps) in this repository is MIT Licensed - see [LICENSE](LICENSE)** By +**All software (including apps) in this repository is MIT Licensed - see [LICENSE](LICENSE)** By submitting code to this repository you confirm that you are happy with it being MIT licensed, and that it is not licensed in another way that would make this impossible. @@ -203,7 +203,7 @@ and which gives information about the app for the Launcher. // added by BangleApps loader on upload - lists all files // that belong to the app so it can be deleted "data":"appid.data.json,appid.data?.json;appidStorageFile,appidStorageFile*" - // added by BangleApps loader on upload - lists files that + // added by BangleApps loader on upload - lists files that // the app might write, so they can be deleted on uninstall // typically these files are not uploaded, but created by the app // these can include '*' or '?' wildcards @@ -251,7 +251,7 @@ and which gives information about the app for the Launcher. "storageFile":true // if supplied, file is treated as storageFile }, {"wildcard":"appid.data.*" // wildcard of filenames used in storage - }, // this is mutually exclusive with using "name" + }, // this is mutually exclusive with using "name" ], "sortorder" : 0, // optional - choose where in the list this goes. // this should only really be used to put system @@ -341,9 +341,12 @@ See [apps/gpsrec/interface.html](the GPS Recorder) for a full example. Apps (or widgets) can add their own settings to the "Settings" menu under "App/widget settings". To do so, the app needs to include a `settings.js` file, containing a single function that handles configuring the app. -When the app settings are opened, this function is called with one +When the app settings are opened, this function is called with one argument, `back`: a callback to return to the settings menu. +Usually it will save any information in `app.json` where `app` is the name +of your app - so you should change the example accordingly. + Example `settings.js` ```js // make sure to enclose the function in parentheses @@ -352,7 +355,7 @@ Example `settings.js` function save(key, value) { settings[key] = value; require('Storage').write('app.json',settings); - } + } const appMenu = { '': {'title': 'App Settings'}, '< Back': back, diff --git a/apps.json b/apps.json index 0c63a9848..6147944fa 100644 --- a/apps.json +++ b/apps.json @@ -168,7 +168,7 @@ "name": "Image background clock", "shortName":"Image Clock", "icon": "app.png", - "version":"0.05", + "version":"0.06", "description": "A clock with an image as a background", "tags": "clock", "type" : "clock", @@ -1469,7 +1469,7 @@ "name": "Round clock with seconds, minutes and date", "shortName":"Round Clock", "icon": "app.png", - "version":"0.02", + "version":"0.03", "description": "Designed round clock with ticks for minutes and seconds and heart rate indication", "tags": "clock", "type": "clock", @@ -1572,7 +1572,7 @@ "id": "largeclock", "name": "Large Clock", "icon": "largeclock.png", - "version": "0.02", + "version": "0.03", "description": "A readable and informational digital watch, with date, seconds and moon phase", "readme": "README.md", "tags": "clock", @@ -1591,12 +1591,10 @@ { "name": "largeclock.settings.js", "url": "settings.js" - }, - { - "name": "largeclock.json", - "url": "largeclock.json", - "evaluate": true } + ], + "data": [ + {"name":"largeclock.json"} ] }, { "id": "smtswch", @@ -1699,7 +1697,7 @@ "version": "0.01", "description": "A clock for time travellers. The light pie segment shows the minutes, the black circle, the hour. The dial itself reads 'time' just in case you forget.", "tags": "clock", - "readme": "README.md", + "readme": "README.md", "type": "clock", "allow_emulator":true, "storage": [ @@ -1708,7 +1706,7 @@ { "name": "gallifr.settings.js", "url": "settings.js" } ], "data": [ - {"name":"app.json"} + {"name":"gallifr.json"} ] } -] \ No newline at end of file +] diff --git a/apps/gallifr/app.js b/apps/gallifr/app.js index b775d247f..8948393d5 100644 --- a/apps/gallifr/app.js +++ b/apps/gallifr/app.js @@ -10,7 +10,7 @@ const cirRad = 2*Math.PI; const proportion = 0.3; // relative size of hour hand const thickness = 4; // thickness of decorative lines // retrieve settings from menu -let settings = require('Storage').readJSON('app.json',1)||{}; +let settings = require('Storage').readJSON('gallifr.json',1)||{}; const decoration = !settings.decoration; const widgets = !settings.widgets; if (widgets) { @@ -133,21 +133,21 @@ const drawDecoration = () => { drawSegment(params); params = { fromX: 0.4, - fromY: 0.2, + fromY: 0.2, toX: 0.6, toY: 0.1 }; drawThickLine(params); params = { fromX: -0.2, - fromY: -0.05, + fromY: -0.05, toX: -0.7, toY: -0.7 }; drawThickLine(params); params = { fromX: -0.3, - fromY: 0.05, + fromY: 0.05, toX: -0.95, toY: -0.3 }; @@ -166,7 +166,7 @@ const drawMinuteHand = () => { break; case "blue": g.setColor(0,0,1); - break; + break; case "80s": g.setColor(1,0,0); break; @@ -203,7 +203,7 @@ const drawClockFace = () => { break; case "blue": g.setColor(0,0.3,0.8); - break; + break; case "80s": g.setColor(1,1,1); break; diff --git a/apps/gallifr/settings.js b/apps/gallifr/settings.js index 78e7e516d..bf6aae846 100644 --- a/apps/gallifr/settings.js +++ b/apps/gallifr/settings.js @@ -1,11 +1,11 @@ // make sure to enclose the function in parentheses (function (back) { - let settings = require('Storage').readJSON('app.json',1)||{}; + let settings = require('Storage').readJSON('gallifr.json',1)||{}; let colours = ["green","red","blue","80s"]; let onoff = ["on","off"]; function save(key, value) { settings[key] = value; - require('Storage').write('app.json',settings); + require('Storage').writeJSON('gallifr.json',settings); } const appMenu = { '': {'title': 'Clock Settings'}, @@ -21,13 +21,13 @@ min:0,max:1, format: m => onoff[m], onchange: m => {save('widgets', m)} - }, + }, 'Decoration': { value: 0|settings['decoration'], min:0,max:1, format: m => onoff[m], onchange: m => {save('decoration', m)} - } + } }; E.showMenu(appMenu) - }) \ No newline at end of file + }) diff --git a/apps/largeclock/ChangeLog b/apps/largeclock/ChangeLog index c45f61d7e..fe44e5078 100644 --- a/apps/largeclock/ChangeLog +++ b/apps/largeclock/ChangeLog @@ -1,2 +1,3 @@ 0.01: Init 0.02: fix 3/4 moon orientation +0.03: Change `largeclock.json` to 'data' file to allow settings to be preserved diff --git a/apps/largeclock/largeclock.js b/apps/largeclock/largeclock.js index e118793cb..9975775fb 100644 --- a/apps/largeclock/largeclock.js +++ b/apps/largeclock/largeclock.js @@ -9,10 +9,8 @@ const moonX = 215; const moonY = 50; const settings = require("Storage").readJSON("largeclock.json", 1); -const BTN1app = settings.BTN1; -const BTN3app = settings.BTN3; -console.log("BTN1app", BTN1app); -console.log("BTN3app", BTN3app); +const BTN1app = settings.BTN1 || ""; +const BTN3app = settings.BTN3 || ""; function drawMoon(d) { const BLACK = 0, @@ -174,14 +172,14 @@ Bangle.setLCDMode(); // Show launcher when middle button pressed clearWatch(); setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" }); -setWatch( +if (BTN1app) setWatch( function() { load(BTN1app); }, BTN1, { repeat: false, edge: "rising" } ); -setWatch( +if (BTN3app) setWatch( function() { load(BTN3app); }, diff --git a/apps/largeclock/settings.js b/apps/largeclock/settings.js index 3901747b8..a33f3c438 100644 --- a/apps/largeclock/settings.js +++ b/apps/largeclock/settings.js @@ -34,7 +34,7 @@ function onchange(v) { settings[btn] = v; - s.write("largeclock.json", settings); + s.writeJSON("largeclock.json", settings); } const btnMenu = { From 9d48b5ddee05eb74017e3440c7e1eda643a4d1e8 Mon Sep 17 00:00:00 2001 From: jl Date: Tue, 12 May 2020 09:42:33 +0200 Subject: [PATCH 11/63] fix: use "write" instead of "writeJSON" to mitigate possible memory leak --- apps/files/files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/files/files.js b/apps/files/files.js index 6ccbe80df..ab259d6df 100644 --- a/apps/files/files.js +++ b/apps/files/files.js @@ -201,7 +201,7 @@ function showSortAppsManually() { function setSortorder(app, val) { app = store.readJSON(app.id + '.info', 1); app.sortorder = val; - store.writeJSON(app.id + '.info', app); + store.write(app.id + '.info', JSON.stringify(app)); } function getAppsList() { From b7ef9e424c758bdde625249074f677e925c5546e Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 12 May 2020 11:05:07 +0100 Subject: [PATCH 12/63] Added app for reading from bluetooth plan moisture sensors --- apps.json | 12 +++++++ apps/miplant/ChangeLog | 1 + apps/miplant/app-icon.js | 1 + apps/miplant/app.js | 74 +++++++++++++++++++++++++++++++++++++++ apps/miplant/app.png | Bin 0 -> 1647 bytes 5 files changed, 88 insertions(+) create mode 100644 apps/miplant/ChangeLog create mode 100644 apps/miplant/app-icon.js create mode 100644 apps/miplant/app.js create mode 100644 apps/miplant/app.png diff --git a/apps.json b/apps.json index 6147944fa..4425351f2 100644 --- a/apps.json +++ b/apps.json @@ -1615,6 +1615,18 @@ {"name":"switch-off.img","url":"switch-off.js","evaluate":true} ] }, + { "id": "miplant", + "name": "Xiaomi Plant Sensor", + "shortName":"Mi Plant", + "icon": "app.png", + "version":"0.01", + "description": "Reads and displays data from Xiaomi bluetooth plant moisture sensors", + "tags": "xiaomi,mi,plant,ble,bluetooth", + "storage": [ + {"name":"miplant.app.js","url":"app.js"}, + {"name":"miplant.img","url":"app-icon.js","evaluate":true} + ] + }, { "id": "simpletimer", "name": "Timer", diff --git a/apps/miplant/ChangeLog b/apps/miplant/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/miplant/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/miplant/app-icon.js b/apps/miplant/app-icon.js new file mode 100644 index 000000000..bf800ea4c --- /dev/null +++ b/apps/miplant/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+4AA/AH4A/AAPQ64AQ44ZKBYwvc6/QF9wwFF9XXF73I4IAH44/F54vdCpYQESAYvm5Avm44ADA4Yvmc44v/F/4v/F/4v/F/4v+zmjv4ABF9GrwoACrYvn2WGFwgABSh4AV0QtDFwYvmFwlhF9wuDF9QuEF82jFw4vmMIQuFv4vuEDOi0d/WgV/0YNGBIN/LrSvCABAkECAI4GAChKBF5QABCIYEDADKpCsIvJLQQ0EGoShJMBwACSJYvEB5GiMCYxJF4LuCLorTLF6IxGQILuBMYgAGC4QwP0YwHYwQbCF4K1CL4lhCohfQMBBiCFQQvEAgIsFAATxWSQyPDAYYSIHgRgZE4IsBF4QGCCI6NRMBboFXgTTIFyYwIPYWcGAb2CCI2iF6qwBD4aqERYQABIQ+cFywALLwgAqXoYvrSAQROA==")) diff --git a/apps/miplant/app.js b/apps/miplant/app.js new file mode 100644 index 000000000..336fddc15 --- /dev/null +++ b/apps/miplant/app.js @@ -0,0 +1,74 @@ + +function getImgHum() { + return require("heatshrink").decompress(atob("jUoxH+AEtlsoYYDS4ZYDAYaVDLAYFDSQYHDSIZYDBIaPDLAYLDRoZYDBoaLDLAYPDRIZYDCIaHDLAYTDQoZYDCoaDDOQYXAA+JxIYX1utDSwYBAAIzYGiwZUTgpODQpzPGGgY3OdI4aRDIIaMDJIYCDIztDGRwaJP5oaWDAwaRDBAbOC5YcKB5I=")); +} +function getImgTemp() { + return require("heatshrink").decompress(atob("iUqxH+AA2sAAQLHCBASMCAoSLCPOBAAQRfI/5Hn3YACy4ACCL4ADCL5H/I/AQHCRAQJCQwQLCQgQNCQYRQCB4A/ADaPjYqTpSCRYQGCZALFA")); +} +function getImgFert() { + return require("heatshrink").decompress(atob("kklxH+AC+FwtbDbAfFAAVbEbgiGEbYiHEbQiEsIjiEQYjeEQiPdEQrXdEdKnTAAJsMD6QlJFZAAIGAIkPEaIkCrdhEaR9MT4gkLFAyjMYoojNUZ4jFEoxrGEBCJDEZSWEEZdhCwpsKJQiJFAgYgGEQwjLD4QjFCRD+KCAylGQ4gjXVhAiPEhAKDJIwiQEowIEEQo2GERgAKEYwAcEUQkDEL9VAAgHFETgAIDJwePEZwdTE5ggdMJt6AAQEEqwRMABYQDAAwkBF5AkKEBQAPEUR6ESAQicJIX+A==")); +} + +var deviceInfo = {}; + +function parseDevice(device) { + var d = new DataView(device.serviceData["fe95"]); + var frame = d.getUint16(0,true); + var offset = 5; + if (frame&16) offset+=6; // mac address + if (frame&32) offset+=1; // capabilitities + if (frame&64) { // event + var l = d.getUint8(offset+2); + var code = d.getUint16(offset,true); + if (!deviceInfo[device.id]) deviceInfo[device.id]={id:device.id}; + event = deviceInfo[device.id]; + switch (code) { + case 0x1004: event.temperature = d.getInt16(offset+3,true)/10; break; + case 0x1006: event.humidity = d.getInt16(offset+3)/10; break; + case 0x100D: + event.temperature = d.getInt16(offset+3,true)/10; + event.humidity = d.getInt16(offset+5)/10; break; + case 0x1008: event.moisture = d.getUint8(offset+3); break; + case 0x1009: event.fertility = d.getUint16(offset+3,true)/10; break; + // case 0x1007: break; // 3 bytes? got 84,0,0 or 68,0,0 + default: event.code = code; + event.raw = new Uint8Array(d.buffer, offset+3, l); + break; + } + //print(event); + show(event); + } +} + +/* +eg. { + "id": "c4:7c:8d:6a:ac:79 public", + "temperature": 16.6, "code": 4103, + "raw": new Uint8Array([246, 0, 0]), + "moisture": 46, "fertility": 20.8 } +*/ +function show(event) { + g.reset().setFont("6x8"); + var y = 45 + 50*Object.keys(deviceInfo).indexOf(event.id); + + g.drawString(event.id.substr(0,17),0,y); + g.drawImage(getImgHum(),0,y+15); + g.setFont("6x8",2); + var t = (event.moisture===undefined) ? "?" : event.moisture; + g.drawString((t+" ").substr(0,3),35,y+25,true); + g.drawImage(getImgFert(),80,y+15); + t = Math.round(event.fertility) || "?"; + g.drawString((t+" ").substr(0,3), 120, y+25, true); + g.drawImage(getImgTemp(),160,y+15); + t = Math.round(event.temperature) || "?"; + g.drawString((t+" ").substr(0,3), 180, y+25, true); + g.flip(); +} + +g.clear(); +g.setFont("6x8",2).setFontAlign(0,-1).drawString("Scanning...",120,24); + +Bangle.loadWidgets() +Bangle.drawWidgets() + +NRF.setScan(parseDevice, { filters: [{serviceData:{"fe95":{}}}], timeout: 2000 }); diff --git a/apps/miplant/app.png b/apps/miplant/app.png new file mode 100644 index 0000000000000000000000000000000000000000..d73d3d79a0e378b598c6fd9483c8b86698d40792 GIT binary patch literal 1647 zcmV-#29WuQP)WFU8GbZ8()Nlj2>E@cM*00q-YL_t(&-tCy#ZyQw< z#(y(j6UTO(tw}f1Hjt(zY8#*p1;nDVNeGaT3J8Ia0Kp5(Ln{z(NaYRw00fUbAR+p| zA_S#khlbLHk~X1fS~rdD*iK@{Gqz{Ov+&>$*RiuSNpT|OK3Qju?>*nW=X_@ote3G^ z!AoR?uN4o#UJS<$qHS?IS{4}E9M?AO96^AbvIGELKLYLdEdE+l89sOd&V5_{`@vse z)1G44p&c-MX0a}`MDgsZf!Dr)w|YRE;gw2c%P|I8cf-LWTu+|6{z2Ta4?KbYDTvFh zkDi9%({t}sQx8wPU+UWc55Enc9jp+5_yrj0pWklpbi<)juzqK;d}G%NaUnPG^}A)R z$yq@cx_Su$wC(}RyhEu8$M8^0?1`sN?6vl$yaNkRRF61 zRspO6SXmue1(zwn@S1ue^*&+&KMAjgi3x>Qe?PIj0Z8f?$HRv?d&gQ-$ND@N%OVnz zs5h?l1#|^;wUAjIZZM6~w(08r)#09&m5pMZa{aEJ1zqJ_{0F`Zeu!pd!68l^5skvkwqer zMN#w;J>NXa^oqs6u7M$*{rWd*QW+A7@>98+CnlD6Caz1#WIZnYepl)3+bs6~GjRPg zaoX)-xT%g%Q-E=whm@xZT@(>53tu`*)A$72FNJ7K$|e6DT-S(Uv#~RmCSvFe*j*q% zo38QFsa_n@gJP)wjQYLwwYD&@v6*py&5U|UpNFBA2L9Z>h0Rw+c(A7zk5ZU52G=$L z&=!jGWPflno&|(!NKFfJq0ie|`J$1eboUNo3IgMP4_FrUse*fr`D*xe z$4!JAYst8sxU?J%Nr`pwaoR7Bl(?dOp)|NRImS_69hznki^(JsHX0hMsIH!Uh;^x@ zk?!6>5?&96&4xFf#cmjrFXH8s2lkS46kaLoc5$WI#g*m;j&*@C=8bJgr0D9)vyJS|bH7V1loY;nmblYV zXmSh_IjxaS=g4MstgABfR=ds%$NpMeBD;TZ2yvFc)eVzqR3;RX&~=l}!C{<}{;oRn zcUPqq0Bji^!L%%7Nh1=L2?mqIV;M5(T#@nBPLUUnpILk+b{RTbbahTWC7VN4a(sX5 zHoouLiX{jbV*Y5s%p3M+M=L$s+X!Dt5sk`ZGFsV*r69ngkuaV~*IRTc@l4-&1aWTe ze)Loyeksj~ZJYVE^F~bj8n1020=8vtE>7x9=gH^S9U8?T)1UHW3~xijZzH+|){hR7KAo#krEwe tPA4FxXEnZ}4Nd#y$kgwq Date: Tue, 12 May 2020 12:37:57 -0400 Subject: [PATCH 13/63] mclock: support 12h time --- apps.json | 2 +- apps/mclock/ChangeLog | 1 + apps/mclock/clock-morphing.js | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps.json b/apps.json index 0a41e7e91..9b4bff03d 100644 --- a/apps.json +++ b/apps.json @@ -108,7 +108,7 @@ { "id": "mclock", "name": "Morphing Clock", "icon": "clock-morphing.png", - "version":"0.05", + "version":"0.06", "description": "7 segment clock that morphs between minutes and hours", "tags": "clock", "type":"clock", diff --git a/apps/mclock/ChangeLog b/apps/mclock/ChangeLog index 98566f277..cca1b6e6b 100644 --- a/apps/mclock/ChangeLog +++ b/apps/mclock/ChangeLog @@ -3,3 +3,4 @@ 0.04: Improve performance, attempt to remove occasional glitch when LCD on (fix #279) 0.05: Add "ram" keyword to allow 2v06 Espruino builds to cache function that needs to be fast Fix issue where first digit could get stuck going from "2x:xx" to " x:xx" (fix #365) +0.06: Support 12 hour time diff --git a/apps/mclock/clock-morphing.js b/apps/mclock/clock-morphing.js index 8a2c62e28..32048cd60 100644 --- a/apps/mclock/clock-morphing.js +++ b/apps/mclock/clock-morphing.js @@ -1,3 +1,4 @@ +var is12Hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]; var locale = require("locale"); var CHARW = 34; // how tall are digits? var CHARP = 2; // how chunky are digits? @@ -146,7 +147,7 @@ function drawDigits(lastText,thisText,n) { x+=s+p+7; } } -function drawSeconds() { +function drawEverythingElse() { var x = (CHARW + CHARP + 6)*5; var y = Y + 2*CHARW + CHARP; var d = new Date(); @@ -154,6 +155,8 @@ function drawSeconds() { g.setFont("6x8"); g.setFontAlign(-1,-1); g.drawString(("0"+d.getSeconds()).substr(-2), x, y-8, true); + // meridian + if (is12Hour) g.drawString((d.getHours() < 12) ? "AM" : "PM", x, Y + 4, true); // date g.setFontAlign(0,-1); var date = locale.date(d,false); @@ -164,13 +167,15 @@ function drawSeconds() { function showTime() { if (animInterval) return; // in animation - quit var d = new Date(); - var t = (" "+d.getHours()).substr(-2)+":"+ + 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); - drawSeconds(); + drawEverythingElse(); lastTime = t; return; } From d03fb00f2ddfddbf09a9f9424308ff17131b9e5f Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 12 May 2020 22:01:22 +0100 Subject: [PATCH 14/63] * URL fetch is now async * Adding '#search' after the URL (when not the name of a 'filter' chip) will set up search for that term * If `bin/pre-publish.sh` has been run and recent.csv created, add 'Sort By' chip* URL fetch is now async --- CHANGELOG.md | 3 +++ bin/pre-publish.sh | 16 ++++++++++++++++ index.html | 30 +++++++++++++++++++++--------- js/index.js | 43 +++++++++++++++++++++++++++++++++++++++---- js/utils.js | 5 ++++- 5 files changed, 83 insertions(+), 14 deletions(-) create mode 100755 bin/pre-publish.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index bd1552747..2e157951f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,3 +14,6 @@ Changed for individual apps are listed in `apps/appname/ChangeLog` * Added espruinotools.js for pretokenisation * Included image and compression tools in repo * Added better upload of large files (incl. compression) +* URL fetch is now async +* Adding '#search' after the URL (when not the name of a 'filter' chip) will set up search for that term +* If `bin/pre-publish.sh` has been run and recent.csv created, add 'Sort By' chip diff --git a/bin/pre-publish.sh b/bin/pre-publish.sh new file mode 100755 index 000000000..47822dbf2 --- /dev/null +++ b/bin/pre-publish.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +cd `dirname $0`/.. +node bin/sanitycheck.js || exit 1 + +echo "Sanity check passed." + +echo "Finding most recent apps..." + +cd apps +for appfolder in *; do + echo "$(git log --follow --format=%ai $appfolder),$appfolder" | tail -n 1 ; +done | grep -v _example_ | sort -r > ../recent.csv +cd .. + +echo "Ready to publish" diff --git a/index.html b/index.html index c7c262557..0d23c2c0b 100644 --- a/index.html +++ b/index.html @@ -40,6 +40,9 @@ .chip { cursor: pointer; } + .sort-nav { + float: right; + } .tile-content { position: relative; } .link-github { position:absolute; @@ -88,16 +91,25 @@
-
- - - - - - - - +
+ +
+ + + + + + + + +
+
+
diff --git a/js/index.js b/js/index.js index 7b896b782..94c3e86a4 100644 --- a/js/index.js +++ b/js/index.js @@ -1,5 +1,6 @@ var appJSON = []; // List of apps and info from apps.json var appsInstalled = []; // list of app JSON +var appPublishDates = {}; // list of app publish dates from recent.csv var files = []; // list of files on Bangle var DEFAULTSETTINGS = { pretokenise : true, @@ -19,6 +20,16 @@ httpGet("apps.json").then(apps=>{ refreshFilter(); }); +httpGet("recent.csv").then(csv=>{ + document.querySelector(".sort-nav").classList.remove("hidden"); + csv.split("\n").forEach(line=>{ + var l = line.split(","); + appPublishDates[l[1]] = Date.parse(l[0]); + }); +}).catch(err=>{ + console.log("No recent.csv - app sort disabled"); +}); + // =========================================== Top Navigation function showChangeLog(appid) { var app = appNameToApp(appid); @@ -182,11 +193,12 @@ function showTab(tabname) { // =========================================== Library -var chips = Array.from(document.querySelectorAll('.chip')).map(chip => chip.attributes.filterid.value); +var chips = Array.from(document.querySelectorAll('.filter-nav .chip')).map(chip => chip.attributes.filterid.value); var hash = window.location.hash ? window.location.hash.slice(1) : ''; var activeFilter = !!~chips.indexOf(hash) ? hash : ''; -var currentSearch = ''; +var activeSort = ''; +var currentSearch = activeFilter ? '' : hash; function refreshFilter(){ var filtersContainer = document.querySelector("#librarycontainer .filter-nav"); @@ -194,6 +206,12 @@ function refreshFilter(){ if(activeFilter) filtersContainer.querySelector('.chip[filterid="'+activeFilter+'"]').classList.add('active'); else filtersContainer.querySelector('.chip[filterid]').classList.add('active'); } +function refreshSort(){ + var sortContainer = document.querySelector("#librarycontainer .sort-nav"); + sortContainer.querySelector('.active').classList.remove('active'); + if(activeSort) sortContainer.querySelector('.chip[sortid="'+activeSort+'"]').classList.add('active'); + else sortContainer.querySelector('.chip[sortid]').classList.add('active'); +} function refreshLibrary() { var panelbody = document.querySelector("#librarycontainer .panel-body"); var visibleApps = appJSON; @@ -202,7 +220,7 @@ function refreshLibrary() { if (activeFilter) { if ( activeFilter == "favourites" ) { visibleApps = visibleApps.filter(app => app.id && (favourites.filter( e => e == app.id).length)); - }else{ + } else { visibleApps = visibleApps.filter(app => app.tags && app.tags.split(',').includes(activeFilter)); } } @@ -211,6 +229,13 @@ function refreshLibrary() { visibleApps = visibleApps.filter(app => app.name.toLowerCase().includes(currentSearch) || app.tags.includes(currentSearch)); } + if (activeSort) { + visibleApps = visibleApps.slice(); // clone the array so sort doesn't mess with original + if (activeSort=="new") { + visibleApps = visibleApps.sort((a,b) => appPublishDates[b.id] - appPublishDates[a.id]); + } else throw new Error("Unknown sort type "+activeSort); + } + panelbody.innerHTML = visibleApps.map((app,idx) => { var appInstalled = appsInstalled.find(a=>a.id==app.id); var version = getVersionInfo(app, appInstalled); @@ -580,12 +605,22 @@ filtersContainer.addEventListener('click', ({ target }) => { }); var librarySearchInput = document.querySelector("#searchform input"); - +librarySearchInput.value = currentSearch; librarySearchInput.addEventListener('input', evt => { currentSearch = evt.target.value.toLowerCase(); refreshLibrary(); }); +var sortContainer = document.querySelector("#librarycontainer .sort-nav"); +sortContainer.addEventListener('click', ({ target }) => { + if (target.classList.contains('active')) return; + + activeSort = target.getAttribute('sortid') || ''; + refreshSort(); + refreshLibrary(); + window.location.hash = activeFilter; +}); + // =========================================== About if (window.location.host=="banglejs.com") { diff --git a/js/utils.js b/js/utils.js index 53eeb1868..2b6a6e4c3 100644 --- a/js/utils.js +++ b/js/utils.js @@ -37,7 +37,10 @@ function httpGet(url) { }); oReq.addEventListener("error", () => reject()); oReq.addEventListener("abort", () => reject()); - oReq.open("GET", url); + oReq.open("GET", url, true); + oReq.onerror = function () { + reject("HTTP Request failed"); + }; oReq.send(); }); } From 069d663253c3389bec7114c58fd47a64a5d34c64 Mon Sep 17 00:00:00 2001 From: msdeibel Date: Tue, 12 May 2020 23:10:14 +0200 Subject: [PATCH 15/63] Add Random Clock Loader widget --- apps.json | 12 ++++++++++++ apps/rndmclk/ChangeLog | 1 + apps/rndmclk/README.md | 6 ++++++ apps/rndmclk/rndmclk.png | Bin 0 -> 1971 bytes apps/rndmclk/widget.js | 29 +++++++++++++++++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 apps/rndmclk/ChangeLog create mode 100644 apps/rndmclk/README.md create mode 100644 apps/rndmclk/rndmclk.png create mode 100644 apps/rndmclk/widget.js diff --git a/apps.json b/apps.json index 0a41e7e91..543ff1907 100644 --- a/apps.json +++ b/apps.json @@ -1720,5 +1720,17 @@ "data": [ {"name":"gallifr.json"} ] + }, + { "id": "rndmclk", + "name": "Random Clock Loader", + "icon": "rndmclk.png", + "version":"0.01", + "description": "Load a different clock whenever the LCD is switched on.", + "readme": "README.md", + "tags": "widget,clock", + "type":"widget", + "storage": [ + {"name":"rndmclk.wid.js","url":"widget.js"} + ] } ] diff --git a/apps/rndmclk/ChangeLog b/apps/rndmclk/ChangeLog new file mode 100644 index 000000000..55cda0f21 --- /dev/null +++ b/apps/rndmclk/ChangeLog @@ -0,0 +1 @@ +0.01: New widget diff --git a/apps/rndmclk/README.md b/apps/rndmclk/README.md new file mode 100644 index 000000000..3bfaf0e89 --- /dev/null +++ b/apps/rndmclk/README.md @@ -0,0 +1,6 @@ +# Summary + +Random Clock is a widget that will randomly show one of the installed watch faces each time the LCD is turned on. + +## Disclaimer +This is an early version and will load a clock each time the LCD is turned on no matter what app was running before the screen went to standby. Also the next watch face is only loaded after the last one is shown for a few tens of seconds. \ No newline at end of file diff --git a/apps/rndmclk/rndmclk.png b/apps/rndmclk/rndmclk.png new file mode 100644 index 0000000000000000000000000000000000000000..9519b8d093988ad29406064d68a8be75fbf3c4de GIT binary patch literal 1971 zcmeHHi#O8?9RH25F^}||Qn*}?Zi}VTb6GNUtB*m_z5-Wn8`p9{bsV6M zyM)0pVQ@_tJToQ_%-}*8?O-Ms%;Z6s?ba-Vbl9>wS2c95e$=_Tp$pc)hc$M=8u@D* z`N)hf$jmQJY`!y_@ASCa>9N4&are(n0{16^4Nct}ngnjm!i`M=cuNnwMdZ~i^lT9! zp7wgT2)DKN?0PCfw)F;3KJCx@bbvM=TrhXAaQ;xyTv+Ms;WGV^ve}3S`l#xUN9p>g znvYR6`eQZvXx4|A`VT11OEmYTAGaUZCBbz`!#nzq@TKAWfyj>jl;q)86b)VNWDX8y+g!)S*m#SvP5x?rz3Re z61%1oyL2gi+SHd?8jW`M?%ne8at4FJWHO&We@=e!`nq_8`btKX$Zkqxh0@W&fzi?- zMV3NMmTRsk)MZ18%Hi?qk+E9YMBT`Eoos?NI?=39HjgRW#*}ioT%k~K#wSI}sa~b3 z|E;QjNyy^*g0fIj(s(`A$2f)xOnEt5hnDc3Nw|^t4W=GpzW3{M!V0ypC&z z699E3C;!WoU9r0lIqnfW+-TVy1#r^C!X%?>*4Q3q$T*oC-wzgYrS7& z$nQ}(^;gLlQF4r|ASw37vY8_En)f6^&v(}Si6cHY0()+F4v$yda@e}iu$vT-U3G6? zF2r_wamShL?GG@bsp$wlzr@2z?0hm8>(fvv&2586yJL;xhRQ|ie{E$41Okcfj?e?RfNMP~vFm36@$ zMYkN^!E&UOn5NGMUQ_MV5X!WOJsaP7_z%{%*ye-)3$>l9SnB#yla4_}L9&-t@+7ux z3DtO4!9iL@Ql>O0ZETx*dvqC%f)0@gTp`OZCre&ggF{=d7jct4tA7OTmgq8}y`DX5 zn(fhE@*Ce=z13GN5Mf+%Gx(2;{{qzz(&Uge6Xwj=m;N}#2J|^7R^WXbXJ`tt=D1*8 z&$` { + + /** + * Random value between zero (inclusive) and max (exclusive) + * @param {int} max + */ + function getRandomInt(max) { + return Math.floor(Math.random() * Math.floor(max)); + } + + function loadRandomClock() { + // Find available clock apps (same way as in the bootloader) + var clockApps = require("Storage").list(/\.info$/).map(app => require("Storage").readJSON(app, 1) || {}).filter(app => app.type == "clock").sort((a, b) => a.sortorder - b.sortorder); + + if (clockApps && clockApps.length > 0) { + var clockIndex = getRandomInt(clockApps.length); + + load(clockApps[clockIndex].src); + } + } + + Bangle.on('lcdPower', (on) => { + if (on) { + // TODO: Only run if the current app is a clock as well + loadRandomClock(); + } + }); + +})(); \ No newline at end of file From 746ea6c1296066bb0e74b3179319201f82e758a8 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 13 May 2020 11:25:08 +0100 Subject: [PATCH 16/63] Allow sorting by modified as well as created date --- .gitignore | 1 + bin/pre-publish.sh | 8 +++++--- index.html | 3 ++- js/index.js | 13 ++++++++----- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index abc3e9bd1..be33fbc90 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules package-lock.json .DS_Store *.js.bak +appdates.csv diff --git a/bin/pre-publish.sh b/bin/pre-publish.sh index 47822dbf2..6a80f2516 100755 --- a/bin/pre-publish.sh +++ b/bin/pre-publish.sh @@ -5,12 +5,14 @@ node bin/sanitycheck.js || exit 1 echo "Sanity check passed." -echo "Finding most recent apps..." +echo "Finding app dates..." +# Create list of: +# appid,created_time,modified_time cd apps for appfolder in *; do - echo "$(git log --follow --format=%ai $appfolder),$appfolder" | tail -n 1 ; -done | grep -v _example_ | sort -r > ../recent.csv + echo "$appfolder,$(git log --follow --format=%ai -- $appfolder | tail -n 1),$(git log --follow --format=%ai -- $appfolder | head -n 1)" ; +done | grep -v _example_ | grep -v unknown.png > ../appdates.csv cd .. echo "Ready to publish" diff --git a/index.html b/index.html index 0d23c2c0b..6d0566d13 100644 --- a/index.html +++ b/index.html @@ -95,7 +95,8 @@
diff --git a/js/index.js b/js/index.js index 94c3e86a4..031391f52 100644 --- a/js/index.js +++ b/js/index.js @@ -1,6 +1,6 @@ var appJSON = []; // List of apps and info from apps.json var appsInstalled = []; // list of app JSON -var appPublishDates = {}; // list of app publish dates from recent.csv +var appSortInfo = {}; // list of data to sort by, from appdates.csv { created, modified } var files = []; // list of files on Bangle var DEFAULTSETTINGS = { pretokenise : true, @@ -20,11 +20,14 @@ httpGet("apps.json").then(apps=>{ refreshFilter(); }); -httpGet("recent.csv").then(csv=>{ +httpGet("appdates.csv").then(csv=>{ document.querySelector(".sort-nav").classList.remove("hidden"); csv.split("\n").forEach(line=>{ var l = line.split(","); - appPublishDates[l[1]] = Date.parse(l[0]); + appSortInfo[l[0]] = { + created : Date.parse(l[1]), + modified : Date.parse(l[2]) + }; }); }).catch(err=>{ console.log("No recent.csv - app sort disabled"); @@ -231,8 +234,8 @@ function refreshLibrary() { if (activeSort) { visibleApps = visibleApps.slice(); // clone the array so sort doesn't mess with original - if (activeSort=="new") { - visibleApps = visibleApps.sort((a,b) => appPublishDates[b.id] - appPublishDates[a.id]); + if (activeSort=="created" || activeSort=="modified") { + visibleApps = visibleApps.sort((a,b) => appSortInfo[b.id][activeSort] - appSortInfo[a.id][activeSort]); } else throw new Error("Unknown sort type "+activeSort); } From 116635b20dde8d681be72ee3db467839cf04add4 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 13 May 2020 11:27:04 +0100 Subject: [PATCH 17/63] minor tweak for systems without node-legacy --- bin/pre-publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pre-publish.sh b/bin/pre-publish.sh index 6a80f2516..ee73968d7 100755 --- a/bin/pre-publish.sh +++ b/bin/pre-publish.sh @@ -1,7 +1,7 @@ #!/bin/bash cd `dirname $0`/.. -node bin/sanitycheck.js || exit 1 +nodejs bin/sanitycheck.js || exit 1 echo "Sanity check passed." From b3e189ad879c1580aa0c20e9712cd7bb484835e8 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 13 May 2020 11:40:33 +0100 Subject: [PATCH 18/63] Fix alignment of sort tab --- index.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 6d0566d13..f3ca261b5 100644 --- a/index.html +++ b/index.html @@ -40,6 +40,9 @@ .chip { cursor: pointer; } + .filter-nav { + display: inline-block; + } .sort-nav { float: right; } @@ -92,12 +95,6 @@
-
@@ -108,10 +105,15 @@
- +
-
+
From f8657f93aa7b7987e2436e22dfa98c6bcad27465 Mon Sep 17 00:00:00 2001 From: bengwalker <63957296+bengwalker@users.noreply.github.com> Date: Wed, 13 May 2020 17:47:47 +0200 Subject: [PATCH 19/63] Handle "Buzz in progess" Exception --- apps/metronome/metronome.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index c41305f77..27c36e06f 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -9,15 +9,16 @@ Bangle.setLCDTimeout(undefined); //do not deaktivate display while running this function changecolor() { const maxColors = 2; const colors = { - 0: { value: 0xFFFF, name: "White" }, - // 1: { value: 0x000F, name: "Navy" }, - // 2: { value: 0x03E0, name: "DarkGreen" }, - // 3: { value: 0x03EF, name: "DarkCyan" }, - // 4: { value: 0x7800, name: "Maroon" }, - // 5: { value: 0x780F, name: "Purple" }, - // 6: { value: 0x7BE0, name: "Olive" }, - // 7: { value: 0xC618, name: "LightGray" }, - // 8: { value: 0x7BEF, name: "DarkGrey" }, + 0: { value: 0xF800, name: "Red" }, + 1: { value: 0xFFFF, name: "White" }, + 2: { value: 0x03E0, name: "DarkGreen" }, + 3: { value: 0xFFFF, name: "White" }, + 4: { value: 0x03E0, name: "DarkGreen" }, + 5: { value: 0xFFFF, name: "White" }, + 6: { value: 0x03E0, name: "DarkGreen" }, + 7: { value: 0xFFFF, name: "White" }, + 8: { value: 0x7BEF, name: "DarkGrey" }, + // 9: { value: 0x001F, name: "Blue" }, // 9: { value: 0x001F, name: "Blue" }, // 10: { value: 0x07E0, name: "Green" }, // 11: { value: 0x07FF, name: "Cyan" }, @@ -42,7 +43,11 @@ function changecolor() { function updateScreen() { g.clearRect(0, 50, 250, 150); changecolor(); - Bangle.buzz(50, 0.75); + try { + Bangle.buzz(50, 0.75); + } + catch(err) { + } g.setFont("Vector",48); g.drawString(Math.floor(bpm)+"bpm", 5, 60); } From 3beaab82ceacf54d29ebf30256ee51635b7dd0ad Mon Sep 17 00:00:00 2001 From: bengwalker Date: Wed, 13 May 2020 22:31:11 +0200 Subject: [PATCH 20/63] adding settings --- apps/banglerun/ChangeLog | 0 apps/buffgym/buffgym-scrn1.png | Bin apps/buffgym/buffgym-scrn2.png | Bin apps/buffgym/buffgym-scrn3.png | Bin apps/buffgym/buffgym-scrn4.png | Bin apps/buffgym/buffgym-scrn5.png | Bin apps/buffgym/buffgym-scrn6.png | Bin apps/buffgym/buffgym.app.js | 0 apps/buffgym/buffgym.png | Bin apps/marioclock/mario-clock-screen-shot.png | Bin apps/metronome/metronome.js | 36 +++++++++++------- apps/metronome/settings.js | 40 ++++++++++++++++++++ apps/miclock/clock-mixed.png | Bin apps/minionclk/ChangeLog | 0 apps/minionclk/app-icon.js | 0 apps/minionclk/app.js | 0 apps/minionclk/minionclk.png | Bin apps/rpgdice/ChangeLog | 0 apps/rpgdice/app-icon.js | 0 apps/rpgdice/app.js | 0 apps/rpgdice/rpgdice.png | Bin apps/sclock/clock-simple.png | Bin apps/scolor/show-color.png | Bin bin/firmwaremaker.js | 0 bin/sanitycheck.js | 0 25 files changed, 62 insertions(+), 14 deletions(-) mode change 100755 => 100644 apps/banglerun/ChangeLog mode change 100755 => 100644 apps/buffgym/buffgym-scrn1.png mode change 100755 => 100644 apps/buffgym/buffgym-scrn2.png mode change 100755 => 100644 apps/buffgym/buffgym-scrn3.png mode change 100755 => 100644 apps/buffgym/buffgym-scrn4.png mode change 100755 => 100644 apps/buffgym/buffgym-scrn5.png mode change 100755 => 100644 apps/buffgym/buffgym-scrn6.png mode change 100755 => 100644 apps/buffgym/buffgym.app.js mode change 100755 => 100644 apps/buffgym/buffgym.png mode change 100755 => 100644 apps/marioclock/mario-clock-screen-shot.png create mode 100644 apps/metronome/settings.js mode change 100755 => 100644 apps/miclock/clock-mixed.png mode change 100755 => 100644 apps/minionclk/ChangeLog mode change 100755 => 100644 apps/minionclk/app-icon.js mode change 100755 => 100644 apps/minionclk/app.js mode change 100755 => 100644 apps/minionclk/minionclk.png mode change 100755 => 100644 apps/rpgdice/ChangeLog mode change 100755 => 100644 apps/rpgdice/app-icon.js mode change 100755 => 100644 apps/rpgdice/app.js mode change 100755 => 100644 apps/rpgdice/rpgdice.png mode change 100755 => 100644 apps/sclock/clock-simple.png mode change 100755 => 100644 apps/scolor/show-color.png mode change 100755 => 100644 bin/firmwaremaker.js mode change 100755 => 100644 bin/sanitycheck.js diff --git a/apps/banglerun/ChangeLog b/apps/banglerun/ChangeLog old mode 100755 new mode 100644 diff --git a/apps/buffgym/buffgym-scrn1.png b/apps/buffgym/buffgym-scrn1.png old mode 100755 new mode 100644 diff --git a/apps/buffgym/buffgym-scrn2.png b/apps/buffgym/buffgym-scrn2.png old mode 100755 new mode 100644 diff --git a/apps/buffgym/buffgym-scrn3.png b/apps/buffgym/buffgym-scrn3.png old mode 100755 new mode 100644 diff --git a/apps/buffgym/buffgym-scrn4.png b/apps/buffgym/buffgym-scrn4.png old mode 100755 new mode 100644 diff --git a/apps/buffgym/buffgym-scrn5.png b/apps/buffgym/buffgym-scrn5.png old mode 100755 new mode 100644 diff --git a/apps/buffgym/buffgym-scrn6.png b/apps/buffgym/buffgym-scrn6.png old mode 100755 new mode 100644 diff --git a/apps/buffgym/buffgym.app.js b/apps/buffgym/buffgym.app.js old mode 100755 new mode 100644 diff --git a/apps/buffgym/buffgym.png b/apps/buffgym/buffgym.png old mode 100755 new mode 100644 diff --git a/apps/marioclock/mario-clock-screen-shot.png b/apps/marioclock/mario-clock-screen-shot.png old mode 100755 new mode 100644 diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index 27c36e06f..f1071c0e4 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -6,8 +6,26 @@ var tindex=0; //index to iterate through time_diffs Bangle.setLCDTimeout(undefined); //do not deaktivate display while running this app +const storage = require("Storage"); +const SETTINGS_FILE = 'metronome.settings.json'; + +//return setting +function setting(key) { + //define default settings + const DEFAULTS = { + 'beatsperbar': 4, + }; + if (!settings) { loadSettings(); } + return (key in settings) ? settings[key] : DEFAULTS[key]; +} + +//load settings +let settings; + +function loadSettings() { + settings = storage.readJSON(SETTINGS_FILE, 1) || {}; + function changecolor() { - const maxColors = 2; const colors = { 0: { value: 0xF800, name: "Red" }, 1: { value: 0xFFFF, name: "White" }, @@ -17,21 +35,10 @@ function changecolor() { 5: { value: 0xFFFF, name: "White" }, 6: { value: 0x03E0, name: "DarkGreen" }, 7: { value: 0xFFFF, name: "White" }, - 8: { value: 0x7BEF, name: "DarkGrey" }, - // 9: { value: 0x001F, name: "Blue" }, - // 9: { value: 0x001F, name: "Blue" }, - // 10: { value: 0x07E0, name: "Green" }, - // 11: { value: 0x07FF, name: "Cyan" }, - 1: { value: 0xF800, name: "Red" }, - // 13: { value: 0xF81F, name: "Magenta" }, - // 14: { value: 0xFFE0, name: "Yellow" }, - // 15: { value: 0xFFFF, name: "White" }, - // 16: { value: 0xFD20, name: "Orange" }, - // 17: { value: 0xAFE5, name: "GreenYellow" }, - // 18: { value: 0xF81F, name: "Pink" }, + 8: { value: 0x03E0, name: "DarkGreen" }, }; g.setColor(colors[cindex].value); - if (cindex == maxColors-1) { + if (cindex == setting('beatsperbar')-1) { cindex = 0; } else { @@ -52,6 +59,7 @@ function updateScreen() { g.drawString(Math.floor(bpm)+"bpm", 5, 60); } + Bangle.on('touch', function(button) { // setting bpm by tapping the screen. Uses the mean time difference between several tappings. if (tindex < time_diffs.length) { diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js new file mode 100644 index 000000000..2aefa1052 --- /dev/null +++ b/apps/metronome/settings.js @@ -0,0 +1,40 @@ +// This file should contain exactly one function, which shows the app's settings +/** + * @param {function} back Use back() to return to settings menu + */ +(function(back) { + const SETTINGS_FILE = 'metronome.settings.json'; + + // initialize with default settings... + let s = { + 'beatsperbar': 4, + }; + // ...and overwrite them with any saved values + // This way saved values are preserved if a new version adds more settings + const storage = require('Storage'); + const saved = storage.readJSON(SETTINGS_FILE, 1) || {}; + for (const key in saved) { + s[key] = saved[key]; + } + + // creates a function to safe a specific setting, e.g. save('color')(1) + function save(key) { + return function(value) { + s[key] = value; + storage.write(SETTINGS_FILE, s); + }; + } + + const menu = { + '': { 'title': 'Metronome' }, + '< Back': back, + 'beats per bar': { + value: s.beatsperbar, + min: 1, + max: 8, + step: 1, + onchange: save('beatsperbar'), + }, + }; + E.showMenu(menu); +}); \ No newline at end of file diff --git a/apps/miclock/clock-mixed.png b/apps/miclock/clock-mixed.png old mode 100755 new mode 100644 diff --git a/apps/minionclk/ChangeLog b/apps/minionclk/ChangeLog old mode 100755 new mode 100644 diff --git a/apps/minionclk/app-icon.js b/apps/minionclk/app-icon.js old mode 100755 new mode 100644 diff --git a/apps/minionclk/app.js b/apps/minionclk/app.js old mode 100755 new mode 100644 diff --git a/apps/minionclk/minionclk.png b/apps/minionclk/minionclk.png old mode 100755 new mode 100644 diff --git a/apps/rpgdice/ChangeLog b/apps/rpgdice/ChangeLog old mode 100755 new mode 100644 diff --git a/apps/rpgdice/app-icon.js b/apps/rpgdice/app-icon.js old mode 100755 new mode 100644 diff --git a/apps/rpgdice/app.js b/apps/rpgdice/app.js old mode 100755 new mode 100644 diff --git a/apps/rpgdice/rpgdice.png b/apps/rpgdice/rpgdice.png old mode 100755 new mode 100644 diff --git a/apps/sclock/clock-simple.png b/apps/sclock/clock-simple.png old mode 100755 new mode 100644 diff --git a/apps/scolor/show-color.png b/apps/scolor/show-color.png old mode 100755 new mode 100644 diff --git a/bin/firmwaremaker.js b/bin/firmwaremaker.js old mode 100755 new mode 100644 diff --git a/bin/sanitycheck.js b/bin/sanitycheck.js old mode 100755 new mode 100644 From 0c1499253dff27d848355a807e2093aa302195c1 Mon Sep 17 00:00:00 2001 From: bengwalker Date: Wed, 13 May 2020 22:44:16 +0200 Subject: [PATCH 21/63] hotfix --- apps/metronome/metronome.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index f1071c0e4..829b7032a 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -24,6 +24,7 @@ let settings; function loadSettings() { settings = storage.readJSON(SETTINGS_FILE, 1) || {}; +} function changecolor() { const colors = { From 09ba504289ae95c113ed2f2beb95c67b39dcecab Mon Sep 17 00:00:00 2001 From: bengwalker Date: Thu, 14 May 2020 07:51:55 +0200 Subject: [PATCH 22/63] add settings to apps.json --- apps.json | 3 ++- apps/metronome/metronome.js | 3 ++- apps/metronome/settings.js | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 92746025e..1caaf9369 100644 --- a/apps.json +++ b/apps.json @@ -1417,7 +1417,8 @@ "name": "metronome.img", "url": "metronome-icon.js", "evaluate": true - } + }, + {"name":"metronome.settings.js","url":"settings.js"} ] }, { "id": "blackjack", diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index 829b7032a..ac9b9d631 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -14,6 +14,7 @@ function setting(key) { //define default settings const DEFAULTS = { 'beatsperbar': 4, + 'buzzintens': 0.75, }; if (!settings) { loadSettings(); } return (key in settings) ? settings[key] : DEFAULTS[key]; @@ -52,7 +53,7 @@ function updateScreen() { g.clearRect(0, 50, 250, 150); changecolor(); try { - Bangle.buzz(50, 0.75); + Bangle.buzz(50, setting('buzzintens')); } catch(err) { } diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js index 2aefa1052..b91dd9288 100644 --- a/apps/metronome/settings.js +++ b/apps/metronome/settings.js @@ -8,6 +8,7 @@ // initialize with default settings... let s = { 'beatsperbar': 4, + 'buzzintens': 0.75, }; // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -35,6 +36,13 @@ step: 1, onchange: save('beatsperbar'), }, + 'buzz intensity': { + value: s.buzzintens, + min: 0, + max: 2, + step: 0.25, + onchange: save('buzzintens'), + }, }; E.showMenu(menu); }); \ No newline at end of file From 7df65cad513258a005bd986b9f0edf33e1e5ec8d Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Thu, 14 May 2020 09:01:52 +0200 Subject: [PATCH 23/63] change version and update Readme --- apps.json | 2 +- apps/metronome/ChangeLog | 1 + apps/metronome/README.md | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 1caaf9369..b478a8f69 100644 --- a/apps.json +++ b/apps.json @@ -1403,7 +1403,7 @@ "id": "metronome", "name": "Metronome", "icon": "metronome_icon.png", - "version": "0.04", + "version": "0.05", "readme": "README.md", "description": "Makes the watch blinking and vibrating with a given rate", "tags": "tool", diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 25628660e..61ff09c98 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,3 +2,4 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed +0.05: Enable to set buzz intensity and beats per bar via settings diff --git a/apps/metronome/README.md b/apps/metronome/README.md index 1bb9a893c..8a76114f8 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,6 +8,7 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. +* Using the settings app, you can change the intensity of buzzing and the beats per bar (default 4). The first beat per bar will be marked in red. ## Attributions From 0ce1556a702cc5197e63082b30e25a1bdcf54b55 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Thu, 14 May 2020 10:55:50 +0200 Subject: [PATCH 24/63] change README and ChangeLog entry --- apps/metronome/ChangeLog | 2 +- apps/metronome/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 61ff09c98..909d6b983 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,4 +2,4 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed -0.05: Enable to set buzz intensity and beats per bar via settings +0.05: Buzz intensity and beats per bar can be changed via settings-app diff --git a/apps/metronome/README.md b/apps/metronome/README.md index 8a76114f8..f67b4adf1 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,7 +8,7 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. -* Using the settings app, you can change the intensity of buzzing and the beats per bar (default 4). The first beat per bar will be marked in red. +* Intensity of buzzing and the beats per bar (default 4) can be changed with the settings-app. The first beat per bar will be marked in red. ## Attributions From 36009ed212b0379254480cb563fef7daa895de62 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 14 May 2020 11:42:10 +0100 Subject: [PATCH 25/63] tweaks to allow `appinfo` to work under node.js --- js/appinfo.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/appinfo.js b/js/appinfo.js index b4d0b5426..ad2611d19 100644 --- a/js/appinfo.js +++ b/js/appinfo.js @@ -1,10 +1,13 @@ +if (typeof btoa==="undefined") + function btoa(d) { return Buffer.from(d).toString('base64'); } + // Converts a string into most efficient way to send to Espruino (either json, base64, or compressed base64) function toJS(txt) { var json = JSON.stringify(txt); var b64 = "atob("+JSON.stringify(btoa(json))+")"; var js = b64.length < json.length ? b64 : json; - if (heatshrink) { + if (typeof heatshrink !== "undefined") { var ua = new Uint8Array(txt.length); for (var i=0;i Date: Thu, 14 May 2020 11:42:24 +0100 Subject: [PATCH 26/63] Bootloader: Don't modify beep/buzz behaviour if firmware does it automatically --- apps.json | 2 +- apps/boot/ChangeLog | 1 + apps/boot/boot0.js | 30 ++++++++++++++++-------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/apps.json b/apps.json index 42a3f0d2a..906331f65 100644 --- a/apps.json +++ b/apps.json @@ -2,7 +2,7 @@ { "id": "boot", "name": "Bootloader", "icon": "bootloader.png", - "version":"0.16", + "version":"0.17", "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings", "tags": "tool,system", "type":"bootloader", diff --git a/apps/boot/ChangeLog b/apps/boot/ChangeLog index c12654e97..c157c6705 100644 --- a/apps/boot/ChangeLog +++ b/apps/boot/ChangeLog @@ -15,3 +15,4 @@ 0.14: Move welcome loaders to *.boot.js 0.15: Added BLE HID option for Joystick and bare Keyboard 0.16: Detect out of memory errors and draw them onto the bottom of the screen in red +0.17: Don't modify beep/buzz behaviour if firmware does it automatically diff --git a/apps/boot/boot0.js b/apps/boot/boot0.js index 9463df27c..38423362d 100644 --- a/apps/boot/boot0.js +++ b/apps/boot/boot0.js @@ -21,20 +21,22 @@ if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth // Don't disconnect if something is already connected to us if (s.ble===false && !NRF.getSecurityStatus().connected) NRF.sleep(); // Set time, vibrate, beep, etc -if (!s.vibrate) Bangle.buzz=Promise.resolve; -if (s.beep===false) Bangle.beep=Promise.resolve; -else if (s.beep=="vib") Bangle.beep = function (time, freq) { - return new Promise(function(resolve) { - if ((0|freq)<=0) freq=4000; - if ((0|time)<=0) time=200; - if (time>5000) time=5000; - analogWrite(D13,0.1,{freq:freq}); - setTimeout(function() { - digitalWrite(D13,0); - resolve(); - }, time); - }); -}; +if (!Bangle.F_BEEPSET) { + if (!s.vibrate) Bangle.buzz=Promise.resolve; + if (s.beep===false) Bangle.beep=Promise.resolve; + else if (s.beep=="vib") Bangle.beep = function (time, freq) { + return new Promise(function(resolve) { + if ((0|freq)<=0) freq=4000; + if ((0|time)<=0) time=200; + if (time>5000) time=5000; + analogWrite(D13,0.1,{freq:freq}); + setTimeout(function() { + digitalWrite(D13,0); + resolve(); + }, time); + }); + }; +} Bangle.setLCDTimeout(s.timeout); if (!s.timeout) Bangle.setLCDPower(1); E.setTimeZone(s.timezone); From 4f9d3e779418689a1f1e1c65438d66ded8986457 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 14 May 2020 16:24:14 +0100 Subject: [PATCH 27/63] New 'espruinotools' which fixes pretokenise issue when ID follows ID (fix #416) --- CHANGELOG.md | 1 + js/espruinotools.js | 75 ++++++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e157951f..e5cd6aef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,3 +17,4 @@ Changed for individual apps are listed in `apps/appname/ChangeLog` * URL fetch is now async * Adding '#search' after the URL (when not the name of a 'filter' chip) will set up search for that term * If `bin/pre-publish.sh` has been run and recent.csv created, add 'Sort By' chip +* New 'espruinotools' which fixes pretokenise issue when ID follows ID (fix #416) diff --git a/js/espruinotools.js b/js/espruinotools.js index df766fc7d..a201a7fd3 100644 --- a/js/espruinotools.js +++ b/js/espruinotools.js @@ -1,6 +1,6 @@ // EspruinoTools bundle (https://github.com/espruino/EspruinoTools) // Created with https://github.com/espruino/EspruinoWebIDE/blob/gh-pages/extras/create_espruinotools_js.sh -// Based on EspruinoWebIDE 0.73.4 +// Based on EspruinoWebIDE 0.73.7 /** Copyright 2014 Gordon Williams (gw@pur3.co.uk) @@ -23,6 +23,7 @@ var Espruino; * * Common processors are: * + * jsCodeChanged - called when the code in the editor changes with {code} * sending - sending code to Espruino (no data) * transformForEspruino - transform code ready to be sent to Espruino * transformModuleForEspruino({code,name}) @@ -4123,7 +4124,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); } else if (isIn(chNum,ch)) { // NUMBER type = "NUMBER"; var chRange = chNum; - if (ch=="0") { // Handle + if (ch=="0") { // Handle s+=ch; nextCh(); if ("xXoObB".indexOf(ch)>=0) { @@ -4132,12 +4133,12 @@ Object.defineProperty(exports, '__esModule', { value: true }); if (ch=="x" || ch=="X") chRange="0123456789ABCDEFabcdef"; s+=ch; nextCh(); - } + } } while (isIn(chRange,ch) || ch==".") { s+=ch; nextCh(); - } + } } else if (isIn(chQuotes,ch)) { // STRING type = "STRING"; var q = ch; @@ -4507,8 +4508,8 @@ Object.defineProperty(exports, '__esModule', { value: true }); fileLoader.click(); } - /* Save a file with a save file dialog. callback(savedFileName) only called in chrome app case when we knopw the filename*/ - function fileSaveDialog(data, filename, callback) { + // Save a file with a save file dialog + function fileSaveDialog(data, filename) { function errorHandler() { Espruino.Core.Notifications.error("Error Saving", true); } @@ -4524,7 +4525,6 @@ Object.defineProperty(exports, '__esModule', { value: true }); writer.onwriteend = function(e) { writer.onwriteend = function(e) { console.log('FileWriter: complete'); - if (callback) callback(writableFileEntry.name); }; console.log('FileWriter: writing'); writer.write(blob); @@ -4535,8 +4535,10 @@ Object.defineProperty(exports, '__esModule', { value: true }); }, errorHandler); }); } else { + var rawdata = new Uint8Array(data.length); + for (var i=0;i { - const minified = generated.code; - console.log('rollup: '+minified.length+' bytes'); - - // FIXME: needs warnings? - Espruino.Core.Notifications.info('Rollup no errors. Bundling ' + code.length + ' bytes to ' + minified.length + ' bytes'); - callback(minified); - }) - .catch(err => { - console.log('rollup:error', err); - Espruino.Core.Notifications.error("Rollup errors - Bundling failed: " + String(err).trim()); - callback(code); - }); - } Espruino.Core.Modules = { init : init @@ -6436,18 +6431,18 @@ To add a new serial device, you must add an object to This Source Code is subject to the terms of the Mozilla Public License, v2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - + ------------------------------------------------------------------ Try and get any URLS that are from GitHub ------------------------------------------------------------------ **/ "use strict"; (function(){ - + function init() { - Espruino.addProcessor("getURL", getGitHub); + Espruino.addProcessor("getURL", getGitHub); } - + function getGitHub(data, callback) { var match = data.url.match(/^https?:\/\/github.com\/([^\/]+)\/([^\/]+)\/blob\/([^\/]+)\/(.*)$/); if (match) { @@ -6457,7 +6452,7 @@ To add a new serial device, you must add an object to branch : match[3], path : match[4] }; - + var url = "https://raw.githubusercontent.com/"+git.owner+"/"+git.repo+"/"+git.branch+"/"+git.path; console.log("Found GitHub", JSON.stringify(git)); callback({url: url}); @@ -6591,7 +6586,7 @@ To add a new serial device, you must add an object to return { startIdx : tk.start, endIdx : tk.end, - str : code.substr(tk.start, tk.end), + str : code.substring(tk.start, tk.end), type : tp }; }}; @@ -6802,5 +6797,7 @@ Espruino.transform = function(code, options) { }); }; +if (!document) Espruino.init(); if ("undefined"!=typeof module) module.exports = Espruino; + From 776fa29728c2d32d0477327310418c6548f360dd Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 14 May 2020 16:59:23 +0100 Subject: [PATCH 28/63] fix #416 for real - forgot to commit this --- js/espruinotools.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/espruinotools.js b/js/espruinotools.js index a201a7fd3..8e266f267 100644 --- a/js/espruinotools.js +++ b/js/espruinotools.js @@ -124,6 +124,7 @@ Espruino.Core.Status = { hasProgress : function() { return false; }, incrementProgress : function(amt) {} }; +var acorn = (function(){ var exports={}; (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -3989,6 +3990,7 @@ exports.nonASCIIwhitespace = nonASCIIwhitespace; Object.defineProperty(exports, '__esModule', { value: true }); }))); +return exports;})(); /** Copyright 2014 Gordon Williams (gw@pur3.co.uk) @@ -6479,6 +6481,7 @@ To add a new serial device, you must add an object to (function(){ if (typeof acorn == "undefined") { console.log("pretokenise: needs acorn, disabling."); + return; } function init() { @@ -6582,7 +6585,8 @@ To add a new serial device, you must add an object to var tp = "?"; if (tk.type.label=="template" || tk.type.label=="string") tp="STRING"; if (tk.type.label=="num") tp="NUMBER"; - if (tk.type.keyword) tp="ID"; + if (tk.type.keyword || tk.type.label=="name") tp="ID"; + if (tp=="?" && tk.start+1==tk.end) tp="CHAR"; return { startIdx : tk.start, endIdx : tk.end, @@ -6797,7 +6801,7 @@ Espruino.transform = function(code, options) { }); }; -if (!document) Espruino.init(); +if ("undefined"==typeof document) Espruino.init(); if ("undefined"!=typeof module) module.exports = Espruino; From decc3dcfaf0240ed7f471c32bf33c082070e1bd3 Mon Sep 17 00:00:00 2001 From: Paul Cockrell Date: Sat, 2 May 2020 21:43:16 +0100 Subject: [PATCH 29/63] Create dotmatrix clock --- apps.json | 14 + apps/dotmatrixclock/ChangeLog | 1 + apps/dotmatrixclock/README.md | 16 ++ apps/dotmatrixclock/app.js | 245 ++++++++++++++++++ .../dotmatrix-clock-screen-shot.png | Bin 0 -> 1855 bytes apps/dotmatrixclock/dotmatrixclock-icon.js | 1 + apps/dotmatrixclock/dotmatrixclock.png | Bin 0 -> 10067 bytes 7 files changed, 277 insertions(+) create mode 100644 apps/dotmatrixclock/ChangeLog create mode 100644 apps/dotmatrixclock/README.md create mode 100755 apps/dotmatrixclock/app.js create mode 100755 apps/dotmatrixclock/dotmatrix-clock-screen-shot.png create mode 100644 apps/dotmatrixclock/dotmatrixclock-icon.js create mode 100755 apps/dotmatrixclock/dotmatrixclock.png diff --git a/apps.json b/apps.json index 906331f65..34cd4fe2e 100644 --- a/apps.json +++ b/apps.json @@ -1732,5 +1732,19 @@ "storage": [ {"name":"rndmclk.wid.js","url":"widget.js"} ] + }, + { "id": "dotmatricsclock", + "name": "Dotmatrix Clock", + "icon": "dotmatrixclock.png", + "version":"0.01", + "description": "A clear white-on-blue dotmatrix simulated clock", + "tags": "clock,dotmatrix,retro", + "type": "clock", + "allow_emulator":true, + "readme": "README.md", + "storage": [ + {"name":"dotmatrixclock.app.js","url":"app.js"}, + {"name":"dotmatrixclock.img","url":"dotmatrixclock-icon.js","evaluate":true} + ] } ] diff --git a/apps/dotmatrixclock/ChangeLog b/apps/dotmatrixclock/ChangeLog new file mode 100644 index 000000000..7ab9e14a9 --- /dev/null +++ b/apps/dotmatrixclock/ChangeLog @@ -0,0 +1 @@ +0.01: Create dotmatrix clock app diff --git a/apps/dotmatrixclock/README.md b/apps/dotmatrixclock/README.md new file mode 100644 index 000000000..5c67c8dfe --- /dev/null +++ b/apps/dotmatrixclock/README.md @@ -0,0 +1,16 @@ +# Dotmatrix clock + +A clock face simulating the classic dotmatrix displays. Shows time, date, compass, and heart rate. + +![](dotmatrix-clock-screen-shot.png) + +## Features + +* Easy to read digits +* Simulated white-on-blue dotmatrix display +* Compass +* Heart rate monitor + +## Requests + +If you have any feature requests, please send an email to the author paulcockrell@gmail.com` diff --git a/apps/dotmatrixclock/app.js b/apps/dotmatrixclock/app.js new file mode 100755 index 000000000..9661f54cf --- /dev/null +++ b/apps/dotmatrixclock/app.js @@ -0,0 +1,245 @@ +/** + * BangleJS DotMatrixCLOCK + * + * + Original Author: Paul Cockrell https://github.com/paulcockrell + * + Created: May 2020 + */ +const storage = require('Storage'); +const settings = (storage.readJSON('setting.json', 1) || {}); +const is12Hour = settings["12hour"] || false; + +const font7x7 = { + "empty": "00000000000000", + "0": "3E61514945433E", + "1": "1808080808081C", + "2": "7E01013E40407F", + "3": "7E01013E01017E", + "4": "4141417F010101", + "5": "7F40407E01017E", + "6": "3E40407E41413E", + "7": "3F010202040408", + "8": "3E41413E41413E", + "9": "3E41413F01013E", +}; + +const font5x5 = { + "empty": "0000000000", + "0": "0E1915130E", + "1": "0C0404040E", + "2": "1E010E101F", + "3": "1E010E011E", + "4": "11111F0101", + "5": "1F101E011E", + "6": "0E101E110E", + "7": "1F01020408", + "8": "0E110E110E", + "9": "0E110F010E", + "A": "040A0E1111", + "B": "1E111E111E", + "C": "0F1010100F", + "D": "1E1111111E", + "E": "1F101E101F", + "F": "1F101E1010", + "G": "0F1013110E", + "H": "11111F1111", + "I": "0E0404040E", + "J": "1F0404140C", + "L": "101010101F", + "M": "111B151111", + "N": "1119151311", + "O": "0E1111110E", + "P": "1E111E1010", + "R": "1E111E1111", + "S": "0F100E011E", + "T": "1F04040404", + "U": "111111110E", + "V": "1111110A04", + "W": "111115150A", + "Y": "110A040404", +}; + +// Char renderer +const COLORS = { + BG: "#0297fe", + DARK: "#3b3ce8", + LIGHT: "#E9ffff", +}; + +// Example +// binToHex(["0111110", "1000000", "1000000", "1111110", "1000001", "1000001", "0111110"]) +function binToHex(bins /* array of binary strings */) { + return bins.map(bin => ("00" + (parseInt(bin, 2).toString(16))).substr(-2).toUpperCase()).join(""); +} + +// Example +// hexToBin("3E40407E41413E") +function hexToBin(hexStr) { + return ( + hexStr + .replace(/../g, el => el + '_') + .slice(0, -1) + .split('_') + .map(hex => ("00000000" + (parseInt(hex, 16)).toString(2)).substr(-8)) + ); +} + +function drawPixel(opts) { + g.setColor(opts.color); + g.fillRect(opts.x, opts.y, opts.x + opts.w, opts.y + opts.h); +} + +function drawGrid(pos /* {x:int, y:int} */, dims /* {rows:int, cols:int} */, charAsBin, opts /* {pxlW:int, pxlH:int, gap:int} */) { + const defaultOpts = { + pxlW: 5, pxlH: 5, + gap: 1, + offColor: COLORS.DARK, onColor: COLORS.LIGHT + }; + const pxl = Object.assign({}, defaultOpts, opts); + + for (let r = 0; r < dims.rows; r++) { + const y = pos.y + ((pxl.pxlH + pxl.gap) * r); + for (let c = 7; c > (7 - dims.cols); c--) { + const x = pos.x + ((pxl.pxlW + pxl.gap) * c); + const color = (charAsBin && parseInt(charAsBin[r][c])) ? pxl.onColor : pxl.offColor; + + drawPixel({ + x: x, y: y, + w: pxl.pxlW, h: pxl.pxlH, + color: color, + }); + } + } +} + +function drawFont(str, font, x, y) { + let fontMap, rows, cols; + + switch(font) { + case "7x7": + fontMap = font7x7; + rows = cols = 7; + break; + case "5x5": + fontMap = font5x5; + rows = cols = 5; + break; + default: + throw "Unknown font type: " + font; + } + + const pxlW = 2; + const pxlH = 2; + const gap = 2; + const gutter = 3; + const charArr = str.split(""); + const gridWidthTotal = (rows * (pxlW + gap)) + gutter; + for (let i = 0; i < charArr.length; i++) { + const charAsBin = fontMap.hasOwnProperty(charArr[i])? + hexToBin(fontMap[charArr[i]]): + fontMap.empty; + + drawGrid( + {x: x + (i * gridWidthTotal), y: y}, + {rows: rows, cols: cols}, + charAsBin || fontMap.empty, + {pxlW: pxlW, pxlH: pxlH, gap: gap} + ); + } +} + +function drawTitles() { + g.setColor("#ffffff"); + g.setFont("6x8"); + g.drawString("COMPASS", 52, 43); + g.drawString("HEART", 122, 43); + g.drawString("TIME", 52, 85); + g.drawString("DATE", 52, 135); +} + +function drawCompass(lastHeading) { + const directions = [ + 'N', + 'NE', + 'E', + 'SE', + 'S', + 'SW', + 'W', + 'NW' + ]; + const cps = Bangle.getCompass(); + let angle = cps.heading; + const heading = angle? + directions[Math.round(((angle %= 360) < 0 ? angle + 360 : angle) / 45) % 8]: + "NE "; + + if (lastHeading != heading) drawFont(heading, "5x5", 40, 58); + setTimeout(drawCompass.bind(null, heading), 1000 * 2); +} + +function drawHeart(hrm) { + drawFont((" " + (hrm ? hrm.bpm : '')).slice(-3), "5x5", 109, 58); +} + +function drawTime(lastHrs, lastMns, toggle) { + const date = new Date(); + const h = date.getHours(); + const hrs = ("00" + ((is12Hour && h > 12) ? h - 12 : h)).substr(-2); + const mns = ("00" + date.getMinutes()).substr(-2); + + if (lastHrs != hrs) { + drawFont(hrs, "7x7", 48, 100); + } + if (lastMns != mns) { + drawFont(mns, "7x7", 124, 100); + } + + const color = toggle? COLORS.LIGHT : COLORS.DARK; + + // This should toggle on/off per second + drawPixel({ + color: color, + x: 118, y: 109, + w: 2, h: 2, + }); + drawPixel({ + color: color, + x: 118, y: 116, + w: 2, h: 2, + }); + + setTimeout(drawTime.bind(null, hrs, mns, !toggle), 1000); +} + +function drawDate(lastDate) { + const locale = require('locale'); + const date = new Date(); + + if (lastDate != date.toISOString().split('T')[0]) { + const dow = locale.dow(date, 1).toUpperCase(); + const dayNum = ("00" + date.getDate()).slice(-2); + const mon = locale.month(date).toUpperCase(); + const yr = date.getFullYear().toString().slice(-2); + drawFont(dow + " " + dayNum, "5x5", 40, 150); + drawFont(mon + " " + yr, "5x5", 40, 180); + } + + setTimeout(drawDate.bind(null, date.toISOString().split('T')), 1000 * 60); +} + +g.setBgColor(COLORS.BG); +g.clear(); + +Bangle.loadWidgets(); +Bangle.drawWidgets(); + +drawTitles(); +drawTime(); +drawDate(); +drawCompass(); +drawHeart(); + +Bangle.on('HRM', drawHeart); +Bangle.setHRMPower(1); + +Bangle.setCompassPower(1); diff --git a/apps/dotmatrixclock/dotmatrix-clock-screen-shot.png b/apps/dotmatrixclock/dotmatrix-clock-screen-shot.png new file mode 100755 index 0000000000000000000000000000000000000000..e6218f4c9f43b9bbb7ac342f5b88915aa640e285 GIT binary patch literal 1855 zcmd5-drVVT7{3&1ZNYQ|NYH8P#-tIJfv`AU1!NE?!73;fpDixh8JT8aEp4go-5(M& zAr$v%j`K?mb`5IXUP1 zzTe|q*-uX1gxP`t0ALd-B{2gYjjnIw2KXPFIa>w*s12mVJqPn^=Tv*kwj}#{(6&AF z#6K=v@IHNgBZt2C>XJx5Tz*h@wBWrv@ug2nVxEAS2gO~n4!7NzSYT4?#y>^`N<=6i z*9^pqaX`1i9cX6*+YkNMixGDo$f#z; zH&OnU8IWyQ=J0r@RGfODz$vzwv}TGGEPvwe#c4^Q;vuV}gJDmuWKE+B&L+rALB9`v z&t*6xNkpjW7pSd2E~A@S)7|57Vu_G!bJ$z8ZkKl?ai^AN%@YjjkWDG$bv3g2J`HL8 zw@?=C+-}RH+TLLudR4(q*ZjPGr})`C=knA8D&D#La(cqanpzmv#T~KD%*rWwvC*m{ z90nHG$i2YBH*zPCyepw+fLU(V>eL|J)L(|LHgmL*xRuk6>NTagYTkR7#MP1g428;LOR$-zEma< zA(C&^gljnGH?Zf!kLuUwB5h=Wj+PV@z0}glc)OQQWfif;D$}u{X`odZg2e5AEppNP z@?IWxpqEM5c3iXzWR6OD#$;F7{OoArcE2nTD?<6VK6cLl{T7>65Dm?#zj6{$0~IRV zy~bwUSf@d1r=D#40m3X(uqjB2=APCq;@4EAGRuX4{4QN4ofZTdi)>SZED%1{u)se^ zL&hG5SDEbipeBTHRa#!rQHr9pJIrcGa-y}J+P9j73-OL!F2pui;JhDssOep48aEds z@`d({zeli0;o7CFI)NjH@k}f$pNS4MGG82;Zw_ap_^F za6-B~ty4wg)v0jS@+4{I?TV9a2G5vGY^XlnJ8s|bAu-)#vcRn*1{*sws-c`)a3-CV z19Hqyf5tm&YA?R?b=zCKBUC>_-?i`3i}_Lm`c?mU`2>ow&@3TX?=u6wNCAiQV0ycF zZe*WBs6yF=bVpPY!8+!lE^$fbd>RO|0wlr~a+H|So;x|@;ZO(6 zC-W+cE&o;ze~IPZMQ&GaxV6-pAY4+UlWTff2n6F`3vSM;HRPUJv*04KIKXGIJAF`b#w0jk>JBap;N(7E+b2#4D)hJjO5PXO+j;xxjqz1o!7ce@#V;V-|Lxhh??5Wb+Q+tj SrxL;sBS1 Date: Thu, 14 May 2020 19:49:20 +0100 Subject: [PATCH 31/63] Fix spelling error --- apps.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 34cd4fe2e..2be79db83 100644 --- a/apps.json +++ b/apps.json @@ -1568,6 +1568,7 @@ {"name":"hidjoystick.img","url":"app-icon.js","evaluate":true} ] }, +<<<<<<< HEAD { "id": "largeclock", "name": "Large Clock", @@ -1733,7 +1734,7 @@ {"name":"rndmclk.wid.js","url":"widget.js"} ] }, - { "id": "dotmatricsclock", + { "id": "dotmatrixclock", "name": "Dotmatrix Clock", "icon": "dotmatrixclock.png", "version":"0.01", From f465e06cdd2fea953c97f7b5993efe6751f61a9a Mon Sep 17 00:00:00 2001 From: Paul Cockrell Date: Thu, 14 May 2020 19:46:34 +0100 Subject: [PATCH 32/63] Finish dotmatrix clock.. turn off sensors when screen sleeps, enable menu on BTN2 press --- apps/dotmatrixclock/app.js | 103 ++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 35 deletions(-) diff --git a/apps/dotmatrixclock/app.js b/apps/dotmatrixclock/app.js index e65377c6e..04091b36a 100755 --- a/apps/dotmatrixclock/app.js +++ b/apps/dotmatrixclock/app.js @@ -8,8 +8,9 @@ const storage = require('Storage'); const settings = (storage.readJSON('setting.json', 1) || {}); const is12Hour = settings["12hour"] || false; + const font7x7 = { - "empty": "00000000000000", + "empty": "00000000", "0": "3E61514945433E", "1": "1808080808081C", "2": "7E01013E40407F", @@ -23,7 +24,7 @@ const font7x7 = { }; const font5x5 = { - "empty": "0000000000", + "empty": "00000000", "0": "0E1915130E", "1": "0C0404040E", "2": "1E010E101F", @@ -74,13 +75,14 @@ function binToHex(bins /* array of binary strings */) { // Example // hexToBin("3E40407E41413E") function hexToBin(hexStr) { - return ( - hexStr - .replace(/../g, el => el + '_') + const regEx = new RegExp("..", "g"); + const bin = hexStr + .replace(regEx, el => el + '_') .slice(0, -1) .split('_') - .map(hex => ("00000000" + (parseInt(hex, 16)).toString(2)).substr(-8)) - ); + .map(hex => ("00000000" + (parseInt(hex, 16)).toString(2)).substr(-8)); + + return bin; } function drawPixel(opts) { @@ -90,22 +92,27 @@ function drawPixel(opts) { function drawGrid(pos /* {x:int, y:int} */, dims /* {rows:int, cols:int} */, charAsBin, opts /* {pxlW:int, pxlH:int, gap:int} */) { const defaultOpts = { - pxlW: 5, pxlH: 5, + pxlW: 5, + pxlH: 5, gap: 1, - offColor: COLORS.DARK, onColor: COLORS.LIGHT + offColor: COLORS.DARK, + onColor: COLORS.LIGHT }; const pxl = Object.assign({}, defaultOpts, opts); for (let r = 0; r < dims.rows; r++) { const y = pos.y + ((pxl.pxlH + pxl.gap) * r); + for (let c = 7; c > (7 - dims.cols); c--) { const x = pos.x + ((pxl.pxlW + pxl.gap) * c); const color = (charAsBin && parseInt(charAsBin[r][c])) ? pxl.onColor : pxl.offColor; drawPixel({ - x: x, y: y, - w: pxl.pxlW, h: pxl.pxlH, - color: color, + x: x, + y: y, + w: pxl.pxlW, + h: pxl.pxlH, + color: color }); } } @@ -141,7 +148,7 @@ function drawFont(str, font, x, y) { drawGrid( {x: x + (i * gridWidthTotal), y: y}, {rows: rows, cols: cols}, - charAsBin || fontMap.empty, + charAsBin, {pxlW: pxlW, pxlH: pxlH, gap: gap} ); } @@ -150,10 +157,10 @@ function drawFont(str, font, x, y) { function drawTitles() { g.setColor("#ffffff"); g.setFont("6x8"); - g.drawString("COMPASS", 52, 43); - g.drawString("HEART", 122, 43); - g.drawString("TIME", 52, 85); - g.drawString("DATE", 52, 135); + g.drawString("COMPASS", 52, 49); + g.drawString("HEART", 122, 49); + g.drawString("TIME", 52, 94); + g.drawString("DATE", 52, 144); } function drawCompass(lastHeading) { @@ -169,16 +176,17 @@ function drawCompass(lastHeading) { ]; const cps = Bangle.getCompass(); let angle = cps.heading; - const heading = angle? - directions[Math.round(((angle %= 360) < 0 ? angle + 360 : angle) / 45) % 8]: - " "; + let heading = angle? + directions[Math.round(((angle %= 360) < 0 ? angle + 360 : angle) / 45) % 8]: + " "; - if (lastHeading != heading) drawFont(heading, "5x5", 40, 58); + heading = (heading + " ").slice(0, 3); + if (lastHeading != heading) drawFont(heading, "5x5", 40, 67); setTimeout(drawCompass.bind(null, heading), 1000 * 2); } function drawHeart(hrm) { - drawFont((" " + (hrm ? hrm.bpm : '')).slice(-3), "5x5", 109, 58); + drawFont((" " + (hrm ? hrm.bpm : '')).slice(-3), "5x5", 109, 67); } function drawTime(lastHrs, lastMns, toggle) { @@ -188,10 +196,10 @@ function drawTime(lastHrs, lastMns, toggle) { const mns = ("00" + date.getMinutes()).substr(-2); if (lastHrs != hrs) { - drawFont(hrs, "7x7", 48, 100); + drawFont(hrs, "7x7", 48, 109); } if (lastMns != mns) { - drawFont(mns, "7x7", 124, 100); + drawFont(mns, "7x7", 124, 109); } const color = toggle? COLORS.LIGHT : COLORS.DARK; @@ -199,12 +207,12 @@ function drawTime(lastHrs, lastMns, toggle) { // This should toggle on/off per second drawPixel({ color: color, - x: 118, y: 109, + x: 118, y: 118, w: 2, h: 2, }); drawPixel({ color: color, - x: 118, y: 116, + x: 118, y: 125, w: 2, h: 2, }); @@ -218,28 +226,53 @@ function drawDate(lastDate) { if (lastDate != date.toISOString().split('T')[0]) { const dow = locale.dow(date, 1).toUpperCase(); const dayNum = ("00" + date.getDate()).slice(-2); - const mon = locale.month(date).toUpperCase(); + const mon = locale.month(date).toUpperCase().slice(-3); const yr = date.getFullYear().toString().slice(-2); - drawFont(dow + " " + dayNum, "5x5", 40, 150); - drawFont(mon + " " + yr, "5x5", 40, 180); + drawFont(dow + " " + dayNum, "5x5", 40, 159); + drawFont(mon + " " + yr, "5x5", 40, 189); } setTimeout(drawDate.bind(null, date.toISOString().split('T')), 1000 * 60); } -g.setBgColor(COLORS.BG); -g.clear(); +function setSensors(state) { + Bangle.setHRMPower(state); + Bangle.setCompassPower(state); +} +// Turn sensors on +setSensors(1); + +// Reset screen +g.clear(); +g.setBgColor(COLORS.BG); +g.clearRect(0, 24, g.getWidth(), g.getHeight()); + +// Load and draw widgets Bangle.loadWidgets(); Bangle.drawWidgets(); +// Draw screen drawTitles(); -drawTime(); -drawDate(); drawCompass(); drawHeart(); +drawTime(); +drawDate(); +// Setup callbacks Bangle.on('HRM', drawHeart); -Bangle.setHRMPower(1); -Bangle.setCompassPower(1); +setWatch(() => { + setSensors(0); + Bangle.setLCDMode(); + Bangle.showLauncher(); +}, BTN2, {repeat: false, edge: "falling"}); + +Bangle.on('lcdPower', (on) => on ? setSensors(1) : setSensors(0)); + +Bangle.on('faceUp', (up) => { + if (up && !Bangle.isLCDOn()) { + setSensors(1); + Bangle.setLCDPower(true); + } +}); \ No newline at end of file From 315131c9d8484106e5a344aa9f62074e41a2385f Mon Sep 17 00:00:00 2001 From: Paul Cockrell Date: Thu, 14 May 2020 19:52:49 +0100 Subject: [PATCH 33/63] Fix apps.json --- apps.json | 1 - 1 file changed, 1 deletion(-) diff --git a/apps.json b/apps.json index 2be79db83..c46de601d 100644 --- a/apps.json +++ b/apps.json @@ -1568,7 +1568,6 @@ {"name":"hidjoystick.img","url":"app-icon.js","evaluate":true} ] }, -<<<<<<< HEAD { "id": "largeclock", "name": "Large Clock", From cc400677a1f8f743cd64fe8ef2e50c0879b6d933 Mon Sep 17 00:00:00 2001 From: Paul Cockrell Date: Thu, 14 May 2020 20:10:49 +0100 Subject: [PATCH 34/63] Fix month string truncation --- apps/dotmatrixclock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dotmatrixclock/app.js b/apps/dotmatrixclock/app.js index 04091b36a..878a5aad3 100755 --- a/apps/dotmatrixclock/app.js +++ b/apps/dotmatrixclock/app.js @@ -226,7 +226,7 @@ function drawDate(lastDate) { if (lastDate != date.toISOString().split('T')[0]) { const dow = locale.dow(date, 1).toUpperCase(); const dayNum = ("00" + date.getDate()).slice(-2); - const mon = locale.month(date).toUpperCase().slice(-3); + const mon = locale.month(date).toUpperCase().slice(0, 3); const yr = date.getFullYear().toString().slice(-2); drawFont(dow + " " + dayNum, "5x5", 40, 159); drawFont(mon + " " + yr, "5x5", 40, 189); From 2ed65f3eadcb0802935bc7cc9cd7e80702f55470 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 14 May 2020 21:32:36 +0100 Subject: [PATCH 35/63] Welcome: Allow welcome to run after a fresh install + More useful app menu + BTN2 now goes to menu on release --- apps.json | 4 ++-- apps/ncstart/ChangeLog | 1 + apps/ncstart/boot.js | 9 +++------ apps/welcome/ChangeLog | 3 +++ apps/welcome/app.js | 2 +- apps/welcome/boot.js | 9 +++------ apps/welcome/settings.js | 8 ++++++-- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/apps.json b/apps.json index 906331f65..7d4bf20cf 100644 --- a/apps.json +++ b/apps.json @@ -78,7 +78,7 @@ { "id": "welcome", "name": "Welcome", "icon": "app.png", - "version":"0.08", + "version":"0.09", "description": "Appears at first boot and explains how to use Bangle.js", "tags": "start,welcome", "allow_emulator":true, @@ -589,7 +589,7 @@ "id": "ncstart", "name": "NCEU Startup", "icon": "start.png", - "version":"0.05", + "version":"0.06", "description": "NodeConfEU 2019 'First Start' Sequence", "tags": "start,welcome", "storage": [ diff --git a/apps/ncstart/ChangeLog b/apps/ncstart/ChangeLog index 522633f7b..152fdc9d1 100644 --- a/apps/ncstart/ChangeLog +++ b/apps/ncstart/ChangeLog @@ -6,3 +6,4 @@ Don't run again when settings app is updated (or absent) Add "Run Now" option to settings 0.05: Don't overwrite existing settings on app update +0.06: Allow welcome to run after a fresh install diff --git a/apps/ncstart/boot.js b/apps/ncstart/boot.js index 094033094..62ac962f6 100644 --- a/apps/ncstart/boot.js +++ b/apps/ncstart/boot.js @@ -1,11 +1,8 @@ (function() { - let s = require('Storage').readJSON('ncstart.json', 1) - || require('Storage').readJSON('setting.json', 1) - || {welcomed: true} // do NOT run if global settings are also absent - if (!s.welcomed && require('Storage').read('ncstart.app.js')) { + let s = require('Storage').readJSON('ncstart.json', 1) || {}; + if (!s.welcomed) { setTimeout(() => { - s.welcomed = true - require('Storage').write('ncstart.json', s) + require('Storage').write('ncstart.json', {welcomed: true}) load('ncstart.app.js') }) } diff --git a/apps/welcome/ChangeLog b/apps/welcome/ChangeLog index a377fc81e..9545dbbfa 100644 --- a/apps/welcome/ChangeLog +++ b/apps/welcome/ChangeLog @@ -8,3 +8,6 @@ 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/welcome/app.js b/apps/welcome/app.js index a32a6e56f..b4c79ddaa 100644 --- a/apps/welcome/app.js +++ b/apps/welcome/app.js @@ -285,7 +285,7 @@ setWatch(()=>{ if (sceneNumber == scenes.length-1) { load(); } -}, BTN2, {repeat:true,edge:"rising"}); +}, BTN2, {repeat:true,edge:"falling"}); setWatch(()=>move(-1), BTN1, {repeat:true}); (function migrateSettings(){ diff --git a/apps/welcome/boot.js b/apps/welcome/boot.js index f6ba6d2d6..4e3a12231 100644 --- a/apps/welcome/boot.js +++ b/apps/welcome/boot.js @@ -1,11 +1,8 @@ (function() { - let s = require('Storage').readJSON('welcome.json', 1) - || require('Storage').readJSON('setting.json', 1) - || {welcomed: true} // do NOT run if global settings are also absent - if (!s.welcomed && require('Storage').read('welcome.app.js')) { + let s = require('Storage').readJSON('welcome.json', 1) || {}; + if (!s.welcomed) { setTimeout(() => { - s.welcomed = true - require('Storage').write('welcome.json', {welcomed: "yes"}) + require('Storage').write('welcome.json', {welcomed: true}) load('welcome.app.js') }) } diff --git a/apps/welcome/settings.js b/apps/welcome/settings.js index 20c2e9b13..4992e6e7a 100644 --- a/apps/welcome/settings.js +++ b/apps/welcome/settings.js @@ -3,12 +3,16 @@ || require('Storage').readJSON('setting.json', 1) || {} E.showMenu({ '': { 'title': 'Welcome App' }, - 'Run on Next Boot': { + 'Run next boot': { value: !settings.welcomed, - format: v => v ? 'OK' : 'No', + format: v => v ? 'Yes' : 'No', onchange: v => require('Storage').write('welcome.json', {welcomed: !v}), }, 'Run Now': () => load('welcome.app.js'), + 'Turn off, run next boot': () => { + require('Storage').write('welcome.json', {welcomed: false}); + Bangle.off(); + }, '< Back': back, }) }) From a13954b6cbfe24a43c6a613cfffff575f1e6f43a Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 14 May 2020 21:36:33 +0100 Subject: [PATCH 36/63] tweak --- apps/welcome/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/welcome/settings.js b/apps/welcome/settings.js index 4992e6e7a..f269f238e 100644 --- a/apps/welcome/settings.js +++ b/apps/welcome/settings.js @@ -9,7 +9,7 @@ onchange: v => require('Storage').write('welcome.json', {welcomed: !v}), }, 'Run Now': () => load('welcome.app.js'), - 'Turn off, run next boot': () => { + 'Turn off & run next': () => { require('Storage').write('welcome.json', {welcomed: false}); Bangle.off(); }, From 9178e1b632f265c95b6f1706f29a169d505d8ed3 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 15 May 2020 07:38:09 +0100 Subject: [PATCH 37/63] Fix Upload failed, TypeError: Espruino.transform is not a function (fix #420) --- js/espruinotools.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/espruinotools.js b/js/espruinotools.js index 8e266f267..0e8df02cb 100644 --- a/js/espruinotools.js +++ b/js/espruinotools.js @@ -124,7 +124,7 @@ Espruino.Core.Status = { hasProgress : function() { return false; }, incrementProgress : function(amt) {} }; -var acorn = (function(){ var exports={}; +var acorn = (function(){ var exports={};var module={}; (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : From 7488970e741f4b96cec1d6dc67a65a417b45b904 Mon Sep 17 00:00:00 2001 From: Paul Cockrell Date: Fri, 15 May 2020 09:33:25 +0100 Subject: [PATCH 38/63] Allow multiple coloured screens --- apps/dotmatrixclock/app.js | 47 +++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/apps/dotmatrixclock/app.js b/apps/dotmatrixclock/app.js index 878a5aad3..da165572c 100755 --- a/apps/dotmatrixclock/app.js +++ b/apps/dotmatrixclock/app.js @@ -61,11 +61,20 @@ const font5x5 = { // Char renderer const COLORS = { - BG: "#0297fe", - DARK: "#3b3ce8", - LIGHT: "#E9ffff", + blue: { + BG: "#0297fe", + DARK: "#3b3ce8", + LIGHT: "#E9ffff", + }, + orange: { + BG: "#f7b336", + DARK: "#ac721e", + LIGHT: "#f6fc0f", + } }; +let selectedColor = "blue"; + // Example // binToHex(["0111110", "1000000", "1000000", "1111110", "1000001", "1000001", "0111110"]) function binToHex(bins /* array of binary strings */) { @@ -95,8 +104,8 @@ function drawGrid(pos /* {x:int, y:int} */, dims /* {rows:int, cols:int} */, cha pxlW: 5, pxlH: 5, gap: 1, - offColor: COLORS.DARK, - onColor: COLORS.LIGHT + offColor: COLORS[selectedColor].DARK, + onColor: COLORS[selectedColor].LIGHT }; const pxl = Object.assign({}, defaultOpts, opts); @@ -202,7 +211,7 @@ function drawTime(lastHrs, lastMns, toggle) { drawFont(mns, "7x7", 124, 109); } - const color = toggle? COLORS.LIGHT : COLORS.DARK; + const color = toggle? COLORS[selectedColor].LIGHT : COLORS[selectedColor].DARK; // This should toggle on/off per second drawPixel({ @@ -240,26 +249,38 @@ function setSensors(state) { Bangle.setCompassPower(state); } +function drawScreen() { + g.setBgColor(COLORS[selectedColor].BG); + g.clearRect(0, 24, g.getWidth(), g.getHeight()); + + // Draw components + drawTitles(); + drawCompass(); + drawHeart(); + drawTime(); + drawDate(); +} + // Turn sensors on setSensors(1); // Reset screen g.clear(); -g.setBgColor(COLORS.BG); -g.clearRect(0, 24, g.getWidth(), g.getHeight()); // Load and draw widgets Bangle.loadWidgets(); Bangle.drawWidgets(); // Draw screen -drawTitles(); -drawCompass(); -drawHeart(); -drawTime(); -drawDate(); +drawScreen(); // Setup callbacks +Bangle.on('swipe', (sDir) => { + selectedColor = selectedColor === "blue" ? "orange" : "blue"; + clearTimeout(); + drawScreen(); +}); + Bangle.on('HRM', drawHeart); setWatch(() => { From 04e3d3b4552cb1738bb1334edc36d2335d1accb3 Mon Sep 17 00:00:00 2001 From: Paul Cockrell Date: Fri, 15 May 2020 09:37:37 +0100 Subject: [PATCH 39/63] Update README --- apps/dotmatrixclock/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/dotmatrixclock/README.md b/apps/dotmatrixclock/README.md index 5c67c8dfe..e862b4e36 100644 --- a/apps/dotmatrixclock/README.md +++ b/apps/dotmatrixclock/README.md @@ -10,6 +10,7 @@ A clock face simulating the classic dotmatrix displays. Shows time, date, compas * Simulated white-on-blue dotmatrix display * Compass * Heart rate monitor +* Multiple colour palletes, swipe to change ## Requests From 40c4673db7aa2938d04c6adbc4985fb358a8c0c5 Mon Sep 17 00:00:00 2001 From: Paul Cockrell Date: Fri, 15 May 2020 09:46:21 +0100 Subject: [PATCH 40/63] Remove inline comments, seems to break pretokenisation or something! --- apps/dotmatrixclock/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dotmatrixclock/app.js b/apps/dotmatrixclock/app.js index da165572c..847b5d074 100755 --- a/apps/dotmatrixclock/app.js +++ b/apps/dotmatrixclock/app.js @@ -77,7 +77,7 @@ let selectedColor = "blue"; // Example // binToHex(["0111110", "1000000", "1000000", "1111110", "1000001", "1000001", "0111110"]) -function binToHex(bins /* array of binary strings */) { +function binToHex(bins) { return bins.map(bin => ("00" + (parseInt(bin, 2).toString(16))).substr(-2).toUpperCase()).join(""); } @@ -99,7 +99,7 @@ function drawPixel(opts) { g.fillRect(opts.x, opts.y, opts.x + opts.w, opts.y + opts.h); } -function drawGrid(pos /* {x:int, y:int} */, dims /* {rows:int, cols:int} */, charAsBin, opts /* {pxlW:int, pxlH:int, gap:int} */) { +function drawGrid(pos, dims, charAsBin, opts) { const defaultOpts = { pxlW: 5, pxlH: 5, @@ -121,7 +121,7 @@ function drawGrid(pos /* {x:int, y:int} */, dims /* {rows:int, cols:int} */, cha y: y, w: pxl.pxlW, h: pxl.pxlH, - color: color + color: color, }); } } From 5a7216166fe4105d7270df161d513bcb49852122 Mon Sep 17 00:00:00 2001 From: Paul Cockrell Date: Fri, 15 May 2020 11:23:52 +0100 Subject: [PATCH 41/63] Fix sensors activation/deactivation and fix more pretokenisation issues (doesn't work well with var names with lenght <= 3 --- apps/dotmatrixclock/README.md | 11 +++++ apps/dotmatrixclock/app.js | 77 ++++++++++++++++++++++++++++++----- 2 files changed, 77 insertions(+), 11 deletions(-) diff --git a/apps/dotmatrixclock/README.md b/apps/dotmatrixclock/README.md index e862b4e36..3af48efc6 100644 --- a/apps/dotmatrixclock/README.md +++ b/apps/dotmatrixclock/README.md @@ -12,6 +12,17 @@ A clock face simulating the classic dotmatrix displays. Shows time, date, compas * Heart rate monitor * Multiple colour palletes, swipe to change +## Usage + +### Sensor readings + +When the display is activated by 'flipping' the watch up, the compass and heart sensors will be activated automatically, but if +you activate the LCD through a button press, then the sensors will remain off until you press button-1. + +### Colours + +The display defaults to blue, but you can change this to orange by swiping the screen + ## Requests If you have any feature requests, please send an email to the author paulcockrell@gmail.com` diff --git a/apps/dotmatrixclock/app.js b/apps/dotmatrixclock/app.js index 847b5d074..94c628b1b 100755 --- a/apps/dotmatrixclock/app.js +++ b/apps/dotmatrixclock/app.js @@ -7,7 +7,7 @@ const storage = require('Storage'); const settings = (storage.readJSON('setting.json', 1) || {}); const is12Hour = settings["12hour"] || false; - +const timeout = settings.timeout || 20; const font7x7 = { "empty": "00000000", @@ -25,6 +25,7 @@ const font7x7 = { const font5x5 = { "empty": "00000000", + "-": "0000FF0000", "0": "0E1915130E", "1": "0C0404040E", "2": "1E010E101F", @@ -74,6 +75,7 @@ const COLORS = { }; let selectedColor = "blue"; +let displayTimeoutRef, sensorTimeoutRef; // Example // binToHex(["0111110", "1000000", "1000000", "1111110", "1000001", "1000001", "0111110"]) @@ -109,12 +111,12 @@ function drawGrid(pos, dims, charAsBin, opts) { }; const pxl = Object.assign({}, defaultOpts, opts); - for (let r = 0; r < dims.rows; r++) { - const y = pos.y + ((pxl.pxlH + pxl.gap) * r); + for (let rowY = 0; rowY < dims.rows; rowY++) { + const y = pos.y + ((pxl.pxlH + pxl.gap) * rowY); - for (let c = 7; c > (7 - dims.cols); c--) { - const x = pos.x + ((pxl.pxlW + pxl.gap) * c); - const color = (charAsBin && parseInt(charAsBin[r][c])) ? pxl.onColor : pxl.offColor; + for (let colX = 7; colX > (7 - dims.cols); colX--) { + const x = pos.x + ((pxl.pxlW + pxl.gap) * colX); + const color = (charAsBin && parseInt(charAsBin[rowY][colX])) ? pxl.onColor : pxl.offColor; drawPixel({ x: x, @@ -187,7 +189,7 @@ function drawCompass(lastHeading) { let angle = cps.heading; let heading = angle? directions[Math.round(((angle %= 360) < 0 ? angle + 360 : angle) / 45) % 8]: - " "; + "-- "; heading = (heading + " ").slice(0, 3); if (lastHeading != heading) drawFont(heading, "5x5", 40, 67); @@ -195,7 +197,7 @@ function drawCompass(lastHeading) { } function drawHeart(hrm) { - drawFont((" " + (hrm ? hrm.bpm : '')).slice(-3), "5x5", 109, 67); + drawFont((" " + (hrm ? hrm.bpm : "---")).slice(-3), "5x5", 109, 67); } function drawTime(lastHrs, lastMns, toggle) { @@ -245,6 +247,23 @@ function drawDate(lastDate) { } function setSensors(state) { + // Already reading sensors and trying to activate sensors, do nothing + if (sensorTimeoutRef && state === 1) return; + + // If we are activating the sensors, turn them off again in one minute + if (state === 1) { + sensorTimeoutRef = setTimeout(() => { setSensors(0); }, 1000 * 60); + } else { + if (sensorTimeoutRef) { + clearInterval(sensorTimeoutRef); + sensorTimeoutRef = null; + } + // Bit nasty, but we only redraw the heart value on sensor callback + // but we want to blank out when sensor is off, but no callback for + // that so force redraw here + drawHeart(); + } + Bangle.setHRMPower(state); Bangle.setCompassPower(state); } @@ -261,6 +280,28 @@ function drawScreen() { drawDate(); } +function clearTimers(){ + if (displayTimeoutRef) { + clearInterval(displayTimeoutRef); + displayTimeoutRef = null; + } + + if (sensorTimeoutRef) { + clearInterval(sensorTimeoutRef); + sensorTimeoutRef = null; + } +} + +function resetDisplayTimeout() { + if (displayTimeoutRef) clearInterval(displayTimeoutRef); + Bangle.setLCDPower(true); + + displayTimeoutRef = setTimeout(() => { + if (Bangle.isLCDOn()) Bangle.setLCDPower(false); + clearTimers(); + }, 1000 * timeout); +} + // Turn sensors on setSensors(1); @@ -273,27 +314,41 @@ Bangle.drawWidgets(); // Draw screen drawScreen(); +resetDisplayTimeout(); // Setup callbacks Bangle.on('swipe', (sDir) => { selectedColor = selectedColor === "blue" ? "orange" : "blue"; - clearTimeout(); + resetDisplayTimeout(); drawScreen(); }); Bangle.on('HRM', drawHeart); +setWatch(() => { + setSensors(1); + resetDisplayTimeout(); +}, BTN1, {repeat: true, edge: "falling"}); + setWatch(() => { setSensors(0); + clearTimers(); Bangle.setLCDMode(); Bangle.showLauncher(); }, BTN2, {repeat: false, edge: "falling"}); -Bangle.on('lcdPower', (on) => on ? setSensors(1) : setSensors(0)); +Bangle.on('lcdPower', (on) => { + if(on) { + resetDisplayTimeout(); + } else { + clearTimers(); + setSensors(0); + } +}); Bangle.on('faceUp', (up) => { if (up && !Bangle.isLCDOn()) { setSensors(1); - Bangle.setLCDPower(true); + resetDisplayTimeout(); } }); \ No newline at end of file From 21963f3835fb97cfdd3e91e85c60fbc771191652 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:34:54 +0200 Subject: [PATCH 42/63] Revert "change README and ChangeLog entry" This reverts commit 0ce1556a702cc5197e63082b30e25a1bdcf54b55. --- apps/metronome/ChangeLog | 2 +- apps/metronome/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 909d6b983..61ff09c98 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,4 +2,4 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed -0.05: Buzz intensity and beats per bar can be changed via settings-app +0.05: Enable to set buzz intensity and beats per bar via settings diff --git a/apps/metronome/README.md b/apps/metronome/README.md index f67b4adf1..8a76114f8 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,7 +8,7 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. -* Intensity of buzzing and the beats per bar (default 4) can be changed with the settings-app. The first beat per bar will be marked in red. +* Using the settings app, you can change the intensity of buzzing and the beats per bar (default 4). The first beat per bar will be marked in red. ## Attributions From e3aea0fd61e7e4333b0508d52feb507e2e14351d Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:35:56 +0200 Subject: [PATCH 43/63] Revert "change version and update Readme" This reverts commit 7df65cad513258a005bd986b9f0edf33e1e5ec8d. --- apps.json | 2 +- apps/metronome/ChangeLog | 1 - apps/metronome/README.md | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/apps.json b/apps.json index b478a8f69..1caaf9369 100644 --- a/apps.json +++ b/apps.json @@ -1403,7 +1403,7 @@ "id": "metronome", "name": "Metronome", "icon": "metronome_icon.png", - "version": "0.05", + "version": "0.04", "readme": "README.md", "description": "Makes the watch blinking and vibrating with a given rate", "tags": "tool", diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 61ff09c98..25628660e 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,4 +2,3 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed -0.05: Enable to set buzz intensity and beats per bar via settings diff --git a/apps/metronome/README.md b/apps/metronome/README.md index 8a76114f8..1bb9a893c 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,7 +8,6 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. -* Using the settings app, you can change the intensity of buzzing and the beats per bar (default 4). The first beat per bar will be marked in red. ## Attributions From 2b77dabe519063dd3107653b785334a52d6fe87e Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:36:33 +0200 Subject: [PATCH 44/63] Revert "add settings to apps.json" This reverts commit 09ba504289ae95c113ed2f2beb95c67b39dcecab. --- apps.json | 3 +-- apps/metronome/metronome.js | 3 +-- apps/metronome/settings.js | 8 -------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/apps.json b/apps.json index 1caaf9369..92746025e 100644 --- a/apps.json +++ b/apps.json @@ -1417,8 +1417,7 @@ "name": "metronome.img", "url": "metronome-icon.js", "evaluate": true - }, - {"name":"metronome.settings.js","url":"settings.js"} + } ] }, { "id": "blackjack", diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index ac9b9d631..829b7032a 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -14,7 +14,6 @@ function setting(key) { //define default settings const DEFAULTS = { 'beatsperbar': 4, - 'buzzintens': 0.75, }; if (!settings) { loadSettings(); } return (key in settings) ? settings[key] : DEFAULTS[key]; @@ -53,7 +52,7 @@ function updateScreen() { g.clearRect(0, 50, 250, 150); changecolor(); try { - Bangle.buzz(50, setting('buzzintens')); + Bangle.buzz(50, 0.75); } catch(err) { } diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js index b91dd9288..2aefa1052 100644 --- a/apps/metronome/settings.js +++ b/apps/metronome/settings.js @@ -8,7 +8,6 @@ // initialize with default settings... let s = { 'beatsperbar': 4, - 'buzzintens': 0.75, }; // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -36,13 +35,6 @@ step: 1, onchange: save('beatsperbar'), }, - 'buzz intensity': { - value: s.buzzintens, - min: 0, - max: 2, - step: 0.25, - onchange: save('buzzintens'), - }, }; E.showMenu(menu); }); \ No newline at end of file From 72f7f2c2f85b7ac93fb9e5023865ebddd9e3062b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Fri, 15 May 2020 13:37:53 +0200 Subject: [PATCH 45/63] Removes add_to_apps.json --- apps/jbb/add_to_apps.json | 23 ----------------------- apps/jbm8b/add_to_apps.json | 13 ------------- 2 files changed, 36 deletions(-) delete mode 100644 apps/jbb/add_to_apps.json delete mode 100644 apps/jbm8b/add_to_apps.json diff --git a/apps/jbb/add_to_apps.json b/apps/jbb/add_to_apps.json deleted file mode 100644 index cc6483ac1..000000000 --- a/apps/jbb/add_to_apps.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "id": "jbb", - "name": "Battery Power", - "icon": "app.png", - "description": "Showing battery level and charging status", - "tags": "tool", - "storage": [ - { - "name": "+jbb", - "url": "app.json" - }, - { - "name": "-jbb", - "url": "app.js" - }, - { - "name": "*jbb", - "url": "app-icon.js", - "evaluate": true - } - ], - "version": "0.02" -} \ No newline at end of file diff --git a/apps/jbm8b/add_to_apps.json b/apps/jbm8b/add_to_apps.json deleted file mode 100644 index 8e28639e7..000000000 --- a/apps/jbm8b/add_to_apps.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "id": "jbm8b", - "name": "Magic 8 Ball", - "shortName": "Magic 8 Ball", - "icon": "app.png", - "description": "A simple fortune telling app", - "tags": "game", - "storage": [ - { "name": "jbm8b.app.js", "url": "app.js" }, - { "name": "jbm8b.img", "url": "app-icon.js", "evaluate": true } - ], - "version": "0.03" -} \ No newline at end of file From 4ceb67f2b2560e929aafe88b9dda2fdb47529488 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:38:03 +0200 Subject: [PATCH 46/63] update0005 --- apps.json | 5 +++-- apps/metronome/ChangeLog | 1 + apps/metronome/README.md | 1 + apps/metronome/metronome.js | 20 ++++++++++---------- apps/metronome/settings.js | 10 +++++++++- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/apps.json b/apps.json index 92746025e..b478a8f69 100644 --- a/apps.json +++ b/apps.json @@ -1403,7 +1403,7 @@ "id": "metronome", "name": "Metronome", "icon": "metronome_icon.png", - "version": "0.04", + "version": "0.05", "readme": "README.md", "description": "Makes the watch blinking and vibrating with a given rate", "tags": "tool", @@ -1417,7 +1417,8 @@ "name": "metronome.img", "url": "metronome-icon.js", "evaluate": true - } + }, + {"name":"metronome.settings.js","url":"settings.js"} ] }, { "id": "blackjack", diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 25628660e..909d6b983 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,3 +2,4 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed +0.05: Buzz intensity and beats per bar can be changed via settings-app diff --git a/apps/metronome/README.md b/apps/metronome/README.md index 1bb9a893c..f67b4adf1 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,6 +8,7 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. +* Intensity of buzzing and the beats per bar (default 4) can be changed with the settings-app. The first beat per bar will be marked in red. ## Attributions diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index 829b7032a..add6fee16 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -14,6 +14,7 @@ function setting(key) { //define default settings const DEFAULTS = { 'beatsperbar': 4, + 'buzzintens': 0.75, }; if (!settings) { loadSettings(); } return (key in settings) ? settings[key] : DEFAULTS[key]; @@ -27,16 +28,15 @@ function loadSettings() { } function changecolor() { - const colors = { - 0: { value: 0xF800, name: "Red" }, - 1: { value: 0xFFFF, name: "White" }, - 2: { value: 0x03E0, name: "DarkGreen" }, - 3: { value: 0xFFFF, name: "White" }, - 4: { value: 0x03E0, name: "DarkGreen" }, - 5: { value: 0xFFFF, name: "White" }, - 6: { value: 0x03E0, name: "DarkGreen" }, + const colors = { + 0: { value: 0xF800, name: "Red" }, + 1: { value: 0xFFFF, name: "White" }, + 2: { value: 0x9492, name: "gray" }, + 3: { value: 0xFFFF, name: "White" }, + 4: { value: 0x9492, name: "gray" }, + 5: { value: 0xFFFF, name: "White" }, + 6: { value: 0x9492, name: "gray" }, 7: { value: 0xFFFF, name: "White" }, - 8: { value: 0x03E0, name: "DarkGreen" }, }; g.setColor(colors[cindex].value); if (cindex == setting('beatsperbar')-1) { @@ -52,7 +52,7 @@ function updateScreen() { g.clearRect(0, 50, 250, 150); changecolor(); try { - Bangle.buzz(50, 0.75); + Bangle.buzz(50, setting('buzzintens')); } catch(err) { } diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js index 2aefa1052..1dd4d92df 100644 --- a/apps/metronome/settings.js +++ b/apps/metronome/settings.js @@ -8,6 +8,7 @@ // initialize with default settings... let s = { 'beatsperbar': 4, + 'buzzintens': 0.75, }; // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -35,6 +36,13 @@ step: 1, onchange: save('beatsperbar'), }, + 'buzz intensity': { + value: s.buzzintens, + min: 0.0, + max: 1.0, + step: 0.25, + onchange: save('buzzintens'), + }, }; E.showMenu(menu); -}); \ No newline at end of file +}); From 67cd8c6c13841f1a02baf03d091669adb99f0aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Fri, 15 May 2020 13:38:28 +0200 Subject: [PATCH 47/63] Reverts example add_to_apps.json changes --- apps/_example_app/add_to_apps.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/_example_app/add_to_apps.json b/apps/_example_app/add_to_apps.json index ee83db39e..1585ab73d 100644 --- a/apps/_example_app/add_to_apps.json +++ b/apps/_example_app/add_to_apps.json @@ -1,3 +1,4 @@ +// Create an entry in apps.json as follows: { "id": "7chname", "name": "My app's human readable name", "shortName":"Short Name", @@ -10,4 +11,4 @@ {"name":"7chname.app.js","url":"app.js"}, {"name":"7chname.img","url":"app-icon.js","evaluate":true} ] -} +} \ No newline at end of file From 0cd385fbfbba3f4769d9a91ae62108dffaad6faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Fri, 15 May 2020 13:42:12 +0200 Subject: [PATCH 48/63] Fixed formatting in apps.json --- apps.json | 1409 +++++++++++++++-------------------------------------- 1 file changed, 389 insertions(+), 1020 deletions(-) diff --git a/apps.json b/apps.json index a0fcf0c79..a1f8a0c7a 100644 --- a/apps.json +++ b/apps.json @@ -1,129 +1,87 @@ [ - { - "id": "boot", + { "id": "boot", "name": "Bootloader", "icon": "bootloader.png", "version":"0.17", "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings", "tags": "tool,system", - "type": "bootloader", + "type":"bootloader", "storage": [ - { - "name": ".boot0", - "url": "boot0.js" - }, - { - "name": ".bootcde", - "url": "bootloader.js" - } + {"name":".boot0","url":"boot0.js"}, + {"name":".bootcde","url":"bootloader.js"} ], - "sortorder": -10 + "sortorder" : -10 }, - { - "id": "moonphase", + { "id": "moonphase", "name": "Moonphase", "icon": "app.png", - "version": "0.02", + "version":"0.02", "description": "Shows current moon phase. Now with GPS function.", "tags": "", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "moonphase.app.js", - "url": "app.js" - }, - { - "name": "moonphase.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"moonphase.app.js","url":"app.js"}, + {"name":"moonphase.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "daysl", + { "id": "daysl", "name": "Days left", "icon": "app.png", - "version": "0.03", + "version":"0.03", "description": "Shows you the days left until a certain date. Date can be set with a settings app and is written to a file.", "tags": "", - "allow_emulator": false, + "allow_emulator":false, "storage": [ - { - "name": "daysl.app.js", - "url": "app.js" - }, - { - "name": "daysl.img", - "url": "app-icon.js", - "evaluate": true - }, - { - "name": "daysl.wid.js", - "url": "widget.js" - } + {"name":"daysl.app.js","url":"app.js"}, + {"name":"daysl.img","url":"app-icon.js","evaluate":true}, + {"name":"daysl.wid.js","url":"widget.js"} ] }, - { - "id": "launch", + { "id": "launch", "name": "Default Launcher", - "shortName": "Launcher", + "shortName":"Launcher", "icon": "app.png", "version":"0.03", "description": "This is needed by Bangle.js to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.", "tags": "tool,system,launcher", - "type": "launch", + "type":"launch", "storage": [ - { - "name": "launch.app.js", - "url": "app.js" - } + {"name":"launch.app.js","url":"app.js"} ], - "sortorder": -10 + "sortorder" : -10 }, - { - "id": "about", + { "id": "about", "name": "About", "icon": "app.png", "version":"0.05", "description": "Bangle.js About page - showing software version, stats, and a collaborative mural from the Bangle.js KickStarter backers", "tags": "tool,system", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "about.app.js", - "url": "app.js" - }, - { - "name": "about.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"about.app.js","url":"app.js"}, + {"name":"about.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "locale", + { "id": "locale", "name": "Languages", "icon": "locale.png", "version":"0.06", "description": "Translations for different countries", "tags": "tool,system,locale,translate", "type": "locale", - "custom": "locale.html", + "custom":"locale.html", "storage": [ - { - "name": "locale" - } + {"name":"locale"} ], - "sortorder": -10 + "sortorder" : -10 }, - { - "id": "welcome", + { "id": "welcome", "name": "Welcome", "icon": "app.png", "version":"0.09", "description": "Appears at first boot and explains how to use Bangle.js", "tags": "start,welcome", - "allow_emulator": true, + "allow_emulator":true, "storage": [ {"name":"welcome.boot.js","url":"boot.js"}, {"name":"welcome.app.js","url":"app.js"}, @@ -134,54 +92,34 @@ {"name":"welcome.json"} ] }, - { - "id": "gbridge", + { "id": "gbridge", "name": "Gadgetbridge", "icon": "app.png", "version":"0.10", "description": "The default notification handler for Gadgetbridge notifications from Android", "tags": "tool,system,android,widget", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "gbridge.settings.js", - "url": "settings.js" - }, - { - "name": "gbridge.img", - "url": "app-icon.js", - "evaluate": true - }, - { - "name": "gbridge.wid.js", - "url": "widget.js" - } + {"name":"gbridge.settings.js","url":"settings.js"}, + {"name":"gbridge.img","url":"app-icon.js","evaluate":true}, + {"name":"gbridge.wid.js","url":"widget.js"} ] }, - { - "id": "mclock", + { "id": "mclock", "name": "Morphing Clock", "icon": "clock-morphing.png", "version":"0.06", "description": "7 segment clock that morphs between minutes and hours", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "mclock.app.js", - "url": "clock-morphing.js" - }, - { - "name": "mclock.img", - "url": "clock-morphing-icon.js", - "evaluate": true - } + {"name":"mclock.app.js","url":"clock-morphing.js"}, + {"name":"mclock.img","url":"clock-morphing-icon.js","evaluate":true} ], - "sortorder": -9 + "sortorder" : -9 }, - { - "id": "setting", + { "id": "setting", "name": "Settings", "icon": "settings.png", "version":"0.19", @@ -193,12 +131,11 @@ {"name":"setting.boot.js","url":"boot.js"}, {"name":"setting.img","url":"settings-icon.js","evaluate":true} ], - "sortorder": -2 + "sortorder" : -2 }, - { - "id": "alarm", + { "id": "alarm", "name": "Default Alarm", - "shortName": "Alarms", + "shortName":"Alarms", "icon": "app.png", "version":"0.07", "description": "Set and respond to alarms", @@ -214,25 +151,17 @@ {"name":"alarm.json"} ] }, - { - "id": "wclock", + { "id": "wclock", "name": "Word Clock", "icon": "clock-word.png", - "version": "0.02", + "version":"0.02", "description": "Display Time as Text", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "wclock.app.js", - "url": "clock-word.js" - }, - { - "name": "wclock.img", - "url": "clock-word-icon.js", - "evaluate": true - } + {"name":"wclock.app.js","url":"clock-word.js"}, + {"name":"wclock.img","url":"clock-word-icon.js","evaluate":true} ] }, { "id": "imgclock", @@ -271,198 +200,118 @@ "version": "0.13", "description": "An Analog Clock", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "aclock.app.js", - "url": "clock-analog.js" - }, - { - "name": "aclock.img", - "url": "clock-analog-icon.js", - "evaluate": true - } + {"name":"aclock.app.js","url":"clock-analog.js"}, + {"name":"aclock.img","url":"clock-analog-icon.js","evaluate":true} ] }, - { - "id": "clock2x3", + { "id": "clock2x3", "name": "2x3 Pixel Clock", "icon": "clock2x3.png", - "version": "0.04", + "version":"0.04", "description": "This is a simple clock using minimalist 2x3 pixel numerical digits", "tags": "clock", "type": "clock", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "clock2x3.app.js", - "url": "clock2x3-app.js" - }, - { - "name": "clock2x3.img", - "url": "clock2x3-icon.js", - "evaluate": true - } + {"name":"clock2x3.app.js","url":"clock2x3-app.js"}, + {"name":"clock2x3.img","url":"clock2x3-icon.js","evaluate":true} ] }, - { - "id": "trex", + { "id": "trex", "name": "T-Rex", "icon": "trex.png", "version":"0.02", "description": "T-Rex game in the style of Chrome's offline game", "tags": "game", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "trex.app.js", - "url": "trex.js" - }, - { - "name": "trex.img", - "url": "trex-icon.js", - "evaluate": true - } + {"name":"trex.app.js","url":"trex.js"}, + {"name":"trex.img","url":"trex-icon.js","evaluate":true} ] }, - { - "id": "astroid", + { "id": "astroid", "name": "Asteroids!", "icon": "asteroids.png", "version":"0.02", "description": "Retro asteroids game", "tags": "game", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "astroid.app.js", - "url": "asteroids.js" - }, - { - "name": "astroid.img", - "url": "asteroids-icon.js", - "evaluate": true - } + {"name":"astroid.app.js","url":"asteroids.js"}, + {"name":"astroid.img","url":"asteroids-icon.js","evaluate":true} ] }, - { - "id": "clickms", + { "id": "clickms", "name": "Click Master", "icon": "click-master.png", - "version": "0.01", + "version":"0.01", "description": "Get several friends to start the game, then compete to see who can press BTN1 the most!", "tags": "game", "storage": [ - { - "name": "clickms.app.js", - "url": "click-master.js" - }, - { - "name": "clickms.img", - "url": "click-master-icon.js", - "evaluate": true - } + {"name":"clickms.app.js","url":"click-master.js"}, + {"name":"clickms.img","url":"click-master-icon.js","evaluate":true} ] }, - { - "id": "horsey", + { "id": "horsey", "name": "Horse Race!", "icon": "horse-race.png", - "version": "0.01", + "version":"0.01", "description": "Get several friends to start the game, then compete to see who can press BTN1 the most!", "tags": "game", "storage": [ - { - "name": "horsey.app.js", - "url": "horse-race.js" - }, - { - "name": "horsey.img", - "url": "horse-race-icon.js", - "evaluate": true - } + {"name":"horsey.app.js","url":"horse-race.js"}, + {"name":"horsey.img","url":"horse-race-icon.js","evaluate":true} ] }, - { - "id": "compass", + { "id": "compass", "name": "Compass", "icon": "compass.png", "version":"0.02", "description": "Simple compass that points North", "tags": "tool,outdoors", "storage": [ - { - "name": "compass.app.js", - "url": "compass.js" - }, - { - "name": "compass.img", - "url": "compass-icon.js", - "evaluate": true - } + {"name":"compass.app.js","url":"compass.js"}, + {"name":"compass.img","url":"compass-icon.js","evaluate":true} ] }, - { - "id": "gpstime", + { "id": "gpstime", "name": "GPS Time", "icon": "gpstime.png", - "version": "0.03", + "version":"0.03", "description": "Update the Bangle.js's clock based on the time from the GPS receiver", "tags": "tool,gps", "storage": [ - { - "name": "gpstime.app.js", - "url": "gpstime.js" - }, - { - "name": "gpstime.img", - "url": "gpstime-icon.js", - "evaluate": true - } + {"name":"gpstime.app.js","url":"gpstime.js"}, + {"name":"gpstime.img","url":"gpstime-icon.js","evaluate":true} ] }, - { - "id": "openloc", + { "id": "openloc", "name": "Open Location / Plus Codes", "shortName": "Open Location", "icon": "app.png", - "version": "0.01", + "version":"0.01", "description": "Convert your current GPS location to a series of characters", "tags": "tool,outdoors,gps", "storage": [ - { - "name": "openloc.app.js", - "url": "app.js" - }, - { - "name": "openloc.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"openloc.app.js","url":"app.js"}, + {"name":"openloc.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "speedo", + { "id": "speedo", "name": "Speedo", "icon": "speedo.png", "version":"0.03", "description": "Show the current speed according to the GPS", "tags": "tool,outdoors,gps", "storage": [ - { - "name": "speedo.app.js", - "url": "speedo.js" - }, - { - "name": "speedo.img", - "url": "speedo-icon.js", - "evaluate": true - } + {"name":"speedo.app.js","url":"speedo.js"}, + {"name":"speedo.img","url":"speedo-icon.js","evaluate":true} ] }, - { - "id": "gpsrec", + { "id": "gpsrec", "name": "GPS Recorder", "icon": "app.png", "version":"0.09", @@ -492,8 +341,7 @@ {"name":"gpsnav.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "heart", + { "id": "heart", "name": "Heart Rate Recorder", "icon": "app.png", "version":"0.02", @@ -510,42 +358,26 @@ {"wildcard":".heart?","storageFile": true} ] }, - { - "id": "slevel", + { "id": "slevel", "name": "Spirit Level", "icon": "spiritlevel.png", - "version": "0.01", + "version":"0.01", "description": "Show the current angle of the watch, so you can use it to make sure something is absolutely flat", "tags": "tool", "storage": [ - { - "name": "slevel.app.js", - "url": "spiritlevel.js" - }, - { - "name": "slevel.img", - "url": "spiritlevel-icon.js", - "evaluate": true - } + {"name":"slevel.app.js","url":"spiritlevel.js"}, + {"name":"slevel.img","url":"spiritlevel-icon.js","evaluate":true} ] }, - { - "id": "files", + { "id": "files", "name": "App Manager", "icon": "files.png", "version":"0.05", "description": "Show currently installed apps, free space, and allow their deletion from the watch", "tags": "tool,system,files", "storage": [ - { - "name": "files.app.js", - "url": "files.js" - }, - { - "name": "files.img", - "url": "files-icon.js", - "evaluate": true - } + {"name":"files.app.js","url":"files.js"}, + {"name":"files.img","url":"files-icon.js","evaluate":true} ] }, { "id": "weather", @@ -571,23 +403,19 @@ "version":"0.05", "description": "Show the current battery level and charging status in the top right of the clock", "tags": "widget,battery", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "widbat.wid.js", - "url": "widget.js" - } + {"name":"widbat.wid.js","url":"widget.js"} ] }, - { - "id": "widbatpc", + { "id": "widbatpc", "name": "Battery Level Widget (with percentage)", "shortName": "Battery Widget", "icon": "widget.png", "version":"0.11", "description": "Show the current battery level and charging status in the top right of the clock, with charge percentage", "tags": "widget,battery", - "type": "widget", + "type":"widget", "storage": [ {"name":"widbatpc.wid.js","url":"widget.js"}, {"name":"widbatpc.settings.js","url":"settings.js"} @@ -596,19 +424,15 @@ {"name":"widbatpc.json"} ] }, - { - "id": "widbt", + { "id": "widbt", "name": "Bluetooth Widget", "icon": "widget.png", "version":"0.04", "description": "Show the current Bluetooth connection status in the top right of the clock", "tags": "widget,bluetooth", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "widbt.wid.js", - "url": "widget.js" - } + {"name":"widbt.wid.js","url":"widget.js"} ] }, { "id": "widram", @@ -626,99 +450,63 @@ { "id": "hrm", "name": "Heart Rate Monitor", "icon": "heartrate.png", - "version": "0.01", + "version":"0.01", "description": "Measure your current heart rate", "tags": "health", "storage": [ - { - "name": "hrm.app.js", - "url": "heartrate.js" - }, - { - "name": "hrm.img", - "url": "heartrate-icon.js", - "evaluate": true - } + {"name":"hrm.app.js","url":"heartrate.js"}, + {"name":"hrm.img","url":"heartrate-icon.js","evaluate":true} ] }, - { - "id": "widhrm", + { "id": "widhrm", "name": "Simple Heart Rate widget", "icon": "widget.png", - "version": "0.03", + "version":"0.03", "description": "When the screen is on, the widget turns on the heart rate monitor and displays the current heart rate (or last known in grey). For this to work well you'll need at least a 15 second LCD Timeout.", "tags": "health,widget", "type": "widget", "storage": [ - { - "name": "widhrm.wid.js", - "url": "widget.js" - } + {"name":"widhrm.wid.js","url":"widget.js"} ] }, - { - "id": "stetho", + { "id": "stetho", "name": "Stethoscope", "icon": "stetho.png", - "version": "0.01", + "version":"0.01", "description": "Hear your heart rate", "tags": "health", "storage": [ - { - "name": "stetho.app.js", - "url": "stetho.js" - }, - { - "name": "stetho.img", - "url": "stetho-icon.js", - "evaluate": true - } + {"name":"stetho.app.js","url":"stetho.js"}, + {"name":"stetho.img","url":"stetho-icon.js","evaluate":true} ] }, - { - "id": "swatch", + { "id": "swatch", "name": "Stopwatch", "icon": "stopwatch.png", "version":"0.07", "interface": "interface.html", "description": "Simple stopwatch with Lap Time logging to a JSON file", "tags": "health", - "allow_emulator": true, + "allow_emulator":true, "readme": "README.md", "storage": [ - { - "name": "swatch.app.js", - "url": "stopwatch.js" - }, - { - "name": "swatch.img", - "url": "stopwatch-icon.js", - "evaluate": true - } + {"name":"swatch.app.js","url":"stopwatch.js"}, + {"name":"swatch.img","url":"stopwatch-icon.js","evaluate":true} ] }, - { - "id": "hidmsic", + { "id": "hidmsic", "name": "Bluetooth Music Controls", "shortName": "Music Control", "icon": "hid-music.png", - "version": "0.02", + "version":"0.02", "description": "Enable HID in settings, pair with your phone, then use this app to control music from your watch!", "tags": "bluetooth", "storage": [ - { - "name": "hidmsic.app.js", - "url": "hid-music.js" - }, - { - "name": "hidmsic.img", - "url": "hid-music-icon.js", - "evaluate": true - } + {"name":"hidmsic.app.js","url":"hid-music.js"}, + {"name":"hidmsic.img","url":"hid-music-icon.js","evaluate":true} ] }, - { - "id": "hidkbd", + { "id": "hidkbd", "name": "Bluetooth Keyboard", "shortName": "Bluetooth Kbd", "icon": "hid-keyboard.png", @@ -726,19 +514,11 @@ "description": "Enable HID in settings, pair with your phone/PC, then use this app to control other apps", "tags": "bluetooth", "storage": [ - { - "name": "hidkbd.app.js", - "url": "hid-keyboard.js" - }, - { - "name": "hidkbd.img", - "url": "hid-keyboard-icon.js", - "evaluate": true - } + {"name":"hidkbd.app.js","url":"hid-keyboard.js"}, + {"name":"hidkbd.img","url":"hid-keyboard-icon.js","evaluate":true} ] }, - { - "id": "hidbkbd", + { "id": "hidbkbd", "name": "Binary Bluetooth Keyboard", "shortName": "Binary BT Kbd", "icon": "hid-binary-keyboard.png", @@ -746,78 +526,30 @@ "description": "Enable HID in settings, pair with your phone/PC, then type messages using the onscreen keyboard by tapping repeatedly on the key you want", "tags": "bluetooth", "storage": [ - { - "name": "hidbkbd.app.js", - "url": "hid-binary-keyboard.js" - }, - { - "name": "hidbkbd.img", - "url": "hid-binary-keyboard-icon.js", - "evaluate": true - } + {"name":"hidbkbd.app.js","url":"hid-binary-keyboard.js"}, + {"name":"hidbkbd.img","url":"hid-binary-keyboard-icon.js","evaluate":true} ] }, - { - "id": "animals", + { "id": "animals", "name": "Animals Game", "icon": "animals.png", - "version": "0.01", + "version":"0.01", "description": "Simple toddler's game - displays a different number of animals each time the screen is pressed", "tags": "game", "storage": [ - { - "name": "animals.app.js", - "url": "animals.js" - }, - { - "name": "animals.img", - "url": "animals-icon.js", - "evaluate": true - }, - { - "name": "animals-snake.img", - "url": "animals-snake.js", - "evaluate": true - }, - { - "name": "animals-duck.img", - "url": "animals-duck.js", - "evaluate": true - }, - { - "name": "animals-swan.img", - "url": "animals-swan.js", - "evaluate": true - }, - { - "name": "animals-fox.img", - "url": "animals-fox.js", - "evaluate": true - }, - { - "name": "animals-camel.img", - "url": "animals-camel.js", - "evaluate": true - }, - { - "name": "animals-pig.img", - "url": "animals-pig.js", - "evaluate": true - }, - { - "name": "animals-sheep.img", - "url": "animals-sheep.js", - "evaluate": true - }, - { - "name": "animals-mouse.img", - "url": "animals-mouse.js", - "evaluate": true - } + {"name":"animals.app.js","url":"animals.js"}, + {"name":"animals.img","url":"animals-icon.js","evaluate":true}, + {"name":"animals-snake.img","url":"animals-snake.js","evaluate":true}, + {"name":"animals-duck.img","url":"animals-duck.js","evaluate":true}, + {"name":"animals-swan.img","url":"animals-swan.js","evaluate":true}, + {"name":"animals-fox.img","url":"animals-fox.js","evaluate":true}, + {"name":"animals-camel.img","url":"animals-camel.js","evaluate":true}, + {"name":"animals-pig.img","url":"animals-pig.js","evaluate":true}, + {"name":"animals-sheep.img","url":"animals-sheep.js","evaluate":true}, + {"name":"animals-mouse.img","url":"animals-mouse.js","evaluate":true} ] }, - { - "id": "qrcode", + { "id": "qrcode", "name": "Custom QR Code", "icon": "app.png", "version":"0.02", @@ -829,8 +561,7 @@ {"name":"qrcode.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "beer", + { "id": "beer", "name": "Beer Compass", "icon": "app.png", "version":"0.01", @@ -842,8 +573,7 @@ {"name":"beer.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "route", + { "id": "route", "name": "Route Viewer", "icon": "app.png", "version":"0.01", @@ -877,337 +607,203 @@ {"name":"ncstart.json"} ] }, - { - "id": "ncfrun", + { "id": "ncfrun", "name": "NCEU 5K Fun Run", "icon": "nceu-funrun.png", - "version": "0.01", + "version":"0.01", "description": "Display a map of the NodeConf EU 2019 5K Fun Run route and your location on it", "tags": "health", "storage": [ - { - "name": "ncfrun.app.js", - "url": "nceu-funrun.js" - }, - { - "name": "ncfrun.img", - "url": "nceu-funrun-icon.js", - "evaluate": true - } + {"name":"ncfrun.app.js","url":"nceu-funrun.js"}, + {"name":"ncfrun.img","url":"nceu-funrun-icon.js","evaluate":true} ] }, - { - "id": "widnceu", + { "id": "widnceu", "name": "NCEU Logo Widget", "icon": "widget.png", - "version": "0.02", + "version":"0.02", "description": "Show the NodeConf EU logo in the top left", "tags": "widget", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "widnceu.wid.js", - "url": "widget.js" - } + {"name":"widnceu.wid.js","url":"widget.js"} ] }, - { - "id": "sclock", + { "id": "sclock", "name": "Simple Clock", "icon": "clock-simple.png", - "version": "0.04", + "version":"0.04", "description": "A Simple Digital Clock", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "sclock.app.js", - "url": "clock-simple.js" - }, - { - "name": "sclock.img", - "url": "clock-simple-icon.js", - "evaluate": true - } + {"name":"sclock.app.js","url":"clock-simple.js"}, + {"name":"sclock.img","url":"clock-simple-icon.js","evaluate":true} ] }, - { - "id": "dclock", + { "id": "dclock", "name": "Dev Clock", "icon": "clock-dev.png", - "version": "0.09", + "version":"0.09", "description": "A Digital Clock including timestamp (tst), beats(@), days in current month (dm) and days since new moon (l)", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "dclock.app.js", - "url": "clock-dev.js" - }, - { - "name": "dclock.img", - "url": "clock-dev-icon.js", - "evaluate": true - } + {"name":"dclock.app.js","url":"clock-dev.js"}, + {"name":"dclock.img","url":"clock-dev-icon.js","evaluate":true} ] }, - { - "id": "gesture", + { "id": "gesture", "name": "Gesture Test", "icon": "gesture.png", - "version": "0.01", + "version":"0.01", "description": "BETA! Uploads a basic Tensorflow Gesture model, and then outputs each gesture as a message", "tags": "gesture,ai", - "type": "app", + "type":"app", "storage": [ - { - "name": "gesture.app.js", - "url": "gesture.js" - }, - { - "name": ".tfnames", - "url": "gesture-tfnames.js", - "evaluate": true - }, - { - "name": ".tfmodel", - "url": "gesture-tfmodel.js", - "evaluate": true - }, - { - "name": "gesture.img", - "url": "gesture-icon.js", - "evaluate": true - } + {"name":"gesture.app.js","url":"gesture.js"}, + {"name":".tfnames","url":"gesture-tfnames.js","evaluate":true}, + {"name":".tfmodel","url":"gesture-tfmodel.js","evaluate":true}, + {"name":"gesture.img","url":"gesture-icon.js","evaluate":true} ] }, - { - "id": "pparrot", + { "id": "pparrot", "name": "Party Parrot", "icon": "party-parrot.png", - "version": "0.01", + "version":"0.01", "description": "Party with a parrot on your wrist", "tags": "party,parrot,lol", - "type": "app", - "allow_emulator": true, + "type":"app", + "allow_emulator":true, "storage": [ - { - "name": "pparrot.app.js", - "url": "party-parrot.js" - }, - { - "name": "pparrot.img", - "url": "party-parrot-icon.js", - "evaluate": true - } + {"name":"pparrot.app.js","url":"party-parrot.js"}, + {"name":"pparrot.img","url":"party-parrot-icon.js","evaluate":true} ] }, - { - "id": "hrings", + { "id": "hrings", "name": "Hypno Rings", "icon": "hypno-rings.png", - "version": "0.01", + "version":"0.01", "description": "Experiment with trippy rings, press buttons for change", "tags": "rings,hypnosis,psychadelic", - "type": "app", - "allow_emulator": true, + "type":"app", + "allow_emulator":true, "storage": [ - { - "name": "hrings.app.js", - "url": "hypno-rings.js" - }, - { - "name": "hrings.img", - "url": "hypno-rings-icon.js", - "evaluate": true - } + {"name":"hrings.app.js","url":"hypno-rings.js"}, + {"name":"hrings.img","url":"hypno-rings-icon.js","evaluate":true} ] }, - { - "id": "morse", + { "id": "morse", "name": "Morse Code", "icon": "morse-code.png", - "version": "0.01", + "version":"0.01", "description": "Learn morse code by hearing/seeing/feeling the code. Tap to toggle buzz!", "tags": "morse,sound,visual,input", - "type": "app", + "type":"app", "storage": [ - { - "name": "morse.app.js", - "url": "morse-code.js" - }, - { - "name": "morse.img", - "url": "morse-code-icon.js", - "evaluate": true - } + {"name":"morse.app.js","url":"morse-code.js"}, + {"name":"morse.img","url":"morse-code-icon.js","evaluate":true} ] }, { "id": "blescan", "name": "BLE Scanner", "icon": "blescan.png", - "version": "0.01", + "version":"0.01", "description": "Scan for advertising BLE devices", - "tags": "bluetooth", - "storage": [ - { - "name": "blescan.app.js", - "url": "blescan.js" - }, - { - "name": "blescan.img", - "url": "blescan-icon.js", - "evaluate": true - } + "tags" : "bluetooth", + "storage" : [ + {"name":"blescan.app.js","url":"blescan.js"}, + {"name":"blescan.img","url":"blescan-icon.js", "evaluate":true} ] }, - { - "id": "mmonday", - "name": "Manic Monday Tone", - "icon": "manic-monday-icon.png", - "version": "0.02", - "description": "The Bangles make a comeback", - "tags": "sound", - "storage": [ - { - "name": "mmonday.app.js", - "url": "manic-monday.js" - }, - { - "name": "mmonday.img", - "url": "manic-monday-icon.js", - "evaluate": true - } - ] + { "id": "mmonday", + "name": "Manic Monday Tone", + "icon": "manic-monday-icon.png", + "version":"0.02", + "description": "The Bangles make a comeback", + "tags": "sound", + "storage": [ + {"name":"mmonday.app.js","url":"manic-monday.js"}, + {"name":"mmonday.img","url":"manic-monday-icon.js","evaluate":true} + ] }, - { - "id": "jbells", + { "id": "jbells", "name": "Jingle Bells", "icon": "jbells.png", - "version": "0.01", + "version":"0.01", "description": "Play Jingle Bells", "tags": "sound", - "type": "app", + "type":"app", "storage": [ - { - "name": "jbells.app.js", - "url": "jbells.js" - }, - { - "name": "jbells.img", - "url": "jbells-icon.js", - "evaluate": true - } + {"name":"jbells.app.js","url":"jbells.js"}, + {"name":"jbells.img","url":"jbells-icon.js","evaluate":true} ] }, - { - "id": "scolor", + { "id": "scolor", "name": "Show Color", "icon": "show-color.png", - "version": "0.01", + "version":"0.01", "description": "Display all available Colors and Names", "tags": "tool", - "type": "app", - "allow_emulator": true, + "type":"app", + "allow_emulator":true, "storage": [ - { - "name": "scolor.app.js", - "url": "show-color.js" - }, - { - "name": "scolor.img", - "url": "show-color-icon.js", - "evaluate": true - } + {"name":"scolor.app.js","url":"show-color.js"}, + {"name":"scolor.img","url":"show-color-icon.js","evaluate":true} ] }, - { - "id": "miclock", + { "id": "miclock", "name": "Mixed Clock", "icon": "clock-mixed.png", - "version": "0.04", + "version":"0.04", "description": "A mix of analog and digital Clock", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "miclock.app.js", - "url": "clock-mixed.js" - }, - { - "name": "miclock.img", - "url": "clock-mixed-icon.js", - "evaluate": true - } + {"name":"miclock.app.js","url":"clock-mixed.js"}, + {"name":"miclock.img","url":"clock-mixed-icon.js","evaluate":true} ] }, - { - "id": "bclock", + { "id": "bclock", "name": "Binary Clock", "icon": "clock-binary.png", - "version": "0.02", + "version":"0.02", "description": "A simple binary clock watch face", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "bclock.app.js", - "url": "clock-binary.js" - }, - { - "name": "bclock.img", - "url": "clock-binary-icon.js", - "evaluate": true - } + {"name":"bclock.app.js","url":"clock-binary.js"}, + {"name":"bclock.img","url":"clock-binary-icon.js","evaluate":true} ] }, - { - "id": "clotris", + { "id": "clotris", "name": "Clock-Tris", "icon": "clock-tris.png", - "version": "0.01", + "version":"0.01", "description": "A fully functional clone of a classic game of falling blocks", "tags": "game", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "clotris.app.js", - "url": "clock-tris.js" - }, - { - "name": "clotris.img", - "url": "clock-tris-icon.js", - "evaluate": true - }, - { - "name": ".trishig", - "url": "clock-tris-high" - } + {"name":"clotris.app.js","url":"clock-tris.js"}, + {"name":"clotris.img","url":"clock-tris-icon.js","evaluate":true}, + {"name":".trishig","url":"clock-tris-high"} ] }, - { - "id": "flappy", + { "id": "flappy", "name": "Flappy Bird", "icon": "app.png", "version":"0.04", "description": "A Flappy Bird game clone", "tags": "game", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "flappy.app.js", - "url": "app.js" - }, - { - "name": "flappy.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"flappy.app.js","url":"app.js"}, + {"name":"flappy.img","url":"app-icon.js","evaluate":true} ] }, { @@ -1219,203 +815,123 @@ "tags": "gps", "type": "app", "storage": [ - { - "name": "gpsinfo.app.js", - "url": "gps-info.js" - }, - { - "name": "gpsinfo.img", - "url": "gps-info-icon.js", - "evaluate": true - } + {"name":"gpsinfo.app.js","url": "gps-info.js"}, + {"name":"gpsinfo.img","url": "gps-info-icon.js","evaluate": true} ] }, { "id": "pomodo", - "name": "Pomodoro", - "icon": "pomodoro.png", - "version": "0.01", + "name":"Pomodoro", + "icon":"pomodoro.png", + "version":"0.01", "description": "A simple pomodoro timer.", "tags": "pomodoro,cooking,tools", "type": "app", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "pomodo.app.js", - "url": "pomodoro.js" - }, - { - "name": "pomodo.img", - "url": "pomodoro-icon.js", - "evaluate": true - } + {"name":"pomodo.app.js","url": "pomodoro.js"}, + {"name":"pomodo.img","url": "pomodoro-icon.js","evaluate": true} ] }, - { - "id": "blobclk", + { "id": "blobclk", "name": "Large Digit Blob Clock", - "shortName": "Blob Clock", + "shortName" : "Blob Clock", "icon": "clock-blob.png", - "version": "0.03", + "version":"0.03", "description": "A clock with big digits", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "blobclk.app.js", - "url": "clock-blob.js" - }, - { - "name": "blobclk.img", - "url": "clock-blob-icon.js", - "evaluate": true - } + {"name":"blobclk.app.js","url":"clock-blob.js"}, + {"name":"blobclk.img","url":"clock-blob-icon.js","evaluate":true} ] }, - { - "id": "boldclk", + { "id": "boldclk", "name": "Bold Clock", "icon": "bold_clock.png", - "version": "0.02", + "version":"0.02", "description": "Simple, readable and practical clock", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "boldclk.app.js", - "url": "bold_clock.js" - }, - { - "name": "boldclk.img", - "url": "bold_clock-icon.js", - "evaluate": true - } + {"name":"boldclk.app.js","url":"bold_clock.js"}, + {"name":"boldclk.img","url":"bold_clock-icon.js","evaluate":true} ] }, - { - "id": "widclk", + { "id": "widclk", "name": "Digital clock widget", "icon": "widget.png", "version":"0.04", "description": "A simple digital clock widget", "tags": "widget,clock", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "widclk.wid.js", - "url": "widget.js" - } + {"name":"widclk.wid.js","url":"widget.js"} ] }, - { - "id": "widpedom", + { "id": "widpedom", "name": "Pedometer widget", "icon": "widget.png", "version":"0.10", "description": "Daily pedometer widget", "tags": "widget", - "type": "widget", + "type":"widget", "storage": [ {"name":"widpedom.wid.js","url":"widget.js"}, {"name":"widpedom.settings.js","url":"settings.js"} ] }, - { - "id": "berlinc", + { "id": "berlinc", "name": "Berlin Clock", "icon": "berlin-clock.png", - "version": "0.02", + "version":"0.02", "description": "Berlin Clock (see https://en.wikipedia.org/wiki/Mengenlehreuhr)", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "berlinc.app.js", - "url": "berlin-clock.js" - }, - { - "name": "berlinc.img", - "url": "berlin-clock-icon.js", - "evaluate": true - } + {"name":"berlinc.app.js","url":"berlin-clock.js"}, + {"name":"berlinc.img","url":"berlin-clock-icon.js","evaluate":true} ] }, - { - "id": "ctrclk", + { "id": "ctrclk", "name": "Centerclock", "icon": "app.png", - "version": "0.02", + "version":"0.02", "description": "Watch-centered digital 24h clock with date in dd.mm.yyyy format.", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "ctrclk.app.js", - "url": "app.js" - }, - { - "name": "ctrclk.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"ctrclk.app.js","url":"app.js"}, + {"name":"ctrclk.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "demoapp", + { "id": "demoapp", "name": "Demo Loop", "icon": "app.png", - "version": "0.01", + "version":"0.01", "description": "Simple demo app - displays Bangle.js, JS logo, graphics, and Bangle.js information", "tags": "", - "type": "app", - "allow_emulator": true, + "type":"app", + "allow_emulator":true, "storage": [ - { - "name": "demoapp.app.js", - "url": "app.js" - }, - { - "name": "demoapp.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"demoapp.app.js","url":"app.js"}, + {"name":"demoapp.img","url":"app-icon.js","evaluate":true} ], - "sortorder": -9 + "sortorder" : -9 }, - { - "id": "jbm8b", - "name": "Magic 8 Ball", - "shortName": "Magic 8 Ball", - "icon": "app.png", - "description": "A simple fortune telling app", - "tags": "game", - "storage": [ - { "name": "jbm8b.app.js", "url": "app.js" }, - { "name": "jbm8b.img", "url": "app-icon.js", "evaluate": true } - ], - "version": "0.03" - }, - { - "id": "flagrse", + { "id": "flagrse", "name": "Espruino Flag Raiser", "icon": "app.png", - "version": "0.01", + "version":"0.01", "description": "App to send a command to another Espruino to cause it to raise a flag", "tags": "", "storage": [ - { - "name": "flagrse.app.js", - "url": "app.js" - }, - { - "name": "flagrse.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"flagrse.app.js","url":"app.js"}, + {"name":"flagrse.img","url":"app-icon.js","evaluate":true} ] }, { @@ -1425,46 +941,27 @@ "version": "0.03", "description": "Pipboy themed clock", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "pipboy.app.js", - "url": "app.js" - }, - { - "name": "pipboy.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"pipboy.app.js","url":"app.js"}, + {"name":"pipboy.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "torch", + { "id": "torch", "name": "Torch", - "shortName": "Torch", + "shortName":"Torch", "icon": "app.png", "version":"0.02", "description": "Turns screen white to help you see in the dark. Select from the launcher or press BTN1,BTN3,BTN1,BTN3 quickly to start when in any app that shows widgets", "tags": "tool,torch", "storage": [ - { - "name": "torch.app.js", - "url": "app.js" - }, - { - "name": "torch.wid.js", - "url": "widget.js" - }, - { - "name": "torch.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"torch.app.js","url":"app.js"}, + {"name":"torch.wid.js","url":"widget.js"}, + {"name":"torch.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "wohrm", + { "id": "wohrm", "name": "Workout HRM", "icon": "app.png", "version":"0.07", @@ -1472,32 +969,21 @@ "description": "Workout heart rate monitor notifies you with a buzz if your heart rate goes above or below the set limits.", "tags": "hrm,workout", "type": "app", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "wohrm.app.js", - "url": "app.js" - }, - { - "name": "wohrm.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"wohrm.app.js","url":"app.js"}, + {"name":"wohrm.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "widid", + { "id": "widid", "name": "Bluetooth ID Widget", "icon": "widget.png", - "version": "0.02", + "version":"0.02", "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", + "type":"widget", "storage": [ - { - "name": "widid.wid.js", - "url": "widget.js" - } + {"name":"widid.wid.js","url":"widget.js"} ] }, { @@ -1508,238 +994,134 @@ "description": "Simple grocery (shopping) list - Display a list of product and track if you already put them in your cart.", "tags": "tool,outdoors,shopping,list", "type": "app", - "custom": "grocery.html", + "custom":"grocery.html", "storage": [ - { - "name": "grocery" - }, - { - "name": "grocery.app.js" - }, - { - "name": "grocery.img", - "url": "grocery-icon.js", - "evaluate": true - } + {"name":"grocery"}, + {"name":"grocery.app.js"}, + {"name":"grocery.img","url":"grocery-icon.js","evaluate":true} ] }, - { - "id": "marioclock", + { "id": "marioclock", "name": "Mario Clock", "icon": "marioclock.png", "version":"0.12", "description": "Animated retro Mario clock, with Gameboy style 8-bit grey-scale graphics.", "tags": "clock,mario,retro", "type": "clock", - "allow_emulator": true, + "allow_emulator":true, "readme": "README.md", "storage": [ - { - "name": "marioclock.app.js", - "url": "marioclock-app.js" - }, - { - "name": "marioclock.img", - "url": "marioclock-icon.js", - "evaluate": true - } + {"name":"marioclock.app.js","url":"marioclock-app.js"}, + {"name":"marioclock.img","url":"marioclock-icon.js","evaluate":true} ] }, - { - "id": "cliock", + { "id": "cliock", "name": "Commandline-Clock", - "shortName": "CLI-Clock", + "shortName":"CLI-Clock", "icon": "app.png", - "version": "0.07", + "version":"0.07", "description": "Simple CLI-Styled Clock", "tags": "clock,cli,command,bash,shell", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "cliock.app.js", - "url": "app.js" - }, - { - "name": "cliock.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"cliock.app.js","url":"app.js"}, + {"name":"cliock.img","url":"app-icon.js","evaluate":true} ] }, - { - "id": "widver", + { "id": "widver", "name": "Firmware Version Widget", "icon": "widget.png", - "version": "0.01", + "version":"0.01", "description": "Display the version of the installed firmware in the top widget section.", "tags": "widget,tool,system", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "widver.wid.js", - "url": "widget.js" - } + {"name":"widver.wid.js","url":"widget.js"} ] }, - { - "id": "barclock", + { "id": "barclock", "name": "Bar Clock", "icon": "clock-bar.png", "version":"0.05", "description": "A simple digital clock showing seconds as a bar", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "barclock.app.js", - "url": "clock-bar.js" - }, - { - "name": "barclock.img", - "url": "clock-bar-icon.js", - "evaluate": true - } + {"name":"barclock.app.js","url":"clock-bar.js"}, + {"name":"barclock.img","url":"clock-bar-icon.js","evaluate":true} ] }, - { - "id": "dotclock", + { "id": "dotclock", "name": "Dot Clock", "icon": "clock-dot.png", - "version": "0.01", + "version":"0.01", "description": "A Minimal Dot Analog Clock", "tags": "clock", - "type": "clock", - "allow_emulator": true, + "type":"clock", + "allow_emulator":true, "storage": [ - { - "name": "dotclock.app.js", - "url": "clock-dot.js" - }, - { - "name": "dotclock.img", - "url": "clock-dot-icon.js", - "evaluate": true - } + {"name":"dotclock.app.js","url":"clock-dot.js"}, + {"name":"dotclock.img","url":"clock-dot-icon.js","evaluate":true} ] }, - { - "id": "widtbat", + { "id": "widtbat", "name": "Tiny Battery Widget", "icon": "widget.png", - "version": "0.01", + "version":"0.01", "description": "Tiny blueish battery widget, vibs and changes level color when charging", "tags": "widget,tool,system", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "widtbat.wid.js", - "url": "widget.js" - } + {"name":"widtbat.wid.js","url":"widget.js"} ] }, - { - "id": "chrono", + { "id": "chrono", "name": "Chrono", - "shortName": "Chrono", + "shortName":"Chrono", "icon": "chrono.png", - "version": "0.01", + "version":"0.01", "description": "Single click BTN1 to add 5 minutes. Single click BTN2 to add 30 seconds. Single click BTN3 to add 5 seconds. Tap to pause or play to timer. Double click BTN1 to reset. When timer finishes the watch vibrates.", "tags": "Tools", "storage": [ - { - "name": "chrono.app.js", - "url": "chrono.js" - }, - { - "name": "chrono.img", - "url": "chrono-icon.js", - "evaluate": true - } + {"name":"chrono.app.js","url":"chrono.js"}, + {"name":"chrono.img","url":"chrono-icon.js","evaluate":true} ] }, - { - "id": "astrocalc", + { "id": "astrocalc", "name": "Astrocalc", "icon": "astrocalc.png", "version":"0.02", "description": "Calculates interesting information on the sun and moon cycles for the current day based on your location.", "tags": "app,sun,moon,cycles,tool,outdoors", - "allow_emulator": true, + "allow_emulator":true, "storage": [ - { - "name": "astrocalc.app.js", - "url": "astrocalc-app.js" - }, - { - "name": "suncalc.js", - "url": "suncalc.js" - }, - { - "name": "astrocalc.img", - "url": "astrocalc-icon.js", - "evaluate": true - }, - { - "name": "first-quarter.img", - "url": "first-quarter-icon.js", - "evaluate": true - }, - { - "name": "last-quarter.img", - "url": "last-quarter-icon.js", - "evaluate": true - }, - { - "name": "waning-crescent.img", - "url": "waning-crescent-icon.js", - "evaluate": true - }, - { - "name": "waning-gibbous.img", - "url": "waning-gibbous-icon.js", - "evaluate": true - }, - { - "name": "full.img", - "url": "full-icon.js", - "evaluate": true - }, - { - "name": "new.img", - "url": "new-icon.js", - "evaluate": true - }, - { - "name": "waxing-gibbous.img", - "url": "waxing-gibbous-icon.js", - "evaluate": true - }, - { - "name": "waxing-crescent.img", - "url": "waxing-crescent-icon.js", - "evaluate": true - } + {"name":"astrocalc.app.js","url":"astrocalc-app.js"}, + {"name":"suncalc.js","url":"suncalc.js"}, + {"name":"astrocalc.img","url":"astrocalc-icon.js","evaluate":true}, + {"name":"first-quarter.img","url":"first-quarter-icon.js","evaluate":true}, + {"name":"last-quarter.img","url":"last-quarter-icon.js","evaluate":true}, + {"name":"waning-crescent.img","url":"waning-crescent-icon.js","evaluate":true}, + {"name":"waning-gibbous.img","url":"waning-gibbous-icon.js","evaluate":true}, + {"name":"full.img","url":"full-icon.js","evaluate":true}, + {"name":"new.img","url":"new-icon.js","evaluate":true}, + {"name":"waxing-gibbous.img","url":"waxing-gibbous-icon.js","evaluate":true}, + {"name":"waxing-crescent.img","url":"waxing-crescent-icon.js","evaluate":true} ] }, - { - "id": "widhwt", + { "id": "widhwt", "name": "Hand Wash Timer", "icon": "widget.png", - "version": "0.01", + "version":"0.01", "description": "Swipe your wrist over the watch face to start your personal Bangle.js hand wash timer for 35 sec. Start washing after the short buzz and stop after the long buzz.", "tags": "widget,tool", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "widhwt.wid.js", - "url": "widget.js" - } + {"name":"widhwt.wid.js","url":"widget.js"} ] }, - { - "id": "toucher", + { "id": "toucher", "name": "Touch Launcher", "shortName":"Toucher", "icon": "app.png", @@ -1754,7 +1136,7 @@ {"name":"toucher.app.js","url":"app.js"}, {"name":"toucher.settings.js","url":"settings.js"} ], - "sortorder": -10 + "sortorder" : -10 }, { "id": "balltastic", @@ -1765,16 +1147,9 @@ "tags": "game,fun", "type": "app", "storage": [ - { - "name": "balltastic.app.js", - "url": "app.js" - }, - { - "name": "balltastic.img", - "url": "app-icon.js", - "evaluate": true - } - ] + {"name":"balltastic.app.js","url":"app.js"}, + {"name":"balltastic.img","url":"app-icon.js","evaluate":true} + ] }, { "id": "rpgdice", @@ -1786,34 +1161,22 @@ "type": "app", "allow_emulator": true, "storage": [ - { - "name": "rpgdice.app.js", - "url": "app.js" - }, - { - "name": "rpgdice.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"rpgdice.app.js","url": "app.js"}, + {"name":"rpgdice.img","url": "app-icon.js","evaluate":true} ] }, - { - "id": "widmp", + { "id": "widmp", "name": "Moon Phase Widget", "icon": "widget.png", - "version": "0.01", + "version":"0.01", "description": "Display the current moon phase in blueish for the northern hemisphere in eight phases", "tags": "widget,tools", - "type": "widget", + "type":"widget", "storage": [ - { - "name": "widmp.wid.js", - "url": "widget.js" - } + {"name":"widmp.wid.js","url":"widget.js"} ] }, - { - "id": "minionclk", + { "id": "minionclk", "name": "Minion clock", "icon": "minionclk.png", "version": "0.02", @@ -1822,15 +1185,8 @@ "type": "clock", "allow_emulator": true, "storage": [ - { - "name": "minionclk.app.js", - "url": "app.js" - }, - { - "name": "minionclk.img", - "url": "app-icon.js", - "evaluate": true - } + {"name":"minionclk.app.js","url":"app.js"}, + {"name":"minionclk.img","url":"app-icon.js","evaluate":true} ] }, { "id": "openstmap", @@ -2390,5 +1746,18 @@ {"name":"dotmatrixclock.app.js","url":"app.js"}, {"name":"dotmatrixclock.img","url":"dotmatrixclock-icon.js","evaluate":true} ] - } -] \ No newline at end of file + }, + { + "id": "jbm8b", + "name": "Magic 8 Ball", + "shortName": "Magic 8 Ball", + "icon": "app.png", + "description": "A simple fortune telling app", + "tags": "game", + "storage": [ + { "name": "jbm8b.app.js", "url": "app.js" }, + { "name": "jbm8b.img", "url": "app-icon.js", "evaluate": true } + ], + "version": "0.03" + }, +] From 6a5bef65a362adb76ff31bc6df959cb6a5e69b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bov=C3=A9?= Date: Fri, 15 May 2020 13:44:14 +0200 Subject: [PATCH 49/63] Removes jbb app --- apps/jbb/ChangeLog | 2 -- apps/jbb/app-icon.js | 1 - apps/jbb/app.js | 53 ------------------------------------------- apps/jbb/app.json | 5 ---- apps/jbb/app.png | Bin 1673 -> 0 bytes 5 files changed, 61 deletions(-) delete mode 100644 apps/jbb/ChangeLog delete mode 100644 apps/jbb/app-icon.js delete mode 100644 apps/jbb/app.js delete mode 100644 apps/jbb/app.json delete mode 100644 apps/jbb/app.png diff --git a/apps/jbb/ChangeLog b/apps/jbb/ChangeLog deleted file mode 100644 index b7359ee0e..000000000 --- a/apps/jbb/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -0.01: First version trying out stuff -0.02: First usable version \ No newline at end of file diff --git a/apps/jbb/app-icon.js b/apps/jbb/app-icon.js deleted file mode 100644 index 8fbebe9df..000000000 --- a/apps/jbb/app-icon.js +++ /dev/null @@ -1 +0,0 @@ -require("heatshrink").decompress(atob("mEwxH+AH4AvlYAVF7NVABdPAggublfVAAfU5gAKFzReCF4guL0RehFxZedF6Iu/F/hezF1AvB1YvOFzxevF54u/F6Qupqxe/FzovBLxougLxoOBACIvNwAuB6YvbXroANqqdQF4YuYLqBedDgNWdqYuZFp/+qwuC6i6nLzi6RF4nPF1peXFqgvCqouUXSheEABhrHRaovSFw9WFyo8O6vUXTb6SFodPF0xeCXTheVF1AvBwC6pLwjsBqoupF4SLqF2AvCFtYuvF4YurF4NWF1otsAH4AXA==")) \ No newline at end of file diff --git a/apps/jbb/app.js b/apps/jbb/app.js deleted file mode 100644 index f39d06280..000000000 --- a/apps/jbb/app.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * draw the current level value - */ -function draw(level) { - console.log('draw', level); - // Clear the screen - g.clear(); - g.setFontAlign(0, 0); // center font - g.setFont("6x8", 8); // bitmap font, 8x magnified - g.drawString(level + "%", 120, 80); - g.setFont("6x8", 4); - g.drawString("power", 120, 130); -} - -function getBatteryLevel() { - level = E.getBattery(); - console.log('getBatteryLevel', level); - - draw(level); - - checkCharging(Bangle.isCharging()); - - // again, 10 secs later - setTimeout(getBatteryLevel, 10E3); -} - -function checkCharging(charging) { - console.log('checkCharging', charging); - // Green LED - //LED2.write(charging); - if (charging) { - g.setFontAlign(0, 0); // center font - g.setFont("6x8", 3); // bitmap font, 3x magnifier - g.drawString("charging", 120, 160); - } -} - -function main() { - console.log('starting jbb version 0.0.1'); - getBatteryLevel(); -} - -g.clear(); -g.flip(); -Bangle.loadWidgets(); -Bangle.drawWidgets(); - -Bangle.on('charging', checkCharging); - -main(); - -// Show launcher when middle button pressed -setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" }); diff --git a/apps/jbb/app.json b/apps/jbb/app.json deleted file mode 100644 index 9e4eb893c..000000000 --- a/apps/jbb/app.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Battery Power", - "icon": "*jbb", - "src": "-jbb" -} \ No newline at end of file diff --git a/apps/jbb/app.png b/apps/jbb/app.png deleted file mode 100644 index 6f58711b57c4be035b8368e4adbba1a5741e9532..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1673 zcmV;426p+0P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1|CU7K~!i%)md9i z9Yq-a_j0b3mIMINK(MNr%4rG$tUw}>;CI)Rcch}=*!W8dih0DHfr39mRxN(i z7A>y9wG~tJrPFCgR`H~OZTIYIP1m~#2Z&JuZ%h@K-b={HWZFpJ( zME-$$?vPR*$jW<=CzK<0O8UQqO`?6ts`PlBQ`DHXxc z02Yg$=|OmGpb4^!I}RNiu025H4Ff{~`Q(F{)K{K7*@`a}84Noc2On}pp5RJ>j*bqF z^TF&`H~O&9`s!MjY?Z=X#IMsI<{^%j4;x`upp@Lfl>)TTrbb?sQXV$ZBYQxZmkk>@^W%e$h!pD9`hh; z6y|b6b`*lsG&1KC7-*0fh@l}WOPS^1$^-Ac^Q3H9;EI9#tPQ9HNKaWPjQi%nCUN&- zc^efe(AL%_n6w_hPslcu@1T!MuhM}q~S z{X!$CsD&S)W5clr48y=3H-oL*+oeTPo94m!wieQsVU#d6AoO&?d|Q{G!2*> z?Ey`-zRRz77kHxp^Jo(~$RLtKF;PO$98@ZcbyQR?(=)rz=0Y-E46~gbb|ja}TnBo9 z26?5oU6MD!$b7gbc`?5vzeS4}3pZNiG>Mtbind6>c~^cP$G8(0&O`GO=uV-xSK8gz z1ES{FvXK7zB|*$&nAb6FRt55$U?BaTk6PjKADZyUL8Zol9>}btg3_wmzttgctl$S7 zaX` zBl%7F#2dtM_!od3Q-##I77;!~d~9sYHF-jb0+hZQ9=r>g<8HWeO7?n(Hm|_RPmaP9 zZ#9TH{3heew%6W5Cg+emB&%wqCX)Lmt8 z>;i@iDoy#_@1kzsQo;#n!~1Te3jz$2`ue-F7s;=xz;K664a6{hyuCWv4`s8EQ`oOq z0=f=-Ek~YodA9#3q=wq6N}k|J0m7G`pT_d~4DJ~ypgIiGWMZfh{@SY9%{10Gs{_{x zko6TsgZkPHj6=Cg{~AQA<6`9@@t(h0hnReL^1w4s-w$x@MPYekQHA*VHq1IqSbcna zyz1l$t`;$EcFfcueeqs^8=peY>#gwfk}6J5)j0R=2Ui{-rMEXYu+7gP{#;y;r@os_ zo=~v@WPQ4S|J4uBaiSSFCk{0=HJ)G6x<$nyL<(4cLpwG*G~zZY@<3;2rzDTXnQ0t4 zc|t`B(0^tKl;3A(XAhk`q2e`AS66pa^1EYDNI1Fd*uT{-&&Awf!__`;>j2 Date: Fri, 15 May 2020 13:45:35 +0200 Subject: [PATCH 50/63] Fixed apps.json Removed trailing comma --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index a1f8a0c7a..3eb485979 100644 --- a/apps.json +++ b/apps.json @@ -1759,5 +1759,5 @@ { "name": "jbm8b.img", "url": "app-icon.js", "evaluate": true } ], "version": "0.03" - }, + } ] From afa6d0dc3aa3a567b29c42e8d8c398a147fe5fdb Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:47:55 +0200 Subject: [PATCH 51/63] Revert "update0005" This reverts commit 4ceb67f2b2560e929aafe88b9dda2fdb47529488. --- apps.json | 5 ++--- apps/metronome/ChangeLog | 1 - apps/metronome/README.md | 1 - apps/metronome/metronome.js | 20 ++++++++++---------- apps/metronome/settings.js | 10 +--------- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/apps.json b/apps.json index b478a8f69..92746025e 100644 --- a/apps.json +++ b/apps.json @@ -1403,7 +1403,7 @@ "id": "metronome", "name": "Metronome", "icon": "metronome_icon.png", - "version": "0.05", + "version": "0.04", "readme": "README.md", "description": "Makes the watch blinking and vibrating with a given rate", "tags": "tool", @@ -1417,8 +1417,7 @@ "name": "metronome.img", "url": "metronome-icon.js", "evaluate": true - }, - {"name":"metronome.settings.js","url":"settings.js"} + } ] }, { "id": "blackjack", diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 909d6b983..25628660e 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,4 +2,3 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed -0.05: Buzz intensity and beats per bar can be changed via settings-app diff --git a/apps/metronome/README.md b/apps/metronome/README.md index f67b4adf1..1bb9a893c 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,7 +8,6 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. -* Intensity of buzzing and the beats per bar (default 4) can be changed with the settings-app. The first beat per bar will be marked in red. ## Attributions diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index add6fee16..829b7032a 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -14,7 +14,6 @@ function setting(key) { //define default settings const DEFAULTS = { 'beatsperbar': 4, - 'buzzintens': 0.75, }; if (!settings) { loadSettings(); } return (key in settings) ? settings[key] : DEFAULTS[key]; @@ -28,15 +27,16 @@ function loadSettings() { } function changecolor() { - const colors = { - 0: { value: 0xF800, name: "Red" }, - 1: { value: 0xFFFF, name: "White" }, - 2: { value: 0x9492, name: "gray" }, - 3: { value: 0xFFFF, name: "White" }, - 4: { value: 0x9492, name: "gray" }, - 5: { value: 0xFFFF, name: "White" }, - 6: { value: 0x9492, name: "gray" }, + const colors = { + 0: { value: 0xF800, name: "Red" }, + 1: { value: 0xFFFF, name: "White" }, + 2: { value: 0x03E0, name: "DarkGreen" }, + 3: { value: 0xFFFF, name: "White" }, + 4: { value: 0x03E0, name: "DarkGreen" }, + 5: { value: 0xFFFF, name: "White" }, + 6: { value: 0x03E0, name: "DarkGreen" }, 7: { value: 0xFFFF, name: "White" }, + 8: { value: 0x03E0, name: "DarkGreen" }, }; g.setColor(colors[cindex].value); if (cindex == setting('beatsperbar')-1) { @@ -52,7 +52,7 @@ function updateScreen() { g.clearRect(0, 50, 250, 150); changecolor(); try { - Bangle.buzz(50, setting('buzzintens')); + Bangle.buzz(50, 0.75); } catch(err) { } diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js index 1dd4d92df..2aefa1052 100644 --- a/apps/metronome/settings.js +++ b/apps/metronome/settings.js @@ -8,7 +8,6 @@ // initialize with default settings... let s = { 'beatsperbar': 4, - 'buzzintens': 0.75, }; // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -36,13 +35,6 @@ step: 1, onchange: save('beatsperbar'), }, - 'buzz intensity': { - value: s.buzzintens, - min: 0.0, - max: 1.0, - step: 0.25, - onchange: save('buzzintens'), - }, }; E.showMenu(menu); -}); +}); \ No newline at end of file From 131c918d3da19a892b1787c791c2e1dea438c0ea Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:51:04 +0200 Subject: [PATCH 52/63] Revert "Revert "add settings to apps.json"" This reverts commit 2b77dabe519063dd3107653b785334a52d6fe87e. --- apps.json | 3 ++- apps/metronome/metronome.js | 3 ++- apps/metronome/settings.js | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 92746025e..1caaf9369 100644 --- a/apps.json +++ b/apps.json @@ -1417,7 +1417,8 @@ "name": "metronome.img", "url": "metronome-icon.js", "evaluate": true - } + }, + {"name":"metronome.settings.js","url":"settings.js"} ] }, { "id": "blackjack", diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index 829b7032a..ac9b9d631 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -14,6 +14,7 @@ function setting(key) { //define default settings const DEFAULTS = { 'beatsperbar': 4, + 'buzzintens': 0.75, }; if (!settings) { loadSettings(); } return (key in settings) ? settings[key] : DEFAULTS[key]; @@ -52,7 +53,7 @@ function updateScreen() { g.clearRect(0, 50, 250, 150); changecolor(); try { - Bangle.buzz(50, 0.75); + Bangle.buzz(50, setting('buzzintens')); } catch(err) { } diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js index 2aefa1052..b91dd9288 100644 --- a/apps/metronome/settings.js +++ b/apps/metronome/settings.js @@ -8,6 +8,7 @@ // initialize with default settings... let s = { 'beatsperbar': 4, + 'buzzintens': 0.75, }; // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -35,6 +36,13 @@ step: 1, onchange: save('beatsperbar'), }, + 'buzz intensity': { + value: s.buzzintens, + min: 0, + max: 2, + step: 0.25, + onchange: save('buzzintens'), + }, }; E.showMenu(menu); }); \ No newline at end of file From e210fdaea3a53e2e2adff8099cc9d00d442e15c8 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:51:15 +0200 Subject: [PATCH 53/63] Revert "Revert "change version and update Readme"" This reverts commit e3aea0fd61e7e4333b0508d52feb507e2e14351d. --- apps.json | 2 +- apps/metronome/ChangeLog | 1 + apps/metronome/README.md | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 1caaf9369..b478a8f69 100644 --- a/apps.json +++ b/apps.json @@ -1403,7 +1403,7 @@ "id": "metronome", "name": "Metronome", "icon": "metronome_icon.png", - "version": "0.04", + "version": "0.05", "readme": "README.md", "description": "Makes the watch blinking and vibrating with a given rate", "tags": "tool", diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 25628660e..61ff09c98 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,3 +2,4 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed +0.05: Enable to set buzz intensity and beats per bar via settings diff --git a/apps/metronome/README.md b/apps/metronome/README.md index 1bb9a893c..8a76114f8 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,6 +8,7 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. +* Using the settings app, you can change the intensity of buzzing and the beats per bar (default 4). The first beat per bar will be marked in red. ## Attributions From 618ade43b95a8ccc5b3c8fd29b2b89b3ecece301 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:51:23 +0200 Subject: [PATCH 54/63] Revert "Revert "change README and ChangeLog entry"" This reverts commit 21963f3835fb97cfdd3e91e85c60fbc771191652. --- apps/metronome/ChangeLog | 2 +- apps/metronome/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 61ff09c98..909d6b983 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,4 +2,4 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed -0.05: Enable to set buzz intensity and beats per bar via settings +0.05: Buzz intensity and beats per bar can be changed via settings-app diff --git a/apps/metronome/README.md b/apps/metronome/README.md index 8a76114f8..f67b4adf1 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,7 +8,7 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. -* Using the settings app, you can change the intensity of buzzing and the beats per bar (default 4). The first beat per bar will be marked in red. +* Intensity of buzzing and the beats per bar (default 4) can be changed with the settings-app. The first beat per bar will be marked in red. ## Attributions From 45b2316e0493042919a06225211d740c4d081b09 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:51:33 +0200 Subject: [PATCH 55/63] Revert "change README and ChangeLog entry" This reverts commit 0ce1556a702cc5197e63082b30e25a1bdcf54b55. --- apps/metronome/ChangeLog | 2 +- apps/metronome/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 909d6b983..61ff09c98 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,4 +2,4 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed -0.05: Buzz intensity and beats per bar can be changed via settings-app +0.05: Enable to set buzz intensity and beats per bar via settings diff --git a/apps/metronome/README.md b/apps/metronome/README.md index f67b4adf1..8a76114f8 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,7 +8,7 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. -* Intensity of buzzing and the beats per bar (default 4) can be changed with the settings-app. The first beat per bar will be marked in red. +* Using the settings app, you can change the intensity of buzzing and the beats per bar (default 4). The first beat per bar will be marked in red. ## Attributions From 886195a339686bc9fcc0b983aa17b92a6c0f3aa7 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:51:57 +0200 Subject: [PATCH 56/63] Revert "change version and update Readme" This reverts commit 7df65cad513258a005bd986b9f0edf33e1e5ec8d. --- apps.json | 2 +- apps/metronome/ChangeLog | 1 - apps/metronome/README.md | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/apps.json b/apps.json index b478a8f69..1caaf9369 100644 --- a/apps.json +++ b/apps.json @@ -1403,7 +1403,7 @@ "id": "metronome", "name": "Metronome", "icon": "metronome_icon.png", - "version": "0.05", + "version": "0.04", "readme": "README.md", "description": "Makes the watch blinking and vibrating with a given rate", "tags": "tool", diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 61ff09c98..25628660e 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,4 +2,3 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed -0.05: Enable to set buzz intensity and beats per bar via settings diff --git a/apps/metronome/README.md b/apps/metronome/README.md index 8a76114f8..1bb9a893c 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,7 +8,6 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. -* Using the settings app, you can change the intensity of buzzing and the beats per bar (default 4). The first beat per bar will be marked in red. ## Attributions From 1e60f47fa96b02f26ab8032ea3bb6a69ee4ab78f Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:52:07 +0200 Subject: [PATCH 57/63] Revert "add settings to apps.json" This reverts commit 09ba504289ae95c113ed2f2beb95c67b39dcecab. --- apps.json | 3 +-- apps/metronome/metronome.js | 3 +-- apps/metronome/settings.js | 8 -------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/apps.json b/apps.json index 1caaf9369..92746025e 100644 --- a/apps.json +++ b/apps.json @@ -1417,8 +1417,7 @@ "name": "metronome.img", "url": "metronome-icon.js", "evaluate": true - }, - {"name":"metronome.settings.js","url":"settings.js"} + } ] }, { "id": "blackjack", diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index ac9b9d631..829b7032a 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -14,7 +14,6 @@ function setting(key) { //define default settings const DEFAULTS = { 'beatsperbar': 4, - 'buzzintens': 0.75, }; if (!settings) { loadSettings(); } return (key in settings) ? settings[key] : DEFAULTS[key]; @@ -53,7 +52,7 @@ function updateScreen() { g.clearRect(0, 50, 250, 150); changecolor(); try { - Bangle.buzz(50, setting('buzzintens')); + Bangle.buzz(50, 0.75); } catch(err) { } diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js index b91dd9288..2aefa1052 100644 --- a/apps/metronome/settings.js +++ b/apps/metronome/settings.js @@ -8,7 +8,6 @@ // initialize with default settings... let s = { 'beatsperbar': 4, - 'buzzintens': 0.75, }; // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -36,13 +35,6 @@ step: 1, onchange: save('beatsperbar'), }, - 'buzz intensity': { - value: s.buzzintens, - min: 0, - max: 2, - step: 0.25, - onchange: save('buzzintens'), - }, }; E.showMenu(menu); }); \ No newline at end of file From 2498881609fc9d94cde99b387ea2714ede1674e3 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:52:15 +0200 Subject: [PATCH 58/63] Revert "hotfix" This reverts commit 0c1499253dff27d848355a807e2093aa302195c1. --- apps/metronome/metronome.js | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index 829b7032a..f1071c0e4 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -24,7 +24,6 @@ let settings; function loadSettings() { settings = storage.readJSON(SETTINGS_FILE, 1) || {}; -} function changecolor() { const colors = { From 4fa752397f980842e4f48afb03aa861b549af8bd Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:52:25 +0200 Subject: [PATCH 59/63] Revert "adding settings" This reverts commit 3beaab82ceacf54d29ebf30256ee51635b7dd0ad. --- apps/banglerun/ChangeLog | 0 apps/buffgym/buffgym-scrn1.png | Bin apps/buffgym/buffgym-scrn2.png | Bin apps/buffgym/buffgym-scrn3.png | Bin apps/buffgym/buffgym-scrn4.png | Bin apps/buffgym/buffgym-scrn5.png | Bin apps/buffgym/buffgym-scrn6.png | Bin apps/buffgym/buffgym.app.js | 0 apps/buffgym/buffgym.png | Bin apps/marioclock/mario-clock-screen-shot.png | Bin apps/metronome/metronome.js | 36 +++++++----------- apps/metronome/settings.js | 40 -------------------- apps/miclock/clock-mixed.png | Bin apps/minionclk/ChangeLog | 0 apps/minionclk/app-icon.js | 0 apps/minionclk/app.js | 0 apps/minionclk/minionclk.png | Bin apps/rpgdice/ChangeLog | 0 apps/rpgdice/app-icon.js | 0 apps/rpgdice/app.js | 0 apps/rpgdice/rpgdice.png | Bin apps/sclock/clock-simple.png | Bin apps/scolor/show-color.png | Bin bin/firmwaremaker.js | 0 bin/sanitycheck.js | 0 25 files changed, 14 insertions(+), 62 deletions(-) mode change 100644 => 100755 apps/banglerun/ChangeLog mode change 100644 => 100755 apps/buffgym/buffgym-scrn1.png mode change 100644 => 100755 apps/buffgym/buffgym-scrn2.png mode change 100644 => 100755 apps/buffgym/buffgym-scrn3.png mode change 100644 => 100755 apps/buffgym/buffgym-scrn4.png mode change 100644 => 100755 apps/buffgym/buffgym-scrn5.png mode change 100644 => 100755 apps/buffgym/buffgym-scrn6.png mode change 100644 => 100755 apps/buffgym/buffgym.app.js mode change 100644 => 100755 apps/buffgym/buffgym.png mode change 100644 => 100755 apps/marioclock/mario-clock-screen-shot.png delete mode 100644 apps/metronome/settings.js mode change 100644 => 100755 apps/miclock/clock-mixed.png mode change 100644 => 100755 apps/minionclk/ChangeLog mode change 100644 => 100755 apps/minionclk/app-icon.js mode change 100644 => 100755 apps/minionclk/app.js mode change 100644 => 100755 apps/minionclk/minionclk.png mode change 100644 => 100755 apps/rpgdice/ChangeLog mode change 100644 => 100755 apps/rpgdice/app-icon.js mode change 100644 => 100755 apps/rpgdice/app.js mode change 100644 => 100755 apps/rpgdice/rpgdice.png mode change 100644 => 100755 apps/sclock/clock-simple.png mode change 100644 => 100755 apps/scolor/show-color.png mode change 100644 => 100755 bin/firmwaremaker.js mode change 100644 => 100755 bin/sanitycheck.js diff --git a/apps/banglerun/ChangeLog b/apps/banglerun/ChangeLog old mode 100644 new mode 100755 diff --git a/apps/buffgym/buffgym-scrn1.png b/apps/buffgym/buffgym-scrn1.png old mode 100644 new mode 100755 diff --git a/apps/buffgym/buffgym-scrn2.png b/apps/buffgym/buffgym-scrn2.png old mode 100644 new mode 100755 diff --git a/apps/buffgym/buffgym-scrn3.png b/apps/buffgym/buffgym-scrn3.png old mode 100644 new mode 100755 diff --git a/apps/buffgym/buffgym-scrn4.png b/apps/buffgym/buffgym-scrn4.png old mode 100644 new mode 100755 diff --git a/apps/buffgym/buffgym-scrn5.png b/apps/buffgym/buffgym-scrn5.png old mode 100644 new mode 100755 diff --git a/apps/buffgym/buffgym-scrn6.png b/apps/buffgym/buffgym-scrn6.png old mode 100644 new mode 100755 diff --git a/apps/buffgym/buffgym.app.js b/apps/buffgym/buffgym.app.js old mode 100644 new mode 100755 diff --git a/apps/buffgym/buffgym.png b/apps/buffgym/buffgym.png old mode 100644 new mode 100755 diff --git a/apps/marioclock/mario-clock-screen-shot.png b/apps/marioclock/mario-clock-screen-shot.png old mode 100644 new mode 100755 diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index f1071c0e4..27c36e06f 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -6,26 +6,8 @@ var tindex=0; //index to iterate through time_diffs Bangle.setLCDTimeout(undefined); //do not deaktivate display while running this app -const storage = require("Storage"); -const SETTINGS_FILE = 'metronome.settings.json'; - -//return setting -function setting(key) { - //define default settings - const DEFAULTS = { - 'beatsperbar': 4, - }; - if (!settings) { loadSettings(); } - return (key in settings) ? settings[key] : DEFAULTS[key]; -} - -//load settings -let settings; - -function loadSettings() { - settings = storage.readJSON(SETTINGS_FILE, 1) || {}; - function changecolor() { + const maxColors = 2; const colors = { 0: { value: 0xF800, name: "Red" }, 1: { value: 0xFFFF, name: "White" }, @@ -35,10 +17,21 @@ function changecolor() { 5: { value: 0xFFFF, name: "White" }, 6: { value: 0x03E0, name: "DarkGreen" }, 7: { value: 0xFFFF, name: "White" }, - 8: { value: 0x03E0, name: "DarkGreen" }, + 8: { value: 0x7BEF, name: "DarkGrey" }, + // 9: { value: 0x001F, name: "Blue" }, + // 9: { value: 0x001F, name: "Blue" }, + // 10: { value: 0x07E0, name: "Green" }, + // 11: { value: 0x07FF, name: "Cyan" }, + 1: { value: 0xF800, name: "Red" }, + // 13: { value: 0xF81F, name: "Magenta" }, + // 14: { value: 0xFFE0, name: "Yellow" }, + // 15: { value: 0xFFFF, name: "White" }, + // 16: { value: 0xFD20, name: "Orange" }, + // 17: { value: 0xAFE5, name: "GreenYellow" }, + // 18: { value: 0xF81F, name: "Pink" }, }; g.setColor(colors[cindex].value); - if (cindex == setting('beatsperbar')-1) { + if (cindex == maxColors-1) { cindex = 0; } else { @@ -59,7 +52,6 @@ function updateScreen() { g.drawString(Math.floor(bpm)+"bpm", 5, 60); } - Bangle.on('touch', function(button) { // setting bpm by tapping the screen. Uses the mean time difference between several tappings. if (tindex < time_diffs.length) { diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js deleted file mode 100644 index 2aefa1052..000000000 --- a/apps/metronome/settings.js +++ /dev/null @@ -1,40 +0,0 @@ -// This file should contain exactly one function, which shows the app's settings -/** - * @param {function} back Use back() to return to settings menu - */ -(function(back) { - const SETTINGS_FILE = 'metronome.settings.json'; - - // initialize with default settings... - let s = { - 'beatsperbar': 4, - }; - // ...and overwrite them with any saved values - // This way saved values are preserved if a new version adds more settings - const storage = require('Storage'); - const saved = storage.readJSON(SETTINGS_FILE, 1) || {}; - for (const key in saved) { - s[key] = saved[key]; - } - - // creates a function to safe a specific setting, e.g. save('color')(1) - function save(key) { - return function(value) { - s[key] = value; - storage.write(SETTINGS_FILE, s); - }; - } - - const menu = { - '': { 'title': 'Metronome' }, - '< Back': back, - 'beats per bar': { - value: s.beatsperbar, - min: 1, - max: 8, - step: 1, - onchange: save('beatsperbar'), - }, - }; - E.showMenu(menu); -}); \ No newline at end of file diff --git a/apps/miclock/clock-mixed.png b/apps/miclock/clock-mixed.png old mode 100644 new mode 100755 diff --git a/apps/minionclk/ChangeLog b/apps/minionclk/ChangeLog old mode 100644 new mode 100755 diff --git a/apps/minionclk/app-icon.js b/apps/minionclk/app-icon.js old mode 100644 new mode 100755 diff --git a/apps/minionclk/app.js b/apps/minionclk/app.js old mode 100644 new mode 100755 diff --git a/apps/minionclk/minionclk.png b/apps/minionclk/minionclk.png old mode 100644 new mode 100755 diff --git a/apps/rpgdice/ChangeLog b/apps/rpgdice/ChangeLog old mode 100644 new mode 100755 diff --git a/apps/rpgdice/app-icon.js b/apps/rpgdice/app-icon.js old mode 100644 new mode 100755 diff --git a/apps/rpgdice/app.js b/apps/rpgdice/app.js old mode 100644 new mode 100755 diff --git a/apps/rpgdice/rpgdice.png b/apps/rpgdice/rpgdice.png old mode 100644 new mode 100755 diff --git a/apps/sclock/clock-simple.png b/apps/sclock/clock-simple.png old mode 100644 new mode 100755 diff --git a/apps/scolor/show-color.png b/apps/scolor/show-color.png old mode 100644 new mode 100755 diff --git a/bin/firmwaremaker.js b/bin/firmwaremaker.js old mode 100644 new mode 100755 diff --git a/bin/sanitycheck.js b/bin/sanitycheck.js old mode 100644 new mode 100755 From c7aed0d192986ed981e977b1c1b9b3655114a3d5 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:53:30 +0200 Subject: [PATCH 60/63] update v005 - Use settings --- apps.json | 5 ++-- apps/metronome/ChangeLog | 1 + apps/metronome/README.md | 1 + apps/metronome/metronome.js | 55 +++++++++++++++++++++---------------- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/apps.json b/apps.json index 92746025e..b478a8f69 100644 --- a/apps.json +++ b/apps.json @@ -1403,7 +1403,7 @@ "id": "metronome", "name": "Metronome", "icon": "metronome_icon.png", - "version": "0.04", + "version": "0.05", "readme": "README.md", "description": "Makes the watch blinking and vibrating with a given rate", "tags": "tool", @@ -1417,7 +1417,8 @@ "name": "metronome.img", "url": "metronome-icon.js", "evaluate": true - } + }, + {"name":"metronome.settings.js","url":"settings.js"} ] }, { "id": "blackjack", diff --git a/apps/metronome/ChangeLog b/apps/metronome/ChangeLog index 25628660e..909d6b983 100644 --- a/apps/metronome/ChangeLog +++ b/apps/metronome/ChangeLog @@ -2,3 +2,4 @@ 0.02: Watch vibrates with every beat 0.03: Uses mean of three time intervalls to calculate bmp 0.04: App shows instructions, Widgets remain visible, color changed +0.05: Buzz intensity and beats per bar can be changed via settings-app diff --git a/apps/metronome/README.md b/apps/metronome/README.md index 1bb9a893c..f67b4adf1 100644 --- a/apps/metronome/README.md +++ b/apps/metronome/README.md @@ -8,6 +8,7 @@ This metronome makes your watch blink and vibrate with a given rate. * Use `BTN1` to increase the bmp value by one. * Use `BTN3` to decrease the bmp value by one. * You can change the bpm value any time by tapping the screen or using `BTN1` and `BTN3`. +* Intensity of buzzing and the beats per bar (default 4) can be changed with the settings-app. The first beat per bar will be marked in red. ## Attributions diff --git a/apps/metronome/metronome.js b/apps/metronome/metronome.js index 27c36e06f..add6fee16 100644 --- a/apps/metronome/metronome.js +++ b/apps/metronome/metronome.js @@ -6,32 +6,40 @@ var tindex=0; //index to iterate through time_diffs Bangle.setLCDTimeout(undefined); //do not deaktivate display while running this app +const storage = require("Storage"); +const SETTINGS_FILE = 'metronome.settings.json'; + +//return setting +function setting(key) { + //define default settings + const DEFAULTS = { + 'beatsperbar': 4, + 'buzzintens': 0.75, + }; + if (!settings) { loadSettings(); } + return (key in settings) ? settings[key] : DEFAULTS[key]; +} + +//load settings +let settings; + +function loadSettings() { + settings = storage.readJSON(SETTINGS_FILE, 1) || {}; +} + function changecolor() { - const maxColors = 2; - const colors = { - 0: { value: 0xF800, name: "Red" }, - 1: { value: 0xFFFF, name: "White" }, - 2: { value: 0x03E0, name: "DarkGreen" }, - 3: { value: 0xFFFF, name: "White" }, - 4: { value: 0x03E0, name: "DarkGreen" }, - 5: { value: 0xFFFF, name: "White" }, - 6: { value: 0x03E0, name: "DarkGreen" }, + const colors = { + 0: { value: 0xF800, name: "Red" }, + 1: { value: 0xFFFF, name: "White" }, + 2: { value: 0x9492, name: "gray" }, + 3: { value: 0xFFFF, name: "White" }, + 4: { value: 0x9492, name: "gray" }, + 5: { value: 0xFFFF, name: "White" }, + 6: { value: 0x9492, name: "gray" }, 7: { value: 0xFFFF, name: "White" }, - 8: { value: 0x7BEF, name: "DarkGrey" }, - // 9: { value: 0x001F, name: "Blue" }, - // 9: { value: 0x001F, name: "Blue" }, - // 10: { value: 0x07E0, name: "Green" }, - // 11: { value: 0x07FF, name: "Cyan" }, - 1: { value: 0xF800, name: "Red" }, - // 13: { value: 0xF81F, name: "Magenta" }, - // 14: { value: 0xFFE0, name: "Yellow" }, - // 15: { value: 0xFFFF, name: "White" }, - // 16: { value: 0xFD20, name: "Orange" }, - // 17: { value: 0xAFE5, name: "GreenYellow" }, - // 18: { value: 0xF81F, name: "Pink" }, }; g.setColor(colors[cindex].value); - if (cindex == maxColors-1) { + if (cindex == setting('beatsperbar')-1) { cindex = 0; } else { @@ -44,7 +52,7 @@ function updateScreen() { g.clearRect(0, 50, 250, 150); changecolor(); try { - Bangle.buzz(50, 0.75); + Bangle.buzz(50, setting('buzzintens')); } catch(err) { } @@ -52,6 +60,7 @@ function updateScreen() { g.drawString(Math.floor(bpm)+"bpm", 5, 60); } + Bangle.on('touch', function(button) { // setting bpm by tapping the screen. Uses the mean time difference between several tappings. if (tindex < time_diffs.length) { From 78cc747c439fce03f58637262a2108c2315d76e5 Mon Sep 17 00:00:00 2001 From: Michael Bengfort Date: Fri, 15 May 2020 13:56:56 +0200 Subject: [PATCH 61/63] add settings.js --- apps/metronome/settings.js | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 apps/metronome/settings.js diff --git a/apps/metronome/settings.js b/apps/metronome/settings.js new file mode 100644 index 000000000..1dd4d92df --- /dev/null +++ b/apps/metronome/settings.js @@ -0,0 +1,48 @@ +// This file should contain exactly one function, which shows the app's settings +/** + * @param {function} back Use back() to return to settings menu + */ +(function(back) { + const SETTINGS_FILE = 'metronome.settings.json'; + + // initialize with default settings... + let s = { + 'beatsperbar': 4, + 'buzzintens': 0.75, + }; + // ...and overwrite them with any saved values + // This way saved values are preserved if a new version adds more settings + const storage = require('Storage'); + const saved = storage.readJSON(SETTINGS_FILE, 1) || {}; + for (const key in saved) { + s[key] = saved[key]; + } + + // creates a function to safe a specific setting, e.g. save('color')(1) + function save(key) { + return function(value) { + s[key] = value; + storage.write(SETTINGS_FILE, s); + }; + } + + const menu = { + '': { 'title': 'Metronome' }, + '< Back': back, + 'beats per bar': { + value: s.beatsperbar, + min: 1, + max: 8, + step: 1, + onchange: save('beatsperbar'), + }, + 'buzz intensity': { + value: s.buzzintens, + min: 0.0, + max: 1.0, + step: 0.25, + onchange: save('buzzintens'), + }, + }; + E.showMenu(menu); +}); From a2bf0e4b3d91a09e07cc7ffa406d954213c54664 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 15 May 2020 13:37:28 +0100 Subject: [PATCH 62/63] tweaks --- apps/jbm8b/{Changelog => ChangeLog} | 0 apps/jbm8b/app.json | 6 ------ 2 files changed, 6 deletions(-) rename apps/jbm8b/{Changelog => ChangeLog} (100%) delete mode 100644 apps/jbm8b/app.json diff --git a/apps/jbm8b/Changelog b/apps/jbm8b/ChangeLog similarity index 100% rename from apps/jbm8b/Changelog rename to apps/jbm8b/ChangeLog diff --git a/apps/jbm8b/app.json b/apps/jbm8b/app.json deleted file mode 100644 index a378c4916..000000000 --- a/apps/jbm8b/app.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Magic 8 Ball", - "icon": "*jbm8b", - "src": "-jbm8b", - "version": "1.1.0" -} \ No newline at end of file From d2b3cb7d346a6645939ce7966cacb572a793df5a Mon Sep 17 00:00:00 2001 From: msdeibel Date: Fri, 15 May 2020 14:48:52 +0200 Subject: [PATCH 63/63] Reduce invasiveness of RndmClk --- apps.json | 2 +- apps/rndmclk/ChangeLog | 1 + apps/rndmclk/README.md | 6 +++--- apps/rndmclk/widget.js | 12 +++++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps.json b/apps.json index ecb20ff83..04c2f637d 100644 --- a/apps.json +++ b/apps.json @@ -1725,7 +1725,7 @@ { "id": "rndmclk", "name": "Random Clock Loader", "icon": "rndmclk.png", - "version":"0.01", + "version":"0.02", "description": "Load a different clock whenever the LCD is switched on.", "readme": "README.md", "tags": "widget,clock", diff --git a/apps/rndmclk/ChangeLog b/apps/rndmclk/ChangeLog index 55cda0f21..2d387a04b 100644 --- a/apps/rndmclk/ChangeLog +++ b/apps/rndmclk/ChangeLog @@ -1 +1,2 @@ 0.01: New widget +0.02: Less invasive, change default clock setting instead of directly loading the new clock (no longer breaks Gadgetbridge notifications) diff --git a/apps/rndmclk/README.md b/apps/rndmclk/README.md index 3bfaf0e89..86138e0e7 100644 --- a/apps/rndmclk/README.md +++ b/apps/rndmclk/README.md @@ -1,6 +1,6 @@ # Summary - Random Clock is a widget that will randomly show one of the installed watch faces each time the LCD is turned on. -## Disclaimer -This is an early version and will load a clock each time the LCD is turned on no matter what app was running before the screen went to standby. Also the next watch face is only loaded after the last one is shown for a few tens of seconds. \ No newline at end of file +# How it works +Everytime the LCD is turned off, the widget randomly changes the clock. When you long press BTN 3 the next time, +you might (or might not, it's random after all) see another watch face. \ No newline at end of file diff --git a/apps/rndmclk/widget.js b/apps/rndmclk/widget.js index 1c3b3d7bc..566d8eed5 100644 --- a/apps/rndmclk/widget.js +++ b/apps/rndmclk/widget.js @@ -1,4 +1,5 @@ (() => { + let currentClock = ""; /** * Random value between zero (inclusive) and max (exclusive) @@ -15,13 +16,18 @@ if (clockApps && clockApps.length > 0) { var clockIndex = getRandomInt(clockApps.length); - load(clockApps[clockIndex].src); + // Only update the file if the clock really change to be nice to the FLASH mem + if (clockApps[clockIndex].src != currentClock) { + currentClock = clockApps[clockIndex].src; + settings = require("Storage").readJSON('setting.json', 1); + settings.clock = clockApps[clockIndex].src; + require("Storage").write('setting.json', settings); + } } } Bangle.on('lcdPower', (on) => { - if (on) { - // TODO: Only run if the current app is a clock as well + if (!on) { loadRandomClock(); } });