fix file-not-found issue during the first boot

pull/802/head
Weiming Hu 2021-09-13 10:55:33 -04:00
parent 171b7d1fce
commit 56ea00dc31
2 changed files with 2 additions and 1 deletions

View File

@ -5,4 +5,4 @@
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 0.07: Change the boot function to avoid reloading the entire watch
0.08: Default to no strikes. 0.08: Default to no strikes. Fix file-not-found issue during the first boot.

View File

@ -1,6 +1,7 @@
(function() { (function() {
function setup () { function setup () {
var settings = require('Storage').readJSON('hourstrike.json',1)||[]; var settings = require('Storage').readJSON('hourstrike.json',1)||[];
if (!settings) resetSettings();
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();
var wait_msec = settings.interval>0?(settings.interval-t_min_sec%settings.interval)*1000:-1; var wait_msec = settings.interval>0?(settings.interval-t_min_sec%settings.interval)*1000:-1;