From dc78f270ae0798982e38617acacf5866515d865e Mon Sep 17 00:00:00 2001 From: dapgo Date: Tue, 27 Dec 2022 17:14:56 +0100 Subject: [PATCH] a minor mistake and a new feature --- apps/mixdiganclock/ChangeLog | 3 +- apps/mixdiganclock/README.md | 12 ++++---- apps/mixdiganclock/metadata.json | 2 +- apps/mixdiganclock/mixdiganclock.app.js | 37 +++++++++++++++++-------- apps/tempmonitor/interface.html | 4 +-- apps/tempmonitor/tempmonitor.app.js | 2 +- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/apps/mixdiganclock/ChangeLog b/apps/mixdiganclock/ChangeLog index 1661af14a..5354e44a7 100644 --- a/apps/mixdiganclock/ChangeLog +++ b/apps/mixdiganclock/ChangeLog @@ -1,2 +1,3 @@ 0.01: fork from miclock, Added compatib with b widgets, devices(dynamic x,y) and themes(dynamic colors) -0.02: Code refactored, change colors in real time \ No newline at end of file +0.02: Code refactored, change colors in real time +0.03: Hour point size can be modified on real time. \ No newline at end of file diff --git a/apps/mixdiganclock/README.md b/apps/mixdiganclock/README.md index a435c77db..aa860b4d4 100644 --- a/apps/mixdiganclock/README.md +++ b/apps/mixdiganclock/README.md @@ -41,13 +41,15 @@ Support for bottom widgets ## Controls -exit: BTN2 BJS1 -exit/launcher : left area for BJS1 or BJS2 +Exit : BTN2 (BJS1) +Exit/launcher : left area +Change Color : right area +Increase Hour Points : swipe right +Decrease Hour Points : swipe left + ## Coming soon - -Right area or swipe - Change colors - +A better color combination ## Support diff --git a/apps/mixdiganclock/metadata.json b/apps/mixdiganclock/metadata.json index f94acdc4f..8fae2dd8f 100644 --- a/apps/mixdiganclock/metadata.json +++ b/apps/mixdiganclock/metadata.json @@ -1,7 +1,7 @@ { "id": "mixdiganclock", "name": "Mix Dig&Anal Clock", - "version": "0.02", + "version": "0.03", "description": "A dual Analog and Digital Clock, based in Mixed Clock, but with more compatibility, change of colors, thicker clock hands... ", "icon": "mixdiganclock.png", "type": "clock", diff --git a/apps/mixdiganclock/mixdiganclock.app.js b/apps/mixdiganclock/mixdiganclock.app.js index fe1a41432..bd36c0f32 100644 --- a/apps/mixdiganclock/mixdiganclock.app.js +++ b/apps/mixdiganclock/mixdiganclock.app.js @@ -50,18 +50,18 @@ function setVariables() { v_count_col=2; //1st=0 1st compatible color (dark/light theme) v_color_erase=g.getBgColor(); if (v_model=='BANGLEJS'||v_model=='EMSCRIPTEN') { - Radius = { "center": 7, "hour": 50, "min": 70, "dots": 88 }; + Radius = { "center": 7, "hour": 50, "min": 70, "dots": 88,"circleH":6,"circleM":2 }; v_bfont_size=3; v_vfont_size=35; v_color1=2; // orange v_color2=4; v_color3=0; //white , for hands PEND replace hardcoded by logic }else{ - Radius = { "center": 5, "hour": 35, "min": 50, "dots": 60 }; + Radius = { "center": 5, "hour": 35, "min": 50, "dots": 60, "circleH":5,"circleM":2 }; v_bfont_size=2; v_vfont_size=22; v_color1=3; // blue - v_color2=1; + v_color2=1; v_color3=1; //opposite to bg, for hands PEND replace hardcoded by logic } if (v_mode_debug>0) console.log("set vars for: "+v_model); @@ -79,11 +79,15 @@ function rotatePoint(x, y, d) { } //no need to repaint -function drawStaticRing(){ +function drawStaticRing(v_colorparam){ // draw hour and minute dots - g.setColor(a_colors[v_color1]); // orange + if (v_mode_debug>0) console.log("color: "+v_colorparam); + //g.setColor(a_colors[v_color1]); + g.setColor(v_colorparam); + for (i = 0; i < 60; i++) { - radius = (i % 5) ? 2 : 4; + // ? 2 : 4; + radius = (i % 5) ? Radius.circleM : Radius.circleH; point = rotatePoint(0, Radius.dots, i * 6); //if (v_mode_debug>1) console.log("point"+point); g.fillCircle(point[0], point[1], radius); @@ -188,7 +192,7 @@ function UserInput(){ } else setVariables(); //v_count_col=3; //reset to 1st common color if (v_mode_debug>0) console.log("paint on color: "+v_count_col); - drawStaticRing(); + drawStaticRing(a_colors[v_color1]); drawDailyTxt(); break; case 3: @@ -196,6 +200,20 @@ function UserInput(){ break; } }); + Bangle.on('swipe', dir => { + if(dir == 1) { + drawStaticRing(v_color_erase); + if (Radius.circleH<13) Radius.circleH++; + if (v_mode_debug>0) console.log("radio: "+Radius.circleH); + drawStaticRing(a_colors[v_color1]); + } + else { + drawStaticRing(v_color_erase); + if (Radius.circleH>1) Radius.circleH--; + if (v_mode_debug>0) console.log("radio: "+Radius.circleH); + drawStaticRing(a_colors[v_color1]); + } + }); } Bangle.on('lcdPower', function(on) { if (on) @@ -207,9 +225,6 @@ Bangle.drawWidgets(); UserInput(); setInterval(drawMixedClock, 5E3); -drawStaticRing(); //pend best position +drawStaticRing(a_colors[v_color1]); drawDailyTxt(); //1st time drawMixedClock(); - - - diff --git a/apps/tempmonitor/interface.html b/apps/tempmonitor/interface.html index fdf447bde..12a63979d 100644 --- a/apps/tempmonitor/interface.html +++ b/apps/tempmonitor/interface.html @@ -47,12 +47,12 @@ function getData() { // You can call a utility function to save the data document.getElementById("btnSave").addEventListener("click", function() { - Util.saveCSV("gpsdata", csvData); + Util.saveCSV("temphistory.csv", csvData); }); // Or you can also delete the file document.getElementById("btnDelete").addEventListener("click", function() { Util.showModal("Deleting..."); - Util.eraseStorageFile("gpspoilog.csv", function() { + Util.eraseStorageFile("temphistory.csv", function() { Util.hideModal(); getData(); }); diff --git a/apps/tempmonitor/tempmonitor.app.js b/apps/tempmonitor/tempmonitor.app.js index 15d6b6708..c3af4bf7b 100644 --- a/apps/tempmonitor/tempmonitor.app.js +++ b/apps/tempmonitor/tempmonitor.app.js @@ -71,7 +71,7 @@ function saveToFile() { if (v_mode_debug==1) console.log("saving="+strlastSaveTime+";"+a.getHours()+":"+a.getMinutes()+";"+lastMeasure); if (v_saveToFile=='Y'){ //write(strlastSaveTime+";"+ - require("Storage").open(filename,"a").write(a.getMonth()+";"+a.getDate()+";"+a.getHours()+":"+a.getMinutes()+";"+lastMeasure+"\n"); + require("Storage").open(filename,"a").write((a.getMonth()+1)+";"+a.getDate()+";"+a.getHours()+":"+a.getMinutes()+";"+lastMeasure+"\n"); //(getTime()+","); v_saved_entries=v_saved_entries+1; }