update boot code

master
Weiming 2021-04-02 22:22:08 -04:00
parent df6d34b951
commit 10c7e2e8d6
4 changed files with 35 additions and 37 deletions

View File

@ -3065,14 +3065,13 @@
"name": "Hour Strike", "name": "Hour Strike",
"shortName": "Hour Strike", "shortName": "Hour Strike",
"icon": "app-icon.png", "icon": "app-icon.png",
"version": "0.06", "version": "0.07",
"description": "Strike the clock on the hour. A great tool to remind you an hour has passed!", "description": "Strike the clock on the hour. A great tool to remind you an hour has passed!",
"tags": "tool,alarm", "tags": "tool,alarm",
"readme": "README.md", "readme": "README.md",
"storage": [ "storage": [
{"name":"hourstrike.app.js","url":"app.js"}, {"name":"hourstrike.app.js","url":"app.js"},
{"name":"hourstrike.boot.js","url":"boot.js"}, {"name":"hourstrike.boot.js","url":"boot.js"},
{"name":"hourstrike.js","url":"hourstrike.js"},
{"name":"hourstrike.img","url":"app-icon.js","evaluate":true} {"name":"hourstrike.img","url":"app-icon.js","evaluate":true}
] ]
} }

View File

@ -4,3 +4,4 @@
0.04: Add more time to strike and the strength 0.04: Add more time to strike and the strength
0.05: Add display for the next strike time 0.05: Add display for the next strike time
0.06: Move the next strike time to the first row of display 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

View File

@ -1,4 +1,5 @@
(function() { (function() {
function setup () {
var settings = require('Storage').readJSON('hourstrike.json',1)||[]; var settings = require('Storage').readJSON('hourstrike.json',1)||[];
var t = new Date(); var t = new Date();
var t_min_sec = t.getMinutes()*60+t.getSeconds(); var t_min_sec = t.getMinutes()*60+t.getSeconds();
@ -20,10 +21,19 @@
settings.next_hour = t_hour; settings.next_hour = t_hour;
settings.next_minute = t.getMinutes(); settings.next_minute = t.getMinutes();
} }
setTimeout(function() {load("hourstrike.js");}, wait_msec); setTimeout(strike_func, wait_msec);
} else { } else {
settings.next_hour = -1; settings.next_hour = -1;
settings.next_minute = -1; settings.next_minute = -1;
} }
require('Storage').write('hourstrike.json', settings); require('Storage').write('hourstrike.json', settings);
}
function strike_func () {
var setting = require('Storage').readJSON('hourstrike.json',1)||[];
Bangle.buzz(200, setting.vlevel||0.5)
.then(() => new Promise(resolve => setTimeout(resolve,200)))
.then(() => Bangle.buzz(200, setting.vlevel||0.5));
setup();
}
setup();
})(); })();

View File

@ -1,12 +0,0 @@
clearInterval();
var setting = require('Storage').readJSON('hourstrike.json',1)||[];
function notify_func () {
Bangle.buzz(200, setting.vlevel||0.5)
.then(() => new Promise(resolve => setTimeout(resolve,200)))
.then(() => Bangle.buzz(200, setting.vlevel||0.5));
}
notify_func();
setTimeout(load, 800);