Skip to content

Commit 8600dd5

Browse files
committed
Start fire with lots of oxygen
1 parent 0500e36 commit 8600dd5

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

bbq.ino

+17-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ void loop() {
2222

2323
if(isAtCookingTemperature(currentTemp)) {
2424
stopMotor();
25-
} else if(isTooCold(currentTemp)) {
25+
} else if (isCold(currentTemp)) {
26+
highOxygen();
27+
} else if(isWarm(currentTemp)) {
2628
heat();
2729
}
2830

@@ -44,6 +46,10 @@ void heat() {
4446
}
4547
}
4648

49+
void highOxygen() {
50+
startMotor();
51+
}
52+
4753
void startMotor() {
4854
motor.run(BACKWARD);
4955
}
@@ -52,12 +58,19 @@ void stopMotor() {
5258
motor.run(RELEASE);
5359
}
5460

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;
5770
}
5871

5972
bool isAtCookingTemperature(double temperature) {
60-
return temperature >= 110;
73+
return temperature >= COOKING_TEMPERATURE;
6174
}
6275

6376
void beforeChangeMotor(double temperature) {

0 commit comments

Comments
 (0)