Fix logic leak, make sure draw functions only deal with drawing UI
parent
9e8dea08e4
commit
bf1fe5de4e
|
|
@ -69,6 +69,15 @@ exports = class Exercise {
|
||||||
}, 1000 * this.restPeriod);
|
}, 1000 * this.restPeriod);
|
||||||
|
|
||||||
this._restInterval = setInterval(() => {
|
this._restInterval = setInterval(() => {
|
||||||
|
this.decRestPeriod();
|
||||||
|
|
||||||
|
if (this.restPeriod < 0) {
|
||||||
|
this.resetRestTimer();
|
||||||
|
this.next();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
workout.emit("redraw");
|
workout.emit("redraw");
|
||||||
}, 1000 );
|
}, 1000 );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,14 +104,6 @@ function drawSetComp() {
|
||||||
|
|
||||||
function drawRestTimer(workout) {
|
function drawRestTimer(workout) {
|
||||||
const exercise = workout.currentExercise();
|
const exercise = workout.currentExercise();
|
||||||
const motivation = "Take a breather..";
|
|
||||||
|
|
||||||
if (exercise.restPeriod <= 0) {
|
|
||||||
exercise.resetRestTimer();
|
|
||||||
workout.next();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g.clear();
|
g.clear();
|
||||||
drawMenu({showBTN2: true});
|
drawMenu({showBTN2: true});
|
||||||
|
|
@ -124,8 +116,6 @@ function drawRestTimer(workout) {
|
||||||
g.setFont("6x8", 5);
|
g.setFont("6x8", 5);
|
||||||
g.drawString(exercise.restPeriod, (W / 2) + 2, (H / 2) - 19);
|
g.drawString(exercise.restPeriod, (W / 2) + 2, (H / 2) - 19);
|
||||||
g.flip();
|
g.flip();
|
||||||
|
|
||||||
exercise.decRestPeriod();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function redraw(workout) {
|
function redraw(workout) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue