diff --git a/apps/andark/app.js b/apps/andark/app.js index 562675c1e..81d757ce4 100644 --- a/apps/andark/app.js +++ b/apps/andark/app.js @@ -88,6 +88,22 @@ let drawTimeout; let queueMillis = 1000; let unlock = true; +const updateState = function() { + if (Bangle.isLCDOn()) { + if (!Bangle.isLocked()) { + queueMillis = 1000; + unlock = true; + } else { + queueMillis = 60000; + unlock = false; + } + draw(); + } else { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}; + const queueDraw = function() { if (drawTimeout) clearTimeout(drawTimeout); drawTimeout = setTimeout(function() { @@ -151,22 +167,6 @@ if (settings.loadWidgets) { require("widget_utils").swipeOn(); } else if (global.WIDGETS) require("widget_utils").hide(); -const updateState = function() { - if (Bangle.isLCDOn()) { - if (!Bangle.isLocked()) { - queueMillis = 1000; - unlock = true; - } else { - queueMillis = 60000; - unlock = false; - } - draw(); - } else { - if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = undefined; - } -}; - // Stop updates when LCD is off, restart when on Bangle.on('lcdPower', updateState); Bangle.on('lock', updateState);