From 0da0acefd2dab2fc1b5d773e0d9b4eb2cdb09106 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Mon, 9 Mar 2020 14:30:56 +0000 Subject: [PATCH] Tweaks for issues redrawing after variable size widget addition (partial #121) --- apps.json | 10 +++++----- apps/widbat/ChangeLog | 1 + apps/widbat/widget.js | 2 +- apps/widbt/ChangeLog | 1 + apps/widbt/widget.js | 2 +- apps/widclk/ChangeLog | 1 + apps/widclk/widget.js | 2 +- apps/widhrm/ChangeLog | 1 + apps/widhrm/widget.js | 4 ++-- apps/widpedom/ChangeLog | 1 + apps/widpedom/widget.js | 4 ++-- 11 files changed, 17 insertions(+), 12 deletions(-) diff --git a/apps.json b/apps.json index b078ea6ae..f55c327fa 100644 --- a/apps.json +++ b/apps.json @@ -286,7 +286,7 @@ { "id": "widbat", "name": "Battery Level Widget", "icon": "widget.png", - "version":"0.03", + "version":"0.04", "description": "Show the current battery level and charging status in the top right of the clock", "tags": "widget,battery", "type":"widget", @@ -297,7 +297,7 @@ { "id": "widbt", "name": "Bluetooth Widget", "icon": "widget.png", - "version":"0.02", + "version":"0.03", "description": "Show the current Bluetooth connection status in the top right of the clock", "tags": "widget,bluetooth", "type":"widget", @@ -319,7 +319,7 @@ { "id": "widhrm", "name": "Simple Heart Rate widget", "icon": "widget.png", - "version":"0.02", + "version":"0.03", "description": "When the screen is on, the widget turns on the heart rate monitor and displays the current heart rate (or last known in grey). For this to work well you'll need at least a 15 second LCD Timeout.", "tags": "health,widget", "type": "widget", @@ -702,7 +702,7 @@ { "id": "widclk", "name": "Digital clock widget", "icon": "widget.png", - "version":"0.02", + "version":"0.03", "description": "A simple digital clock widget", "tags": "widget,clock", "type":"widget", @@ -713,7 +713,7 @@ { "id": "widpedom", "name": "Pedometer widget", "icon": "widget.png", - "version":"0.07", + "version":"0.08", "description": "Daily pedometer widget", "tags": "widget", "type":"widget", diff --git a/apps/widbat/ChangeLog b/apps/widbat/ChangeLog index b19144b47..cd9993c02 100644 --- a/apps/widbat/ChangeLog +++ b/apps/widbat/ChangeLog @@ -1,2 +1,3 @@ 0.02: Now refresh battery monitor every minute if LCD on 0.03: Tweaks for variable size widget system +0.04: Ensure redrawing works with variable size widget system diff --git a/apps/widbat/widget.js b/apps/widbat/widget.js index c209821cc..2f1f29802 100644 --- a/apps/widbat/widget.js +++ b/apps/widbat/widget.js @@ -27,7 +27,7 @@ Bangle.on('charging',function(charging) { var batteryInterval; Bangle.on('lcdPower', function(on) { if (on) { - draw(); + WIDGETS["bat"].draw(); // refresh once a minute if LCD on if (!batteryInterval) batteryInterval = setInterval(draw, 60000); diff --git a/apps/widbt/ChangeLog b/apps/widbt/ChangeLog index 1a85a6b12..c268d6df0 100644 --- a/apps/widbt/ChangeLog +++ b/apps/widbt/ChangeLog @@ -1 +1,2 @@ 0.02: Tweaks for variable size widget system +0.03: Ensure redrawing works with variable size widget system diff --git a/apps/widbt/widget.js b/apps/widbt/widget.js index 0ffd0dd4c..8e96a395d 100644 --- a/apps/widbt/widget.js +++ b/apps/widbt/widget.js @@ -10,7 +10,7 @@ function draw() { g.drawImage(img_bt,10+this.x,2+this.y); } function changed() { - draw(); + WIDGETS["bluetooth"].draw(); g.flip();// turns screen on } NRF.on('connected',changed); diff --git a/apps/widclk/ChangeLog b/apps/widclk/ChangeLog index ba01ef944..5370129cc 100644 --- a/apps/widclk/ChangeLog +++ b/apps/widclk/ChangeLog @@ -1 +1,2 @@ 0.02: Now refresh battery monitor every minute if LCD on +0.03: Ensure redrawing works with variable size widget system diff --git a/apps/widclk/widget.js b/apps/widclk/widget.js index a1129328f..1d5df36b2 100644 --- a/apps/widclk/widget.js +++ b/apps/widclk/widget.js @@ -15,7 +15,7 @@ } function startTimers(){ intervalRef = setInterval(draw, 60*1000); - draw(); + WIDGETS["wdclk"].draw(); } Bangle.on('lcdPower', (on) => { clearTimers(); diff --git a/apps/widhrm/ChangeLog b/apps/widhrm/ChangeLog index 4152a8406..d6c076227 100644 --- a/apps/widhrm/ChangeLog +++ b/apps/widhrm/ChangeLog @@ -1,2 +1,3 @@ 0.01: New Widget! 0.02: Tweaks for variable size widget system +0.03: Ensure redrawing works with variable size widget system diff --git a/apps/widhrm/widget.js b/apps/widhrm/widget.js index f0af08f46..ca66f8b44 100644 --- a/apps/widhrm/widget.js +++ b/apps/widhrm/widget.js @@ -29,7 +29,7 @@ Bangle.setHRMPower(1); firstBPM = true; currentBPM = undefined; - draw(); + WIDGETS["hrm"].draw(); } else { Bangle.setHRMPower(0); } @@ -42,7 +42,7 @@ currentBPM = d.bpm; lastBPM = currentBPM; } - draw(); + WIDGETS["hrm"].draw(); }); Bangle.setHRMPower(Bangle.isLCDOn()); diff --git a/apps/widpedom/ChangeLog b/apps/widpedom/ChangeLog index b0b0753fd..980494acb 100644 --- a/apps/widpedom/ChangeLog +++ b/apps/widpedom/ChangeLog @@ -4,3 +4,4 @@ 0.05: Add foot icon, use tidier font, and move to the left of the screen 0.06: Fix widget position increment 0.07: Tweaks for variable size widget system +0.08: Ensure redrawing works with variable size widget system diff --git a/apps/widpedom/widget.js b/apps/widpedom/widget.js index 6ab837c81..1cc14fc2c 100644 --- a/apps/widpedom/widget.js +++ b/apps/widpedom/widget.js @@ -33,11 +33,11 @@ } lastUpdate = date; //console.log("up: " + up + " stp: " + stp_today + " " + date.toString()); - if (Bangle.isLCDOn()) draw(); + if (Bangle.isLCDOn()) WIDGETS["wpedom"].draw(); }); // redraw when the LCD turns on Bangle.on('lcdPower', function(on) { - if (on) draw(); + if (on) WIDGETS["wpedom"].draw(); }); // When unloading, save state E.on('kill', () => {