Merge branch 'espruino:master' into master

master
jamespsteinberg 2023-11-02 01:26:07 -04:00 committed by GitHub
commit 3c06f268b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 38 additions and 14 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",

View File

@ -1,2 +1,5 @@
0.01: New App!
0.02: Shorten the timeout before executing to 250 ms.
0.03: Add inner timeout of 150 ms so user has more time to release the button
before clock ui is initialized and adds it's button watch for going to
launcher.

View File

@ -1,5 +1,5 @@
{let buzzTimeout;
setWatch((e)=>{
if (e.state) buzzTimeout = setTimeout(()=>{Bangle.buzz(80,0.40);Bangle.showClock();}, 250);
if (e.state) buzzTimeout = setTimeout(()=>{Bangle.buzz(80,0.40);setTimeout(Bangle.showClock,150);}, 250);
if (!e.state && buzzTimeout) clearTimeout(buzzTimeout);},
BTN,{repeat:true, edge:'both' });}
BTN,{repeat:true,edge:'both'});}

View File

@ -1,7 +1,7 @@
{ "id": "fastreset",
"name": "Fast Reset",
"shortName":"Fast Reset",
"version":"0.02",
"version":"0.03",
"description": "Reset the watch by pressing the hardware button just a little bit longer than a click. If 'Fastload Utils' is installed this will typically be done with fastloading. A buzz acts as indicator.",
"icon": "app.png",
"type": "bootloader",

View File

@ -3,3 +3,4 @@
0.03: Swipe down to see widgets
Support for fast loading
0.04: Localisation request: added Miles and AM/PM
0.05: Prevent exceptions from halting the draw cycle

View File

@ -2,7 +2,7 @@
"id": "pebbled",
"name": "Pebble Clock with distance",
"shortName": "Pebble + distance",
"version": "0.04",
"version": "0.05",
"description": "Fork of Pebble Clock with distance in KM. Both step count and the distance are on the main screen. Default step length = 0.75m (can be changed in settings).",
"readme": "README.md",
"icon": "pebbled.png",

View File

@ -37,6 +37,13 @@ const h3 = 7*h/8 - 10;
let batteryWarning = false;
let draw = function() {
// queue next draw
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
let date = new Date();
let da = date.toString().split(" ");
let timeStr = settings.localization === "US" ? tConv24(da[4].substr(0,5)) : da[4].substr(0,5);
@ -101,13 +108,6 @@ let draw = function() {
else
g.setColor('#000'); // otherwise black regardless of theme
g.drawString(distanceStr, w/2, ha + 107);
// queue next draw
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
};
// at x,y width:wi thicknes:th

View File

@ -3,3 +3,4 @@
0.03: Show day/month, add animations, fix !mylocation and text glitch
0.04: Always show the widgets, swifter animations and lighter sea line
0.05: Fixed hours increasing too early, added missing 23 o'clock, simplified code
0.06: Draw the screen exactly on the minute boundary

View File

@ -358,13 +358,18 @@ function initialAnimation () {
initialAnimationFrame();
}
function renderAndQueue() {
setTimeout(renderAndQueue, 60000 - (Date.now() % 60000));
renderScreen();
}
function main () {
sunRiseX = xfromTime(sunrise.getHours() + sunrise.getMinutes() / 60);
sunSetX = xfromTime(sunset.getHours() + sunset.getMinutes() / 60);
g.setBgColor(0, 0, 0);
g.clear();
setInterval(renderScreen, 60 * 1000);
renderAndQueue();
initialAnimation();
}

View File

@ -2,7 +2,7 @@
"id": "sunrise",
"name": "Sunrise",
"shortName": "Sunrise",
"version": "0.05",
"version": "0.06",
"type": "clock",
"description": "Show sunrise and sunset times",
"icon": "app.png",