mirror of https://github.com/espruino/BangleApps
Add rep info to time screen
parent
e486659525
commit
ba03c98c2c
|
@ -1 +1,2 @@
|
||||||
0.01: New App!
|
0.01: New App!
|
||||||
|
0.02: Add rep info to time screen
|
||||||
|
|
|
@ -55,6 +55,8 @@ For example `w6d1(r:6|w:3|x2)` means:
|
||||||
If you ever need to peek at the time, just press the middle (or only) physical button on the watch:
|
If you ever need to peek at the time, just press the middle (or only) physical button on the watch:
|
||||||

|

|
||||||
|
|
||||||
|
This view also shows `current rep / total reps` at the top.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
|
@ -3,7 +3,8 @@ var day = 1;
|
||||||
var time;
|
var time;
|
||||||
|
|
||||||
var loop; // To store how many times we will have to do a countdown
|
var loop; // To store how many times we will have to do a countdown
|
||||||
var counter = 0; // To keep count of how many iterations we have in the current countdown
|
var rep = 0; // The current rep counter
|
||||||
|
var counter = 0; // The seconds counter
|
||||||
var currentMode; // Either "run" or "walk"
|
var currentMode; // Either "run" or "walk"
|
||||||
var mainInterval; // Ticks every second, checking if a new countdown is needed
|
var mainInterval; // Ticks every second, checking if a new countdown is needed
|
||||||
var activityInterval; // Ticks every second, doing the countdown
|
var activityInterval; // Ticks every second, doing the countdown
|
||||||
|
@ -31,21 +32,20 @@ function outOfTime() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function countDown() {
|
function countDown() {
|
||||||
text = (currentMode === "run") ? "Run\n" + counter : "Walk\n" + counter; // Switches output text
|
var text = "";
|
||||||
|
var textsize = (process.env.HWVERSION == 2) ? 7 : 8; // Default font size, Banglejs 2 has smaller screen
|
||||||
|
if (time) {
|
||||||
|
var w = week -1;
|
||||||
|
var d = day - 1;
|
||||||
|
var total = ("walk" in PLAN[w][d]) ? PLAN[w][d].repetition : 1;
|
||||||
|
text += rep + "/" + total + "\n"; // Show the current/total rep count when time is shown
|
||||||
|
textsize -= (process.env.HWVERSION == 2) ? 2 : 1; // Use smaller font size to fit everything nicely on the screen
|
||||||
|
}
|
||||||
|
text += (currentMode === "run") ? "Run\n" + counter : "Walk\n" + counter; // Switches output text
|
||||||
if (time) text += "\n" + time;
|
if (time) text += "\n" + time;
|
||||||
g.clear();
|
g.clear();
|
||||||
g.setFontAlign(0,0); // center font
|
g.setFontAlign(0, 0); // center font
|
||||||
if (process.env.HWVERSION == 2) { // To accomodate the Bangle.js 2 screen
|
g.setFont("6x8", textsize);
|
||||||
if (time) {
|
|
||||||
g.setFont("6x8",5); // when time is shown
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
g.setFont("6x8",7); // when time is not shown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
g.setFont("6x8",8); // bitmap font, 8x magnified
|
|
||||||
}
|
|
||||||
g.drawString(text, g.getWidth() / 2, g.getHeight() / 2); // draw the current mode and seconds
|
g.drawString(text, g.getWidth() / 2, g.getHeight() / 2); // draw the current mode and seconds
|
||||||
Bangle.setLCDPower(1); // keep the watch LCD lit up
|
Bangle.setLCDPower(1); // keep the watch LCD lit up
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ function startTimer(w, d) {
|
||||||
// Switches between the two modes
|
// Switches between the two modes
|
||||||
if (!currentMode || currentMode === "walk") {
|
if (!currentMode || currentMode === "walk") {
|
||||||
currentMode = "run";
|
currentMode = "run";
|
||||||
|
rep++; // Increase the rep counter every time a "run" activity starts
|
||||||
counter = PLAN[w][d].run * 60;
|
counter = PLAN[w][d].run * 60;
|
||||||
g.setBgColor("#ff5733");
|
g.setBgColor("#ff5733");
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.0 KiB |
|
@ -2,7 +2,7 @@
|
||||||
"id": "c25k",
|
"id": "c25k",
|
||||||
"name": "C25K",
|
"name": "C25K",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version":"0.01",
|
"version":"0.02",
|
||||||
"description": "Unofficial app for the Couch to 5k training plan",
|
"description": "Unofficial app for the Couch to 5k training plan",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"type": "app",
|
"type": "app",
|
||||||
|
|
Loading…
Reference in New Issue