diff --git a/apps/daisy/ChangeLog b/apps/daisy/ChangeLog index f21249c29..f40825ac6 100644 --- a/apps/daisy/ChangeLog +++ b/apps/daisy/ChangeLog @@ -12,4 +12,4 @@ 0.12: Added setting to change Battery estimate to hours 0.13: Fixed Battery estimate Default to percentage and improved setting string 0.14: Use `power_usage` module -0.15: Ring can now show minutes, seconds, and battery; Allowed for 12hr time; Ring now goes up in 5% increments +0.15: Ring can now show hours, minute, or seconds hand, or battery; Allowed for 12hr time; Ring now goes up in 5% increments diff --git a/apps/daisy/app.js b/apps/daisy/app.js index 6baff0167..c61360935 100644 --- a/apps/daisy/app.js +++ b/apps/daisy/app.js @@ -224,14 +224,13 @@ function draw() { function drawClock() { var date = new Date(); var hh = date.getHours(); - if (settings.hr_12) { - hh = hh % 12; - if (hh == 0) hh = 12; - } - hh = hh.toString().toString().padStart(2, '0'); var mm = date.getMinutes(); var ring_percent; switch (settings.ring) { + case 'Hours': + let min_so_far = (hh * 60) + mm; + ring_percent = Math.round((10*min_so_far)/72); + break; case 'Minutes': ring_percent = Math.round((10*mm)/6); break; @@ -245,6 +244,12 @@ function drawClock() { ring_percent = E.getBattery(); break; } + + if (settings.hr_12) { + hh = hh % 12; + if (hh == 0) hh = 12; + } + hh = hh.toString().padStart(2, '0'); mm = mm.toString().padStart(2, '0'); g.reset(); diff --git a/apps/daisy/settings.js b/apps/daisy/settings.js index 4ad2fd431..84cbb9b66 100644 --- a/apps/daisy/settings.js +++ b/apps/daisy/settings.js @@ -8,7 +8,7 @@ 'check_idle' : true, 'batt_hours' : false, 'hr_12' : false, - 'ring' : 'Minutes'}; + 'ring' : 'Steps'}; // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -27,7 +27,7 @@ var color_options = ['Green','Orange','Cyan','Purple','Red','Blue']; var fg_code = ['#0f0','#ff0','#0ff','#f0f','#f00','#00f']; var gy_code = ['#020','#220','#022','#202','#200','#002']; - var ring_options = ['Minutes', 'Seconds', 'Steps', 'Battery']; + var ring_options = ['Hours', 'Minutes', 'Seconds', 'Steps', 'Battery']; E.showMenu({ '': { 'title': 'Daisy Clock' }, @@ -66,7 +66,7 @@ }, 'Ring Display': { value: 0 | ring_options.indexOf(s.ring), - min: 0, max: 3, + min: 0, max: 4, format: v => ring_options[v], onchange: v => { s.ring = ring_options[v];