diff --git a/apps.json b/apps.json index 32d11394a..9cf55d1a1 100644 --- a/apps.json +++ b/apps.json @@ -3272,10 +3272,8 @@ "storage": [ {"name":"hourstrike.app.js","url":"app.js"}, {"name":"hourstrike.boot.js","url":"boot.js"}, - {"name":"hourstrike.img","url":"app-icon.js","evaluate":true} - ], - "data": [ - {"name":"hourstrike.json"} + {"name":"hourstrike.img","url":"app-icon.js","evaluate":true}, + {"name":"hourstrike.json","url":"hourstrike.json"} ] }, { "id": "whereworld", diff --git a/apps/hourstrike/ChangeLog b/apps/hourstrike/ChangeLog index d0b064565..09eb45b36 100644 --- a/apps/hourstrike/ChangeLog +++ b/apps/hourstrike/ChangeLog @@ -5,4 +5,4 @@ 0.05: Add display for the next strike time 0.06: Move the next strike time to the first row of display 0.07: Change the boot function to avoid reloading the entire watch -0.08: Default to no strikes. Fix file-not-found issue during the first boot. +0.08: Default to no strikes. Fix file-not-found issue during the first boot. Add data file. diff --git a/apps/hourstrike/app.js b/apps/hourstrike/app.js index 3d47b7b44..7dc62d440 100644 --- a/apps/hourstrike/app.js +++ b/apps/hourstrike/app.js @@ -1,25 +1,10 @@ const storage = require('Storage'); -let settings; +var settings = storage.readJSON('hourstrike.json', 1); function updateSettings() { storage.write('hourstrike.json', settings); } -function resetSettings() { - settings = { - interval: -1, - start: 9, - end: 21, - vlevel: 0.5, - next_hour: -1, - next_minute: -1, - }; - updateSettings(); -} - -settings = storage.readJSON('hourstrike.json', 1); -if (!settings) resetSettings(); - function showMainMenu() { var mode_txt = ['Off','1 min','5 min','10 min','1/4 h','1/2 h','1 h']; var mode_interval = [-1,60,300,600,900,1800,3600]; diff --git a/apps/hourstrike/boot.js b/apps/hourstrike/boot.js index b8d44c961..027b8bb5b 100644 --- a/apps/hourstrike/boot.js +++ b/apps/hourstrike/boot.js @@ -1,7 +1,6 @@ (function() { function setup () { var settings = require('Storage').readJSON('hourstrike.json',1); - if (!settings) resetSettings(); var t = new Date(); var t_min_sec = t.getMinutes()*60+t.getSeconds(); var wait_msec = settings.interval>0?(settings.interval-t_min_sec%settings.interval)*1000:-1; diff --git a/apps/hourstrike/hourstrike.json b/apps/hourstrike/hourstrike.json new file mode 100644 index 000000000..09b17dc8e --- /dev/null +++ b/apps/hourstrike/hourstrike.json @@ -0,0 +1 @@ +{"interval":-1,"start":9,"end":21,"vlevel":0.5,"next_hour":-1,"next_minute":-1}