1
0
Fork 0

tweaks for last PR - re-add settings menu item

master
Gordon Williams 2022-04-25 15:11:01 +01:00
parent 385e9a71ed
commit 22bd782ffe
2 changed files with 10 additions and 9 deletions

View File

@ -6,7 +6,8 @@ function menuMain() {
/*LANG*/"< Back": () => load(),
/*LANG*/"Step Counting": () => menuStepCount(),
/*LANG*/"Movement": () => menuMovement(),
/*LANG*/"Heart Rate": () => menuHRM()
/*LANG*/"Heart Rate": () => menuHRM(),
/*LANG*/"Settings": () => eval(require("Storage").read("health.settings.js"))(()=>menuMain())
});
}
@ -132,7 +133,7 @@ var chart_data;
var swipe_enabled = false;
var btn;
// find the max value in the array, using a loop due to array size
// find the max value in the array, using a loop due to array size
function max(arr) {
var m = -Infinity;
@ -144,10 +145,10 @@ function max(arr) {
// find the end of the data, the array might be for 31 days but only have 2 days of data in it
function get_data_length(arr) {
var nlen = arr.length;
for(var i = arr.length - 1; i > 0 && arr[i] == 0; i--)
nlen--;
return nlen;
}
@ -166,10 +167,10 @@ function drawBarChart() {
const bar_width = (w - 2) / 9; // we want 9 bars, bar 5 in the centre
var bar_top;
var bar;
g.setColor(g.theme.bg);
g.fillRect(0,24,w,h);
for (bar = 1; bar < 10; bar++) {
if (bar == 5) {
g.setFont('6x8', 2);
@ -182,7 +183,7 @@ function drawBarChart() {
}
// draw a fake 0 height bar if chart_index is outside the bounds of the array
if ((chart_index + bar - 1) >= 0 && (chart_index + bar - 1) < data_len)
if ((chart_index + bar - 1) >= 0 && (chart_index + bar - 1) < data_len)
bar_top = bar_bot - 100 * (chart_data[chart_index + bar - 1]) / chart_max_datum;
else
bar_top = bar_bot;
@ -212,7 +213,7 @@ Bangle.on('swipe', dir => {
function setButton(fn) {
// cancel callback, otherwise a slight up down movement will show the E.showMenu()
Bangle.setUI("updown", undefined);
if (process.env.HWVERSION == 1)
btn = setWatch(fn, BTN2);
else

View File

@ -40,4 +40,4 @@
function setSettings(settings) {
require("Storage").writeJSON("health.json", settings);
}
});
})