Added display of hr hand in daisy

master
David Volovskiy 2025-02-23 11:41:57 -05:00
parent 3c3ab7c80c
commit 3e0ee44dcb
3 changed files with 14 additions and 9 deletions

View File

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

View File

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

View File

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