diff --git a/apps/myprofile/README.md b/apps/myprofile/README.md new file mode 100644 index 000000000..931d50ae2 --- /dev/null +++ b/apps/myprofile/README.md @@ -0,0 +1,11 @@ +# My Profile + +Configure your personal profile. All settings are optional and are only stored on the watch. + +## Available settings + +| Setting | Description | Displayed in | Stored in | Default value | How to measure | +| ------------- | ----------------------------- | ------------------- | --------- | ------------- | ----------------------------------------------------------------- | +| HR max | maximum heart rate | BPM | BPM | 60 | Use maximum value when exercising.
If unsure set to 220-age. | +| HR min | minimum heart rate | BPM | BPM | 200 | Measure your heart rate after waking up | +| Stride length | distance travel with one step | local length unit | meter | 0 (=not set) | Walk 10 steps and divide the travelled distance by 10 | diff --git a/apps/myprofile/app.png b/apps/myprofile/app.png new file mode 100644 index 000000000..4d95f2c69 Binary files /dev/null and b/apps/myprofile/app.png differ diff --git a/apps/myprofile/metadata.json b/apps/myprofile/metadata.json new file mode 100644 index 000000000..79add3b5a --- /dev/null +++ b/apps/myprofile/metadata.json @@ -0,0 +1,18 @@ +{ "id": "myprofile", + "name": "My Profile", + "shortName":"My Profile", + "icon": "app.png", + "type": "settings", + "version":"0.01", + "description": "Configure your personal profile. All settings are optional and only stored on the watch.", + "readme": "README.md", + "tags": "tool,utility", + "supports": ["BANGLEJS", "BANGLEJS2"], + "storage": [ + {"name":"myprofile.settings.js","url":"settings.js"} + ], + "data": [ + {"name":"myprofile.json"} + ] +} + diff --git a/apps/myprofile/settings.js b/apps/myprofile/settings.js new file mode 100644 index 000000000..576627212 --- /dev/null +++ b/apps/myprofile/settings.js @@ -0,0 +1,52 @@ +(function(back) { + const FILE = "myprofile.json"; + + const myprofile = Object.assign({ + minHrm: 60, + maxHrm: 200, + strideLength: 0, // 0 = not set + }, require('Storage').readJSON(FILE, true) || {}); + + function writeProfile() { + require('Storage').writeJSON(FILE, myprofile); + } + + // Show the menu + E.showMenu({ + "" : { "title" : /*LANG*/"My Profile" }, + + "< Back" : () => back(), + + /*LANG*/'HR max': { + format: v => /*LANG*/`${v} BPM`, + value: myprofile.maxHrm, + min: 30, max: 220, + onchange: v => { + myprofile.maxHrm = v; + writeProfile(); + } + }, + + /*LANG*/'HR min': { + format: v => /*LANG*/`${v} BPM`, + value: myprofile.minHrm, + min: 30, max: 220, + onchange: v => { + myprofile.minHrm = v; + writeProfile(); + } + }, + + /*LANG*/"Stride length": { + value: myprofile.strideLength, + min:0.00, + step:0.01, + format: v => v ? require("locale").distance(v, 2) : '-', + onchange: v => { + console.log(v); + myprofile.strideLength=v; + writeProfile(); + }, + }, + }); +})