From b723512dce3db4f921da0660d569b8c99269c31b Mon Sep 17 00:00:00 2001 From: Erik Andresen Date: Sun, 10 Dec 2023 09:18:21 +0100 Subject: [PATCH] health: move strideLength to new app myprofile --- apps/health/ChangeLog | 2 +- apps/health/README.md | 2 +- apps/health/app.js | 5 +++-- apps/health/settings.js | 11 ----------- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/apps/health/ChangeLog b/apps/health/ChangeLog index 98a4a3426..99d8edf72 100644 --- a/apps/health/ChangeLog +++ b/apps/health/ChangeLog @@ -29,4 +29,4 @@ 0.26: Implement API for activity fetching 0.27: Fix typo in daily summary graph code causing graph not to load 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 diff --git a/apps/health/README.md b/apps/health/README.md index b5f6191cc..3fcf394ba 100644 --- a/apps/health/README.md +++ b/apps/health/README.md @@ -13,7 +13,7 @@ To view data, run the `Health` app from your watch. Stores: * Heart rate -* Step count +* Step count (can calculate distance if myprofile is installed and stride length is set) * Movement ## Settings diff --git a/apps/health/app.js b/apps/health/app.js index 60b337321..0b4cef233 100644 --- a/apps/health/app.js +++ b/apps/health/app.js @@ -1,4 +1,5 @@ let settings; +const myprofile = require("Storage").readJSON("myprofile.json",1)||{}; function menuMain() { E.showMenu({ @@ -18,7 +19,7 @@ function menuStepCount() { /*LANG*/"per hour": () => stepsPerHour(menuStepCount), /*LANG*/"per day": () => stepsPerDay(menuStepCount) }; - if (settings.strideLength) { + if (myprofile.strideLength) { menu[/*LANG*/"distance"] = () => menuDistance(); } @@ -26,7 +27,7 @@ function menuStepCount() { } 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({ "": { title:/*LANG*/"Distance" }, /*LANG*/"< Back": () => menuStepCount(), diff --git a/apps/health/settings.js b/apps/health/settings.js index 2d5809cdb..88c8061c6 100644 --- a/apps/health/settings.js +++ b/apps/health/settings.js @@ -49,16 +49,5 @@ 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(); - }, - }, }); })