1
0
Fork 0

a minor mistake and a new feature

master
dapgo 2022-12-27 17:14:56 +01:00
parent 5a3317a324
commit dc78f270ae
6 changed files with 39 additions and 21 deletions

View File

@ -1,2 +1,3 @@
0.01: fork from miclock, Added compatib with b widgets, devices(dynamic x,y) and themes(dynamic colors) 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 0.02: Code refactored, change colors in real time
0.03: Hour point size can be modified on real time.

View File

@ -41,13 +41,15 @@ Support for bottom widgets
## Controls ## Controls
exit: BTN2 BJS1 Exit : BTN2 (BJS1)
exit/launcher : left area for BJS1 or BJS2 Exit/launcher : left area
Change Color : right area
Increase Hour Points : swipe right
Decrease Hour Points : swipe left
## Coming soon ## Coming soon
A better color combination
Right area or swipe - Change colors
## Support ## Support

View File

@ -1,7 +1,7 @@
{ {
"id": "mixdiganclock", "id": "mixdiganclock",
"name": "Mix Dig&Anal Clock", "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... ", "description": "A dual Analog and Digital Clock, based in Mixed Clock, but with more compatibility, change of colors, thicker clock hands... ",
"icon": "mixdiganclock.png", "icon": "mixdiganclock.png",
"type": "clock", "type": "clock",

View File

@ -50,14 +50,14 @@ function setVariables() {
v_count_col=2; //1st=0 1st compatible color (dark/light theme) v_count_col=2; //1st=0 1st compatible color (dark/light theme)
v_color_erase=g.getBgColor(); v_color_erase=g.getBgColor();
if (v_model=='BANGLEJS'||v_model=='EMSCRIPTEN') { 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_bfont_size=3;
v_vfont_size=35; v_vfont_size=35;
v_color1=2; // orange v_color1=2; // orange
v_color2=4; v_color2=4;
v_color3=0; //white , for hands PEND replace hardcoded by logic v_color3=0; //white , for hands PEND replace hardcoded by logic
}else{ }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_bfont_size=2;
v_vfont_size=22; v_vfont_size=22;
v_color1=3; // blue v_color1=3; // blue
@ -79,11 +79,15 @@ function rotatePoint(x, y, d) {
} }
//no need to repaint //no need to repaint
function drawStaticRing(){ function drawStaticRing(v_colorparam){
// draw hour and minute dots // 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++) { 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); point = rotatePoint(0, Radius.dots, i * 6);
//if (v_mode_debug>1) console.log("point"+point); //if (v_mode_debug>1) console.log("point"+point);
g.fillCircle(point[0], point[1], radius); g.fillCircle(point[0], point[1], radius);
@ -188,7 +192,7 @@ function UserInput(){
} }
else setVariables(); //v_count_col=3; //reset to 1st common color else setVariables(); //v_count_col=3; //reset to 1st common color
if (v_mode_debug>0) console.log("paint on color: "+v_count_col); if (v_mode_debug>0) console.log("paint on color: "+v_count_col);
drawStaticRing(); drawStaticRing(a_colors[v_color1]);
drawDailyTxt(); drawDailyTxt();
break; break;
case 3: case 3:
@ -196,6 +200,20 @@ function UserInput(){
break; 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) { Bangle.on('lcdPower', function(on) {
if (on) if (on)
@ -207,9 +225,6 @@ Bangle.drawWidgets();
UserInput(); UserInput();
setInterval(drawMixedClock, 5E3); setInterval(drawMixedClock, 5E3);
drawStaticRing(); //pend best position drawStaticRing(a_colors[v_color1]);
drawDailyTxt(); //1st time drawDailyTxt(); //1st time
drawMixedClock(); drawMixedClock();

View File

@ -47,12 +47,12 @@ function getData() {
// You can call a utility function to save the data // You can call a utility function to save the data
document.getElementById("btnSave").addEventListener("click", function() { document.getElementById("btnSave").addEventListener("click", function() {
Util.saveCSV("gpsdata", csvData); Util.saveCSV("temphistory.csv", csvData);
}); });
// Or you can also delete the file // Or you can also delete the file
document.getElementById("btnDelete").addEventListener("click", function() { document.getElementById("btnDelete").addEventListener("click", function() {
Util.showModal("Deleting..."); Util.showModal("Deleting...");
Util.eraseStorageFile("gpspoilog.csv", function() { Util.eraseStorageFile("temphistory.csv", function() {
Util.hideModal(); Util.hideModal();
getData(); getData();
}); });

View File

@ -71,7 +71,7 @@ function saveToFile() {
if (v_mode_debug==1) console.log("saving="+strlastSaveTime+";"+a.getHours()+":"+a.getMinutes()+";"+lastMeasure); if (v_mode_debug==1) console.log("saving="+strlastSaveTime+";"+a.getHours()+":"+a.getMinutes()+";"+lastMeasure);
if (v_saveToFile=='Y'){ if (v_saveToFile=='Y'){
//write(strlastSaveTime+";"+ //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()+","); //(getTime()+",");
v_saved_entries=v_saved_entries+1; v_saved_entries=v_saved_entries+1;
} }