First commit

pull/2285/head
thyttan 2022-11-17 02:27:08 +01:00
parent e25d51ef9f
commit 36766e69c5
6 changed files with 143 additions and 0 deletions

1
apps/sevenmin/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New app!

19
apps/sevenmin/README.md Normal file
View File

@ -0,0 +1,19 @@
Do a seven minute workout - or three!
Touch the screen to start the workout and follow the instructions.
Once the workout is finished the screen can be touched to go again - but get a minute or two of rest inbetween!
Search the web if you want further instructions, videos are helpful!
TODO:
- Add visible countdowns
- Add tracking of excercises, number of repetitions done etc. (Integration with BanglExercise app?)
- Add tracking of workouts over time.
- Move the whole app into BangleExercise app?
-
Creator:
Thyttan
<a target="_blank" href="https://icons8.com/icon/19961/jump">Jump</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwhC/AFfd7oWUhoXB6AuVGCoX/CQZwDO4wGBRJ4uESpYLCBg4KKLQw+EBBAYK6Wq1UtPaAPC7QXB1qSRLAMqC4OiLZQYIC4YWRAAIWBAALvTC/7DLCySoBAASPSCgPc5owSFwXM5gwSFwQXBGCQuC4EMGARGSAoJIRIwXAAoMMJB4uFGCIuFGCIuGGAhGM7gKHGAJIKC4IMIBRRHDAYUzAAQKGABUDCwYABmDvPC4IFDC6IAYJAhGSAAwZNCwQQEA44WJBQ4YMgYLWAH4AaA=="))

106
apps/sevenmin/app.js Normal file
View File

@ -0,0 +1,106 @@
/*
'Jumping jacks',
'Wall sit',
'Pushups',
'Crunches',
'Step-up onto chair, alternating legs',
'Squats',
'Triceps dips, using a chair or bench',
'Forearm plank',
'High-knees or running in place',
'Lunges, alternating legs',
'Pushups with rotation, alternating sides',
'Side plank',
Once you've completed all 12 exercises, take a break for 12 minutes and repeat the circuit another 23 times.
*/
{
let R = Bangle.appRect;
let instructions = ['Rest\n\nNext up:\n\n',
'Tap to start!',
'Get ready!\nFirst up:\n',
'Jumping jacks',
'Wall sit',
'Pushups',
'Crunches',
'Step-up onto\nchair,\nalternating legs',
'Squats',
'Triceps dips,\n using\ a\nchair or bench',
'Forearm plank',
'High-knees or\nrunning in place',
'Lunges,\nalternating legs',
'Pushups with\nrotation,\nalternating sides',
'Side plank',
'Workout done!'
];
Bangle.setLCDTimeout(0);
Bangle.setLocked(false);
let draw = function(instruction) {
g.reset();
g.clearRect(R);
g.setFont12x20();
g.setFontAlign(0,0,0);
g.drawString(instruction, R.w/2, R.h/2);
};
let endWorkout = function(interval) {
draw(instructions[instructions.length-1]);
clearInterval(interval);
ongoing = false;
};
let cycle = 40; // standard cycle is 40 seconds
let scaling = cycle/40; // scaling if changing cycle length
let ongoing = false;
let touchHandler = function() {
if (!ongoing) {
Bangle.buzz();
ongoing = true;
// Get ready!
draw(instructions[2]+instructions[3]);
let i = 3;
// buzzes before start
setTimeout(()=>{let j = 0; let buzzes = setInterval(()=>{Bangle.buzz(200*scaling); j++; if (j==5) clearInterval(buzzes);}, 1*1000*scaling);}, 4*1000*scaling);
// timeout till first excercise
let timeout = setTimeout(()=>{draw(instructions[i]);i++;}, 10*1000*scaling);
// buzzes before first rest
setTimeout(()=>{let j = 0; let buzzes = setInterval(()=>{Bangle.buzz(200*scaling); j++; if (j==5) clearInterval(buzzes);}, 1*1000*scaling);}, 34*1000*scaling);
// interval containing rest and excercises 10+30=40
let interval = setInterval(()=>{
if (i==instructions.length-1) {
endWorkout(interval);
} else {
// draw pause message
draw(instructions[0]+instructions[i]);
// buzzes before next excercise
setTimeout(()=>{let j = 0; let buzzes = setInterval(()=>{Bangle.buzz(200*scaling); j++; if (j==5) clearInterval(buzzes);}, 1*1000*scaling);}, 4*1000*scaling);
// timeout till next excercise
setTimeout(()=>{draw(instructions[i]);i++;}, 10*1000*scaling);
// buzzes before next rest
setTimeout(()=>{let j = 0; let buzzes = setInterval(()=>{Bangle.buzz(200*scaling); j++; if (j==5) clearInterval(buzzes);}, 1*1000*scaling);}, 34*1000*scaling);
}
}, 40*1000*scaling);
}
};
let swipeHandler = function() {
};
let uiMode = {
mode : 'custom',
back : load,
touch : touchHandler,
//swipe : swipeHandler
};
Bangle.setUI(uiMode);
Bangle.loadWidgets();
// Tap to start!
draw(instructions[1]);
}

BIN
apps/sevenmin/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,16 @@
{ "id": "sevenmin",
"name": "Seven minute workout",
"shortName": "7 min wo",
"version": "0.01",
"description": "A basic implementation of the famous consice workout",
"icon": "icon.png",
"type":"app",
"tags": "Training, Workout",
"supports": ["BANGLEJS2"],
"readme": "README.md",
"allow_emulator":true,
"storage": [
{"name":"sevenmin.app.js", "url":"app.js"},
{"name":"sevenmin.img", "url":"app-icon.js","evaluate":true}
]
}