Pastel fixed for Gadgetbridge on a Bangle 2

pull/831/head
hughbarney 2021-09-30 23:03:47 +01:00
parent d0fd2f0172
commit db4e2fa480
3 changed files with 16 additions and 10 deletions

View File

@ -3503,7 +3503,7 @@
"name": "Pastel Clock", "name": "Pastel Clock",
"shortName": "Pastel", "shortName": "Pastel",
"icon": "pastel.png", "icon": "pastel.png",
"version":"0.02", "version":"0.03",
"description": "A Configurable clock with custom fonts and background", "description": "A Configurable clock with custom fonts and background",
"tags": "clock,b2", "tags": "clock,b2",
"type":"clock", "type":"clock",

View File

@ -1,2 +1,3 @@
0.01: First release 0.01: First release
0.02: Display 12 hour clock as 12:xx not 00:xx when just into PM 0.02: Display 12 hour clock as 12:xx not 00:xx when just into PM
0.03: Make it work with Gadgetbridge, Notifications fullscreen on a Bangle 2

View File

@ -51,7 +51,7 @@ const SETTINGS_FILE = "pastel.json";
let settings = undefined; let settings = undefined;
function loadSettings() { function loadSettings() {
//console.log("loadSettings()"); //Console.log("loadSettings()");
settings = require("Storage").readJSON(SETTINGS_FILE,1)||{}; settings = require("Storage").readJSON(SETTINGS_FILE,1)||{};
settings.grid = settings.grid||false; settings.grid = settings.grid||false;
settings.date = settings.date||false; settings.date = settings.date||false;
@ -119,7 +119,7 @@ function draw() {
g.setFontAlign(1,-1); // right aligned g.setFontAlign(1,-1); // right aligned
g.drawString(hh, x - 6, y); g.drawString(hh, x - 6, y);
g.setFontAlign(-1,-1); // left aligned g.setFontAlign(-1,-1); // left aligned
g.drawString(mm ,x + 6, y); g.drawString(mm, x + 6, y);
// for the colon // for the colon
g.setFontAlign(0,-1); // centre aligned g.setFontAlign(0,-1); // centre aligned
@ -143,17 +143,22 @@ function draw() {
} }
} }
// handle switch display on by pressing BTN1 // Only update when display turns on
if (process.env.BOARD!="SMAQ3") // hack for Q3 which is always-on
Bangle.on('lcdPower', function(on) { Bangle.on('lcdPower', function(on) {
if (on) draw(); if (secondInterval)
clearInterval(secondInterval);
secondInterval = undefined;
if (on)
secondInterval = setInterval(draw, 1000);
draw();
}); });
g.clear();
Bangle.loadWidgets();
Bangle.drawWidgets();
loadSettings(); loadSettings();
setInterval(draw, 1000); // refresh every second g.clear();
var secondInterval = setInterval(draw, 1000);
draw(); draw();
// Show launcher when button pressed // Show launcher when button pressed
Bangle.setUI("clock"); Bangle.setUI("clock");
Bangle.loadWidgets();
Bangle.drawWidgets();