From c882c52b2719a6590e1486d78966780ffcd942ba Mon Sep 17 00:00:00 2001 From: fxiii Date: Sun, 11 Jul 2021 21:07:20 +0200 Subject: [PATCH 01/26] Black Jack game: ignoring buttons events on pauses --- apps.json | 2 +- apps/blackjack/ChangeLog | 3 ++- apps/blackjack/blackjack.app.js | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index cc21f3115..25a947b87 100644 --- a/apps.json +++ b/apps.json @@ -1746,7 +1746,7 @@ "name": "Black Jack game", "shortName":"Black Jack game", "icon": "blackjack.png", - "version":"0.01", + "version":"0.02", "description": "Simple implementation of card game Black Jack", "tags": "game", "allow_emulator":true, diff --git a/apps/blackjack/ChangeLog b/apps/blackjack/ChangeLog index c941d90e5..25b5f9195 100644 --- a/apps/blackjack/ChangeLog +++ b/apps/blackjack/ChangeLog @@ -1 +1,2 @@ -0.01: New game! BTN4- Hit card, BTN5- Stand \ No newline at end of file +0.01: New game! BTN4- Hit card, BTN5- Stand +0.02: ignore buttons on pauses \ No newline at end of file diff --git a/apps/blackjack/blackjack.app.js b/apps/blackjack/blackjack.app.js index bbee8137b..b88432fd9 100644 --- a/apps/blackjack/blackjack.app.js +++ b/apps/blackjack/blackjack.app.js @@ -18,6 +18,7 @@ const Diamonds = { width : 48, height : 48, bpp : 4, var deck = []; var player = {Hand:[]}; var computer = {Hand:[]}; +var ctx = {ready:true}; function createDeck() { var suits = ["Spades", "Hearts", "Diamonds", "Clubs"]; @@ -44,6 +45,7 @@ function shuffle(a) { } function EndGameMessdage(msg){ + ctx.ready = false; g.drawString(msg, 155, 200); setTimeout(function(){ startGame(); @@ -52,6 +54,7 @@ function EndGameMessdage(msg){ } function hitMe() { + if (!ctx.ready) return; player.Hand.push(deck.pop()); renderOnScreen(1); var playerWeight = calcWeight(player.Hand, 0); @@ -97,6 +100,8 @@ function calcWeight(hand, hideCard) { } function stand(){ + if (!ctx.ready) return; + ctx.ready = false; function sleepFor( sleepDuration ){ console.log("Sleeping..."); var now = new Date().getTime(); @@ -156,6 +161,7 @@ function renderOnScreen(HideCard) { function dealHands() { player.Hand= []; computer.Hand= []; + ctx.ready = false; setTimeout(function(){ player.Hand.push(deck.pop()); @@ -175,6 +181,7 @@ function dealHands() { setTimeout(function(){ computer.Hand.push(deck.pop()); renderOnScreen(1); + ctx.ready = true; }, 2000); } From fc0989ca41456ea9914e5929b8acbcf3d46fb12a Mon Sep 17 00:00:00 2001 From: fxiii Date: Sun, 11 Jul 2021 21:13:18 +0200 Subject: [PATCH 02/26] Desktop Launcher: reset to clock after 2 mins of inactivity --- apps.json | 2 +- apps/dtlaunch/ChangeLog | 2 +- apps/dtlaunch/app.js | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 25a947b87..1b30a782a 100644 --- a/apps.json +++ b/apps.json @@ -2667,7 +2667,7 @@ { "id": "dtlaunch", "name": "Desktop Launcher", "icon": "icon.png", - "version":"0.03", + "version":"0.04", "description": "Desktop style App Launcher with six apps per page - fast access if you have lots of apps installed.", "readme": "README.md", "tags": "tool,system,launcher", diff --git a/apps/dtlaunch/ChangeLog b/apps/dtlaunch/ChangeLog index 3df4ab63b..985321e91 100644 --- a/apps/dtlaunch/ChangeLog +++ b/apps/dtlaunch/ChangeLog @@ -1,4 +1,4 @@ 0.01: Initial version 0.02: Multiple pages 0.03: cycle thru pages - +0.04: reset to clock after 2 mins of inactivity diff --git a/apps/dtlaunch/app.js b/apps/dtlaunch/app.js index 329a96958..9bbf3e219 100644 --- a/apps/dtlaunch/app.js +++ b/apps/dtlaunch/app.js @@ -2,6 +2,20 @@ * */ +function wdog(handle,timeout){ + if(handle !== undefined){ + wdog.handle = handle; + wdog.timeout = timeout; + } + if(wdog.timer){ + clearTimeout(wdog.timer) + } + wdog.timer = setTimeout(wdog.handle,wdog.timeout) +} + +// reset after two minutes of inactivity +wdog(load,120000) + var s = require("Storage"); var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || app.type=="clock" || !app.type)); apps.sort((a,b)=>{ @@ -42,6 +56,7 @@ function drawPage(p){ } Bangle.on("swipe",(dir)=>{ + wdog() selected = 0; oldselected=-1; if (dir<0){ @@ -54,6 +69,7 @@ Bangle.on("swipe",(dir)=>{ }); function nextapp(d){ + wdog(); oldselected = selected; selected+=d; selected = selected<0?5:selected>5?0:selected; From d62dec7dcbbffa756c8688ca685e13002c3d54ac Mon Sep 17 00:00:00 2001 From: fxiii Date: Sun, 11 Jul 2021 21:18:13 +0200 Subject: [PATCH 03/26] App Manager: Allow negative numbers when manual-sorting --- apps.json | 2 +- apps/files/ChangeLog | 3 ++- apps/files/files.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index 1b30a782a..8f9f86918 100644 --- a/apps.json +++ b/apps.json @@ -533,7 +533,7 @@ { "id": "files", "name": "App Manager", "icon": "files.png", - "version":"0.06", + "version":"0.07", "description": "Show currently installed apps, free space, and allow their deletion from the watch", "tags": "tool,system,files", "storage": [ diff --git a/apps/files/ChangeLog b/apps/files/ChangeLog index b4037a733..1908f7e5c 100644 --- a/apps/files/ChangeLog +++ b/apps/files/ChangeLog @@ -2,4 +2,5 @@ 0.03: Add support for data files 0.04: Add functionality to sort apps manually or alphabetically ascending/descending. 0.05: Tweaks to help with memory usage -0.06: Reduce memory usage \ No newline at end of file +0.06: Reduce memory usage +0.07: Allow negative numbers when manual-sorting \ No newline at end of file diff --git a/apps/files/files.js b/apps/files/files.js index 9e6c97702..9ac6ebb35 100644 --- a/apps/files/files.js +++ b/apps/files/files.js @@ -180,7 +180,7 @@ function showSortAppsManually() { appList.reduce((menu, app) => { menu[app.name] = { value: app.sortorder || 0, - min: 0, + min: -appList.length, max: appList.length, step: 1, onchange: val => setSortorder(app, val) From c341947e7d48a78c5b58e1d39d419b2b7edfcbaf Mon Sep 17 00:00:00 2001 From: fxiii Date: Sun, 11 Jul 2021 21:27:09 +0200 Subject: [PATCH 04/26] Red torch: like torch but red :D --- apps.json | 13 +++++++++++++ apps/rtorch/ChangeLog | 1 + apps/rtorch/app-icon.js | 1 + apps/rtorch/app.js | 22 ++++++++++++++++++++++ apps/rtorch/app.png | Bin 0 -> 1770 bytes apps/rtorch/widget.js | 26 ++++++++++++++++++++++++++ 6 files changed, 63 insertions(+) create mode 100644 apps/rtorch/ChangeLog create mode 100644 apps/rtorch/app-icon.js create mode 100644 apps/rtorch/app.js create mode 100644 apps/rtorch/app.png create mode 100644 apps/rtorch/widget.js diff --git a/apps.json b/apps.json index 8f9f86918..a2ff7b571 100644 --- a/apps.json +++ b/apps.json @@ -1244,6 +1244,19 @@ {"name":"torch.img","url":"app-icon.js","evaluate":true} ] }, + { "id": "rtorch", + "name": "Red Torch", + "shortName":"RedTorch", + "icon": "app.png", + "version":"0.01", + "description": "Turns screen RED to help you see in the dark without breaking your night vision. Select from the launcher or press BTN3,BTN1,BTN3,BTN1 quickly to start when in any app that shows widgets", + "tags": "tool,torch", + "storage": [ + {"name":"rtorch.app.js","url":"app.js"}, + {"name":"rtorch.wid.js","url":"widget.js"}, + {"name":"rtorch.img","url":"app-icon.js","evaluate":true} + ] + }, { "id": "wohrm", "name": "Workout HRM", "icon": "app.png", diff --git a/apps/rtorch/ChangeLog b/apps/rtorch/ChangeLog new file mode 100644 index 000000000..06f10fe08 --- /dev/null +++ b/apps/rtorch/ChangeLog @@ -0,0 +1 @@ +0.01: Cloning torch and making it red :D diff --git a/apps/rtorch/app-icon.js b/apps/rtorch/app-icon.js new file mode 100644 index 000000000..ff1265c9b --- /dev/null +++ b/apps/rtorch/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEw4UA///oP4gH+t9TCQ1VAAYLpgILunoLK/4LJgf/6oLIh//+oLK/oLIhapBBZEqBYIwDBYu/GAgLE1WvGAgLF1YwEBQcC1WqGAgLGGAgLDhQLBGAdQBYwwCBQgLDGASlFlQLC3/8BYoIBGAXwBQkCFgILC4AuFBYeAFw2v/wLBBQqNCBYOgBQp1B1/qCw5dDFoxdEBQwuBAAOoBQykCHI4uXgZPBFxEP/QuJn5/CFw7DBLpILB9QuHEYP//QuHHYP//wuHKYL0HGAoLJn/8BZMP+ALJgfABRA=")) \ No newline at end of file diff --git a/apps/rtorch/app.js b/apps/rtorch/app.js new file mode 100644 index 000000000..4f6b1d6f7 --- /dev/null +++ b/apps/rtorch/app.js @@ -0,0 +1,22 @@ +Bangle.setLCDPower(1); +Bangle.setLCDTimeout(0); +g.reset(); +c = 1; +function setColor(delta){ + c+=delta; + c = Math.max(c,0); + c = Math.min(c,2); + if (c<1){ + g.setColor(c,0,0); + }else{ + g.setColor(1,c-1,c-1); + } + g.fillRect(0,0,g.getWidth(),g.getHeight()); +} +setColor(0) +// BTN1 light up toward white +// BTN3 light down to red +// BTN2 to reset +setWatch(()=>setColor(0.1), BTN1, { repeat:true, edge:"rising", debounce: 50 }); +setWatch(()=>load(), BTN2); +setWatch(()=>setColor(-0.1), BTN3, { repeat:true, edge:"rising", debounce: 50 }); diff --git a/apps/rtorch/app.png b/apps/rtorch/app.png new file mode 100644 index 0000000000000000000000000000000000000000..17b0f3efcd9ff5c3fb5656b12b728983569670c9 GIT binary patch literal 1770 zcmVpF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H126stB zK~!jg?U`+CTUQy!f9GDuzVW+bJ9VE0hf~F-=-07%v|-B-Acw0*$p}w1Nr* zlTeZN0av0R_(FwHp%V}d_My;qA2zX}ma(oc+8P#G&{n1;OVT8c7bmfuI8OX}4en=Q-y&_g=v!OWJII2U?AaCyWYIjwG0{*^+=}R7}OFKxN5h z+l7Jfu-OLS9-{;P-@q#MziU9wY#4itj=Om?plMBj$LO#dzKyoEwW)ed%c*=a@z_&W zFWVlu*==Zi)zD~*6bglusOoOdPEQ_;4h@d6U1#@R3fzCHIpo0&>IIU4Rq*L7?z51v3Rx~lSLhZ|Qm zOUrm{-Q#T7BF;`F+ZMwMARdhn8;|poh8_GfP`B=JHe?2*M4_kfc*h4Wzt!oUhadis z$wUkx1m4;@I(P1-Wu57?AqGO9(SG=`n&_j=wRyVJcazuES@13Dz z`8p@>G)ctMt33mAgIdj=YHj}2pVqx1Xd^$DBNVp%V>%3dv#68LJveU^h1EGWF z{Rr_?sWv`q62CJ~M}IB8x_S7~@Bm1O-Q~d*sO8PZJ8>t*%Bt9gorUBZmUF=8%4z%F zXe~d!vY+^PmYFK8W1p=R0P*1nsfh&NAM9ga&-;tJ_afyr;5u;K5CifREZ8h@pt9UP z*FUW1$a8xr6bjhgUOd|ZbMUunMX)+h_~Y3>yoeAt(DhCfh_ zHax)HfdP&_QpvBcd=i`Yzv2CLL3FFVU8GXqC>3YjYd}f_{pzoPW+`E4NYc{_kqG4S z;B*SaGV{E%dW_b_7;g^lWF!)ug;(&`1+iG|r$?*IU+=qcLEkU~QX;r$IRSiCO6dMT z^4hteyOL&`J&nt?e5U%WNjw!Jyn4-!K*3iRM4N$s{6Z*{Ux{JO28!Un za|`}&@3=T|aR;faiF97!y{LnSnxfRylwN9$RSC>m<-c!cc2{UN`|~2w_2erjPZrAI zSkoF<01x!^N-o}T@{3E`$?Nm56{p)Wht%Nz*0{>9*5s{ z1Q)=Y6v=_se*C_Y(XOJ%BjSNv=W03T##v3{<=_Ddi{QWgKo1Y@o}jjN$@J+3ah$!G zb|F~xQ!iH8b)Xm?ARLy2hvx79BkZERBS?iRIe2eBd+(Z{dB=hsXbQN5l&6ShUlL!Y ztQY+|unm9*W`5Ba~xUr#nO|%k)^gR!pI#;7e%{{3-Tkz9|H9eVEIu z|5l09GM|C|n63yIy$NQMo6%T}41`nVp ziu`MQIMQ_MEIxCbwb3==c6G%0Lu8-usRQ4k7l(|$mbau=wo;+!{O7P zWh!S`s_&M=11LhbJZRP`CuZR7bMU!r2D7H2xSBY2v5jPA!5iak0S~i_xb4tU7n=H) zd_I3)F}%O75k*x=rzXiHhIsD48`L-_ZX0+g+D6+B9d(Vw!rjx!q_4uFQC&X+Kb=f6 z7Mb}$5v+40{`8yYt8N!~C@N%Up8e^#+2s6$)!~ZH!Kadp&cZvYyhvL^@9hK+iz@NC z(a?uI*OpKcY#^>NgRF(EtDd M07*qoM6N<$f@-*GDF6Tf literal 0 HcmV?d00001 diff --git a/apps/rtorch/widget.js b/apps/rtorch/widget.js new file mode 100644 index 000000000..89009266d --- /dev/null +++ b/apps/rtorch/widget.js @@ -0,0 +1,26 @@ +(function() { + var clickTimes = []; + var clickPattern = ""; + var TAPS = 4; // number of taps + var PERIOD = 1; // seconds + + // we don't actually create/draw a widget here at all... + Bangle.on("lcdPower",function(on) { + // First click (that turns LCD on) isn't given to + // setWatch, so handle it here + if (!on) return; + clickTimes=[getTime()]; + clickPattern="x"; + }); + function tap(e,c) { + clickPattern = clickPattern.substr(-3)+c; + while (clickTimes.length>=TAPS) clickTimes.shift(); + clickTimes.push(e.time); + var clickPeriod = e.time-clickTimes[0]; + if (clickPeriod Date: Sun, 11 Jul 2021 21:40:17 +0200 Subject: [PATCH 05/26] Magic 8 Ball Italiano : like Magic 8 Ball but in italian :D --- apps.json | 14 +++++++ apps/jbm8b_IT/ChangeLog | 1 + apps/jbm8b_IT/app-icon.js | 1 + apps/jbm8b_IT/app.js | 79 ++++++++++++++++++++++++++++++++++++++ apps/jbm8b_IT/app.png | Bin 0 -> 1548 bytes 5 files changed, 95 insertions(+) create mode 100644 apps/jbm8b_IT/ChangeLog create mode 100644 apps/jbm8b_IT/app-icon.js create mode 100644 apps/jbm8b_IT/app.js create mode 100644 apps/jbm8b_IT/app.png diff --git a/apps.json b/apps.json index a2ff7b571..ed49e19ac 100644 --- a/apps.json +++ b/apps.json @@ -2110,6 +2110,20 @@ { "name": "jbm8b.img", "url": "app-icon.js", "evaluate": true } ] }, + { + "id": "jbm8b_IT", + "name": "Magic 8 Ball Italiano", + "shortName": "Magic 8 Ball IT", + "icon": "app.png", + "description": "La palla predice il futuro", + "tags": "game", + "version": "0.03", + "allow_emulator":true, + "storage": [ + { "name": "jbm8b_IT.app.js", "url": "app.js" }, + { "name": "jbm8b_IT.img", "url": "app-icon.js", "evaluate": true } + ] + }, { "id": "BLEcontroller", "name": "BLE Customisable Controller with Joystick", "shortName": "BLE Controller", diff --git a/apps/jbm8b_IT/ChangeLog b/apps/jbm8b_IT/ChangeLog new file mode 100644 index 000000000..b7b783924 --- /dev/null +++ b/apps/jbm8b_IT/ChangeLog @@ -0,0 +1 @@ +0.01: Cloning Magic 8 Ball and make it speak italian \ No newline at end of file diff --git a/apps/jbm8b_IT/app-icon.js b/apps/jbm8b_IT/app-icon.js new file mode 100644 index 000000000..09bf032a6 --- /dev/null +++ b/apps/jbm8b_IT/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwhBC/AGMrq2B1gAEwNWlYthq2s64AKGYIydFpoAEGLUrFqIADqxcXFqhiDFymBFy7GCF1owTRjCSVlYudeiGsF7/XlaNqSKBeP1mBwJxQMBReO1gaEleBMDBLN1hAC1hhBAoIwNCwQAGlZINqxvFGAIXOSBAXQN4hPBC5yQIVBxfBCAgvQSBC+NFAYRDMwJHOF654DqxkBYooALF6+sbIhkEF8Z3CRIWBR6AvXFAzvQF6wnIYQJgNd5AWNdoLoGBBAvPO5pfYH4IvUUwS/GVBzXBYCpHCq2s1mBDwKOWDwRgNPAwVVMCRLCwIABCZ6OJJSAATLxZgRACJeLAAMrFz9WFxiRgRpoADwIub1guQGDmsXhqSfRiL0G1jqkMRYxRwKLUGK2sFryVEq2B1gAEwNWFkIA/AH4A/AH4AQ")) \ No newline at end of file diff --git a/apps/jbm8b_IT/app.js b/apps/jbm8b_IT/app.js new file mode 100644 index 000000000..13ab3d39d --- /dev/null +++ b/apps/jbm8b_IT/app.js @@ -0,0 +1,79 @@ +const affirmative = [ + 'È certo.', + 'È decisamente\ncosì.', + 'Senza alcun\ndubbio.', + 'Sì,\nsenza dubbio.', + 'Ci puoi\ncontare.', + 'Da quanto\nvedo,\nsì.', + 'Molto\nprobabilmente.', + 'Le prospettive\nsono buone.', + 'Sì.', + 'I segni\nindicano\ndi sì.' +]; +const nonCommittal = [ + 'È difficile\ndirlo,\nprova di nuovo.', + 'Rifai la domanda\npiù tardi.', + 'Meglio non\nrisponderti\nadesso.', + 'Non posso\npredirlo ora.', + 'Concentrati e\nrifai la\ndomanda.' +]; +const negative = [ + 'Non ci\ncontare.', + 'La mia\nrisposta\nè no.', + 'Le mie\nfonti dicono\ndi no.', + 'Le prospettive\nnon sono\nbuone.', + 'È molto\ndubbio.' +]; +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('Ponimi una\ndomanda\nSì/No e\ntocca lo\nschermo'); +} + +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" }); + +// Back to launcher +setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" }); \ No newline at end of file diff --git a/apps/jbm8b_IT/app.png b/apps/jbm8b_IT/app.png new file mode 100644 index 0000000000000000000000000000000000000000..24c3013de011db9c1517ed544e9d383f5c60378c GIT binary patch literal 1548 zcmeH_{WsGK9LK-L%+owW>~?OVSQ<5jdzFVG z7KTZRJWrN~OKhyo#XZ;1!5ArX5tskq{sH%M&g=6&?{nTieLn9rUvGD)hOq_!08md4 zSHEpNvV)rP_9l(0*KLau&ClH#sOsN6vu#wuusAFL)I8MOAcFxw8SwoP@3s?CQUZZM z%F4SrKP2nm6f%%wT+F9t*xz{ zo!zlx$L#IxF&K=aqocF4^O-Ye+}+)AI2<02_xJZF5C{PQ0YoB^L?V&Nh&d$!w&CScp%g@g*C@3f_EG#ZAE-5J~EiGlU z*=1#A<>loS6%`x~r?RrLy1JUn<<`{H)YjJ4)z!Uy`?jH>p|P>Csi~>Cxw)mKrM0!S zt*wp6<8^d&bar;~`TP$bK6G_;b$567^z`)h_V)Gl4Gatn4h{+g0-;biJUlECiNs>D zL?Rg(85tcN9UB`PA0MBXn2<`PQ&UsZ)6+9EGqba^b8~YtnQVT3eqmujE|)JZE-o!C zEiW&B{rdIWw{I&eD++~Tb#--ZZEbyhePd(e`}gmgo10r(Tib8_fBwq_1kdR=w{z+- z9sx7}FhK91^i-dZ002<7rz;lk;Wd^mxh!--q=Y>&&l(UI44!qv`yxh>c)U{^O1JFU z%a;}ljh)Wt4!yc(lI+jS(N5&_O}>~%hcC4sX#H*D+Vm)f7G{2Yve4IU+B&)Y z?$GYABWY+zFG-Kpm_z2WjDs}KYx^G4fTKz8{Q=y znAAd`uHOq9nnlG&5e52-Jn?}ZIE6l?!8crQIGwGipOq&~#_GtX zD~=*r(WQ3Ws}1WYw0Hk7s}L*Y_TFdz8p>hw=$GoNY8}NwHyK=%CDZoxj9q=&`O)F? zFYqmdD{5tmeB<-{!{ESspW6NiN0f4}>{GzaqJ-qY-0Ea~S=Wr@I@;&SMcbbb*IPJT z4e#>niaQQAnGzM)Fupi=8I*C?gtXV2ciZ28Vc~8;FCM25x-Kz6ck~n2)5~CQ#Dpt_ zdpH<_?oEccI&B%8cz^dN{vASx^s!Lxt{PbGrAhhdlpj&{sd6L#pDhOKv`zbaUMoJO QXs6wtZr-j{&ZOjj0hD%CN&o-= literal 0 HcmV?d00001 From 7c5369d11fcd03141073c96c0ad71bb94c6b7aac Mon Sep 17 00:00:00 2001 From: numerist Date: Sat, 17 Jul 2021 15:49:50 -0400 Subject: [PATCH 06/26] Update app.js --- apps/doztime/app.js | 50 ++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/apps/doztime/app.js b/apps/doztime/app.js index 83f536018..9faede70a 100644 --- a/apps/doztime/app.js +++ b/apps/doztime/app.js @@ -17,7 +17,7 @@ const timeColour = "#f2f2f2"; const dateColours = ["#ff0000","#ffa500","#ffff00","#00b800","#0000ff","#ff00ff","#ff0080"]; const calen10 = {"size":32,"pt0":[32-g_x_off,16],"step":[20,0],"dx":-4.5,"dy":-4.5}; // positioning for usual calendar line const calen7 = {"size":32,"pt0":[62-g_x_off,16],"step":[20,0],"dx":-4.5,"dy":-4.5}; // positioning for S-day calendar line -const time5 = {"size":48,"pt0":[64-g_x_off,24],"step":[30,0],"dx":-6.5,"dy":-6.5}; // positioning for lull time line; was 64 +const time5 = {"size":48,"pt0":[64-g_x_off,24],"step":[30,0],"dx":-6.5,"dy":-6.5}; // positioning for lull time line const time6 = {"size":48,"pt0":[48-g_x_off,24],"step":[30,0],"dx":-6.5,"dy":-6.5}; // positioning for twinkling time line const baseYear = 11584; const baseDate = Date(2020,11,21); // month values run from 0 to 11 @@ -30,8 +30,11 @@ let lastX = 999999999; let res = {}; //var last_time_log = 0; +var drawtime_timeout; + // Date and time graphics buffers var dateColour = "#ffffff"; // override later +var timeColour2 = timeColour; var g_d = Graphics.createArrayBuffer(g_width,g_height_d,1,{'msb':true}); var g_t = Graphics.createArrayBuffer(g_width,g_height_t,1,{'msb':true}); // Set screen mode and function to write graphics buffers @@ -46,7 +49,7 @@ g.flip = function() height:g_height_d, buffer:g_d.buffer }, g_x_off, g_y_off + g_y_off_d); - g.setColor(timeColour); + g.setColor(timeColour2); g.drawImage( { width:g_width, @@ -118,7 +121,7 @@ function formatDate(res,dateFormat){ return(yyyy+"-"+m+"-"+w+"-"+d); } -function writeDozTime(text,def,colour){ +function writeDozTime(text,def){ let pts = def.pts; let x=def.pt0[0]; let y=def.pt0[1]; @@ -133,6 +136,7 @@ function writeDozTime(text,def,colour){ } } function writeDozDate(text,def,colour){ + dateColour = colour; let pts = def.pts; let x=def.pt0[0]; @@ -177,10 +181,10 @@ function drawTime() { // Write to background buffers, then display on screen writeDozDate(date,calenDef,res.colour); - writeDozTime(time,timeDef,timeColour); + writeDozTime(time,timeDef); g.flip(); // Ready next interval - setTimeout(drawTime,wait); + drawtime_timeout = setTimeout(drawTime,wait); } else { @@ -196,22 +200,14 @@ function modeTime() timeActiveUntil = new Date(); timeActiveUntil.setDate(timeActiveUntil.getDate()); timeActiveUntil.setSeconds(timeActiveUntil.getSeconds()+15); - //Bangle.setLCDPower(true); - clearTimeout(); + if (typeof drawtime_timeout !== 'undefined') + { + clearTimeout(drawtime_timeout); + } drawTime(); } - Bangle.loadWidgets(); - -// Time-logging function -/*function logTime(label) -{ - var d = new Date(); - var t = d.getTime(); - var diff_test = t - last_time_log; - last_time_log = t; - console.log(label + " at time: " + t + ", since last: " + diff_test); -}*/ +Bangle.drawWidgets(); // Functions for weather mode - TODO function drawWeather() {} @@ -222,4 +218,20 @@ Bangle.on('twist', function() { modeTime(); }); -Bangle.drawWidgets(); +// Time fix with GPS +function fixTime() { + Bangle.on("GPS",function cb(g) { + Bangle.setGPSPower(0,"time"); + Bangle.removeListener("GPS",cb); + if (!g.time || (g.time.getFullYear()<2000) || + (g.time.getFullYear()>2200)) { + } else { + // We have a GPS time. Set time + setTime(g.time.getTime()/1000); + } + }); + Bangle.setGPSPower(1,"time"); + setTimeout(fixTime, 10*60*1000); // every 10 minutes +} +// Start time fixing with GPS on next 10 minute interval +setTimeout(fixTime, ((60-(new Date()).getMinutes()) % 10) * 60 * 1000); From 13598a209a12a2ac5f78df796bf7ca7501312845 Mon Sep 17 00:00:00 2001 From: numerist Date: Sat, 17 Jul 2021 15:57:58 -0400 Subject: [PATCH 07/26] Update ChangeLog --- apps/doztime/ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/doztime/ChangeLog b/apps/doztime/ChangeLog index 5560f00bc..f615b246e 100644 --- a/apps/doztime/ChangeLog +++ b/apps/doztime/ChangeLog @@ -1 +1,3 @@ 0.01: New App! +0.02 added emulator capability and display of widgets +0.03 bug of advancing time fixed; doztime now correct within 1 second From ba63388a0939de6fd17fab74eef8710f889bfebe Mon Sep 17 00:00:00 2001 From: numerist Date: Sun, 18 Jul 2021 06:31:23 -0400 Subject: [PATCH 08/26] Update ChangeLog --- apps/doztime/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/doztime/ChangeLog b/apps/doztime/ChangeLog index f615b246e..ffa84b497 100644 --- a/apps/doztime/ChangeLog +++ b/apps/doztime/ChangeLog @@ -1,3 +1,3 @@ 0.01: New App! 0.02 added emulator capability and display of widgets -0.03 bug of advancing time fixed; doztime now correct within 1 second +0.03 bug of advancing time fixed; doztime now correct within ca. 1 second From d19f96f8ce8b9288f0f52c3a5d9f01b7b91bfae3 Mon Sep 17 00:00:00 2001 From: numerist Date: Thu, 22 Jul 2021 11:56:14 -0400 Subject: [PATCH 09/26] Update ChangeLog --- apps/doztime/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/doztime/ChangeLog b/apps/doztime/ChangeLog index ffa84b497..de00f009c 100644 --- a/apps/doztime/ChangeLog +++ b/apps/doztime/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02 added emulator capability and display of widgets 0.03 bug of advancing time fixed; doztime now correct within ca. 1 second +0.04 changed time colour from slightly off white to pure white From b5b85fe7f604d76496a43e99674acd31b83beca5 Mon Sep 17 00:00:00 2001 From: numerist Date: Thu, 22 Jul 2021 12:08:15 -0400 Subject: [PATCH 10/26] Update app.js --- apps/doztime/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/doztime/app.js b/apps/doztime/app.js index 9faede70a..38c5acbac 100644 --- a/apps/doztime/app.js +++ b/apps/doztime/app.js @@ -13,7 +13,7 @@ const g_height_t = 48; // height of time region const A1 = [30,30,30,30,31,31,31,31,31,31,30,30]; const B1 = [30,30,30,30,30,31,31,31,31,31,30,30]; const B2 = [30,30,30,30,31,31,31,31,31,30,30,30]; -const timeColour = "#f2f2f2"; +const timeColour = "#ffffff"; const dateColours = ["#ff0000","#ffa500","#ffff00","#00b800","#0000ff","#ff00ff","#ff0080"]; const calen10 = {"size":32,"pt0":[32-g_x_off,16],"step":[20,0],"dx":-4.5,"dy":-4.5}; // positioning for usual calendar line const calen7 = {"size":32,"pt0":[62-g_x_off,16],"step":[20,0],"dx":-4.5,"dy":-4.5}; // positioning for S-day calendar line From 1d5dc855d07ee93df0327f1a678a09ba35fb12a1 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 09:34:03 -0700 Subject: [PATCH 11/26] Added Fahrenheit Thermometer --- apps.json | 17 +++++++++++++++++ apps/thermomF/app-icon.js | 2 ++ apps/thermomF/app..png | Bin 0 -> 1189 bytes apps/thermomF/app.js | 28 ++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 apps/thermomF/app-icon.js create mode 100644 apps/thermomF/app..png create mode 100644 apps/thermomF/app.js diff --git a/apps.json b/apps.json index cc21f3115..2148fb5f6 100644 --- a/apps.json +++ b/apps.json @@ -3316,5 +3316,22 @@ {"name":"mysticclock.settings.js","url":"mystic-clock-settings.js"}, {"name":"mysticclock.img","url":"mystic-clock-icon.js","evaluate":true} ] +}, + + +{ "id": "thermomF", + "name": "Fahrenheit Thermometer", + "shortName":"Thermometer F", + "icon": "app.png", + "version":"0.01", + "description": "A modification of the Thermometer App to display temprature in Fahrenheit", + "tags": "", + "storage": [ + {"name":"thermof.app.js","url":"app.js"}, + {"name":"thermof.png","url":"app-icon.js","evaluate":true} + ] } ] + + + diff --git a/apps/thermomF/app-icon.js b/apps/thermomF/app-icon.js new file mode 100644 index 000000000..3a5bb959f --- /dev/null +++ b/apps/thermomF/app-icon.js @@ -0,0 +1,2 @@ +require("heatshrink").decompress(atob("AH4A/AAMIxGIwAXTxACEACIsChAXqLwQDBMCQXYI4YvUCgIXVF6xH/I8DX/R/4ANgUgAIYX/C+MiC4ciFyQCGC54aEgAXQIIUiAYYXRgUzmYtBC6ASCC4IcCC5+wgGzC4M7gELC6O7C4O7C6ISC2c7DgQXRAQIDDC58LFYIFIGB4uSFQRFDFyJeDMAYA/AH4")) +} \ No newline at end of file diff --git a/apps/thermomF/app..png b/apps/thermomF/app..png new file mode 100644 index 0000000000000000000000000000000000000000..bb33cb939d63a9682e318025e2f94c7c1f0ea31b GIT binary patch literal 1189 zcmV;W1X}xvP)nbkt*}t8k&unGMZv-!*9L9P7LD0b z$gE+K)ifw5s5ZsGe@q54Q4?BH5!OTshs9=5bi*=m{V<9_)2Li(Qenkb?8kkd(;xS~ z+nBrl(fi!m#T|J5c+NST@AKt3&pGG47p7%eE^SfS3LJYvmN-HjK!i_E?@`CHfn%M( z{3oTz8Kzy}t_h}2m89YOm(-s&@f@4M0Q^DPwV~QKH2DrO-y!A;&7R>7?eMy7JgaiU zBeJBlQKW3WG)=UXt(T_KMv<}&vdAW;)f@2PR&Br^Vc!L|5%y^VI-tTPrd0y2p->x8 zaHf2nNclRE(02S4bygd211__Psci=H0TB>I%Vc&>Kv^yuRtad6B5?FI)tt$0n}F36 z(k8WTTO(5Wplr!xw~A>sSo#K(qJ@A@CbLiZ6hh$L{gbDVXRzKnvywt}_leZ4&e0SC zP|#vzk`xj^CTb&M+6?BK)cM|gD{~6j9=_~9V&MLjV-0No!LetnbA^D)(8zLzz^iXx zq>u}~2$_WCYJawle0Cv2msz&Wo znSh_3g~sp4iB=*1?*_!TRLTrnxK;>k ztB@;(JrbU>gd8*T}bwAsLpOkn3ysn>>k-GFDGKB^9f`qsEC(1tnMFlX0Nxh~W{^Reo54b9rH zsENgSpfq|@qFVk^&G&93#D2qK1i0sP;JW3?*i{jaG?6pZuKER+alQtH2E_rc<3WF z_;1e;=>`gg`C4$CfSyq2L4(dGnZE*xW~SE66`=D8TxbaWT&!wG2#_4}?Joe+&)jhDCOPjYP!OpaMY@3*hI870FT_Rz26U@)I0Zk# zl_RND@B_GKaWr&?exBi)bffz@${8XNSp5~JJi{5^P!sA3|7N={^!>gUGuQ!x9dLdx z#)Cd@i0z@D4>g|Q^qMdD>3<`jP@)Y7T*EybH>OHueXr_w0~Wc%v=4mFz+a!y?c#~YM15N_p=pm|Wzf(gO^Y2<9dC5Ey3QAp{ z>uZmzU!&kh?gJ~oR=;S&S}nx!>3pYHW@qy4S|C^9)1`&Qj<7cB;lbkP#rq}l0Pr%x zpulcX9P(Xy0Y;LPD2I9skE6&Fc(~?UwciG=)!{Z#EG57;U^(DUFb4__8O5gCdsVM3 z%&h#)nkbgp+E67hFAZ`!>5!;8p?=E--n2~1r7ZsdH4U76`VJt+00000NkvXXu0mjf DV^KD_ literal 0 HcmV?d00001 diff --git a/apps/thermomF/app.js b/apps/thermomF/app.js new file mode 100644 index 000000000..76f15b481 --- /dev/null +++ b/apps/thermomF/app.js @@ -0,0 +1,28 @@ +function onTemperature(p) { + g.reset(1).clearRect(0,24,g.getWidth(),g.getHeight()); + g.setFont("6x8",2).setFontAlign(0,0); + var x = g.getWidth()/2; + var y = g.getHeight()/2 + 10; + g.drawString("Temperature", x, y - 45); + g.setFontVector(70).setFontAlign(0,0); + g.drawString(p.temperature.toFixed(1), x, y); +} + +function drawTemperature() { + if (Bangle.getPressure) { + Bangle.getPressure().then(onTemperature); + } else { + onTemperature({ + temperature : E.getTemperature() * (9/5) + 32, + }); + } +} + + +setInterval(function() { + drawTemperature(); +}, 20000); +drawTemperature(); +E.showMessage("Loading..."); +Bangle.loadWidgets(); +Bangle.drawWidgets(); \ No newline at end of file From fcc17e075edcafdb2aaa6cf3f5b8d77b5f4fa76f Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 09:51:50 -0700 Subject: [PATCH 12/26] Update apps.json fixed formatting --- apps.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps.json b/apps.json index 2148fb5f6..6a486e7e5 100644 --- a/apps.json +++ b/apps.json @@ -3317,8 +3317,6 @@ {"name":"mysticclock.img","url":"mystic-clock-icon.js","evaluate":true} ] }, - - { "id": "thermomF", "name": "Fahrenheit Thermometer", "shortName":"Thermometer F", From 3f50989e03225fb8e400165eaf01ab13d76aa268 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 09:59:39 -0700 Subject: [PATCH 13/26] Formating fixes --- apps.json | 2 -- apps/thermomF/{app..png => app.png} | Bin 2 files changed, 2 deletions(-) rename apps/thermomF/{app..png => app.png} (100%) diff --git a/apps.json b/apps.json index 2148fb5f6..6a486e7e5 100644 --- a/apps.json +++ b/apps.json @@ -3317,8 +3317,6 @@ {"name":"mysticclock.img","url":"mystic-clock-icon.js","evaluate":true} ] }, - - { "id": "thermomF", "name": "Fahrenheit Thermometer", "shortName":"Thermometer F", diff --git a/apps/thermomF/app..png b/apps/thermomF/app.png similarity index 100% rename from apps/thermomF/app..png rename to apps/thermomF/app.png From 51a10df84c10ea184f88d64bd72aad978ea3da40 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 10:11:24 -0700 Subject: [PATCH 14/26] formatting fixes (forgive the noob) --- apps.json | 8 ++++---- apps/thermomF/{app.png => thermf.png} | Bin 2 files changed, 4 insertions(+), 4 deletions(-) rename apps/thermomF/{app.png => thermf.png} (100%) diff --git a/apps.json b/apps.json index 6a486e7e5..d64b6c017 100644 --- a/apps.json +++ b/apps.json @@ -3318,15 +3318,15 @@ ] }, { "id": "thermomF", - "name": "Fahrenheit Thermometer", - "shortName":"Thermometer F", - "icon": "app.png", + "name": "Fahrenheit Temp", + "shortName":"F Temp", + "icon": "thermf.png", "version":"0.01", "description": "A modification of the Thermometer App to display temprature in Fahrenheit", "tags": "", "storage": [ {"name":"thermof.app.js","url":"app.js"}, - {"name":"thermof.png","url":"app-icon.js","evaluate":true} + {"name":"thermof.img","url":"app-icon.js","evaluate":true} ] } ] diff --git a/apps/thermomF/app.png b/apps/thermomF/thermf.png similarity index 100% rename from apps/thermomF/app.png rename to apps/thermomF/thermf.png From 89f67dff6e1a04f209514d89b575f958e679cc47 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 10:20:06 -0700 Subject: [PATCH 15/26] another format fix *sigh* --- apps.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index d64b6c017..4befd9965 100644 --- a/apps.json +++ b/apps.json @@ -3325,8 +3325,8 @@ "description": "A modification of the Thermometer App to display temprature in Fahrenheit", "tags": "", "storage": [ - {"name":"thermof.app.js","url":"app.js"}, - {"name":"thermof.img","url":"app-icon.js","evaluate":true} + {"name":"thermomF.app.js","url":"app.js"}, + {"name":"thermomF.img","url":"app-icon.js","evaluate":true} ] } ] From f43b2d33190ecf730d4f0bb5fdec8e30810cdc61 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 10:27:16 -0700 Subject: [PATCH 16/26] YAFF --- apps.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 4befd9965..18b7e9c66 100644 --- a/apps.json +++ b/apps.json @@ -3319,11 +3319,10 @@ }, { "id": "thermomF", "name": "Fahrenheit Temp", - "shortName":"F Temp", "icon": "thermf.png", "version":"0.01", "description": "A modification of the Thermometer App to display temprature in Fahrenheit", - "tags": "", + "tags": "Temperature, Thermometer", "storage": [ {"name":"thermomF.app.js","url":"app.js"}, {"name":"thermomF.img","url":"app-icon.js","evaluate":true} From 53a138f11656e7d434a14518efd7017f0abe6188 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 10:34:41 -0700 Subject: [PATCH 17/26] YAFF a comma --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 18b7e9c66..c6e3a5af0 100644 --- a/apps.json +++ b/apps.json @@ -3327,7 +3327,7 @@ {"name":"thermomF.app.js","url":"app.js"}, {"name":"thermomF.img","url":"app-icon.js","evaluate":true} ] -} +}, ] From 0d6524ff2e18c8fed80ab093cbdbbbcf080fb26e Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 10:45:24 -0700 Subject: [PATCH 18/26] fixed synatx error --- apps/thermomF/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/thermomF/app.js b/apps/thermomF/app.js index 76f15b481..2961e1efc 100644 --- a/apps/thermomF/app.js +++ b/apps/thermomF/app.js @@ -13,7 +13,7 @@ function drawTemperature() { Bangle.getPressure().then(onTemperature); } else { onTemperature({ - temperature : E.getTemperature() * (9/5) + 32, + temperature : E.getTemperature() * (9/5) + 32 }); } } From 13b65888f840a883f2e841381111ab63b0730599 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 10:48:34 -0700 Subject: [PATCH 19/26] YAFF --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index c6e3a5af0..18b7e9c66 100644 --- a/apps.json +++ b/apps.json @@ -3327,7 +3327,7 @@ {"name":"thermomF.app.js","url":"app.js"}, {"name":"thermomF.img","url":"app-icon.js","evaluate":true} ] -}, +} ] From e4880a57d4ad506399c6524d6f34fe55b7da4fd1 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 10:59:29 -0700 Subject: [PATCH 20/26] YAFF --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 18b7e9c66..690c03e8b 100644 --- a/apps.json +++ b/apps.json @@ -3322,7 +3322,7 @@ "icon": "thermf.png", "version":"0.01", "description": "A modification of the Thermometer App to display temprature in Fahrenheit", - "tags": "Temperature, Thermometer", + "tags": "tool", "storage": [ {"name":"thermomF.app.js","url":"app.js"}, {"name":"thermomF.img","url":"app-icon.js","evaluate":true} From 026c63f7dd9373bc6f3fad73043b0ad0cf29ae67 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 11:53:26 -0700 Subject: [PATCH 21/26] correct syntax error --- apps/thermomF/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/thermomF/app-icon.js b/apps/thermomF/app-icon.js index 3a5bb959f..45e3675b6 100644 --- a/apps/thermomF/app-icon.js +++ b/apps/thermomF/app-icon.js @@ -1,2 +1,2 @@ require("heatshrink").decompress(atob("AH4A/AAMIxGIwAXTxACEACIsChAXqLwQDBMCQXYI4YvUCgIXVF6xH/I8DX/R/4ANgUgAIYX/C+MiC4ciFyQCGC54aEgAXQIIUiAYYXRgUzmYtBC6ASCC4IcCC5+wgGzC4M7gELC6O7C4O7C6ISC2c7DgQXRAQIDDC58LFYIFIGB4uSFQRFDFyJeDMAYA/AH4")) -} \ No newline at end of file +}; \ No newline at end of file From 2c952dc281615754f7176ce416c54bd7f9fa3dde Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 11:58:03 -0700 Subject: [PATCH 22/26] FAFF --- apps/thermomF/app-icon.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/thermomF/app-icon.js b/apps/thermomF/app-icon.js index 45e3675b6..64edafeed 100644 --- a/apps/thermomF/app-icon.js +++ b/apps/thermomF/app-icon.js @@ -1,2 +1 @@ -require("heatshrink").decompress(atob("AH4A/AAMIxGIwAXTxACEACIsChAXqLwQDBMCQXYI4YvUCgIXVF6xH/I8DX/R/4ANgUgAIYX/C+MiC4ciFyQCGC54aEgAXQIIUiAYYXRgUzmYtBC6ASCC4IcCC5+wgGzC4M7gELC6O7C4O7C6ISC2c7DgQXRAQIDDC58LFYIFIGB4uSFQRFDFyJeDMAYA/AH4")) -}; \ No newline at end of file +require("heatshrink").decompress(atob("AH4A/AAMIxGIwAXTxACEACIsChAXqLwQDBMCQXYI4YvUCgIXVF6xH/I8DX/R/4ANgUgAIYX/C+MiC4ciFyQCGC54aEgAXQIIUiAYYXRgUzmYtBC6ASCC4IcCC5+wgGzC4M7gELC6O7C4O7C6ISC2c7DgQXRAQIDDC58LFYIFIGB4uSFQRFDFyJeDMAYA/AH4"))} \ No newline at end of file From dda544bd5810bf1e90e1e7b88e6dd4ff0c73fe44 Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 12:17:58 -0700 Subject: [PATCH 23/26] Fixed Syntax error --- apps/thermomF/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/thermomF/app-icon.js b/apps/thermomF/app-icon.js index 64edafeed..0f733eeac 100644 --- a/apps/thermomF/app-icon.js +++ b/apps/thermomF/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("AH4A/AAMIxGIwAXTxACEACIsChAXqLwQDBMCQXYI4YvUCgIXVF6xH/I8DX/R/4ANgUgAIYX/C+MiC4ciFyQCGC54aEgAXQIIUiAYYXRgUzmYtBC6ASCC4IcCC5+wgGzC4M7gELC6O7C4O7C6ISC2c7DgQXRAQIDDC58LFYIFIGB4uSFQRFDFyJeDMAYA/AH4"))} \ No newline at end of file +require("heatshrink").decompress(atob("AH4A/AAMIxGIwAXTxACEACIsChAXqLwQDBMCQXYI4YvUCgIXVF6xH/I8DX/R/4ANgUgAIYX/C+MiC4ciFyQCGC54aEgAXQIIUiAYYXRgUzmYtBC6ASCC4IcCC5+wgGzC4M7gELC6O7C4O7C6ISC2c7DgQXRAQIDDC58LFYIFIGB4uSFQRFDFyJeDMAYA/AH4")) \ No newline at end of file From 944d89468bc18f25a07c384d0306ddfd335d107b Mon Sep 17 00:00:00 2001 From: "L. Christopher Bird" Date: Thu, 22 Jul 2021 12:38:24 -0700 Subject: [PATCH 24/26] fkxed icon from object to string --- apps/thermomF/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/thermomF/app-icon.js b/apps/thermomF/app-icon.js index 0f733eeac..fe1fa86b7 100644 --- a/apps/thermomF/app-icon.js +++ b/apps/thermomF/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("AH4A/AAMIxGIwAXTxACEACIsChAXqLwQDBMCQXYI4YvUCgIXVF6xH/I8DX/R/4ANgUgAIYX/C+MiC4ciFyQCGC54aEgAXQIIUiAYYXRgUzmYtBC6ASCC4IcCC5+wgGzC4M7gELC6O7C4O7C6ISC2c7DgQXRAQIDDC58LFYIFIGB4uSFQRFDFyJeDMAYA/AH4")) \ No newline at end of file +require("heatshrink").decompress(atob("mEwwhC/AH4AChGIxGAC6eIAQgARFgUIC9ReCAYJgSC7BHDF6gUBC6ovWI/5Hga/6P/ABsCkABDC/4XxkQXDkQuSAQwXPDQkAC6BBCkQDDC6MCmczFoIXQCQQXBDgQXP2EA2YXBncAhYXR3YXB3YXRCQWznYcCC6ICBAYYXPhYrBApAwPFyQqCIoYuRLwZgDAH4A/")) \ No newline at end of file From 8c5b0e4c362512781984269f353b212d6ebc09ba Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Mon, 26 Jul 2021 09:10:22 +0100 Subject: [PATCH 25/26] tidying --- app.js | 292 ------------------------------------------------------ apps.json | 4 +- 2 files changed, 2 insertions(+), 294 deletions(-) delete mode 100644 app.js diff --git a/app.js b/app.js deleted file mode 100644 index 4ce084f37..000000000 --- a/app.js +++ /dev/null @@ -1,292 +0,0 @@ - - /** - * Widget measurements - * Description: - * name: connection.wid.js - *icon: conectionIcon.icon - * - */ - - //Font - g.setFont("Vector", 100); - //variabangle.Sensorss - let acclS, bttS, compssS, gpsS, hrmS, stepS; //Strings - let accelN, compssN, gpsN, hrmN, stepN; //Num - let prueba = 1; - let data = [0, 0, 0, 0, 0, 0]; - //Constants for redabangle.Sensors code - let storage = require('Storage'); - let deCom = require('heatshrink'); - - - - - //Sensors code - /** - * - * @author Jorge - */ - function accel() { - - Bangle.on('accel', function (acc) { - // acc = {x,y,z,diff,mag} - accelN = acc; - }); - - setInterval(function () { - - acclS = accelN.x + "##" + accelN.y + "##" + accelN.z + "\n" + accelN.diff + "##" + accelN.mag; - data[3] = accelN; - }, 2 * 1000); - - } - - function btt() { - - setInterval(function () { - - bttS = E.getBattery(); //return String - data[2] = E.getBattery(); - }, 15 * 1000); - - } - - - - function compss() { - - Bangle.setCompassPower(1); - Bangle.on('mag', function (mag) { - // mag = {x,y,z,dx,dy,dz,heading} - compssN = mag; - }); - - - setInterval(function () { - - compssS = "A: " + compssN.x + " ## " + compssN.y + " ## " + compssN.z + "\n" + - "B: " + compssN.dx + " ## " + compssN.dy + " ## " + compssN.dz + " ## " + "\n" + - "C: " + compssN.heading; //return String - data[4] = compssN; - }, 2 * 1000); - - } - - - - function gps() { - - Bangle.setGPSPower(1); - Bangle.on('GPS', function (gps) { - // gps = {lat,lon,alt,speed,etc} - gpsN = gps; - - }); - - setInterval(function () { - - gpsS = "A: " + gpsN.lat + " ## " + gpsN.lon + " ## " + gpsN.alt + "\n" + "B: " + gpsN.speed + " ## " + gpsN.course + " ## " + gpsN.time + "\n" + - "C: " + gpsN.satellites + " ## " + gpsN.fix; //return String - // work out how to display the current time - var d = new Date(); - var year = d.getFullYear(); - - var month = d.getMonth() + 1; - var finalMonth = 0; - if (month < 10) { - finalMonth = "0" + month; - } else { - finalMonth = month; - } - var day = d.getDate(); - var finalDay = 0; - if (day < 10) { - finalDay = "0" + day; - } else { - finalDay = day; - } - var h = d.getHours(), - m = d.getMinutes(); - var finalh = 0; - if (h < 10) { - finalh = "0" + h; - } else { - finalh = h; - } - var finalM = 0; - if (m < 10) { - finalM = "0" + m; - } else { - finalM = m; - } - - var s = d.getSeconds(); - var finalS = 0; - if (s < 10) { - finalS = "0" + s; - } else { - finalS = s; - } - var z = d.getMilliseconds(); - var zFinal = new String(z); - zFinal = zFinal.replace('.', ''); - var completeTime = year + "-" + finalMonth + "-" + finalDay + "T" + finalh + ":" + finalM + ":" + finalS + "." + z + "Z"; - var time = h + ":" + ("0" + m).substr(-2); - gpsN.time = completeTime; - data[5] = gpsN; - }, 2 * 1000); - } - - //2021-06-11T19:21:58.000Z - - function hrm() { - - let msr = [0, 0, 0, 0, 0]; - let lastInsert = -1; - - function roundInsert(nueva) { - let indexFinal = (lastInsert + 1) % (msr.length); - //console.log("Index ==> "+ index); - msr[indexFinal] = nueva; - - item = nueva; - lastInsert = indexFinal; - - } - - function normalize(nueva) { - - let normalize = 0; - roundInsert(nueva); - - - msr.forEach(function (number) { - normalize += number; - }); - normalize = normalize / msr.length; - - return normalize; - - } - - - - - setInterval(function () { - - if (!isNaN(hrmN)) { - - - hrmN = normalize(hrmN); - var roundedRate = parseFloat(hrmN).toFixed(2); - hrmS = String.valueOf(roundedRate); //return String - //console.log("array----->" + msr); - data[0] = roundedRate; - - } - - - - - - }, 2 * 1000); - - } - - - function steps() { - - Bangle.on('step', s => { - - stepN = s; - }); - - - setInterval(function () { - - stepS = String.valueOf(stepN); //return String - data[1] = stepN; - }, 2 * 1000); - - - } - - function initSensors() { - - //need power control - Bangle.setHRMPower(1); - - Bangle.on('HRM', function (hrm) { - hrmN = hrm.bpm; - - - }); - console.log("Sensors are being Init...."); - accel(); - btt(); - compss(); - gps(); - hrm(); - steps(); - - } - - var flip = 1; - Bangle.on('lcdPower', function (on) { - /* - prueba ++; - Bangle.drawWidgets(); - g.setFont("Vector", 45); - g.drawString(prueba,100,200);*/ - if (flip == 1) { //when off - - flip = 0; - //Bangle.buzz(1000); - g.clear(); - } else { //when on - - flip = 1; - g.setFont("Vector", 30); - g.drawString(data[0], 65, 180); - Bangle.drawWidgets(); - } - - }); - - - function draw() { - - g.drawImage(storage.read("iconWatch.img"), this.x + 1, this.y + 1); - g.drawImage(storage.read("heart.img"), 145, 167); - } - - - - initSensors(); - // Bangle.drawWidgets(); - // Terminal.println("Running BangleBridge"); - data[0] = 80.5; - g.setFont("Vector", 30); - g.drawString(data[0], 65, 180); - Bangle.drawWidgets(); - setInterval(function () { - //console.log("---------------------------------------------------------------"); - //console.log(data); - //Bluetooth.println(data[0]); - var measurement = { - hrm: data[0], - step: data[1], - batt: data[2], - acc: data[3], - com: data[4], - gps: data[5] - }; - /* g.clear(); - g.drawString(compssS,100,200); - */ - - - - Bluetooth.println(JSON.stringify(measurement) + "#"); - - }, 5 * 1000); diff --git a/apps.json b/apps.json index 190038600..aa4d712fe 100644 --- a/apps.json +++ b/apps.json @@ -3210,7 +3210,7 @@ "readme": "README.md", "storage": [ {"name":"banglebridge.wid.js","url":"widget.js"}, - {"name":"iconWatch.png","url":"iconWatch.png"}, + {"name":"iconWatch.png","url":"iconWatch.png"}, {"name":"heart.png","url":"heart.png"} ] }, @@ -3291,7 +3291,7 @@ "name":"Dozenal Time", "shortName":"Dozenal Time", "icon":"app.png", - "version":"0.01", + "version":"0.04", "description":"A dozenal Holocene calendar and dozenal diurnal clock", "tags":"clock", "type":"clock", From 6168782cf5c1335c149b99c4e29c06cab6c52a17 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Mon, 26 Jul 2021 15:53:46 +0100 Subject: [PATCH 26/26] bootloader 0.28: Fix double clock load after settings are changed --- apps.json | 5 +---- apps/boot/ChangeLog | 1 + apps/boot/bootupdate.js | 5 +++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps.json b/apps.json index 2399b53c7..f4343600f 100644 --- a/apps.json +++ b/apps.json @@ -4,7 +4,7 @@ "tags": "tool,system,b2", "type":"bootloader", "icon": "bootloader.png", - "version":"0.27", + "version":"0.28", "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings", "storage": [ {"name":".boot0","url":"boot0.js"}, @@ -3371,6 +3371,3 @@ ] } ] - - - diff --git a/apps/boot/ChangeLog b/apps/boot/ChangeLog index ccf97a9eb..4a8c62d59 100644 --- a/apps/boot/ChangeLog +++ b/apps/boot/ChangeLog @@ -26,3 +26,4 @@ 0.25: Fix error in 'no clock app' message 0.26: Remove buzz in setUI polyfill (#750) 0.27: Update polyfill for most recent changes +0.28: Fix double clock load after settings are changed diff --git a/apps/boot/bootupdate.js b/apps/boot/bootupdate.js index 014edd552..4c4efed29 100644 --- a/apps/boot/bootupdate.js +++ b/apps/boot/bootupdate.js @@ -136,8 +136,9 @@ require('Storage').list(/\.boot\.js/).forEach(bootFile=>{ boot += "//"+bootFile+"\n"+require('Storage').read(bootFile)+"\n"; }); boot += "}\n";// initial 'if' -var s = require('Storage').write('.boot0',boot); +require('Storage').write('.boot0',boot); delete boot; E.showMessage("Reloading..."); eval(require('Storage').read('.boot0')); -eval(require('Storage').read('.bootcde')); +// .bootcde should be run automatically after if required, since +// we normally get called automatically from '.boot0'