-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpomodoro.cpp
47 lines (41 loc) · 832 Bytes
/
pomodoro.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "pomodoro.h"
Pomodoro::Pomodoro() {
Modes modes;
this->modes = modes;
this->pristine = true;
this->timer;
}
void Pomodoro::start() {
if (!modes.is_action_type()) {
modes.advance();
if (pristine) {
pristine = false;
}
timer = Timer(modes.get_time_limit());
}
}
void Pomodoro::stop() {
if (!pristine) {
timer.reset();
if (modes.is_work_stage()) {
modes.set_current("waitingForRelax");
} else {
modes.set_current("waitingForWork");
}
}
}
void Pomodoro::process() {
if (modes.is_action_type()) {
// Serial.println(timer.get_remaining_time());
if (timer.has_finished()) {
timer.reset();
modes.advance();
}
}
}
boolean Pomodoro::is_pristine() {
return pristine;
}
String Pomodoro::current_mode() {
return modes.get_name();
}