More testing and tweaking of existing clock apps

pull/780/head^2
Gordon Williams 2021-07-28 10:54:22 +01:00
parent c1d06ef4d9
commit 6d73d175eb
17 changed files with 600 additions and 606 deletions

View File

@ -312,7 +312,7 @@
{ "id": "impwclock",
"name": "Imprecise Word Clock",
"icon": "clock-impword.png",
"version":"0.02",
"version":"0.03",
"description": "Imprecise word clock for vacations, weekends, and those who never need accurate time.",
"tags": "clock",
"type":"clock",
@ -1785,7 +1785,7 @@
"name": "SWL Clock / Short Wave Listner Clock",
"shortName": "SWL Clock",
"icon": "swlclk.png",
"version":"0.01",
"version":"0.02",
"description": "Display Local, UTC time and some programs on the shorts waves along the day, with the frequencies",
"tags": "tool,clock",
"type":"clock",
@ -1801,7 +1801,7 @@
"name": "Round clock with seconds, minutes and date",
"shortName": "Round Clock",
"icon": "app.png",
"version": "0.05",
"version": "0.06",
"description": "Designed round clock with ticks for minutes and seconds and heart rate indication",
"tags": "clock",
"type": "clock",
@ -1815,7 +1815,7 @@
"name": "fclock",
"shortName": "F Clock",
"icon": "app.png",
"version": "0.01",
"version": "0.02",
"description": "Simple design of a digital clock",
"tags": "clock",
"type": "clock",
@ -2623,7 +2623,7 @@
"name": "ISO Compliant Clock Face",
"shortName":"ISO Clock",
"icon": "isoclock.png",
"version":"0.01",
"version":"0.02",
"description": "Tweaked fork of digiclock for ISO date and time",
"tags": "clock",
"type" : "clock",
@ -2781,7 +2781,7 @@
{ "id": "lazyclock",
"name": "Lazy Clock",
"icon": "lazyclock.png",
"version":"0.02",
"version":"0.03",
"readme": "README.md",
"description": "Tells the time, roughly",
"tags": "clock",
@ -2821,13 +2821,13 @@
"name": "Game of Life Clock",
"shortName":"Conway's Clock",
"icon": "app.png",
"version":"0.05",
"version":"0.06",
"description": "Modification and clockification of Conway's Game of Life",
"tags": "clock",
"type" : "clock",
"readme": "README.md",
"storage": [
{"name":"lifeclk.app.js","url":"app.js"},
{"name":"lifeclk.app.js","url":"app.min.js"},
{"name":"lifeclk.img","url":"app-icon.js","evaluate":true}
]
},
@ -3347,7 +3347,7 @@
{ "id": "mysticclock",
"name": "Mystic Clock",
"icon": "mystic-clock.png",
"version":"1.00",
"version":"1.01",
"description": "A retro-inspired watchface featuring time, date, and an interactive data display line.",
"tags": "clock",
"type":"clock",

View File

@ -1 +1,2 @@
0.01: First published version of app
0.02: Move to Bangle.setUI to launcher support

View File

@ -1,4 +1,3 @@
{
var minutes;
var seconds;
var hours;
@ -200,7 +199,5 @@
// draw now
drawClock();
// Show launcher when middle button pressed
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
}
// Show launcher when button pressed
Bangle.setUI("clock");

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Stopped watchface from flashing every interval
0.03: Move to Bangle.setUI to launcher support

View File

@ -47,10 +47,9 @@ const activeColorNight = 0xF800 /*red*/ ;
const activeColorDay = 0xFFFF /* white */;
var hidxPrev;
var showDigitalTime = false;
function drawWordClock() {
// get time
var t = new Date();
var h = t.getHours();
@ -141,7 +140,7 @@ function drawWordClock() {
// Display digital time while button 1 is pressed
g.clearRect(0, 215, 240, 240);
if (BTN1.read()){
if (showDigitalTime){
g.setColor(activeColor);
g.drawString(time, 120, 215);
}
@ -158,8 +157,20 @@ Bangle.drawWidgets();
setInterval(drawWordClock, 1E4);
drawWordClock();
// Show digital time while top button is pressed
setWatch(drawWordClock, BTN1, {repeat:true,edge:"both"});
// Show digital time while top button is pressed (if we have physical buttons)
if (global.BTN3) setWatch(function() {
showDigitalTime = BTN1.read();
drawWordClock();
}, BTN1, {repeat:true,edge:"both"});
// Show launcher when middle button pressed
setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"});
// If LCD pressed (on Bangle.js 2) draw digital time
Bangle.on('drag',e=>{
var pressed = e.b!=0;
if (pressed!=showDigitalTime) {
showDigitalTime = pressed;
drawWordClock();
}
});
// Show launcher when button pressed
Bangle.setUI("clock");

View File

@ -1 +1,2 @@
0.01: Created app based on digiclock with some small tweaks.
0.02: Swap to Bangle.setUI for launcher/buttons

View File

@ -92,4 +92,5 @@ Bangle.on('lcdPower',on=>{
Bangle.loadWidgets();
Bangle.drawWidgets();
setWatch(Bangle.showLauncher, BTN2, {repeat : false, edge: "falling"});
// Show launcher when button pressed
Bangle.setUI("clock");

View File

@ -1,2 +1,3 @@
0.01: Launch app
0.02: Fix bug with the elusive one o'clock monster; Only change template when going over boundaries; Re-jig wording options
0.03: Use Bangle.setUI for launcher/buttons

View File

@ -221,22 +221,13 @@ function addEvents() {
}
});
setWatch(switchMode, BTN1, {
repeat: true,
edge: "falling"
});
setWatch(Bangle.showLauncher, BTN2, {
repeat: false,
edge: "falling"
});
setWatch(() => {
// Show launcher when button pressed
Bangle.setUI("clockupdown", btn=>{
if (btn<0) switchMode();
if (btn>0) {
currentFormatter = null;
refreshTime();
}, BTN3, {
repeat: true,
edge: "falling"
}
});
}

View File

@ -3,3 +3,4 @@
0.03: Ah yes. Some people prefer the 12 hour system 2021-01-14
0.04: Fixed a bug, doesn't run while display's on now 2021-01-18
0.05: Fixed a bug, doesn't count the time it was asleep when calculating the update time 2021-01-19
0.06: Use Bangle.set UI, change to unminified upload to ensure this works ok on Bangle.js

View File

@ -1,4 +1,4 @@
Bangle.setLCDTimeout(30);
// Name as .min.js so we don't try and pretokenise (which stops Bangle.js running this somehow)
const is12Hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"];
@ -435,9 +435,11 @@ function showMinAgain(){
}
function setButtons(){
setWatch(showMinAgain, BTN1, {repeat:true,edge:"falling"});
setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"});
setWatch(regen, BTN3, {repeat:true,edge:"falling"});
// Show launcher when button pressed
Bangle.setUI("clockupdown", btn=>{
if (btn<0) showMinAgain();
if (btn>0) regen();
});
}
let wentToSleepAt;

View File

@ -1 +1,2 @@
1.00: First published version.
1.01: Use Bangle.setUI for Launcher/buttons

View File

@ -200,16 +200,9 @@ if (Bangle.isLCDOn()) {
drawAll(); // draw immediately
}
// show launcher when middle button pressed
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
// rotate through info when the buttons are pressed
setWatch(() => {
nextInfo();
// Show launcher when button pressed
Bangle.setUI("clockupdown", btn=>{
if (btn<0) prevInfo();
if (btn>0) nextInfo();
drawAll();
}, BTN3, { repeat: true });
setWatch(() => {
prevInfo();
drawAll();
}, BTN1, { repeat: true });
});

View File

@ -3,3 +3,5 @@
0.03: Added HR indication to clock
0.04: Update font size and alignment
0.05: Changes which circle show minutes and seconds
0.06: Avoid function wrapper, use setUI for launcher
Clock face smaller so no longer breaks widgets

View File

@ -1,4 +1,3 @@
{
var minutes;
var seconds;
var hours;
@ -20,7 +19,7 @@
center: g.getHeight() / 2,
};
// Ssettings
// Settings
const settings = {
time: {
color: '#D6ED17',
@ -42,7 +41,7 @@
width: 10,
middle: screen.middle,
center: screen.center,
height: screen.height
height: screen.height-24
},
hr: {
color: '#333333',
@ -67,10 +66,10 @@
const drawMinArc = function (sections, color) {
g.setColor(color);
rad = (settings.circle.height / 2) - 40;
r1 = getArcXY(settings.circle.middle, settings.circle.center, rad, sections * (360 / 60) - 90);
var rad = (settings.circle.height / 2) - 40;
var r1 = getArcXY(settings.circle.middle, settings.circle.center, rad, sections * (360 / 60) - 90);
//g.setPixel(r[0],r[1]);
r2 = getArcXY(settings.circle.middle, settings.circle.center, rad - settings.circle.width, sections * (360 / 60) - 90);
var r2 = getArcXY(settings.circle.middle, settings.circle.center, rad - settings.circle.width, sections * (360 / 60) - 90);
//g.setPixel(r[0],r[1]);
g.drawLine(r1[0], r1[1], r2[0], r2[1]);
g.setColor('#333333');
@ -79,10 +78,10 @@
const drawSecArc = function (sections, color) {
g.setColor(color);
rad = (settings.circle.height / 2) - 20;
r1 = getArcXY(settings.circle.middle, settings.circle.center, rad, sections * (360 / 60) - 90);
var rad = (settings.circle.height / 2) - 20;
var r1 = getArcXY(settings.circle.middle, settings.circle.center, rad, sections * (360 / 60) - 90);
//g.setPixel(r[0],r[1]);
r2 = getArcXY(settings.circle.middle, settings.circle.center, rad - settings.circle.width, sections * (360 / 60) - 90);
var r2 = getArcXY(settings.circle.middle, settings.circle.center, rad - settings.circle.width, sections * (360 / 60) - 90);
//g.setPixel(r[0],r[1]);
g.drawLine(r1[0], r1[1], r2[0], r2[1]);
g.setColor('#333333');
@ -90,7 +89,7 @@
};
const drawClock = function () {
g.reset();
currentTime = new Date();
//Set to initial time when started
@ -223,7 +222,5 @@
// draw now
drawClock();
// Show launcher when middle button pressed
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
}
// Show launcher when button pressed
Bangle.setUI("clock");

View File

@ -1 +1,2 @@
0.01: New App!
0.02: Fix text alignment, move to setUI

View File

@ -17,8 +17,7 @@ function drawTime(){
var utc = getUTCTime(d);
var beats = Math.floor((((utc[0] + 1) % 24) + utc[1] / 60 + utc[2] / 3600) * 1000 / 24);
function drawStation(){
g.setFont("Vector",10);
g.reset().setFont("Vector",10).setFontAlign(0,0);
g.setColor("#ffffff");
switch (utc[0]) {
case 0:
@ -118,25 +117,19 @@ function drawTime(){
g.drawString("17h00-18h00 R.F.I.\n13740 15300 17850\n17h00-18h00 R.F.I.\n7205 9790",xyCenter,30);
break;
}
}
drawStation();
// Local time
g.setFont("6x8",1);
g.setColor("#cccccc");
g.setFont("6x8",1).setColor("#cccccc");
g.drawString("Loc",10,85);
g.setFont("7x11Numeric7Seg",4);
g.setColor("#ffffff");
g.setFont("7x11Numeric7Seg",4).setColor("#ffffff");
g.drawString(`${hours}:${minutes}:${seconds}`, xyCenter, 115, true);
// UTC time
g.setFont("6x8",1);
g.setColor("#cccccc");
g.setFont("6x8",1).setColor("#cccccc");
g.drawString("UTC",10,155);
g.setFont("7x11Numeric7Seg",4);
g.setColor("#ff0000");
g.setFont("7x11Numeric7Seg",4).setColor("#ff0000");
g.drawString(utc[0]+`:${minutes}:${seconds}`, xyCenter, 185,true);
// footer date
@ -147,6 +140,7 @@ function drawTime(){
}
function setGpsTime(){
print("set GPS time");
Bangle.setGPSPower(1);
Bangle.on('GPS',function(fix) {
if (fix.fix) {
@ -157,7 +151,7 @@ function setGpsTime(){
start();
} else {
stop();
g.setFont("Vector",10);
g.reset().setFont("Vector",10).setFontAlign(0,0);
g.setColor("#cccccc");
g.clearRect(0,25,240,80);
g.drawString("Mise à l'heure\npar satellites\nen cours...",xyCenter,40);
@ -166,14 +160,13 @@ function setGpsTime(){
}
function setButtons(){
// BTN 1
setWatch(() => {
// Show launcher when button pressed
Bangle.setUI("clockupdown", btn=>{
if (btn!=-1) return;
// if up pressed, turn GPS on and wait for new time
setGpsTime();
Bangle.beep(500, 4000);
}, BTN1, {edge:"rising", repeat:true});
// BTN 2
setWatch(Bangle.showLauncher, BTN2, {repeat:false,edge:"falling"});
});
}
var intervalRef = null;