Merge pull request #3065 from LeonMatthes/calclock

CalClock: Add buzzing before events
pull/3067/head
Rob Pilling 2023-10-30 15:13:27 -05:00 committed by GitHub
commit e8e6136443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -4,3 +4,4 @@
0.04: Improve current time readability in light theme.
0.05: Show calendar colors & improved all day events.
0.06: Improved multi-line locations & titles
0.07: Buzz 30, 15 and 1 minute before an event

View File

@ -117,6 +117,17 @@ function fullRedraw() {
drawFutureEvents(y);
}
function buzzForEvents() {
let nextEvent = next[0]; if (!nextEvent) return;
if (nextEvent.allDay) return;
let minToEvent = Math.round((nextEvent.timestamp - getTime()) / 60.0);
switch (minToEvent) {
case 30: require("buzz").pattern(","); break;
case 15: require("buzz").pattern(", ,"); break;
case 1: require("buzz").pattern(": : :"); break;
}
}
function redraw() {
g.reset();
if (current.find(e=>!isActive(e)) || next.find(isActive)) {
@ -124,10 +135,12 @@ function redraw() {
} else {
drawCurrentEvents(30);
}
buzzForEvents();
}
g.clear();
fullRedraw();
buzzForEvents();
var minuteInterval = setInterval(redraw, 60 * 1000);
Bangle.setUI("clock");

View File

@ -2,7 +2,7 @@
"id": "calclock",
"name": "Calendar Clock",
"shortName": "CalClock",
"version": "0.06",
"version": "0.07",
"description": "Show the current and upcoming events synchronized from Gadgetbridge",
"icon": "calclock.png",
"type": "clock",