diff --git a/apps.json b/apps.json index 8ff3627f6..ff669ca2c 100644 --- a/apps.json +++ b/apps.json @@ -2138,12 +2138,12 @@ { "id": "multiclock", "name": "Multi Clock", "icon": "multiclock.png", - "version":"0.07", + "version":"0.08", "description": "Clock with multiple faces - Big, Analogue, Digital, Text, Time-Date.\n Switch between faces with BTN1 & BTN3", "readme": "README.md", "tags": "clock", "type":"clock", - "allow_emulator":false, + "allow_emulator":true, "storage": [ {"name":"multiclock.app.js","url":"clock.js"}, {"name":"big.face.js","url":"big.js"}, diff --git a/apps/multiclock/ChangeLog b/apps/multiclock/ChangeLog index 7b553ae42..ac53da24b 100644 --- a/apps/multiclock/ChangeLog +++ b/apps/multiclock/ChangeLog @@ -5,6 +5,8 @@ 0.05: Add README 0.06: Add txt clock 0.07: Add Time Date clock and fix font sizes +0.08: Add pinned clock face + diff --git a/apps/multiclock/ana.min.js b/apps/multiclock/ana.min.js deleted file mode 100644 index f0c671e97..000000000 --- a/apps/multiclock/ana.min.js +++ /dev/null @@ -1,2 +0,0 @@ -(function(){return function(){function e(a,d,b,c){a*=k;g.fillPoly([120+Math.sin(a)*d,134-Math.cos(a)*d,120+Math.sin(a+h)*c,134-Math.cos(a+h)*c,120+Math.sin(a)*b,134-Math.cos(a)*b,120+Math.sin(a-h)*c,134-Math.cos(a-h)*c])}function l(){g.setColor(0,0,0);e(360*f.getSeconds()/60,-5,90,3);0===f.getSeconds()&&(e(360*(d.getHours()+d.getMinutes()/60)/12,-16,60,7),e(360*d.getMinutes()/60,-16,86,7),d=new Date);g.setColor(1,1,1);e(360*(d.getHours()+d.getMinutes()/60)/12,-16,60,7);e(360*d.getMinutes()/60,-16, - 86,7);g.setColor(0,1,1);f=new Date;e(360*f.getSeconds()/60,-5,90,3);g.setColor(0,0,0);g.fillCircle(120,134,2)}var h=Math.PI/2,k=Math.PI/180,d,f;return{init:function(){f=d=new Date;g.setColor(1,1,1);for(var a=0;60>a;a++){var e=360*a/60,b=e*k,c=120+100*Math.sin(b);b=134-100*Math.cos(b);0==e%90?(g.setColor(0,1,1),g.fillRect(c-6,b-6,c+6,b+6)):0==e%30?(g.setColor(0,1,1),g.fillRect(c-4,b-4,c+4,b+4)):(g.setColor(1,1,1),g.fillRect(c-1,b-1,c+1,b+1))}l()},tick:l}}})(); \ No newline at end of file diff --git a/apps/multiclock/clock.js b/apps/multiclock/clock.js index ed2383b8d..50410f096 100644 --- a/apps/multiclock/clock.js +++ b/apps/multiclock/clock.js @@ -1,6 +1,8 @@ var FACES = []; -var iface = 0; -require("Storage").list(/\.face\.js$/).forEach(face=>FACES.push(eval(require("Storage").read(face)))); +var STOR = require("Storage"); +STOR.list(/\.face\.js$/).forEach(face=>FACES.push(eval(require("Storage").read(face)))); +var lastface = STOR.readJSON("multiclock.json")||{pinned:0}; +var iface = lastface.pinned; var face = FACES[iface](); var intervalRefSec; @@ -25,7 +27,14 @@ function setButtons(){ face = FACES[iface](); startdraw(); } - setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"}); + function finish(){ + if (lastface.pinned!=iface){ + lastface.pinned=iface; + STOR.write("multiclock.json",lastface); + } + Bangle.showLauncher(); + } + setWatch(finish, BTN2, {repeat:false,edge:"falling"}); setWatch(newFace.bind(null,1), BTN1, {repeat:true,edge:"rising"}); setWatch(newFace.bind(null,-1), BTN3, {repeat:true,edge:"rising"}); }