From e5d806b5ebbb0453caac86e7a49cbd6e7417c410 Mon Sep 17 00:00:00 2001 From: Stuff-etc Date: Sat, 23 Mar 2024 05:39:11 +0100 Subject: [PATCH] button exits the calendar --- apps/clockcal/app.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/clockcal/app.js b/apps/clockcal/app.js index 58ddd7ef5..9db81c7ca 100644 --- a/apps/clockcal/app.js +++ b/apps/clockcal/app.js @@ -156,7 +156,7 @@ function drawSeconds() { } function drawWatch() { - if (DEBUG) console.log("CALENDAR"); + if (DEBUG) console.log("DRAWWATCH"); monthOffset = 0; state = "watch"; var d = new Date(); @@ -197,6 +197,7 @@ function drawWatch() { if (DEBUG) console.log("Next Day:" + (nextday / 3600)); if (typeof dayInterval !== "undefined") clearTimeout(dayInterval); dayInterval = setTimeout(drawWatch, nextday * 1000); + if (DEBUG) console.log("ended DRAWWATCH. next refresh in " + nextday + "s"); } function BTevent() { @@ -211,8 +212,11 @@ function action(a) { g.reset(); if (typeof secondInterval !== "undefined") clearTimeout(secondInterval); if (DEBUG) console.log("action:" + a); + state = "unknown"; + console.log("state -> unknown"); switch (a) { case "[ignore]": + drawWatch(); break; case "[calend.]": drawFullCalendar(); @@ -276,7 +280,6 @@ function input(dir) { drawWatch(); } break; - } } @@ -309,3 +312,10 @@ NRF.on('disconnect', BTevent); dimSeconds = Bangle.isLocked(); drawWatch(); +setWatch(function() { + if (state == "watch") { + Bangle.showLauncher() + } else if (state == "calendar") { + drawWatch(); + } +}, BTN1, {repeat:true, edge:"falling"});