diff --git a/apps/thunder/ChangeLog b/apps/thunder/ChangeLog index 4e9c694a5..3513ca80e 100644 --- a/apps/thunder/ChangeLog +++ b/apps/thunder/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Use locale module to display distance +0.03: Fix lightning image and flash button diff --git a/apps/thunder/app.js b/apps/thunder/app.js index ca213c64d..4544b224d 100644 --- a/apps/thunder/app.js +++ b/apps/thunder/app.js @@ -22,7 +22,7 @@ var layout = new Layout( { {type:"txt", pad:8, font:"20%", label:"", id:"distance", fillx:1}, {type:"h", c: [ {type:"btn", font:"6x8:2", label:"Flash", cb: l=>flash() }, - {type:"img", pad:4, src:require("heatshrink").decompress(atob("h0awkBiMQBAQFBAxwdDAoIGKCYQGGFBQTCAyIAPgIGGIAoFCAxITDAxIFDAxATEJwIMEAw4TEAwo")) }, + {type:"img", pad:4, src:atob("DhoBH+B/gf4P8D/A/gP4H+B/AfwH8B//////7/+A/APwD4A+APADwA4AcAHABgAYAA==") }, {type:"btn", font:"6x8:2", label:"Boom", cb: l=>boom() } ]}, ] @@ -79,21 +79,27 @@ const renderIntervalCallback = function() { updateTimeAndDistance(); }; -const flash = function() { - Bangle.buzz(50, 0.5); - - startTime = startTime = Date.now(); - updateTimeAndDistance(); - renderIntervalId = setInterval(renderIntervalCallback, 100); -}; - -const boom = function() { +const flashAndBoom = function() { Bangle.buzz(50, 0.5); if (renderIntervalId !== undefined) { clearInterval(renderIntervalId); renderIntervalId = undefined; } +}; + +const flash = function() { + flashAndBoom(); + + startTime = undefined; + updateTimeAndDistance(); + + startTime = Date.now(); + renderIntervalId = setInterval(renderIntervalCallback, 100); +}; + +const boom = function() { + flashAndBoom(); updateTimeAndDistance(); startTime = undefined; diff --git a/apps/thunder/metadata.json b/apps/thunder/metadata.json index e8812a3c4..52abcf4d8 100644 --- a/apps/thunder/metadata.json +++ b/apps/thunder/metadata.json @@ -1,7 +1,7 @@ { "id": "thunder", "name": "Come on Thunder", "shortName":"Thunder", - "version":"0.02", + "version":"0.03", "description": "Simple timer to calculate how far away lightning is", "icon": "app.png", "tags": "tool,weather",