diff --git a/apps.json b/apps.json index 95d39fdb7..b0061634a 100644 --- a/apps.json +++ b/apps.json @@ -2945,5 +2945,31 @@ {"name":"UI4swatch.app.js","url":"app.js"}, {"name":"UI4swatch.img","url":"app-icon.js","evaluate":true} ] -} +}, +{ "id": "simplest", + "name": "Simplest Clock", + "icon": "simplest.png", + "version":"0.01", + "description": "The simplest working clock, acts as a tutorial piece", + "tags": "clock", + "type":"clock", + "readme": "README.md", + "storage": [ + {"name":"simplest.app.js","url":"app.js"}, + {"name":"simplest.img","url":"icon.js","evaluate":true} + ] +}, +{ "id": "stepo", + "name": "Stepometer Clock", + "icon": "stepo.png", + "version":"0.01", + "description": "A large font watch, displays step count in a doughnut guage and warns of low battery", + "tags": "clock", + "type":"clock", + "readme": "README.md", + "storage": [ + {"name":"stepo.app.js","url":"app.js"}, + {"name":"stepo.img","url":"icon.js","evaluate":true} + ] +} ] diff --git a/apps/arrow/ChangeLog b/apps/arrow/ChangeLog new file mode 100644 index 000000000..96e34340f --- /dev/null +++ b/apps/arrow/ChangeLog @@ -0,0 +1,2 @@ +0.01: First version +0.02: Moved arrow image load to global scope diff --git a/apps/simplest/README.md b/apps/simplest/README.md new file mode 100644 index 000000000..2fe597234 --- /dev/null +++ b/apps/simplest/README.md @@ -0,0 +1,5 @@ +# Simplest Clock + +The simplest working clock, acts as a tutorial piece + +![](screenshot.jpg) diff --git a/apps/simplest/app.js b/apps/simplest/app.js new file mode 100644 index 000000000..32992534e --- /dev/null +++ b/apps/simplest/app.js @@ -0,0 +1,24 @@ + +function draw() { + var d = new Date(); + var da = d.toString().split(" "); + var time = da[4].substr(0,5); + + g.reset(); + g.clearRect(0, 30, 239, 99); + g.setFontAlign(0, -1); + g.setFont("Vector", 80); + g.drawString(time, 120, 40); +} + +// handle switch display on by pressing BTN1 +Bangle.on('lcdPower', function(on) { + if (on) draw(); +}); + +g.clear(); +Bangle.loadWidgets(); +Bangle.drawWidgets(); +setInterval(draw, 15000); // refresh every 15s +draw(); +setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"}); diff --git a/apps/simplest/icon.js b/apps/simplest/icon.js new file mode 100644 index 000000000..06f93e2ef --- /dev/null +++ b/apps/simplest/icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwIdah/wAof//4ECgYFB4AFBg4FB8AFBj/wh/4AoM/wEB/gFBvwCEBAU/AQP4gfAj8AgPwAoMPwED8AFBg/AAYIBDA4ngg4TB4EBApkPKgJSBJQIFTMgIFCJIIFDKoIFEvgFBGoMAnw7DP4IFEh+BAoItBg+DNIQwBMIaeCKoKxCPoIzCEgKVHUIqtFXIrFFaIrdFdIwAV")) diff --git a/apps/simplest/screenshot.jpg b/apps/simplest/screenshot.jpg new file mode 100644 index 000000000..6e91d27f6 Binary files /dev/null and b/apps/simplest/screenshot.jpg differ diff --git a/apps/simplest/simplest.info.js b/apps/simplest/simplest.info.js new file mode 100644 index 000000000..7f7d98783 --- /dev/null +++ b/apps/simplest/simplest.info.js @@ -0,0 +1,7 @@ +require("Storage").write("simplest.info",{ + "id":"simplest", + "name":"Simplest Clock", + "src":"simplest.app.js", + "icon":"simplest.img", + "type":"clock" +}); diff --git a/apps/simplest/simplest.png b/apps/simplest/simplest.png new file mode 100644 index 000000000..cf057046b Binary files /dev/null and b/apps/simplest/simplest.png differ diff --git a/apps/stepo/README.md b/apps/stepo/README.md new file mode 100644 index 000000000..86f462ca2 --- /dev/null +++ b/apps/stepo/README.md @@ -0,0 +1,26 @@ +# Stepometer Clock + +A large font watch, displays step count in a doughnut guage and warns of low battery + +## Features + +- Displays the time in large font +- Display current step count in a doughnut guage +- Show step count in the middle of the doughnut guage +- The guage show percentage of steps out of a goal of 10000 steps + + +![](screenshot1.jpg) + +- When the battery is less than 25% the doughnut turns red + +![](screenshot2.jpg) + + +# Notes + + +* Uses an arrayBuffer to prepare the doughnut guage. The arrayBuffer + is 160*160 and is larger than required. The reason for this is that + I plan to use this watch face with others in a multiclock format + and want to be able to reuse the arrayBuffer with other clocks. diff --git a/apps/stepo/app.js b/apps/stepo/app.js new file mode 100644 index 000000000..640355d98 --- /dev/null +++ b/apps/stepo/app.js @@ -0,0 +1,104 @@ +var pal4color = new Uint16Array([0x0000,0xFFFF,0x7BEF,0xAFE5],0,2); // b,w,grey,greenyellow +var pal4red = new Uint16Array([0x0000,0xFFFF,0xF800,0xAFE5],0,2); // b,w,red,greenyellow +var buf = Graphics.createArrayBuffer(160,160,2,{msb:true}); + +function flip(x,y) { + g.drawImage({width:160,height:160,bpp:2,buffer:buf.buffer, palette:pal4color}, x, y); + buf.clear(); +} + +function flip_red(x,y) { + g.drawImage({width:160,height:160,bpp:2,buffer:buf.buffer, palette:pal4red}, x, y); + buf.clear(); +} + +function radians(a) { + return a*Math.PI/180; +} + +function drawSteps() { + var i = 0; + var cx = 80; + var cy = 75; + var r = 56; + var steps = getSteps(); + var percent = steps / 10000; + + if (percent > 1) percent = 1; + + var startrot = 0 - 180; + var midrot = -180 - (360 * percent); + var endrot = -360 - 180; + + buf.setColor(3); // green-yellow + + // draw guauge + for (i = startrot; i > midrot; i--) { + x = cx + r * Math.sin(radians(i)); + y = cy + r * Math.cos(radians(i)); + buf.fillCircle(x,y,4); + } + + buf.setColor(2); // grey + + // draw remainder of guage in grey + for (i = midrot; i > endrot; i--) { + x = cx + r * Math.sin(radians(i)); + y = cy + r * Math.cos(radians(i)); + buf.fillCircle(x,y,4); + } + + // draw steps + buf.setColor(1); // white + buf.setFont("Vector", 24); + buf.setFontAlign(0,0); + buf.drawString(steps, 80, cy); + + // change the remaining color to RED if battery is below 25% + if (E.getBattery() > 25) + flip(40,100); + else + flip_red(40,100); +} + +function draw() { + var d = new Date(); + var da = d.toString().split(" "); + var time = da[4].substr(0,5); + + g.clearRect(0, 30, 239, 99); + g.setColor(1,1,1); + g.setFontAlign(0, -1); + g.setFont("Vector", 80); + g.drawString(time, 120, 30, true); + + drawSteps(); +} + +function getSteps() { + if (stepsWidget() !== undefined) + return stepsWidget().getSteps(); + return "-"; +} + +function stepsWidget() { + if (WIDGETS.activepedom !== undefined) { + return WIDGETS.activepedom; + } else if (WIDGETS.wpedom !== undefined) { + return WIDGETS.wpedom; + } + return undefined; +} + +// handle switch display on by pressing BTN1 +Bangle.on('lcdPower', function(on) { + if (on) draw(); +}); + +g.reset(); +g.clear(); +Bangle.loadWidgets(); +Bangle.drawWidgets(); +setInterval(draw, 15000); // refresh every 15s +draw(); +setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"}); diff --git a/apps/stepo/icon.js b/apps/stepo/icon.js new file mode 100644 index 000000000..29c93f7b3 --- /dev/null +++ b/apps/stepo/icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwkDEkEF5nMoUhiAVSAAUikUhCyYwBDBwWGC4YYMCwxHCAAUgCxEMCw3CC4kiPg5FF4tVgEBiIXEJI4uE4oKEgMSGBQWD4BTHGBIuDFooxEDAYJErgXCqCbJgSSHFxhJFJAZGDFxQABPQYXGCxZhESIReCRhBIIMARGPJAgXFCxqRDPAMFC6JgDOwalMMAwXDOxwXZPAUQC/4X/ABcs5jXVCQPCgEFAgPMCxwSC4gcDC55CCC4tQC5tcOQgFFLxoRDGoRINOIZBCC4ZIMFA4GCVJgPHMAQwLFwZwEBAYwJLoZvGBIaSIBgYlGGAYLHBQZVHHQgYBqoIBqoJFNRYAKQhIWMfpRJFAArLMDBIWMDBIWODIb3CCqIAQA=")) diff --git a/apps/stepo/screenshot1.jpg b/apps/stepo/screenshot1.jpg new file mode 100644 index 000000000..4e5c88a62 Binary files /dev/null and b/apps/stepo/screenshot1.jpg differ diff --git a/apps/stepo/screenshot2.jpg b/apps/stepo/screenshot2.jpg new file mode 100644 index 000000000..0388bec4a Binary files /dev/null and b/apps/stepo/screenshot2.jpg differ diff --git a/apps/stepo/stepo.info.js b/apps/stepo/stepo.info.js new file mode 100644 index 000000000..0bee0cfc7 --- /dev/null +++ b/apps/stepo/stepo.info.js @@ -0,0 +1,7 @@ +require("Storage").write("stepo.info",{ + "id":"stepo", + "name":"Stepometer Clock", + "src":"stepo.app.js", + "icon":"stepo.img", + "type":"clock" +}); diff --git a/apps/stepo/stepo.png b/apps/stepo/stepo.png new file mode 100644 index 000000000..b264f3a01 Binary files /dev/null and b/apps/stepo/stepo.png differ