function onSettingChange() { if (Options.getFeatures().enable_backlight && locked && !enabled) { enabled = true; Light.on(); } else if (enabled) { enabled = false; Light.auto(); } }
function enable() { locked = true; console.log("enable"); if (Options.getFeatures().enable_backlight && !enabled) { enabled = true; console.log("light enabled"); Light.on(); } }
var countDown = function(i, uiCard, callback) { Light.on(); // Must have this here otherwise it waits 1 second to update the Ui // because it immediately enters the setInterval uiCard.text(i); i--; refreshIntervalId = setInterval(function() { if (i >= 0) { uiCard.text(i); i--; } else { // clearInterval is working but is giving a warning in cloudPebble clearInterval(refreshIntervalId); Light.auto(); console.log('Calling callback'); callback(); } }, 1000); };