Merge branch 'pushups' of github.com:wagnerf42/BangleApps into pushups

pull/3669/head
frederic wagner 2024-09-04 16:38:25 +02:00
commit 509064f08d
1 changed files with 27 additions and 20 deletions

View File

@ -37,7 +37,7 @@ const IMAGES = [
];
// number of movements or duration required for each activity
const DEFAULTS = [10, 10, 10, 30, 30, 30];
const DEFAULTS = [7, 10, 10, 30, 15, 30];
function default_routine() {
let routine = [];
@ -49,18 +49,20 @@ function default_routine() {
const DETECTORS = [
(xyz) => {
if (xyz.y > 0.3) {
"ram"
if (xyz.y > 0.15) {
return 1;
} else if (xyz.y < 0.2) {
} else if (xyz.y < 0.1) {
return 0;
} else {
return null;
}
},
(xyz) => {
if (xyz.x > 0.15) {
"ram"
if (xyz.x > 0.075) {
return 1;
} else if (xyz.x < -0.15) {
} else if (xyz.x < -0.075) {
return 0;
} else {
return null;
@ -68,6 +70,7 @@ const DETECTORS = [
// return xyz.x > 0 ? 1 : 0;
},
(xyz) => {
"ram"
if (xyz.z > -0.4) {
return 0;
} else if (xyz.z < -0.6) {
@ -77,16 +80,16 @@ const DETECTORS = [
}
},
null,
null,
// (xyz) => {
// if (xyz.y > 0.2) {
// return 0;
// }
// if (xyz.y < 0) {
// return 1;
// }
// return null;
// }, // TODO: jumping jacks detector does not work
(xyz) => {
"ram"
if (xyz.x < -0.8) {
return 0;
}
if (xyz.x > 0.3) {
return 1;
}
return null;
},
null
];
@ -167,6 +170,10 @@ class FitnessStatus {
if (this.completed) {
Bangle.buzz(1000).then(() => {
Bangle.setPollInterval(80); // default poll interval
Bangle.accelWr(0x18, 0b01101100); // off, +-4g
Bangle.accelWr(0x1B, 0x0); // default 12.5hz output
Bangle.accelWr(0x18, 0b11101100); // +-4g
load();
});
return;
@ -239,14 +246,14 @@ class FitnessStatus {
let status = new FitnessStatus(10 * 60);
// status.display();
// Bangle.accelWr(0x18,0b01110100); // off, +-8g // NOTE: this code is taken from 'accelrec' app
// Bangle.accelWr(0x1B,0x03 | 0x40); // 100hz output, ODR/2 filter
// Bangle.accelWr(0x18,0b11110100); // +-8g
Bangle.setPollInterval(10);
function start_routine() {
Bangle.accelWr(0x18,0b01110100); // off, +-8g // NOTE: this code is taken from 'accelrec' app
Bangle.accelWr(0x1B,0x03 | 0x40); // 100hz output, ODR/2 filter
Bangle.accelWr(0x18,0b11110100); // +-8g
Bangle.setPollInterval(10);
status.remaining = status.routine[status.routine_step][1];
Bangle.loadWidgets();