1
0
Fork 0

Merge pull request #1452 from myxor/circlesclock_v0.10

Circlesclock v0.10
master
Gordon Williams 2022-02-15 09:07:22 +00:00 committed by GitHub
commit 975a0d349c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 113 additions and 79 deletions

View File

@ -19,3 +19,4 @@
Colors of circles can be configured Colors of circles can be configured
Color depending on value (green -> red, red -> green) option Color depending on value (green -> red, red -> green) option
Good HRM value will not be overwritten so fast anymore Good HRM value will not be overwritten so fast anymore
0.10: Use roboto font for time, date and day of week and center align them

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,25 @@
{
"minHR": 40,
"maxHR": 200,
"confidence": 0,
"stepGoal": 10000,
"stepDistanceGoal": 8000,
"stepLength": 0.8,
"batteryWarn": 30,
"showWidgets": false,
"weatherCircleData": "humidity",
"circleCount": 3,
"circle1": "hr",
"circle2": "steps",
"circle3": "battery",
"circle4": "weather",
"circle1color": "green-red",
"circle2color": "#0000ff",
"circle3color": "red-green",
"circle4color": "#ffff00",
"circle1colorizeIcon": true,
"circle2colorizeIcon": true,
"circle3colorizeIcon": true,
"circle4colorizeIcon": false,
"hrmValidity": 60
}

View File

