Metronome shows manual instructions

pull/419/head
Michael Bengfort 2020-05-10 16:42:27 +02:00
parent b2905a7a12
commit c69ac747a1
3 changed files with 13 additions and 8 deletions

View File

@ -1403,7 +1403,7 @@
"id": "metronome",
"name": "Metronome",
"icon": "metronome_icon.png",
"version": "0.03",
"version": "0.04",
"readme": "README.md",
"description": "Makes the watch blinking and vibrating with a given rate",
"tags": "tool",

View File

@ -1,3 +1,4 @@
0.01: New App!
0.02: Watch vibrates with every beat
0.03: Uses mean of three time intervalls to calculate bmp
0.04: App gives manual instructions

View File

@ -10,7 +10,7 @@ function changecolor() {
const maxColors = 2;
const colors = {
0: { value: 0xFFFF, name: "White" },
1: { value: 0x000F, name: "Navy" },
// 1: { value: 0x000F, name: "Navy" },
// 2: { value: 0x03E0, name: "DarkGreen" },
// 3: { value: 0x03EF, name: "DarkCyan" },
// 4: { value: 0x7800, name: "Maroon" },
@ -21,7 +21,7 @@ function changecolor() {
// 9: { value: 0x001F, name: "Blue" },
// 10: { value: 0x07E0, name: "Green" },
// 11: { value: 0x07FF, name: "Cyan" },
// 12: { value: 0xF800, name: "Red" },
1: { value: 0xF800, name: "Red" },
// 13: { value: 0xF81F, name: "Magenta" },
// 14: { value: 0xFFE0, name: "Yellow" },
// 15: { value: 0xFFFF, name: "White" },
@ -40,11 +40,12 @@ function changecolor() {
}
function updateScreen() {
g.clear();
//g.clear();
g.clearRect(0, 50, 250, 200);
changecolor();
Bangle.buzz(50, 0.75);
g.setFont("Vector",48);
g.drawString(Math.floor(bpm)+"bpm", -1, 70);
g.drawString(Math.floor(bpm)+"bpm", 5, 80);
}
Bangle.on('touch', function(button) {
@ -66,10 +67,8 @@ Bangle.on('touch', function(button) {
tStart = Date.now();
clearInterval(time_diff);
g.clear();
g.setFont("Vector",48);
bpm = (60 * 1000/(time_diff));
g.drawString(Math.floor(bpm)+"bpm", -1, 70);
updateScreen();
clearInterval(interval);
interval = setInterval(updateScreen, 60000 / bpm);
return bpm;
@ -91,3 +90,8 @@ setWatch(() => {
}, BTN3, {repeat:true});
interval = setInterval(updateScreen, 60000 / bpm);
g.drawString('Touch the screen to set tempo.\nUse BTN1 to increase, and\nBTN3 to decrease bpm value by 1.', 15, 20);
Bangle.loadWidgets();
Bangle.drawWidgets();