From cff3c77f0805ca51f691a0f637e3b9c45161e211 Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 16 May 2022 13:50:25 -0400 Subject: [PATCH 01/14] First commit for f9lander --- apps/f9lander/ChangeLog | 1 + apps/f9lander/README.md | 30 +++++ apps/f9lander/app-icon.js | 1 + apps/f9lander/app.js | 150 +++++++++++++++++++++++++ apps/f9lander/f9lander_screenshot1.png | Bin 0 -> 1340 bytes apps/f9lander/f9lander_screenshot2.png | Bin 0 -> 722 bytes apps/f9lander/metadata.json | 15 +++ 7 files changed, 197 insertions(+) create mode 100644 apps/f9lander/ChangeLog create mode 100644 apps/f9lander/README.md create mode 100644 apps/f9lander/app-icon.js create mode 100644 apps/f9lander/app.js create mode 100644 apps/f9lander/f9lander_screenshot1.png create mode 100644 apps/f9lander/f9lander_screenshot2.png create mode 100644 apps/f9lander/metadata.json diff --git a/apps/f9lander/ChangeLog b/apps/f9lander/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/f9lander/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/f9lander/README.md b/apps/f9lander/README.md new file mode 100644 index 000000000..ce0e56903 --- /dev/null +++ b/apps/f9lander/README.md @@ -0,0 +1,30 @@ +# F9 Lander + +Land a Falcon 9 booster on a drone ship. + +## Game play + +Attempt to land your Falcon 9 booster on a drone ship before running out of fuel. +A successful landing requires: + * setting down on the ship + * the booster has to be mostly vertical + * the landing speed cannot be too high + +## Controls + +The angle of the booster is controlled by tilting the watch side-to-side. The +throttle level is controlled by tilting the watch forward and back: + * screen horizontal (face up) means no throttle + * screen vertical corresponds to full throttle + +The fuel burn rate is proportional to the throttle level. + +## Creators +Liam Kl. B. +Marko Kl. B. + +## Screenshots + +![](f9lander_screenshot1.png) + +![](f9lander_screenshot2.png) diff --git a/apps/f9lander/app-icon.js b/apps/f9lander/app-icon.js new file mode 100644 index 000000000..d08b4ce9a --- /dev/null +++ b/apps/f9lander/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("sFgwcA/4AL/1JkmSARMntu27YCEEbUk9ojT+QjiEBYCCzojS/gjOyYjS8gjOyV2EcVOEcVJEccnEcTaFEbySEEb4CDEf4j/EbYgUEf4jV/Ij/AA3JEf4AF/wgVEZnyEcQgWEZf8EcXkEbMnEQ35EC4CDz7UeAQlPRjoC/AX4C/AX4C3n4jgyf//n/5JHgngmCEcJHhn4jjR8Qjj//+fb4j/Ef4j/Ef4jgp4jk+Qjfyf/EcP+I4P/5Ijdk/yp3Y+V/R74jBSQPkEb127cSa8Aj/Ef4COye2a4Ij/Ef6zN4gjhpwgfAX4C/AX4C/AX4C/AX4CIk//ACnJEd8kESn+NxufEafyEeIC/AX4C/ASA")) diff --git a/apps/f9lander/app.js b/apps/f9lander/app.js new file mode 100644 index 000000000..41f3b7666 --- /dev/null +++ b/apps/f9lander/app.js @@ -0,0 +1,150 @@ +const falcon9 = Graphics.createImage(` + xxxxx + xxxxx xxxxx + x x + x x + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxx + xxxxxxxxx + xx xxxxx xx +xx xx`); + +const droneShip = Graphics.createImage(` +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +`); + +const droneX = Math.floor(Math.random()*(g.getWidth()-droneShip.width-40) + 20) +const cloudOffs = Math.floor(Math.random()*g.getWidth()/2); + +const oceanHeight = g.getHeight()*0.1; + +const targetY = g.getHeight()-oceanHeight-falcon9.height/2; + +var booster = { x : g.getWidth()/4 + Math.random()*g.getWidth()/2, + y : 20, + vx : 0, + vy : 0, + mass : 100, + fuel : 100 }; + +var exploded = false; +var nExplosions = 0; +var landed = false; + +const gravity = 4; +const dt = 0.1; +const fuelBurnRate = 20; +const maxV = 12; + +function flameImageGen (throttle) { + var str = " xxx \n xxx \n"; + str += "xxxxx\n".repeat(throttle); + str += " xxx \n x \n"; + return Graphics.createImage(str); +} + +function drawFalcon(x, y, throttle, angle) { + g.setColor(1, 1, 1).drawImage(falcon9, x, y, {rotate:angle}); + if (throttle>0) { + var flameImg = flameImageGen(throttle); + var r = falcon9.height/2 + flameImg.height/2-1; + var xoffs = -Math.sin(angle)*r; + var yoffs = Math.cos(angle)*r; + if (Math.random()>0.7) g.setColor(1, 0.5, 0); + else g.setColor(1, 1, 0); + g.drawImage(flameImg, x+xoffs, y+yoffs, {rotate:angle}); + } +} + +function drawBG() { + g.setBgColor(0.2, 0.2, 1).clear(); + g.setColor(0, 0, 1).fillRect(0, g.getHeight()-oceanHeight, g.getWidth()-1, g.getHeight()-1); + g.setColor(0.5, 0.5, 1).fillCircle(cloudOffs+34, 30, 15).fillCircle(cloudOffs+60, 35, 20).fillCircle(cloudOffs+75, 20, 10); + g.setColor(1, 1, 0).fillCircle(g.getWidth(), 0, 20); + g.setColor(1, 1, 1).drawImage(droneShip, droneX, g.getHeight()-oceanHeight-1); +} + +function showFuel() { + g.setColor(0, 0, 0).setFont("4x6:2").setFontAlign(-1, -1, 0).drawString("Fuel: "+Math.abs(booster.fuel).toFixed(0), 4, 4); +} + +function renderScreen(input) { + drawBG(); + showFuel(); + drawFalcon(booster.x, booster.y, Math.floor(input.throttle*12), input.angle); +} + +function getInputs() { + var accel = Bangle.getAccel(); + var a = Math.PI/2 + Math.atan2(accel.y, accel.x); + var t = (1+accel.z); + if (t > 1) t = 1; + if (t < 0) t = 0; + if (booster.fuel<=0) t = 0; + return {throttle: t, angle: a}; +} + +function epilogue(str) { + g.setFont("Vector", 24).setFontAlign(0, 0, 0).setColor(0, 0, 0).drawString(str, g.getWidth()/2, g.getHeight()/2).flip(); + g.setFont("Vector", 16).drawString("<= again exit =>", g.getWidth()/2, g.getHeight()/2+20); + clearInterval(stepInterval); + Bangle.on("swipe", (d) => { if (d>0) load(); else load('falcon.app.js'); }); +} + +function gameStep() { + if (exploded) { + if (nExplosions++ < 15) { + var r = Math.random()*25; + var x = Math.random()*30 - 15; + var y = Math.random()*30 - 15; + g.setColor(1, Math.random()*0.5+0.5, 0).fillCircle(booster.x+x, booster.y+y, r); + if (nExplosions==1) Bangle.buzz(600); + } + else epilogue("You crashed!"); + } + else { + var input = getInputs(); + if (booster.y >= targetY) { +// console.log(booster.x + " " + booster.y + " " + booster.vy + " " + droneX + " " + input.angle); + if (Math.abs(booster.x-droneX-droneShip.width/2) { + stepInterval = setInterval(gameStep, Math.floor(1000*dt)); + Bangle.removeListener("swipe"); +}); diff --git a/apps/f9lander/f9lander_screenshot1.png b/apps/f9lander/f9lander_screenshot1.png new file mode 100644 index 0000000000000000000000000000000000000000..a2f13d6c7278538af255e6c267cd11e0bfca517e GIT binary patch literal 1340 zcmZ{ke>l^76vsbYGuwzR*CZunidw!1-I0Eo$dAMlB__Yhucl#JevNUdT*|MgZoAb} zD?f+2jZxO_C0bHp)+}>rQDj%eSBZB2xPSD={o|b1^FHUipXWT!d7g9H*JqCo+87N0 z(D870^;1##Z)p6W%A(YdS5?r6-s!y)fQBN>LKs4&*Mz(Kc>{3D0sv+X0H0MQ<~RV! z5CCt<01zqwz)~)^>~~f*tbDylL;Y1vcNLb@KVJ4y7HQ_^h-Qpf;F zaYGl>v}LvH8z~Wl!SRbY#|^uCVlZ3Tu`d(tG~|CTjQ&%ePznf;l7m!o=;sFO-v?i(~eR z0<2lIN+ovWbWJbr_2bZsDXt@F()U0y({Ig8)e0Hcd}w=rvEupL zR>YQRALJge{XKRuRNaBG_CkK*tA~6eZB3Sd41Eu=!J%7h>YQKKu@CkeC+DfOmY9lF z;R&4jl_8D$*6{S$8pYRZSC!Rw!|3k%ylg=lHvVyO6ZRfy^b$9aC^5FWfSwQBq`Wat z>A)yD9m&mApKhC5_AiLA7Ds71is~~3>>t-j)cdi0SDI4s8BvBc0YAlDU5wlogxARN zaN<9js@Wc+hAs~u%Ed+)dKIi46;$Q@twgL;+{b&4h+e zxA6$wsWRQsdb7B%9TU}7x#ZKt$?TXK%f2hM6kYcC`ZUwbdA?D5Gsn{Czf+t(pI%ZV zpZpqPPHawvuT9$ecW}em57wfIh zc}!P!^iNbkiH0T(V%;uz_iMMD>bGx{TAe0id%Nm;mG%C@jBQyDb+r`}xl6N=R}v>4 zGnS`SmN1oU64ZR0UY@0Nh5JSq^HB$@v#rZg&wZ8AP`Y!39h^Kl)sM~{Yxw{G literal 0 HcmV?d00001 diff --git a/apps/f9lander/f9lander_screenshot2.png b/apps/f9lander/f9lander_screenshot2.png new file mode 100644 index 0000000000000000000000000000000000000000..ea7d8a834d4fb8c60a13722957ff42be49e8010d GIT binary patch literal 722 zcmeAS@N?(olHy`uVBq!ia0vp^A3&Ie8AzU~{<08Av7|ftIx;Y9?C1WI$O_~uBzpw; zGB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpoBz#Pl&65!H*w*fEc#S%MS13By^p1!W^&sYUGH8flJ+Ghf#w|lxc zhE&{od*g2IAp?=NL}hE{5>|f!P3|X3%mtH0cm3z!ZCqfo&@VQ*o^`*z(*0I9e+#dk{rU0h-}x-(!}s5b*jlZy^YZ_OzoOsjx__tdwz^>xwKaa* z?xM#}^Hzx-h!vmaFa2ZJ`>VUA`?~M?##Mgw;cRIM%k%Efj6UeQ`K4{!EO$^%HZK2a z-krzO!#7z=TYvu{J9XRh+fm>1ILtCXNWFZNFqz3-;?wsJPi^cIAJ`w@T=`(JZ#YMK z5x@UNp1jZkz3&|7%svRtIm^0^VcUVF3BmF?p#=p`%+zy2H%vUpXt{p(pQtTQAI?|H zzc0IOk?(sqJ<|_)Pmu(vvx)j-ek=iMK z_KjMU(dO54QxYDtU0m(W#&5NQU2l@`A))O~J9cgVxS(;lX?8+-%;H<6#!{SjdKOQt z5uA~D^n`fCBp$ia50X1PdIhHKu)1;L!RJU8VL?=I@wX{UxAnDjpG1pS0fig5ch Date: Mon, 16 May 2022 13:53:27 -0400 Subject: [PATCH 02/14] Add icon --- apps/f9lander/f9lander.png | Bin 0 -> 542 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/f9lander/f9lander.png diff --git a/apps/f9lander/f9lander.png b/apps/f9lander/f9lander.png new file mode 100644 index 0000000000000000000000000000000000000000..9ecf155411021db6cba17a262d80a24446c7e732 GIT binary patch literal 542 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeE3?v1%WpM*3mUKs7M+SzC{oH>NS%G|oWRD45bDP46hOx7_4S6Fo+k-*%fF5ln@Q@32|*`_+eo1rlDl0^$SkL4-#TD%s zn8?b^?ZAA2!KC8;!G>@@&JETVtP*WA&aP)W+j~H)L6;$#VH*SAof@VE&(s@Mm;RRw zc$rZBfSGkqhxn#MCzXW!gvJf#8yr+h3LGBnXGn0EwcMfVwv(;hK?&O-T>}#<1B0zgj(9nO2Eg!;zo$9zYEYp00i_>zopr0F|q_761SM literal 0 HcmV?d00001 From 2430cefbbfe905c650bb56eeaddd472073f2c290 Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 16 May 2022 14:00:46 -0400 Subject: [PATCH 03/14] Fix icon size --- apps/f9lander/app-icon.js | 2 +- apps/f9lander/f9lander.png | Bin 542 -> 1229 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/f9lander/app-icon.js b/apps/f9lander/app-icon.js index d08b4ce9a..572768a28 100644 --- a/apps/f9lander/app-icon.js +++ b/apps/f9lander/app-icon.js @@ -1 +1 @@ -require("heatshrink").decompress(atob("sFgwcA/4AL/1JkmSARMntu27YCEEbUk9ojT+QjiEBYCCzojS/gjOyYjS8gjOyV2EcVOEcVJEccnEcTaFEbySEEb4CDEf4j/EbYgUEf4jV/Ij/AA3JEf4AF/wgVEZnyEcQgWEZf8EcXkEbMnEQ35EC4CDz7UeAQlPRjoC/AX4C/AX4C3n4jgyf//n/5JHgngmCEcJHhn4jjR8Qjj//+fb4j/Ef4j/Ef4jgp4jk+Qjfyf/EcP+I4P/5Ijdk/yp3Y+V/R74jBSQPkEb127cSa8Aj/Ef4COye2a4Ij/Ef6zN4gjhpwgfAX4C/AX4C/AX4C/AX4CIk//ACnJEd8kESn+NxufEafyEeIC/AX4C/ASA")) +require("heatshrink").decompress(atob("mEwwcA/4AD/P8yVJkgCCye27dt2wRE//kCIuSuwRIBwgCCpwRQpIRRnYRQkmdCIvPCJICBEZ4RG/IRP/15CJ/z5IRPz4RM/gQB/n+BxICCn/z/P/BxQCDz7mIAX4Cq31/CJ+ebpiYE/IR/CNP/5IROnn//4jP5DFQ5sJCKAjPk3oCMMk4QRQAX4Ckn7jBAA/5CK8nCJPJNHA")) diff --git a/apps/f9lander/f9lander.png b/apps/f9lander/f9lander.png index 9ecf155411021db6cba17a262d80a24446c7e732..f03cc1645264e4bbbff1fbcb774a8c5c890bbd7d 100644 GIT binary patch delta 1093 zcmYL{eK6Yx7{`Bk@ls>7*;Xr4FV~v4BqjCURw5xv39^-HOSDlG+c2SC63n}uxkzYx z-g?%Sq26gsXGhO%=jCR_Ij`}uZmLzIm**FW?6m%!A1YsDrx5Y(y5)l^;H^#PG3t*YL!&qsgh>d3++`I8Q|#&PEL@W4Zgl`^CqOH zLrMx{WdWNF4i4aX4%mK>m;|@tz?%saX#!|^2xZ?wY8tq@f~_qSmx3SzO3EOL z2P_siIznwd>?vUKH()Tp+Z*PW;7|iBA6WYX)EW>=z|KwxYnxCd1$%p7GC{rxw-aDz z4^TCfmV=u+@S+t%!%CG#we=dJZzv?yiugojU7l=5R`j%QJ1-yHXxlRW#kY5KQUY5k zXATk)A>t}HkWrTF(z?Jzorg%mvh2tzGDR8aIl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S6S864_INt$Y(4o^+LPm1l=&>IOiXnROsotH gwk|pTW%2|TWhsQvk)QP*z<^-zboFyt=akR{0PP}|hyVZp From c83c82bd0990f39980e9e8957a331970f7822570 Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 16 May 2022 14:08:26 -0400 Subject: [PATCH 04/14] Swap screen shots, fix README --- apps/f9lander/README.md | 1 + apps/f9lander/metadata.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/f9lander/README.md b/apps/f9lander/README.md index ce0e56903..30136fe58 100644 --- a/apps/f9lander/README.md +++ b/apps/f9lander/README.md @@ -21,6 +21,7 @@ The fuel burn rate is proportional to the throttle level. ## Creators Liam Kl. B. + Marko Kl. B. ## Screenshots diff --git a/apps/f9lander/metadata.json b/apps/f9lander/metadata.json index 65831351b..7d2ee9dce 100644 --- a/apps/f9lander/metadata.json +++ b/apps/f9lander/metadata.json @@ -1,10 +1,10 @@ { "id": "f9lander", - "name": "Falcon9 lander", + "name": "Falcon9 Lander", "shortName":"F9lander", "version":"0.01", "description": "Land a rocket booster", "icon": "f9lander.png", - "screenshots" : [ { "url":"f9lander_screenshot1.png" }, { "url":"f9lander_screenshot2.png" }], + "screenshots" : [ { "url":"f9lander_screenshot2.png" }, { "url":"f9lander_screenshot1.png" }], "readme": "README.md", "tags": "game", "supports" : ["BANGLEJS", "BANGLEJS2"], From fec2074764e6a6913b4b7f417c2dc9ecb94cfac0 Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 16 May 2022 14:12:04 -0400 Subject: [PATCH 05/14] Fix app name on reload --- apps/f9lander/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/f9lander/app.js b/apps/f9lander/app.js index 41f3b7666..62d88df6d 100644 --- a/apps/f9lander/app.js +++ b/apps/f9lander/app.js @@ -104,7 +104,7 @@ function epilogue(str) { g.setFont("Vector", 24).setFontAlign(0, 0, 0).setColor(0, 0, 0).drawString(str, g.getWidth()/2, g.getHeight()/2).flip(); g.setFont("Vector", 16).drawString("<= again exit =>", g.getWidth()/2, g.getHeight()/2+20); clearInterval(stepInterval); - Bangle.on("swipe", (d) => { if (d>0) load(); else load('falcon.app.js'); }); + Bangle.on("swipe", (d) => { if (d>0) load(); else load('f9lander.app.js'); }); } function gameStep() { From 8e2fdffd20a2515d18369b2de3845ec6ff395378 Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 16 May 2022 14:14:17 -0400 Subject: [PATCH 06/14] Fix fuel burn rate on Bangle 1 --- apps/f9lander/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/f9lander/app.js b/apps/f9lander/app.js index 62d88df6d..7e52104c0 100644 --- a/apps/f9lander/app.js +++ b/apps/f9lander/app.js @@ -49,7 +49,7 @@ var landed = false; const gravity = 4; const dt = 0.1; -const fuelBurnRate = 20; +const fuelBurnRate = 20*(176/g.getHeight()); const maxV = 12; function flameImageGen (throttle) { From f7efc338f172ccc3a0468ce8ffcacb4a6e44d702 Mon Sep 17 00:00:00 2001 From: Richard de Boer Date: Mon, 16 May 2022 20:21:24 +0200 Subject: [PATCH 07/14] ClockFace: add `is12Hour` property, document `paused` --- modules/ClockFace.js | 5 ++++- modules/ClockFace.md | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/modules/ClockFace.js b/modules/ClockFace.js index 9818ae4e3..25e2430bf 100644 --- a/modules/ClockFace.js +++ b/modules/ClockFace.js @@ -32,6 +32,8 @@ function ClockFace(options) { if (dir>0 && options.down) options.down.apply(this); }; if (options.upDown) this._upDown = options.upDown; + + this.is12Hour = !!(require("Storage").readJSON("setting.json", 1) || {})["12hour"]; } ClockFace.prototype.tick = function() { @@ -69,6 +71,7 @@ ClockFace.prototype.start = function() { if (this._upDown) Bangle.setUI("clockupdown", d=>this._upDown.apply(this,[d])); else Bangle.setUI("clock"); delete this._last; + this.paused = false; this.tick(); Bangle.on("lcdPower", on => { @@ -87,7 +90,7 @@ ClockFace.prototype.pause = function() { ClockFace.prototype.resume = function() { if (this._timeout) return; // not paused delete this._last; - delete this.paused; + this.paused = false; if (this._resume) this._resume.apply(this); this.tick(true); }; diff --git a/modules/ClockFace.md b/modules/ClockFace.md index 1da6e6020..e760c3e74 100644 --- a/modules/ClockFace.md +++ b/modules/ClockFace.md @@ -59,6 +59,7 @@ var clock = new ClockFace({ draw: function(time, changed) { // at least draw or update is required // (re)draw entire clockface, time is a Date object // `changed` is the same format as for update() below, but always all true + // You can use `this.is12Hour` to test if the 'Time Format' setting is set to "12h" or "24h" }, // The difference between draw() and update() is that the screen is cleared // before draw() is called, so it needs to always redraw the entire clock @@ -107,4 +108,29 @@ var clock = new ClockFace(function(time) { }); clock.start(); +``` + +Properties +---------- +The following properties are automatically set on the clock: +* `is12Hour`: `true` if the "Time Format" setting is set to "12h", `false` for "24h". +* `paused`: `true` while the clock is paused. (You don't need to check this inside your `draw()` code) + +Inside the `draw()`/`update()` function you can access these using `this`: + +```js + +var ClockFace = require("ClockFace"); +var clock = new ClockFace({ + draw: function (time) { + if (this.is12Hour) // draw 12h time + else // use 24h format + } +}); +clock.start(); + +Bangle.on('step', function(steps) { + if (clock.paused === false) // draw step count +}); + ``` \ No newline at end of file From 0059e8ec92131625eaff63d6d7b6b5ca7613a7b1 Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 16 May 2022 14:49:02 -0400 Subject: [PATCH 08/14] Add "landed" screenshot --- apps/f9lander/README.md | 2 ++ apps/f9lander/f9lander_screenshot1.png | Bin 1340 -> 722 bytes apps/f9lander/f9lander_screenshot2.png | Bin 722 -> 1340 bytes apps/f9lander/f9lander_screenshot3.png | Bin 0 -> 3241 bytes apps/f9lander/metadata.json | 2 +- 5 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 apps/f9lander/f9lander_screenshot3.png diff --git a/apps/f9lander/README.md b/apps/f9lander/README.md index 30136fe58..16202f166 100644 --- a/apps/f9lander/README.md +++ b/apps/f9lander/README.md @@ -29,3 +29,5 @@ Marko Kl. B. ![](f9lander_screenshot1.png) ![](f9lander_screenshot2.png) + +![](f9lander_screenshot3.png) diff --git a/apps/f9lander/f9lander_screenshot1.png b/apps/f9lander/f9lander_screenshot1.png index a2f13d6c7278538af255e6c267cd11e0bfca517e..ea7d8a834d4fb8c60a13722957ff42be49e8010d 100644 GIT binary patch delta 579 zcmdnPb%}LCLcK(QPl&65!H*w*7=WOm0m%6AqXEeL@&Et-&*!^CflS6EZ+91VvBZwo zKn{C}r>`sfGgbjk4b2w5_L)HG?Vc`_F8yA=?^ovcdXWg&w^vM0x;$kKagJl`=-|J89+Islj@880!XMcYD`gcCd`SAUB zBDPj5?7aNH;jieoy6)fUyRB~6L~V`Vw!7%@)4Wxp2V%vi`Ah%U_5SLv>Avo}zHyZw zeK=cM!t%WPGougsZhmRoHp?AUla0&2ns?{%^zcpA($?R9$WGn%{C3p$JPxzW4^l55 zB}`_rm-zJk!_#^j`@{$K2RK(gSnM0lkzT~_zmX>|v_S7W$2qePf^*KYu4CACU}-|I zd`@UV!4os}oX`yu4>DS=-~A_Q%hQMR)$;GlZd>I0-c8T+L*A35cWF7G+ew`SskCgvV?bS9`PZTkT-in=(n&;aL=E<|Vf6q200(qQO+^Rh1rP}*AIvNc&j0`f4@pEp zRCwC$+dXdEFcb%HMhc9qy@9|J81Mx;*yx%iHz-_m>(D?$_kTtOx(D7m_XGxfgyv9{ z_#u8sqCQAI#@72IAC_e4r}ro^b^sFsnh$MY-L=D%(sqOPuwKxCR8f)~IZ zNd=E}dWCQ#cXWu8!P``DEO!i!R`3`c%|&q(Ox6eIsbFWx+n8{k3MR>5haA_H z?-p}-c&PI2t;2buPIpR%D!5ZJm}`{`SFlwwplkkL0)IAnBA1A9-om>W3S(uZM!cd>3uYlCu}LRO6elSVh?yDwhiRSS;|R`EbSy=EpZ+xvKT4Bq`PW%oiqN zcMayNihqos5+m6H)fd#BvwJOmW)`eg6>6dWWj$Ff1cXUDyU6XVKWYIAmSfz77i1Pp zj3VQ~s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ep^RgIjweX*F6{S zng;R6xnJepuIqSLTbm3UkL?3U=o1$ef`%}AeB$O!TDEu?QGF7ht%-Kc^pq9T8k3@P zGG1rrS}c9i+**knOHx88oL-*CD%?GF65) z5*S4G(eGct`@3UC&Wd6$_H^nigto|5#nPj`JeW+R`MfD{EE<+i*d5U6Xcy8WstL~` zCHIv-#|NGqxm6^3tKzSB37i|6Bu0?JO1BskJ_)lE@+~=&E>X{>cs}cDu|{tm;;8q% z4zw@}fdr{yU&Q$B-meJK-p3hb4E{cN9skD z{`R6$wCSHhw_zstK_#k^V4Kb?T$Zd;jrYF%91(8w;HtzU0#Td{Bk z=UycKS(y(H7k?lPjABiDI++ve-)A$rrJRhW)6m$YKBmk*j%PK+kA_-)rkS7G} z4Fr%v*3kuxrPKT(cMlShdIc?CIe8f+=`>S!D}c5TmI`@avn3ot{4XTFZc3Q0s9zyu SSxWyN2q$}2yJ}nVwf_Q8wo>u{ literal 0 HcmV?d00001 diff --git a/apps/f9lander/metadata.json b/apps/f9lander/metadata.json index 7d2ee9dce..75c6a0164 100644 --- a/apps/f9lander/metadata.json +++ b/apps/f9lander/metadata.json @@ -4,7 +4,7 @@ "version":"0.01", "description": "Land a rocket booster", "icon": "f9lander.png", - "screenshots" : [ { "url":"f9lander_screenshot2.png" }, { "url":"f9lander_screenshot1.png" }], + "screenshots" : [ { "url":"f9lander_screenshot1.png" }, { "url":"f9lander_screenshot2.png" }, { "url":"f9lander_screenshot3.png" }], "readme": "README.md", "tags": "game", "supports" : ["BANGLEJS", "BANGLEJS2"], From 33d25e4b0755288d5f9e77ba1c15bf72006bc7af Mon Sep 17 00:00:00 2001 From: Richard de Boer Date: Mon, 16 May 2022 21:28:08 +0200 Subject: [PATCH 09/14] barclock: use ClockFace.is12Hour instead of reading the setting --- apps/barclock/ChangeLog | 1 + apps/barclock/clock-bar.js | 7 +++---- apps/barclock/metadata.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/barclock/ChangeLog b/apps/barclock/ChangeLog index 0b8470b6a..5df032c4d 100644 --- a/apps/barclock/ChangeLog +++ b/apps/barclock/ChangeLog @@ -8,3 +8,4 @@ 0.08: Use theme colors, Layout library 0.09: Fix time/date disappearing after fullscreen notification 0.10: Use ClockFace library +0.11: Use ClockFace.is12Hour diff --git a/apps/barclock/clock-bar.js b/apps/barclock/clock-bar.js index a465bb692..987d41cc6 100644 --- a/apps/barclock/clock-bar.js +++ b/apps/barclock/clock-bar.js @@ -3,7 +3,6 @@ * A simple digital clock showing seconds as a bar **/ // Check settings for what type our clock should be -const is12Hour = (require("Storage").readJSON("setting.json", 1) || {})["12hour"]; let locale = require("locale"); { // add some more info to locale let date = new Date(); @@ -25,7 +24,7 @@ function renderBar(l) { function timeText(date) { - if (!is12Hour) { + if (!clock.is12Hour) { return locale.time(date, true); } const date12 = new Date(date.getTime()); @@ -38,7 +37,7 @@ function timeText(date) { return locale.time(date12, true); } function ampmText(date) { - return (is12Hour && locale.hasMeridian)? locale.meridian(date) : ""; + return (clock.is12Hour && locale.hasMeridian) ? locale.meridian(date) : ""; } function dateText(date) { const dayName = locale.dow(date, true), @@ -69,7 +68,7 @@ const ClockFace = require("ClockFace"), }, {lazy: true}); // adjustments based on screen size and whether we display am/pm let thickness; // bar thickness, same as time font "pixel block" size - if (is12Hour) { + if (this.is12Hour) { // Maximum font size = ( - ) / (5chars * 6px) thickness = Math.floor((Bangle.appRect.w-24)/(5*6)); } else { diff --git a/apps/barclock/metadata.json b/apps/barclock/metadata.json index 3ee7ccb3a..7bc61096d 100644 --- a/apps/barclock/metadata.json +++ b/apps/barclock/metadata.json @@ -1,7 +1,7 @@ { "id": "barclock", "name": "Bar Clock", - "version": "0.10", + "version": "0.11", "description": "A simple digital clock showing seconds as a bar", "icon": "clock-bar.png", "screenshots": [{"url":"screenshot.png"},{"url":"screenshot_pm.png"}], From 9750be3fa50fc38dae49d249a737b73a89f488f0 Mon Sep 17 00:00:00 2001 From: Alessandro Cocco Date: Sat, 14 May 2022 16:44:32 +0200 Subject: [PATCH 10/14] [lang] Update Italian translations --- lang/it_IT.json | 70 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/lang/it_IT.json b/lang/it_IT.json index 07545e1e7..4bc36ee48 100644 --- a/lang/it_IT.json +++ b/lang/it_IT.json @@ -45,6 +45,7 @@ "Messages": "Messaggi", "No Messages": "Nessun messaggio", "Keep Msgs": "Tieni i messaggi", + "Mark all read": "Segna tutto come letto", "Mark Unread": "Segna come non letto", "Vibrate": "Vibrazione", "Are you sure": "Sei sicuro/a", @@ -83,8 +84,8 @@ "Background": "Sfondo", "Foreground 2": "Primo piano 2", "Background 2": "Sfondo 2", - "Highlight FG": "Selezione PP", - "Highlight BG": "Selezione Sf", + "Highlight FG": "Primo piano selezione", + "Highlight BG": "Sfondo selezione", "Utilities": "Utilità", "Storage": "Memoria", "Compact Storage": "Compatta memoria", @@ -110,7 +111,7 @@ "Loading": "Caricamento", "Launcher Settings": "Impostazioni Launcher", "Font": "Font", - "Show clocks": "Mostra orologi", + "Show Clocks": "Mostra orologi", "Log": "Log", "Steps": "Passi", "steps": "passi", @@ -151,19 +152,76 @@ "start&lap/reset, BTN1: EXIT": "start&lap/reset, BTN1: EXIT", "back": "indietro", "color": "colore", - "BACK": "INDIETRO" + "BACK": "INDIETRO", + "Select App": "Seleziona app", + "No Apps Found": "Nessuna app trovata", + "Edit Alarm": "Modifica sveglia", + "Auto Snooze": "Ripeti automaticamente", + "Delete Alarm": "Cancella sveglia", + "Repeat Alarm": "Ripeti sveglia", + "Once": "Una volta", + "Workdays": "Giorni lavorativi", + "Weekends": "Weekend", + "Every Day": "Ogni giorno", + "Custom": "Personalizza", + "Edit Timer": "Modifica timer", + "Delete Timer": "Cancella timer", + "Scheduler Settings": "Impostazioni schedulatore", + "Nothing to Enable": "Niente da attivare", + "Nothing to Disable": "Niente da disattivare", + "Enable All": "Attiva tutto", + "Disable All": "Disattiva tutto", + "Delete All": "Cancella tutto", + "Updating boot0": "Aggiornamento boot0 in corso", + "Reloading": "Ricaricamento in corso", + "Date & Time": "Data & ora", + "Small": "Piccolo", + "Medium": "Medio", + "Big": "Grande", + "Text size": "Dimensione testo", + "Find Phone": "Trova telefono", + "Movement": "Movimento", + "Heart Rate": "Frequenza cardiaca", + "Step Counting": "Conteggio passi", + "Daily Step Goal": "Obiettivo passi giornalieri", + "Fullscreen": "Schermo intero", + "Unlock Watch": "Sblocca orologio", + "Flash Icon": "Icona lampeggiante", + "Auto-Open Music": "Apri modalità musica automaticamente", + "Colour": "Colore", + "Notifications": "Notifiche", + "Scheduler": "Schedulatore", + "Stop": "Stop", + "Min Font": "Dimensione minima del font" }, "//2": "App-specific overrides", + "alarm": { + "//": "'Crea' instead of 'Nuovo' because 'Nuovo sveglia' would be weird (and wrong)", + "New": "Crea", + "Custom Days": "Personalizza i giorni", + "Advanced": "Altre funzionalità" + }, + "health": { + "Health Tracking": "Monitoraggio salute", + "HRM Interval": "Intervallo monitoraggio cardiaco", + "3 min": "3 min", + "10 min": "10 min", + "Always": "Sempre" + }, "launch": { - "Vector font size": "Dim. font vett.", + "Vector Font Size": "Dim. font vett.", "App Source\nNot found": "Codice app\nnon trovato" }, "messages": { - "Unread timer": "Timer msg non letti" + "Unread timer": "Timer messaggi non letti" }, "run": { "Record Run": "Registra corsa" }, + "sched": { + "Unlock at Buzz": "Sblocca quando vibra", + "s": "s" + }, "setting": { "Clock Style": "Formato ora", "Compacting...\nTakes approx\n1 minute": "Compattamento in corso...\nCi vorrà circa un minuto", From 1d3428321ce41f34ad0e99b7536d8bfcb329ff9c Mon Sep 17 00:00:00 2001 From: Alessandro Cocco Date: Tue, 17 May 2022 23:18:44 +0200 Subject: [PATCH 11/14] [Health] Use var instead of let --- apps/health/app.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/health/app.js b/apps/health/app.js index a1fe1a4f7..30f57af19 100644 --- a/apps/health/app.js +++ b/apps/health/app.js @@ -46,7 +46,7 @@ function menuHRM() { function stepsPerHour() { E.showMessage(/*LANG*/"Loading..."); - let data = new Uint16Array(24); + var data = new Uint16Array(24); require("health").readDay(new Date(), h=>data[h.hr]+=h.steps); g.clear(1); Bangle.drawWidgets(); @@ -57,7 +57,7 @@ function stepsPerHour() { function stepsPerDay() { E.showMessage(/*LANG*/"Loading..."); - let data = new Uint16Array(31); + var data = new Uint16Array(31); require("health").readDailySummaries(new Date(), h=>data[h.day]+=h.steps); g.clear(1); Bangle.drawWidgets(); @@ -68,8 +68,8 @@ function stepsPerDay() { function hrmPerHour() { E.showMessage(/*LANG*/"Loading..."); - let data = new Uint16Array(24); - let cnt = new Uint8Array(23); + var data = new Uint16Array(24); + var cnt = new Uint8Array(23); require("health").readDay(new Date(), h=>{ data[h.hr]+=h.bpm; if (h.bpm) cnt[h.hr]++; @@ -84,8 +84,8 @@ function hrmPerHour() { function hrmPerDay() { E.showMessage(/*LANG*/"Loading..."); - let data = new Uint16Array(31); - let cnt = new Uint8Array(31); + var data = new Uint16Array(31); + var cnt = new Uint8Array(31); require("health").readDailySummaries(new Date(), h=>{ data[h.day]+=h.bpm; if (h.bpm) cnt[h.day]++; @@ -100,7 +100,7 @@ function hrmPerDay() { function movementPerHour() { E.showMessage(/*LANG*/"Loading..."); - let data = new Uint16Array(24); + var data = new Uint16Array(24); require("health").readDay(new Date(), h=>data[h.hr]+=h.movement); g.clear(1); Bangle.drawWidgets(); @@ -111,7 +111,7 @@ function movementPerHour() { function movementPerDay() { E.showMessage(/*LANG*/"Loading..."); - let data = new Uint16Array(31); + var data = new Uint16Array(31); require("health").readDailySummaries(new Date(), h=>data[h.day]+=h.movement); g.clear(1); Bangle.drawWidgets(); From 5b37bdca63850a1e12ab1cba010de65842ed081b Mon Sep 17 00:00:00 2001 From: Alessandro Cocco Date: Tue, 17 May 2022 23:19:42 +0200 Subject: [PATCH 12/14] [Health] Avoid division by zero --- apps/health/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/health/app.js b/apps/health/app.js index 30f57af19..c0a40bd93 100644 --- a/apps/health/app.js +++ b/apps/health/app.js @@ -183,7 +183,7 @@ function drawBarChart() { } // draw a fake 0 height bar if chart_index is outside the bounds of the array - if ((chart_index + bar - 1) >= 0 && (chart_index + bar - 1) < data_len) + if ((chart_index + bar - 1) >= 0 && (chart_index + bar - 1) < data_len && chart_max_datum > 0) bar_top = bar_bot - 100 * (chart_data[chart_index + bar - 1]) / chart_max_datum; else bar_top = bar_bot; From 774aa169ebe5432c6f1a212a282f90077e91342c Mon Sep 17 00:00:00 2001 From: Alessandro Cocco Date: Tue, 17 May 2022 23:27:13 +0200 Subject: [PATCH 13/14] [Health] Update metadata and changelog --- apps/health/ChangeLog | 1 + apps/health/metadata.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/health/ChangeLog b/apps/health/ChangeLog index 74be2faec..62d93e606 100644 --- a/apps/health/ChangeLog +++ b/apps/health/ChangeLog @@ -13,3 +13,4 @@ 0.12: Add setting for Daily Step Goal 0.13: Add support for internationalization 0.14: Move settings +0.15: Fix charts (fix #1366) diff --git a/apps/health/metadata.json b/apps/health/metadata.json index 58762c77a..a038f67b5 100644 --- a/apps/health/metadata.json +++ b/apps/health/metadata.json @@ -1,7 +1,7 @@ { "id": "health", "name": "Health Tracking", - "version": "0.14", + "version": "0.15", "description": "Logs health data and provides an app to view it", "icon": "app.png", "tags": "tool,system,health", From 5daf2be7df8114ca823cd2db6db26300d7ad847b Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 18 May 2022 09:23:23 +0100 Subject: [PATCH 14/14] boot 0.48: Workaround for BTHRM issues on Bangle.js 1 (write .boot files in chunks) --- apps/boot/ChangeLog | 1 + apps/boot/bootupdate.js | 14 ++++++++++++-- apps/boot/metadata.json | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/boot/ChangeLog b/apps/boot/ChangeLog index e3f492d3b..a43ecf86e 100644 --- a/apps/boot/ChangeLog +++ b/apps/boot/ChangeLog @@ -51,3 +51,4 @@ 0.45: Fix 0.44 regression (auto-add semi-colon between each boot code chunk) 0.46: Fix no clock found error on Bangle.js 2 0.47: Add polyfill for setUI with an object as an argument (fix regression for 2v12 devices after Layout module changed) +0.48: Workaround for BTHRM issues on Bangle.js 1 (write .boot files in chunks) diff --git a/apps/boot/bootupdate.js b/apps/boot/bootupdate.js index 119cd2c2c..4cb3c52e4 100644 --- a/apps/boot/bootupdate.js +++ b/apps/boot/bootupdate.js @@ -197,8 +197,18 @@ bootFiles.forEach(bootFile=>{ require('Storage').write('.boot0',"//"+bootFile+"\n",fileOffset); fileOffset+=2+bootFile.length+1; var bf = require('Storage').read(bootFile); - require('Storage').write('.boot0',bf,fileOffset); - fileOffset+=bf.length; + // we can't just write 'bf' in one go because at least in 2v13 and earlier + // Espruino wants to read the whole file into RAM first, and on Bangle.js 1 + // it can be too big (especially BTHRM). + var bflen = bf.length; + var bfoffset = 0; + while (bflen) { + var bfchunk = Math.min(bflen, 2048); + require('Storage').write('.boot0',bf.substr(bfoffset, bfchunk),fileOffset); + fileOffset+=bfchunk; + bfoffset+=bfchunk; + bflen-=bfchunk; + } require('Storage').write('.boot0',";\n",fileOffset); fileOffset+=2; }); diff --git a/apps/boot/metadata.json b/apps/boot/metadata.json index d1bf2edde..62adc4db1 100644 --- a/apps/boot/metadata.json +++ b/apps/boot/metadata.json @@ -1,7 +1,7 @@ { "id": "boot", "name": "Bootloader", - "version": "0.47", + "version": "0.48", "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings", "icon": "bootloader.png", "type": "bootloader",