1
0
Fork 0

add default data file as json

master
Weiming Hu 2021-09-13 11:24:24 -04:00
parent fc9c529dc5
commit 7ad0ca6acb
5 changed files with 5 additions and 22 deletions

View File

@ -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",

View File

@ -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.

View File

@ -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];

View File

@ -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;

View File

@ -0,0 +1 @@
{"interval":-1,"start":9,"end":21,"vlevel":0.5,"next_hour":-1,"next_minute":-1}