From f6629aa3fc9eff51b9eea281fe11fd26e18e6de7 Mon Sep 17 00:00:00 2001 From: David Volovskiy Date: Sat, 24 May 2025 10:33:25 -0400 Subject: [PATCH] Fixed up info width overwrite; settings default funciton added --- apps/daisy/app.js | 10 +++---- apps/daisy/settings.js | 60 +++++++++++++++++++++--------------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/apps/daisy/app.js b/apps/daisy/app.js index fc65ec7e2..8cf105d34 100644 --- a/apps/daisy/app.js +++ b/apps/daisy/app.js @@ -24,8 +24,8 @@ var pals = Array(3).fill().map(() => ( let palbg; const infoLineDefault = (3*h/4) - 6; -const infoWidthDefault = 56; -const infoHeightDefault = 11; +const infoWidthDefault = 64; +const infoHeightDefault = 8; const ringEdge = 4; const ringIterOffset = 10; const ringThick = 6; @@ -359,13 +359,13 @@ function getInfoDims() { var height = infoHeightDefault; switch (innerMostRing) { case 2: - width -= 8; + width -= 10; height -= 2; line -= 7; break; case 3: - width -= 9; - height -= 6; + width -= 17; + height -= 3; line -= 10; break; } diff --git a/apps/daisy/settings.js b/apps/daisy/settings.js index 1fe60dda0..52ba83d99 100644 --- a/apps/daisy/settings.js +++ b/apps/daisy/settings.js @@ -1,43 +1,43 @@ (function(back) { const SETTINGS_FILE = "daisy.json"; - // default settings - let s = { - rings: [{}, {}, {}], + function getDefaultSettings() { + return { + 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', fg: '#0f0', check_idle: true, batt_hours: false, idxInfo: 0, }; +} - s.rings[0] = { - 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, - }; - +let s = getDefaultSettings(); // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings const storage = require('Storage');