Fixed up info width overwrite; settings default funciton added

master
David Volovskiy 2025-05-24 10:33:25 -04:00
parent a1927e95c3
commit f6629aa3fc
2 changed files with 35 additions and 35 deletions

View File

@ -24,8 +24,8 @@ var pals = Array(3).fill().map(() => (
let palbg; let palbg;
const infoLineDefault = (3*h/4) - 6; const infoLineDefault = (3*h/4) - 6;
const infoWidthDefault = 56; const infoWidthDefault = 64;
const infoHeightDefault = 11; const infoHeightDefault = 8;
const ringEdge = 4; const ringEdge = 4;
const ringIterOffset = 10; const ringIterOffset = 10;
const ringThick = 6; const ringThick = 6;
@ -359,13 +359,13 @@ function getInfoDims() {
var height = infoHeightDefault; var height = infoHeightDefault;
switch (innerMostRing) { switch (innerMostRing) {
case 2: case 2:
width -= 8; width -= 10;
height -= 2; height -= 2;
line -= 7; line -= 7;
break; break;
case 3: case 3:
width -= 9; width -= 17;
height -= 6; height -= 3;
line -= 10; line -= 10;
break; break;
} }

View File

@ -1,43 +1,43 @@
(function(back) { (function(back) {
const SETTINGS_FILE = "daisy.json"; const SETTINGS_FILE = "daisy.json";
// default settings function getDefaultSettings() {
let s = { return {
rings: [{}, {}, {}], rings: [
{
color: 'Green',
fg: '#0f0',
gy: '#020',
ring: 'Steps',
type: 'Full',
step_target: 10000,
},
{
color: 'Blk/Wht',
fg: null,
gy: null,
ring: 'Minutes',
type: 'None',
step_target: 10000,
},
{
color: 'Green',
fg: '#0f0',
gy: '#020',
ring: 'Hours',
type: 'None',
step_target: 10000,
}
],
color: 'Outer', color: 'Outer',
fg: '#0f0', fg: '#0f0',
check_idle: true, check_idle: true,
batt_hours: false, batt_hours: false,
idxInfo: 0, idxInfo: 0,
}; };
}
s.rings[0] = { let s = getDefaultSettings();
color: 'Green',
fg: '#0f0',
gy: '#020',
ring: 'Steps',
type: 'Full',
step_target: 10000,
};
s.rings[1] = {
color: 'Blk/Wht',
fg: null,
gy: null,
ring: 'Minutes',
type: 'None',
step_target: 10000,
};
s.rings[2] = {
color: 'Green',
fg: '#0f0',
gy: '#020',
ring: 'Hours',
type: 'None',
step_target: 10000,
};
// ...and overwrite them with any saved values // ...and overwrite them with any saved values
// This way saved values are preserved if a new version adds more settings // This way saved values are preserved if a new version adds more settings
const storage = require('Storage'); const storage = require('Storage');