Update app.js

master
sir-indy 2022-04-20 14:32:23 +01:00 committed by GitHub
parent 7bfe23d809
commit c377a4f194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -2,8 +2,8 @@ function getSettings() {
return require("Storage").readJSON("health.json",1)||{};
}
function setSettings(s) {
require("Storage").writeJSON("health.json",s);
function setSettings(healthSettings) {
require("Storage").writeJSON("health.json",healthSettings);
}
function menuMain() {
@ -22,20 +22,21 @@ function menuMain() {
function menuSettings() {
swipe_enabled = false;
clearButton();
var s=getSettings();
var healthSettings=getSettings();
//print(healthSettings);
E.showMenu({
"":{title:"Health Tracking"},
"< Back":()=>menuMain(),
"Heart Rt":{
value : 0|s.hrm,
value : 0|healthSettings.hrm,
min : 0, max : 3,
format : v=>["Off","3 mins","10 mins","Always"][v],
onchange : v => { s.hrm=v;setSettings(s); }
onchange : v => { healthSettings.hrm=v;setSettings(healthSettings); }
},
"Daily Step Goal":{
value : (s.stepGoal ? s.stepGoal : 10000),
value : (healthSettings.stepGoal ? healthSettings.stepGoal : 10000),
min : 0, max : 20000, step : 100,
onchange : v => { s.stepGoal=v;setSettings(s); }
onchange : v => { healthSettings.stepGoal=v;setSettings(healthSettings); }
}
});
}
@ -204,7 +205,7 @@ function drawBarChart() {
for (bar = 1; bar < 10; bar++) {
if (bar == 5) {
g.setFont('6x8', 2);
g.setFontAlign(0,-1)
g.setFontAlign(0,-1);
g.setColor(g.theme.fg);
g.drawString(chart_label + " " + (chart_index + bar -1) + " " + chart_data[chart_index + bar - 1], g.getWidth()/2, 150);
g.setColor("#00f");