miclock2: Redraw only when seconds change

pull/1796/head
Erik Andresen 2022-05-05 18:52:23 +02:00
parent 500309e217
commit 24181f65bb
3 changed files with 6 additions and 4 deletions

View File

@ -1 +1,2 @@
0.01: New App! 0.01: New App!
0.02: Redraw only when seconds change

View File

@ -6,6 +6,7 @@ const Radius = { "center": 7, "hour": 60, "min": 80, "dots": 88 };
const Center = { "x": 120, "y": 96 }; const Center = { "x": 120, "y": 96 };
const Widths = { hour: 2, minute: 2 }; const Widths = { hour: 2, minute: 2 };
var buf = Graphics.createArrayBuffer(240,192,1,{msb:true}); var buf = Graphics.createArrayBuffer(240,192,1,{msb:true});
var lastDate = new Date();
function rotatePoint(x, y, d) { function rotatePoint(x, y, d) {
rad = -1 * d / 180 * Math.PI; rad = -1 * d / 180 * Math.PI;
@ -45,10 +46,10 @@ function setLineWidth(x1, y1, x2, y2, lw) {
]; ];
} }
function drawMixedClock(force) { function drawMixedClock(force) {
if ((force || Bangle.isLCDOn()) && buf.buffer) { var date = new Date();
var date = new Date(); if ((force || Bangle.isLCDOn()) && buf.buffer && date.getSeconds() === lastDate.getSeconds()) {
lastDate = date;
var dateArray = date.toString().split(" "); var dateArray = date.toString().split(" ");
var isEn = locale.name.startsWith("en"); var isEn = locale.name.startsWith("en");
var point = []; var point = [];

View File

@ -1,7 +1,7 @@
{ {
"id": "miclock2", "id": "miclock2",
"name": "Mixed Clock 2", "name": "Mixed Clock 2",
"version": "0.01", "version": "0.02",
"description": "White color variant of the Mixed Clock with thicker clock hands for better readability in the bright sunlight, extra space under the clock for widgets and seconds in the digital clock.", "description": "White color variant of the Mixed Clock with thicker clock hands for better readability in the bright sunlight, extra space under the clock for widgets and seconds in the digital clock.",
"icon": "clock-mixed.png", "icon": "clock-mixed.png",
"type": "clock", "type": "clock",