Fixed bug that clock is unresponsive

pull/1241/head
David Peer 2022-01-07 17:26:34 +01:00
parent 6cd9167565
commit 677cd16f8b
3 changed files with 13 additions and 18 deletions

View File

@ -4488,7 +4488,7 @@
"name": "LCARS Clock", "name": "LCARS Clock",
"shortName":"LCARS", "shortName":"LCARS",
"icon": "lcars.png", "icon": "lcars.png",
"version":"0.09", "version":"0.10",
"readme": "README.md", "readme": "README.md",
"supports": ["BANGLEJS2"], "supports": ["BANGLEJS2"],
"description": "Library Computer Access Retrieval System (LCARS) clock.", "description": "Library Computer Access Retrieval System (LCARS) clock.",

View File

@ -7,3 +7,4 @@
0.07: Added settings to adjust data that is shown for each row. 0.07: Added settings to adjust data that is shown for each row.
0.08: Support for multiple screens. 24h graph for steps + HRM. Fullscreen Mode. 0.08: Support for multiple screens. 24h graph for steps + HRM. Fullscreen Mode.
0.09: Tab anywhere to open the launcher. 0.09: Tab anywhere to open the launcher.
0.10: Fix - Clock is unresponsive, if gadgetbridge connects.

View File

@ -32,8 +32,8 @@ let cGrey = "#9E9E9E";
let lcarsViewPos = 0; let lcarsViewPos = 0;
let drag; let drag;
let hrmValue = 0; let hrmValue = 0;
var connected = NRF.getSecurityStatus().connected;
var plotWeek = false; var plotWeek = false;
var disableInfoUpdate = true; // When gadgetbridge connects, step infos cannot be loaded
/* /*
* Requirements and globals * Requirements and globals
@ -170,7 +170,7 @@ function drawHorizontalBgLine(color, x1, x2, y, h){
} }
function drawLock(){ function drawInfo(){
if(lcarsViewPos != 0){ if(lcarsViewPos != 0){
return; return;
} }
@ -179,7 +179,8 @@ function drawLock(){
g.setColor(cOrange); g.setColor(cOrange);
g.clearRect(120, 10, g.getWidth(), 75); g.clearRect(120, 10, g.getWidth(), 75);
g.drawString("LCARS", 128, 13); g.drawString("LCARS", 128, 13);
if(connected){
if(NRF.getSecurityStatus().connected){
g.drawString("CONN", 128, 33); g.drawString("CONN", 128, 33);
} else { } else {
g.drawString("NOCON", 128, 33); g.drawString("NOCON", 128, 33);
@ -243,8 +244,8 @@ function drawPosition0(){
drawHorizontalBgLine(cOrange, 35, batX2, 171, 5); drawHorizontalBgLine(cOrange, 35, batX2, 171, 5);
drawHorizontalBgLine(cGrey, batX2+10, 172, 171, 5); drawHorizontalBgLine(cGrey, batX2+10, 172, 171, 5);
// Draw logo // Draw Infos
drawLock(); drawInfo();
// Write time // Write time
g.setFontAlign(-1, -1, 0); g.setFontAlign(-1, -1, 0);
@ -467,24 +468,17 @@ function handleAlarm(){
Bangle.on('lcdPower',on=>{ Bangle.on('lcdPower',on=>{
if (on) { if (on) {
// Whenever we connect to Gadgetbridge, reading data from // Whenever we connect to Gadgetbridge, reading data from
// health failed. Therefore, we update and read data from // health failed. Therefore, we update only partially...
// health iff the connection state did not change. drawInfo();
if(connected == NRF.getSecurityStatus().connected) { drawState();
draw();
} else {
connected = NRF.getSecurityStatus().connected
drawLock();
}
} else { // stop draw timer } else { // stop draw timer
if (drawTimeout) clearTimeout(drawTimeout); if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined; drawTimeout = undefined;
} }
connected = NRF.getSecurityStatus().connected
}); });
Bangle.on('lock', function(isLocked) { Bangle.on('lock', function(isLocked) {
drawLock(); drawInfo();
}); });
Bangle.on('charging',function(charging) { Bangle.on('charging',function(charging) {