health: move strideLength to new app myprofile

master
Erik Andresen 2023-12-10 09:18:21 +01:00
parent ef74b85ef9
commit b723512dce
4 changed files with 5 additions and 15 deletions

View File

@ -29,4 +29,4 @@
0.26: Implement API for activity fetching 0.26: Implement API for activity fetching
0.27: Fix typo in daily summary graph code causing graph not to load 0.27: Fix typo in daily summary graph code causing graph not to load
Fix daily summaries for 31st of the month Fix daily summaries for 31st of the month
0.28: Calculate distance from steps if new stride length setting is set 0.28: Calculate distance from steps if myprofile is installed and stride length is set

View File

@ -13,7 +13,7 @@ To view data, run the `Health` app from your watch.
Stores: Stores:
* Heart rate * Heart rate
* Step count * Step count (can calculate distance if myprofile is installed and stride length is set)
* Movement * Movement
## Settings ## Settings

View File

@ -1,4 +1,5 @@
let settings; let settings;
const myprofile = require("Storage").readJSON("myprofile.json",1)||{};
function menuMain() { function menuMain() {
E.showMenu({ E.showMenu({
@ -18,7 +19,7 @@ function menuStepCount() {
/*LANG*/"per hour": () => stepsPerHour(menuStepCount), /*LANG*/"per hour": () => stepsPerHour(menuStepCount),
/*LANG*/"per day": () => stepsPerDay(menuStepCount) /*LANG*/"per day": () => stepsPerDay(menuStepCount)
}; };
if (settings.strideLength) { if (myprofile.strideLength) {
menu[/*LANG*/"distance"] = () => menuDistance(); menu[/*LANG*/"distance"] = () => menuDistance();
} }
@ -26,7 +27,7 @@ function menuStepCount() {
} }
function menuDistance() { function menuDistance() {
const distMult = 1*require("locale").distance(settings.strideLength, 2); // hackish: this removes the distance suffix, e.g. 'm' const distMult = 1*require("locale").distance(myprofile.strideLength, 2); // hackish: this removes the distance suffix, e.g. 'm'
E.showMenu({ E.showMenu({
"": { title:/*LANG*/"Distance" }, "": { title:/*LANG*/"Distance" },
/*LANG*/"< Back": () => menuStepCount(), /*LANG*/"< Back": () => menuStepCount(),

View File

@ -49,16 +49,5 @@
setSettings(); setSettings();
} }
}, },
/*LANG*/"Stride length": {
value : settings.strideLength || 0.0,
min:0.01,
step:0.01,
format: v => require("locale").distance(v, 2),
onchange : v => {
settings.strideLength=v;
setSettings();
},
},
}); });
}) })