diff --git a/apps/mixdiganclock/ChangeLog b/apps/mixdiganclock/ChangeLog new file mode 100644 index 000000000..0263ea13d --- /dev/null +++ b/apps/mixdiganclock/ChangeLog @@ -0,0 +1 @@ +0.01: fork from miclock, Added compatib with b widgets, devices(dynamic x,y) and themes(dynamic colors) diff --git a/apps/mixdiganclock/README.md b/apps/mixdiganclock/README.md new file mode 100644 index 000000000..1dc2fa67c --- /dev/null +++ b/apps/mixdiganclock/README.md @@ -0,0 +1,48 @@ +# Mix Digital & Analog Clock +A dual and simultaneous Analog and Digital Clock, also shows day, month and year. +Color are automatically set depending on the configured Theme or device + +Compatible with BangleJS1,BangleJS2,and EMSCRIPTENx emulators + +## Pictures: + +Bangle JS1 + +![](photo_mixdigan_bjs1.jpg) + +Screenshot emulator BJS2 + +![](ss_mixdigan_ems2.png) + +Screenshot emulator BJS1 + +![](ss_mixdigan_ems.png) + + + +## Usage + +Open and see + +## Features + +Compatibility with devices +Dynamic Colours and positions +Support for bottom widgets + + +## Controls + +exit: BTN2 BJS1 +exit/launcher : left area for BJS1 or BJS2 + +## Coming soon + +Right area or swipe - Change colors + + +## Support + +This app is so basic that probably the easiest is to just edit the code ;) + +Otherwise you can contact me [here](https://github.com/dapgo/my_espruino_smartwatch_things) \ No newline at end of file diff --git a/apps/mixdiganclock/metadata.json b/apps/mixdiganclock/metadata.json new file mode 100644 index 000000000..9af660a43 --- /dev/null +++ b/apps/mixdiganclock/metadata.json @@ -0,0 +1,16 @@ +{ + "id": "mixanadigclock", + "name": "Mix Dig&Anal Clock", + "version": "0.01", + "description": "A dual Analog and Digital Clock", + "icon": "mixanadigclock.png", + "type": "clock", + "tags": "clock", + "screenshots": [{"url":"bjs1-mixanadigclock_ss.png"}], + "supports": ["BANGLEJS","BANGLEJS"], + "allow_emulator": true, + "storage": [ + {"name":"mixanadigclock.app.js","url":"mixanadigclock.js"}, + {"name":"mixanadigclock.img","url":"mixanadigclock.js","evaluate":true} + ] +} diff --git a/apps/mixdiganclock/mixdiganclock.app.js b/apps/mixdiganclock/mixdiganclock.app.js new file mode 100644 index 000000000..e28a961b7 --- /dev/null +++ b/apps/mixdiganclock/mixdiganclock.app.js @@ -0,0 +1,159 @@ +//fork of miclock, dynamic x,y compatible with BJS1, BJS2 and bottom widgets +/*replace g.setFontVector(height) by g.setFont("Vector", 60); +below size 20 replace g.setFontVector(13) by +g.setFont("6x8",2 or 4x6 (built into all devices */ +/* jshint esversion: 6 */ +var locale = require("locale"); +var v_mode_debug=1; //, 0=no, 1 min, 2 prone detail +var v_model=process.env.BOARD; + +g.clear(); +//show the exit button +Bangle.setUI(); + +/*{ + mode : "custom", + back : Bangle.showLauncher +});*/ + +Bangle.loadWidgets(); + +// different values depending on loaded widgets or not, so after load widgets +var rect = Bangle.appRect; +var v_center_x = g.getWidth()/2; +var v_center_y = g.getHeight()/2; //vertical middle + +if (v_mode_debug>0) console.log(v_model+" center x, y "+v_center_x+" , "+v_center_y+" Max y,y2"+rect.y+" ,"+rect.y2); +var TxtPosition = { + "x1": 3, "x2": g.getWidth()-3, + "y1": rect.y+17, "y2": rect.y2-6, + "x_HH": g.getWidth()/2 ,"y_mm": v_center_y+32 + }; + +//emuls EMSCRIPTEN,EMSCRIPTEN2 +if (v_model=='BANGLEJS'||v_model=='EMSCRIPTEN') { + var Radius = { "center": 7, "hour": 50, "min": 70, "dots": 88 }; + var v_bfont_size=3; + var v_vfont_size=35; + var v_color1=0xFD20; // orange + var v_color2=0x7be0; + var v_color3=0xFFFF; //white , for hands PEND replace hardcoded by logic + var v_color_erase=g.getBgColor(); //0 + }else{ + var Radius = { "center": 5, "hour": 35, "min": 50, "dots": 60 }; + var v_bfont_size=2; + var v_vfont_size=22; + var v_color1=0x001F; // blue + var v_color2=0x03E0; //darkgreen + var v_color3=0x0000; //opposite to bg, for hands PEND replace hardcoded by logic + var v_color_erase=g.getBgColor(); + } +function rotatePoint(x, y, d) { + rad = -1 * d / 180 * Math.PI; + var sin = Math.sin(rad); + var cos = Math.cos(rad); + xn = ((v_center_x + x * cos - y * sin) + 0.5) | 0; + yn = ((v_center_y + x * sin - y * cos) + 0.5) | 0; + p = [xn, yn]; + return p; +} + +function drawMixedClock() { + var date = new Date(); + var dateArray = date.toString().split(" "); + var isEn = locale.name.startsWith("en"); + var point = []; + var minute = date.getMinutes(); + var hour = date.getHours(); + var radius; + + // draw date + g.setColor(v_color2); + //small size then bitmap + g.setFont("4x6", v_bfont_size); //6x8 + g.setFontAlign(-1, 0); + g.drawString(locale.dow(date,true) + ' ',TxtPosition.x1 , TxtPosition.y1, true); + g.drawString(isEn?(' ' + dateArray[2]):locale.month(date,true), TxtPosition.x1, TxtPosition.y2, true); + g.setFontAlign(1, 0); + g.drawString(isEn?locale.month(date,true):(' ' + dateArray[2]), TxtPosition.x2, TxtPosition.y1, true); + g.drawString(dateArray[3], TxtPosition.x2, TxtPosition.y2, true); + + // draw hour and minute dots + g.setColor(v_color1); // orange + for (i = 0; i < 60; i++) { + radius = (i % 5) ? 2 : 4; + point = rotatePoint(0, Radius.dots, i * 6); + g.fillCircle(point[0], point[1], radius); + } + + // erase last minutes hand + g.setColor(v_color_erase); + point = rotatePoint(0, Radius.min, (minute - 1) * 6); + g.drawLine(v_center_x, v_center_y, point[0], point[1]); + //to increase thicknes + g.drawLine(v_center_x+1, v_center_y, point[0]+1, point[1]); + + // erase last two hour hands + g.setColor(v_color_erase); + p = rotatePoint(0, Radius.hour, hour % 12 * 30 + (minute - 2) / 2 | 0); + g.drawLine(v_center_x, v_center_y, p[0], p[1]); + //to increase thicknes + g.drawLine(v_center_x+1, v_center_y, p[0]+1, p[1]); + + point = rotatePoint(0, Radius.hour, hour % 12 * 30 + (minute - 1) / 2 | 0); + g.drawLine(v_center_x, v_center_y, point[0], point[1]); + //to increase thicknes + g.drawLine(v_center_x+1, v_center_y, point[0]+1, point[1]); + + // draw digital time + //g.setFont("6x8", 3); 3 bigger size + g.setFontVector(v_vfont_size); + g.setColor(v_color2); + g.setFontAlign(0, 0); + g.drawString(dateArray[4].substr(0, 5), TxtPosition.x_HH, TxtPosition.y_mm, true); + + // draw new minute hand + point = rotatePoint(0, Radius.min, minute * 6); + g.setColor(v_color3); + g.drawLine(v_center_x, v_center_y, point[0], point[1]); + //to increase thicknes + g.drawLine(v_center_x+1, v_center_y, point[0]+1, point[1]); + + // draw new hour hand + point = rotatePoint(0, Radius.hour, hour % 12 * 30 + date.getMinutes() / 2 | 0); + g.setColor(v_color3); + g.drawLine(v_center_x, v_center_y, point[0], point[1]); + //to increase thicknes + g.drawLine(v_center_x+1, v_center_y, point[0]+1, point[1]); + + // draw center + g.setColor(v_color1); + g.fillCircle(v_center_x, v_center_y, Radius.center); +} +function UserInput(){ + Bangle.on('touch', function(button){ + switch(button){ + case 1: + //console.log("Touch 1");//left + Bangle.showLauncher(); + break; + case 2: + //console.log("Touch 2");//right + break; + case 3: + //console.log("Touch 3");//center 1+2 + break; + } + }); +} +Bangle.on('lcdPower', function(on) { + if (on) + drawMixedClock(); +}); + +Bangle.drawWidgets(); +UserInput(); +setInterval(drawMixedClock, 5E3); +drawMixedClock(); + + diff --git a/apps/mixdiganclock/mixdiganclock.img b/apps/mixdiganclock/mixdiganclock.img new file mode 100644 index 000000000..bf9947858 Binary files /dev/null and b/apps/mixdiganclock/mixdiganclock.img differ diff --git a/apps/mixdiganclock/mixdiganclock.png b/apps/mixdiganclock/mixdiganclock.png new file mode 100644 index 000000000..9881aed85 Binary files /dev/null and b/apps/mixdiganclock/mixdiganclock.png differ diff --git a/apps/mixdiganclock/photo_mixdigan_bjs1.jpg b/apps/mixdiganclock/photo_mixdigan_bjs1.jpg new file mode 100644 index 000000000..eeb23a8ee Binary files /dev/null and b/apps/mixdiganclock/photo_mixdigan_bjs1.jpg differ diff --git a/apps/mixdiganclock/ss_mixdigan_ems.png b/apps/mixdiganclock/ss_mixdigan_ems.png new file mode 100644 index 000000000..0c4b6fab1 Binary files /dev/null and b/apps/mixdiganclock/ss_mixdigan_ems.png differ diff --git a/apps/mixdiganclock/ss_mixdigan_ems2.png b/apps/mixdiganclock/ss_mixdigan_ems2.png new file mode 100644 index 000000000..fee8b8ef3 Binary files /dev/null and b/apps/mixdiganclock/ss_mixdigan_ems2.png differ diff --git a/apps/tempmonitor/ss_emul_bjs1.png b/apps/tempmonitor/ss_emul_bjs1.png index 1865ebc85..da7a53bd1 100644 Binary files a/apps/tempmonitor/ss_emul_bjs1.png and b/apps/tempmonitor/ss_emul_bjs1.png differ diff --git a/apps/tempmonitor/tempmonitor.app.js b/apps/tempmonitor/tempmonitor.app.js index 36b4bb654..d0757d076 100644 --- a/apps/tempmonitor/tempmonitor.app.js +++ b/apps/tempmonitor/tempmonitor.app.js @@ -2,6 +2,7 @@ // Version 001 standalone for developer // PEND //test with small savefreq +{ var v_mode_debug=0; //, 0=no, 1 min, 2 prone detail //var required for drawing with dynamic screen var rect = Bangle.appRect; @@ -134,4 +135,5 @@ if (v_saveToFile=="Y") { } setTimeout(ClearScreen, 3500); setTimeout(drawGraph,4000); -setTimeout(drawTemperature,4500); \ No newline at end of file +setTimeout(drawTemperature,4500); +} \ No newline at end of file diff --git a/apps/widhwbttm/ChangeLog b/apps/widhwbttm/ChangeLog index 23192b302..7d3aafc41 100644 --- a/apps/widhwbttm/ChangeLog +++ b/apps/widhwbttm/ChangeLog @@ -1,2 +1,3 @@ 0.01: 1st ver, inspired in some code from widclkbttm (Digital clock bttom widget) 0.02: Correction, intervals, dynamic color and font size depending on device +0.03: minor corrections, and color depending on theme diff --git a/apps/widhwbttm/README.md b/apps/widhwbttm/README.md index 2427ff818..85f7af47f 100644 --- a/apps/widhwbttm/README.md +++ b/apps/widhwbttm/README.md @@ -2,8 +2,9 @@ A basic HW/performance monitor widget that shows on real time some technical info, such as free mem, free storage, trash mem, files, FW version. Also allows to test the unfrequently used widget bottom area. Compatible with BangleJS1,BangleJS2,and EMSCRIPTENx emulators +Dynamic Color dependant on Theme color bg -forked from widclkbttm (Digital clock bttom widget) +forked from my widclkbttm (Digital clock bttom widget) ## Photo @@ -13,6 +14,8 @@ Example of usage ![](widhwbttm.ss1.jpg) ![](widhwbttm.ss2.jpg) +Screenshot emulator +![](screenshot_ems2.png) diff --git a/apps/widhwbttm/metadata.json b/apps/widhwbttm/metadata.json index f455e90a7..a01ffc344 100644 --- a/apps/widhwbttm/metadata.json +++ b/apps/widhwbttm/metadata.json @@ -2,12 +2,13 @@ "id": "widhwbttm", "name": "HW stats (Bottom) widget", "shortName": "Digital clock Bottom Widget", - "version": "0.02", + "version": "0.03", "description": "Displays technical info and mem stats in the bottom of the screen (may not be compatible with some apps)", "icon": "widhwbttm.png", "type": "widget", "tags": "widget", "supports": ["BANGLEJS","BANGLEJS2"], + "screenshots": [{"url":"screenshot.png"}], "readme": "README.md", "storage": [ {"name":"widhwbttm.wid.js","url":"widhwbttm.wid.js"} diff --git a/apps/widhwbttm/screenshot.png b/apps/widhwbttm/screenshot.png new file mode 100644 index 000000000..de648d399 Binary files /dev/null and b/apps/widhwbttm/screenshot.png differ diff --git a/apps/widhwbttm/screenshot_ems2.png b/apps/widhwbttm/screenshot_ems2.png new file mode 100644 index 000000000..d0c753946 Binary files /dev/null and b/apps/widhwbttm/screenshot_ems2.png differ diff --git a/apps/widhwbttm/widhwbttm.wid.js b/apps/widhwbttm/widhwbttm.wid.js index ec7b568a0..57cae8f76 100644 --- a/apps/widhwbttm/widhwbttm.wid.js +++ b/apps/widhwbttm/widhwbttm.wid.js @@ -1,42 +1,44 @@ (function() { let intervalRef = null; - var v_switch; // show stats + var v_count; // show stats var v_str_hw=new String(); - if (process.env.BOARD=='BANGLEJS'||process.env.BOARD=='EMSCRIPTEN') var v_font_size=16; - else var v_font_size=14; - if (v_switch == null || v_switch == '') v_switch=0; - function draw(){ - if (Bangle.CLOCK) return; + //if (process.env.BOARD=='BANGLEJS'||process.env.BOARD=='EMSCRIPTEN') var v_bfont_size=2; + var v_bfont_size=2; + if (g.theme.dark==true) var v_color=0xFFFF; //white + else var v_color=0x0000; //black + if (v_count == null || v_count == '') v_count=0; - if (v_switch==0) { - // var v_hw=process.env.VERSION; - v_str_hw="V "+process.env.VERSION.substr(0,6); - v_switch++; - } else if (v_switch==1) { + function draw(){ + // if (Bangle.CLOCK) return; //to remove from a clock + + if (v_count==0) { + v_str_hw=process.env.VERSION.substr(0,6); + v_count++; + } else if (v_count==1) { v_str_hw=process.env.BOARD.substr(0,3)+".."+process.env.BOARD.substr(process.env.BOARD.length-3,3); - v_switch++; + v_count++; } - else if (v_switch==2) { + else if (v_count==2) { v_str_hw="Bat "+E.getBattery()+"%"; - v_switch++; - } - else { + v_count++; + } + else { // text prefix has to be 4char stor=require("Storage").getStats(); - if (v_switch==3) { + if (v_count==3) { v_str_hw="Fre "+process.memory().free; //+"/"+process.memory().total; - v_switch++; + v_count++; } - else if (v_switch==4) { + else if (v_count==4) { v_str_hw="Sto "+stor.freeBytes; - v_switch++; - } else if (v_switch==5) { + v_count++; + } else if (v_count==5) { v_str_hw="Tra "+stor.trashBytes; - v_switch++; - } else if (v_switch==6) { + v_count++; + } else if (v_count==6) { v_str_hw="Fil "+stor.fileCount; - v_switch=0; + v_count=0; } // 4 char are prefix if (v_str_hw.length>7) { @@ -44,14 +46,13 @@ //substring betw x and y v_str_hw=v_str_hw.substr(0,v_str_hw.length-3)+"k"; } - } //else storage - g.reset().setFontVector(v_font_size).setFontAlign(-1, 0); + } //end else storage + g.reset().setColor(v_color).setFont("6x8",v_bfont_size).setFontAlign(-1, 0); //clean a longer previous string, care with br widgets g.drawString(" ", this.x, this.y+11, true); g.drawString(v_str_hw, this.x, this.y+11, true); } //end draw -WIDGETS["wdhwbttm"]={area:"bl",width:60,draw:draw}; -//{area:"bl",width:Bangle.CLOCK?0:60,draw:draw}; +WIDGETS["wdhwbttm"]={area:"bl",width:100,draw:draw}; if (Bangle.isLCDOn) intervalRef = setInterval(()=>WIDGETS["wdhwbttm"].draw(), 10*1000); })()