diff --git a/apps/contourclock/ChangeLog b/apps/contourclock/ChangeLog index d13b16702..2fa26b89a 100644 --- a/apps/contourclock/ChangeLog +++ b/apps/contourclock/ChangeLog @@ -10,3 +10,4 @@ 0.28: More config options for cleaner look, enabled fast loading 0.29: Fixed a bug that would leave old font files in storage. 0.30: Added options to show widgets and date on twist and tap. New fonts. +0.31: Bugfix, no more freeze. diff --git a/apps/contourclock/app.js b/apps/contourclock/app.js index 407203e6c..1a510f014 100644 --- a/apps/contourclock/app.js +++ b/apps/contourclock/app.js @@ -34,9 +34,12 @@ extrasTimeout = undefined; hideExtras(); }, 5000); + extrasShown = false; }; let drawExtras = function() { //draw date, day of the week and widgets let date = new Date(); + g.reset(); + g.clearRect(0, 138, g.getWidth() - 1, 176); g.setFont("Teletext10x18Ascii").setFontAlign(0, 1); if (settings.weekday) g.drawString(require("locale").dow(date).toUpperCase(), g.getWidth() / 2, g.getHeight() - 18); if (settings.date) g.drawString(require('locale').date(date, 1), g.getWidth() / 2, g.getHeight()); @@ -45,21 +48,23 @@ }; let hideExtras = function() { if (extrasTimeout) clearTimeout(extrasTimeout); + extrasTimeout = undefined; //NEW + g.reset(); g.clearRect(0, 138, g.getWidth() - 1, 176); require("widget_utils").hide(); - extrasShown = false; + extrasShown = false; ///NEW }; let draw = function() { + if (drawTimeout) clearTimeout(drawTimeout); //NEW + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + draw(); + }, 60000 - (Date.now() % 60000)); let date = new Date(); g.reset(); if (extrasShown) drawExtras(); else hideExtras(); require('contourclock').drawClock(settings.fontIndex); - if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = setTimeout(function() { - drawTimeout = undefined; - draw(); - }, 60000 - (Date.now() % 60000)); }; if (settings.hideWhenLocked) { onLock = locked => { @@ -83,6 +88,8 @@ Bangle.removeListener('twist', showExtras); if (drawTimeout) clearTimeout(drawTimeout); if (extrasTimeout) clearTimeout(extrasTimeout); + drawTimeout = undefined; + extrasTimeout = undefined; if (settings.hideWhenLocked) require("widget_utils").show(); g.reset(); g.clear(); @@ -91,7 +98,7 @@ g.clear(); if (settings.widgets) { Bangle.loadWidgets(); - Bangle.drawWidgets(); + setTimeout(Bangle.drawWidgets,0); //NEW } draw(); } diff --git a/apps/contourclock/metadata.json b/apps/contourclock/metadata.json index ca5ee114f..5c97ce933 100644 --- a/apps/contourclock/metadata.json +++ b/apps/contourclock/metadata.json @@ -1,7 +1,7 @@ { "id": "contourclock", "name": "Contour Clock", "shortName" : "Contour Clock", - "version":"0.30", + "version":"0.31", "icon": "app.png", "readme": "README.md", "description": "A Minimalist clockface with large Digits.", diff --git a/apps/pomoplus/ChangeLog b/apps/pomoplus/ChangeLog index 1a137aad0..96104469b 100644 --- a/apps/pomoplus/ChangeLog +++ b/apps/pomoplus/ChangeLog @@ -1,3 +1,4 @@ 0.01: New app! 0.02-0.04: Bug fixes -0.05: Submitted to the app loader \ No newline at end of file +0.05: Submitted to the app loader +0.06: Added setting to show clock after start/resume diff --git a/apps/pomoplus/app.js b/apps/pomoplus/app.js index 73af5c935..a9e21b98a 100644 --- a/apps/pomoplus/app.js +++ b/apps/pomoplus/app.js @@ -1,3 +1,5 @@ +g.clear(); + Bangle.POMOPLUS_ACTIVE = true; //Prevent the boot code from running. To avoid having to reload on every interaction, we'll control the vibrations from here when the user is in the app. const storage = require("Storage"); @@ -13,32 +15,36 @@ if ( } function drawButtons() { + let w = g.getWidth(); + let h = g.getHeight(); //Draw the backdrop - const BAR_TOP = g.getHeight() - 24; + const BAR_TOP = h - 24; g.setColor(0, 0, 1).setFontAlign(0, -1) - .clearRect(0, BAR_TOP, g.getWidth(), g.getHeight()) - .fillRect(0, BAR_TOP, g.getWidth(), g.getHeight()) + .clearRect(0, BAR_TOP, w, h) + .fillRect(0, BAR_TOP, w, h) .setColor(1, 1, 1); if (!common.state.wasRunning) { //If the timer was never started, only show a play button - g.drawImage(common.BUTTON_ICONS.play, g.getWidth() / 2, BAR_TOP); + g.drawImage(common.BUTTON_ICONS.play, w / 2, BAR_TOP); } else { - g.drawLine(g.getWidth() / 2, BAR_TOP, g.getWidth() / 2, g.getHeight()); + g.drawLine(w / 2, BAR_TOP, w / 2, h); if (common.state.running) { - g.drawImage(common.BUTTON_ICONS.pause, g.getWidth() / 4, BAR_TOP) - .drawImage(common.BUTTON_ICONS.skip, g.getWidth() * 3 / 4, BAR_TOP); + g.drawImage(common.BUTTON_ICONS.pause, w / 4, BAR_TOP) + .drawImage(common.BUTTON_ICONS.skip, w * 3 / 4, BAR_TOP); } else { - g.drawImage(common.BUTTON_ICONS.reset, g.getWidth() / 4, BAR_TOP) - .drawImage(common.BUTTON_ICONS.play, g.getWidth() * 3 / 4, BAR_TOP); + g.drawImage(common.BUTTON_ICONS.reset, w / 4, BAR_TOP) + .drawImage(common.BUTTON_ICONS.play, w * 3 / 4, BAR_TOP); } } } function drawTimerAndMessage() { + let w = g.getWidth(); + let h = g.getHeight(); g.reset() .setFontAlign(0, 0) .setFont("Vector", 36) - .clearRect(0, 24, 176, 152) + .clearRect(w / 2 - 60, h / 2 - 34, w / 2 + 60, h / 2 + 34) //Draw the timer .drawString((() => { @@ -53,7 +59,7 @@ function drawTimerAndMessage() { if (hours >= 1) return `${parseInt(hours)}:${pad(minutes)}:${pad(seconds)}`; else return `${parseInt(minutes)}:${pad(seconds)}`; - })(), g.getWidth() / 2, g.getHeight() / 2) + })(), w / 2, h / 2) //Draw the phase label .setFont("Vector", 12) @@ -63,7 +69,7 @@ function drawTimerAndMessage() { else if (currentPhase == common.PHASE_SHORT_BREAK) return `Short break ${numShortBreaks + 1}/${common.settings.numShortBreaks}`; else return "Long break!"; })(common.state.phase, common.state.numShortBreaks), - g.getWidth() / 2, g.getHeight() / 2 + 18); + w / 2, h / 2 + 18); //Update phase with vibation if needed if (common.getTimeLeft() <= 0) { @@ -91,6 +97,7 @@ Bangle.on("touch", (button, xy) => { }; setupTimerInterval(); drawButtons(); + if (common.settings.showClock) Bangle.showClock(); } else if (common.state.running) { //If we are running, there are two buttons: pause and skip @@ -127,6 +134,7 @@ Bangle.on("touch", (button, xy) => { drawTimerAndMessage(); setupTimerInterval(); drawButtons(); + if (common.settings.showClock) Bangle.showClock(); } } }); @@ -154,4 +162,4 @@ E.on('kill', () => { }); Bangle.loadWidgets(); -Bangle.drawWidgets(); \ No newline at end of file +Bangle.drawWidgets(); diff --git a/apps/pomoplus/common.js b/apps/pomoplus/common.js index b1cd42de8..bf3e80751 100644 --- a/apps/pomoplus/common.js +++ b/apps/pomoplus/common.js @@ -105,14 +105,13 @@ exports.nextPhase = function (vibrate) { if (vibrate) { if (exports.state.phase == exports.PHASE_WORKING) { - Bangle.buzz(750, 1); + Bangle.buzz(800, 1); } else if (exports.state.phase == exports.PHASE_SHORT_BREAK) { Bangle.buzz(); setTimeout(Bangle.buzz, 400); } else { Bangle.buzz(); - setTimeout(Bangle.buzz, 400); - setTimeout(Bangle.buzz, 600); + setTimeout(Bangle.buzz, 400, 400); } } -} \ No newline at end of file +} diff --git a/apps/pomoplus/metadata.json b/apps/pomoplus/metadata.json index 0db15ab4d..4f2fd6cbb 100644 --- a/apps/pomoplus/metadata.json +++ b/apps/pomoplus/metadata.json @@ -1,7 +1,7 @@ { "id": "pomoplus", "name": "Pomodoro Plus", - "version": "0.05", + "version": "0.06", "description": "A configurable pomodoro timer that runs in the background.", "icon": "icon.png", "type": "app", diff --git a/apps/pomoplus/settings.js b/apps/pomoplus/settings.js index 1ff52340a..e5c516457 100644 --- a/apps/pomoplus/settings.js +++ b/apps/pomoplus/settings.js @@ -10,7 +10,8 @@ const storage = require("Storage"); longBreak: 900000, //15 minute long break numShortBreaks: 3, //3 short breaks for every long break pausedTimerExpireTime: 21600000, //If the timer was left paused for >6 hours, reset it on next launch - widget: false //If a widget is added in the future, whether the user wants it + showClock: false, //Show clock after start/resume + widget: false, //If a widget is added in the future, whether the user wants it }; } @@ -89,6 +90,13 @@ const storage = require("Storage"); else return `${Math.floor(value / 3600000)}h ${(value % 3600000) / 60000}m` } }, + 'Show clock': { + value: settings.showClock, + onchange: function(value) { + settings.showClock = value; + save(); + }, + }, }; E.showMenu(menu) -}) \ No newline at end of file +}) diff --git a/apps/setting/settings.js b/apps/setting/settings.js index f3b963d6e..3c4115a2f 100644 --- a/apps/setting/settings.js +++ b/apps/setting/settings.js @@ -823,7 +823,7 @@ function showAppSettings(app) { try { appSettings = eval(appSettings); } catch (e) { - console.log(`${app.name} settings error:`, e) + console.log(`${app.name} settings error:`, e); return showError(/*LANG*/'Error in settings'); } if (typeof appSettings !== "function") { @@ -833,7 +833,7 @@ function showAppSettings(app) { // pass showAppSettingsMenu as "back" argument appSettings(()=>showAppSettingsMenu()); } catch (e) { - console.log(`${app.name} settings error:`, e) + console.log(`${app.name} settings error:`, e); return showError(/*LANG*/'Error in settings'); } } diff --git a/core b/core index 71813fe2e..11f8e16d2 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 71813fe2eaf19987cec07db850ab9d1959694f96 +Subproject commit 11f8e16d2ebb726bb92f29d812dc3ccba4f362a9