File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ void loop() {
22
22
23
23
if (isAtCookingTemperature (currentTemp)) {
24
24
stopMotor ();
25
- } else if (isTooCold (currentTemp)) {
25
+ } else if (isCold (currentTemp)) {
26
+ highOxygen ();
27
+ } else if (isWarm (currentTemp)) {
26
28
heat ();
27
29
}
28
30
@@ -44,6 +46,10 @@ void heat() {
44
46
}
45
47
}
46
48
49
+ void highOxygen () {
50
+ startMotor ();
51
+ }
52
+
47
53
void startMotor () {
48
54
motor.run (BACKWARD);
49
55
}
@@ -52,12 +58,19 @@ void stopMotor() {
52
58
motor.run (RELEASE);
53
59
}
54
60
55
- bool isTooCold (double temperature) {
56
- return temperature < 110 ;
61
+ const double WARM_FIRE_TEMPERATURE = 70 ;
62
+ const double COOKING_TEMPERATURE = 110 ;
63
+
64
+ bool isCold (double temperature) {
65
+ return temperature <= WARM_FIRE_TEMPERATURE;
66
+ }
67
+
68
+ bool isWarm (double temperature) {
69
+ return temperature < COOKING_TEMPERATURE && temperature > WARM_FIRE_TEMPERATURE;
57
70
}
58
71
59
72
bool isAtCookingTemperature (double temperature) {
60
- return temperature >= 110 ;
73
+ return temperature >= COOKING_TEMPERATURE ;
61
74
}
62
75
63
76
void beforeChangeMotor (double temperature) {
You can’t perform that action at this time.
0 commit comments