@ -1,7 +1,7 @@
{ "id": "circlesclock", { "id": "circlesclock",
"name": "Circles clock", "name": "Circles clock",
"shortName":"Circles clock", "shortName":"Circles clock",
"version":"0.09", "version":"0.10",
"description": "A clock with three or four circles for different data at the bottom in a probably familiar style", "description": "A clock with three or four circles for different data at the bottom in a probably familiar style",
"icon": "app.png", "icon": "app.png",
"screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}], "screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}],
@ -13,7 +13,8 @@
"storage": [ "storage": [
{"name":"circlesclock.app.js","url":"app.js"}, {"name":"circlesclock.app.js","url":"app.js"},
{"name":"circlesclock.img","url":"app-icon.js","evaluate":true}, {"name":"circlesclock.img","url":"app-icon.js","evaluate":true},
{"name":"circlesclock.settings.js","url":"settings.js"} {"name":"circlesclock.settings.js","url":"settings.js"},
{"name":"circlesclock.default.json","url":"default.json"}
], ],
"data": [ "data": [
{"name":"circlesclock.json"} {"name":"circlesclock.json"}

View File

@ -1,7 +1,11 @@
(function(back) { (function(back) {
const SETTINGS_FILE = "circlesclock.json"; const SETTINGS_FILE = "circlesclock.json";
const storage = require('Storage'); const storage = require('Storage');
let settings = storage.readJSON(SETTINGS_FILE, 1) || {}; let settings = Object.assign(
storage.readJSON("circlesclock.default.json", true) || {},
storage.readJSON(SETTINGS_FILE, true) || {}
);
function save(key, value) { function save(key, value) {
settings[key] = value; settings[key] = value;
storage.write(SETTINGS_FILE, settings); storage.write(SETTINGS_FILE, settings);
@ -10,8 +14,8 @@
const valuesCircleTypes = ["empty", "steps", "stepsDist", "hr", "battery", "weather", "sunprogress", "temperature", "pressure", "altitude"]; const valuesCircleTypes = ["empty", "steps", "stepsDist", "hr", "battery", "weather", "sunprogress", "temperature", "pressure", "altitude"];
const namesCircleTypes = ["empty", "steps", "distance", "heart", "battery", "weather", "sun", "temperature", "pressure", "altitude"]; const namesCircleTypes = ["empty", "steps", "distance", "heart", "battery", "weather", "sun", "temperature", "pressure", "altitude"];
const valuesColors = ["", "#ff0000", "#00ff00", "#0000ff", "#ffff00", "#ff00ff", "#00ffff", "#fff", "#000", "green-red", "red-green"]; const valuesColors = ["", "#ff0000", "#00ff00", "#0000ff", "#ffff00", "#ff00ff", "#00ffff", "#fff", "#000", "green-red", "red-green"];
const namesColors = ["default", "red", "green", "blue", "yellow", "magenta", "cyan", "white", "black", "green->red", "red->green"]; const namesColors = ["default", "red", "green", "blue", "yellow", "magenta", "cyan", "white", "black", "green->red", "red->green"];
const weatherData = ["empty", "humidity", "wind"]; const weatherData = ["empty", "humidity", "wind"];
@ -20,7 +24,7 @@
'': { 'title': 'Circles clock' }, '': { 'title': 'Circles clock' },
/*LANG*/'< Back': back, /*LANG*/'< Back': back,
/*LANG*/'circle count': { /*LANG*/'circle count': {
value: "circleCount" in settings ? settings.circleCount : 3, value: settings.circleCount,
min: 3, min: 3,
max : 4, max : 4,
step: 1, step: 1,
@ -33,7 +37,7 @@
/*LANG*/'heartrate': ()=>showHRMenu(), /*LANG*/'heartrate': ()=>showHRMenu(),
/*LANG*/'steps': ()=>showStepMenu(), /*LANG*/'steps': ()=>showStepMenu(),
/*LANG*/'battery warn': { /*LANG*/'battery warn': {
value: "batteryWarn" in settings ? settings.batteryWarn : 30, value: settings.batteryWarn,
min: 10, min: 10,
max : 100, max : 100,
step: 10, step: 10,
@ -43,12 +47,12 @@
onchange: x => save('batteryWarn', x), onchange: x => save('batteryWarn', x),
}, },
/*LANG*/'show widgets': { /*LANG*/'show widgets': {
value: "showWidgets" in settings ? settings.showWidgets : false, value: !!settings.showWidgets,
format: () => (settings.showWidgets ? 'Yes' : 'No'), format: () => (settings.showWidgets ? 'Yes' : 'No'),
onchange: x => save('showWidgets', x), onchange: x => save('showWidgets', x),
}, },
/*LANG*/'weather circle': { /*LANG*/'weather data': {
value: settings.weatherCircleData ? weatherData.indexOf(settings.weatherCircleData) : 1, value: weatherData.indexOf(settings.weatherCircleData),
min: 0, max: 2, min: 0, max: 2,
format: v => weatherData[v], format: v => weatherData[v],
onchange: x => save('weatherCircleData', weatherData[x]), onchange: x => save('weatherCircleData', weatherData[x]),
@ -62,7 +66,7 @@
'': { 'title': /*LANG*/'Heartrate' }, '': { 'title': /*LANG*/'Heartrate' },
/*LANG*/'< Back': ()=>showMainMenu(), /*LANG*/'< Back': ()=>showMainMenu(),
/*LANG*/'minimum': { /*LANG*/'minimum': {
value: "minHR" in settings ? settings.minHR : 40, value: settings.minHR,
min: 0, min: 0,
max : 250, max : 250,
step: 5, step: 5,
@ -72,7 +76,7 @@
onchange: x => save('minHR', x), onchange: x => save('minHR', x),
}, },
/*LANG*/'maximum': { /*LANG*/'maximum': {
value: "maxHR" in settings ? settings.maxHR : 200, value: settings.maxHR,
min: 20, min: 20,
max : 250, max : 250,
step: 5, step: 5,
@ -82,7 +86,7 @@
onchange: x => save('maxHR', x), onchange: x => save('maxHR', x),
}, },
/*LANG*/'min. confidence': { /*LANG*/'min. confidence': {
value: "confidence" in settings ? settings.confidence : 0, value: settings.confidence,
min: 0, min: 0,
max : 100, max : 100,
step: 10, step: 10,
@ -92,7 +96,7 @@
onchange: x => save('confidence', x), onchange: x => save('confidence', x),
}, },
/*LANG*/'valid period': { /*LANG*/'valid period': {
value: "hrmValidity" in settings ? settings.hrmValidity : 30, value: settings.hrmValidity,
min: 10, min: 10,
max : 600, max : 600,
step: 10, step: 10,
@ -110,7 +114,7 @@
'': { 'title': /*LANG*/'Steps' }, '': { 'title': /*LANG*/'Steps' },
/*LANG*/'< Back': ()=>showMainMenu(), /*LANG*/'< Back': ()=>showMainMenu(),
/*LANG*/'goal': { /*LANG*/'goal': {
value: "stepGoal" in settings ? settings.stepGoal : 10000, value: settings.stepGoal,
min: 2000, min: 2000,
max : 50000, max : 50000,
step: 2000, step: 2000,
@ -120,7 +124,7 @@
onchange: x => save('stepGoal', x), onchange: x => save('stepGoal', x),
}, },
/*LANG*/'distance goal': { /*LANG*/'distance goal': {
value: "stepDistanceGoal" in settings ? settings.stepDistanceGoal : 8000, value: settings.stepDistanceGoal,
min: 2000, min: 2000,
max : 30000, max : 30000,
step: 1000, step: 1000,
@ -130,7 +134,7 @@
onchange: x => save('stepDistanceGoal', x), onchange: x => save('stepDistanceGoal', x),
}, },
/*LANG*/'step length': { /*LANG*/'step length': {
value: "stepLength" in settings ? settings.stepLength : 0.8, value: settings.stepLength,
min: 0.1, min: 0.1,
max : 1.5, max : 1.5,
step: 0.01, step: 0.01,
@ -142,9 +146,6 @@
}; };
E.showMenu(menu); E.showMenu(menu);
} }
const defaultCircleTypes = ["steps", "hr", "battery", "weather"];
function showCircleMenu(circleId) { function showCircleMenu(circleId) {
const circleName = "circle" + circleId; const circleName = "circle" + circleId;
const colorKey = circleName + "color"; const colorKey = circleName + "color";
@ -154,19 +155,19 @@
'': { 'title': /*LANG*/'Circle ' + circleId }, '': { 'title': /*LANG*/'Circle ' + circleId },
/*LANG*/'< Back': ()=>showMainMenu(), /*LANG*/'< Back': ()=>showMainMenu(),
/*LANG*/'data': { /*LANG*/'data': {
value: settings[circleName]!=undefined ? valuesCircleTypes.indexOf(settings[circleName]) : valuesCircleTypes.indexOf(defaultCircleTypes[circleId -1]), value: valuesCircleTypes.indexOf(settings[circleName]),
min: 0, max: valuesCircleTypes.length - 1, min: 0, max: valuesCircleTypes.length - 1,
format: v => namesCircleTypes[v], format: v => namesCircleTypes[v],
onchange: x => save(circleName, valuesCircleTypes[x]), onchange: x => save(circleName, valuesCircleTypes[x]),
}, },
/*LANG*/'color': { /*LANG*/'color': {
value: settings[colorKey] ? valuesColors.indexOf(settings[colorKey]) : 0, value: valuesColors.indexOf(settings[colorKey]) || 0,
min: 0, max: valuesColors.length - 1, min: 0, max: valuesColors.length - 1,
format: v => namesColors[v], format: v => namesColors[v],
onchange: x => save(colorKey, valuesColors[x]), onchange: x => save(colorKey, valuesColors[x]),
}, },
/*LANG*/'colorize icon': { /*LANG*/'colorize icon': {
value: colorizeIconKey in settings ? settings[colorizeIconKey] : false, value: settings[colorizeIconKey] || false,
format: () => (settings[colorizeIconKey] ? 'Yes' : 'No'), format: () => (settings[colorizeIconKey] ? 'Yes' : 'No'),
onchange: x => save(colorizeIconKey, x), onchange: x => save(colorizeIconKey, x),
}, },