Fix logic leak, make sure draw functions only deal with drawing UI

pull/343/head
Paul Cockrell 2020-04-23 06:58:14 +01:00
parent 9e8dea08e4
commit bf1fe5de4e
2 changed files with 9 additions and 10 deletions

View File

@ -69,6 +69,15 @@ exports = class Exercise {
}, 1000 * this.restPeriod);
this._restInterval = setInterval(() => {
this.decRestPeriod();
if (this.restPeriod < 0) {
this.resetRestTimer();
this.next();
return;
}
workout.emit("redraw");
}, 1000 );
}

View File

@ -104,14 +104,6 @@ function drawSetComp() {
function drawRestTimer(workout) {
const exercise = workout.currentExercise();
const motivation = "Take a breather..";
if (exercise.restPeriod <= 0) {
exercise.resetRestTimer();
workout.next();
return;
}
g.clear();
drawMenu({showBTN2: true});
@ -124,8 +116,6 @@ function drawRestTimer(workout) {
g.setFont("6x8", 5);
g.drawString(exercise.restPeriod, (W / 2) + 2, (H / 2) - 19);
g.flip();
exercise.decRestPeriod();
}
function redraw(workout) {