main/automation.c

Sat, 06 Jun 2020 20:20:06 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 06 Jun 2020 20:20:06 +0200
changeset 79
cb5c73a8ae90
parent 78
b58e0c9897e1
child 81
72c715ac0444
permissions
-rw-r--r--

Websocket selectors using jquery style. During cooling display the pump button on the webpage too.

0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * @file automation.c
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 * @brief Automation functions.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 #include "config.h"
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
8 int BoilPower = 100; ///< Boil power 0..100%
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
9 int LastMashStep = 0; ///< Last valid mash step
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
10 char temp_buf[64]; ///< Temporary buffer
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
11 char logline[128]; ///< Log line buffer
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
12 char strftime_buf[64]; ///< Time buffer
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
13 bool loop; ///< Loop flag
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
14 bool CoolBeep = false; ///< Did beep during cooling
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
15 bool Resume = false; ///< Resume brew flag
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
16 bool pumpRest = false; ///< Pump is resting
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
17 bool updateRuntime = false; ///< Update runtime record
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
18 bool NewMinute = false; ///< We have a new minute
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
19 bool TempReached = false; ///< Temperature is reached
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
20 uint8_t MashState = MASH_NONE; ///< Mash states
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
21 float temp_MLT; ///< MLT temperature
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
22 float MinMash = 38.0; ///< Minimum edit value
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
23 float MaxMash = 80.0; ///< Maximum edit value
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
24 uint32_t power_MLT = 0; ///< MLT power
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
25 uint32_t power_HLT = 0; ///< HLT power
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
26 uint32_t counts = 0; ///< Counter for power average
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
27 float stageTemp = 0.0; ///< Current stage temperature
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
28 uint16_t stageTime = 0; ///< Current stage timer
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
29 uint16_t TimeWhirlPool = 0; ///< Whirlpool timer
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
30 uint32_t TimeLeft = 0; ///< Tie left in this stage
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
31 uint32_t TimeSpent = 0; ///< Tota time spent
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
32 uint32_t SecsCount = 0; ///< Seconds counter
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
33 uint32_t pumpTime = 0; ///< Pump running time
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
34 uint32_t TimeBrewing = 0; ///< Brewing time elapsed
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
35 uint16_t Steady = 0; ///< Temperature is steady
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
36 bool _NewMinute = false; ///< New minute slave flag
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
37 bool _UseHLT = false; ///< Use HLT slave flag
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
38 bool _Prompt = false; ///< Prompt display flag
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
40 extern bool System_TimeOk; ///< System time is valid
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
41 extern sButton Buttons[MAXBUTTONS]; ///< Buttons definitions
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
42 extern int Main_Screen; ///< Current screen
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
43 extern int Sub_Screen; ///< Sub screen during mash
1
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
44 extern DS18B20_State *ds18b20_state; ///< DS18B20 state
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
45 extern DRIVER_State *driver_state; ///< Relays driver state
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
46 extern SemaphoreHandle_t xSemaphoreDS18B20; ///< DS18B20 lock semaphore
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
47 extern SemaphoreHandle_t xSemaphoreDriver; ///< Relays driver lock semaphore
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
48 extern double Output; ///< Cakculated outpout power
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
49 extern time_t now; ///< Current time
ad2c8b13eb88 Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
50 extern struct tm timeinfo; ///< Current time structure
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 #ifdef CONFIG_TEMP_SENSORS_SIMULATOR
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 extern float Fake_MLT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 extern float Fake_HLT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 #endif
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
57 extern const char *mashTypes[];
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
58
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 static const char *TAG = "automation";
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
62 void change_sp(bool up)
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
63 {
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
64 if (up)
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
65 stageTemp += 0.25;
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
66 else
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
67 stageTemp -= 0.25;
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
68 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
69 driver_state->mlt_sp = stageTemp;
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
70 xSemaphoreGive(xSemaphoreDriver);
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
71 }
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
72 log_msg(TAG, "Changed sp to %.2f", stageTemp);
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
73 }
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
74
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
75
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
76
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
77 void change_tl(int max)
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
78 {
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
79 if (max) {
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
80 if (TimeLeft < max)
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
81 TimeLeft += 60;
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
82 else
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
83 TimeLeft = max;
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
84 } else {
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
85 if (TimeLeft > 60)
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
86 TimeLeft -= 60;
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
87 else
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
88 TimeLeft = 0;
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
89 }
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
90 log_msg(TAG, "Changed timeleft to %d", TimeLeft / 60);
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
91 }
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
92
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
93
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
94
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 * Automation init function that only runs once when a
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 * new screen is entered.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 bool Automation_Init(void)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
101 char msg[64];
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
102
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 switch (Main_Screen) {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
104 case MAIN_AUTO_INIT1:
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
105 log_msg(TAG, "Automation startup");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 #ifdef CONFIG_TEMP_SENSORS_SIMULATOR
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
107 Fake_MLT = recipe.MashStep[0].Step_temp - 10;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 Fake_HLT = recipe.SpargeTemp - 15;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 if (xSemaphoreTake(xSemaphoreDS18B20, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 ds18b20_state->mlt_temperature = ((int)(Fake_MLT * 16)) / 16.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 ds18b20_state->hlt_temperature = ((int)(Fake_HLT * 16)) / 16.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 xSemaphoreGive(xSemaphoreDS18B20);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 #endif
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
115 if (recipe.Mashsteps > 1)
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
116 LastMashStep = recipe.Mashsteps - 2;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
117 else
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
118 LastMashStep = 0;
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
119 log_msg(TAG, "Last mash step %d", LastMashStep);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 // Check for a crashed session.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 if (runtime.AutoModeStarted) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
123 TopMessage((char *)"Brouwen hervatten?");
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
124 Buttons_Add( 40, 100, 80, 40, (char *)"Ja", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
125 Buttons_Add(200, 100, 80, 40, (char *)"Nee", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 SoundPlay(SOUND_Prompt);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 loop = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 while (loop) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 switch (Buttons_Scan()) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 case 0: loop = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 Resume = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 Main_Screen = runtime.StageResume;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 TimeLeft = runtime.StageTimeLeft;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 TimeBrewing = runtime.TimeBrewing;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 _UseHLT = runtime.UseHLT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 MashState = MASH_NONE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 pumpTime = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 pumpRest = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 driver_state->enable = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 if (_UseHLT) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 driver_state->hlt_sp = recipe.SpargeTemp;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 driver_state->hlt_mode = HLT_MODE_BANG;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 }
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
148 log_msg(TAG, "Resume brew screen %d, time left %d", Main_Screen, TimeLeft);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 log_begin((time_t)0);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 update_json();
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
151 log_annotation(ANNOTATION_SYSTEM, (char *)"Resume");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 return true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 case 1: loop = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 Resume = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 vTaskDelay(50 / portTICK_PERIOD_MS);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 Buttons_Clear();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 TFT_fillScreen(_bg);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 driver_state->enable = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 runtime.AutoModeStarted = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 runtime.UseHLT = _UseHLT = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 runtime.TimeBrewing = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 TimeBrewing = 0;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
176 runtime.StageResume = MAIN_AUTO_INIT1;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 runtime.StageTimeLeft = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 runtime.HopAddition = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 runtime.Logfile[0] = '\0';
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 runtime.PumpCooling = false;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
181 runtime.MashStep = 0;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
182 runtime.MaltAdded = false;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 write_runtime();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 power_MLT = power_HLT = counts = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 log_clean();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 vTaskDelay(250 / portTICK_PERIOD_MS); // Allow some time
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
189 case MAIN_AUTO_INIT2:
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 case MAIN_AUTO_DELAYSTART:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 case MAIN_AUTO_HEATUP:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 if (runtime.UseHLT) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 driver_state->hlt_mode = HLT_MODE_BANG;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
199 TopMessage((char *)"Spoelwater opwarmen");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 MLT_info(71, 26, false);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 HLT_info(71,150, false, false);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
205 case MAIN_AUTO_MASH:
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
206 if (runtime.MashStep == 0) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 MinMash = 38.0;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
208 MaxMash = recipe.MashStep[0].Step_temp+ 10.0;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 TimeBrewing = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 runtime.TimeBrewing = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 if (System_TimeOk) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 time(&now);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 localtime_r(&now, &timeinfo);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 log_begin(now);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 runtime.BrewStart = now;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 log_begin((time_t)0);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 runtime.BrewStart = (time_t)0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 updateRuntime = true;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
221 } else if (runtime.MashStep == (recipe.Mashsteps - 1)) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 MinMash = 75.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 MaxMash = 80.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 } else {
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
225 MinMash = recipe.MashStep[runtime.MashStep - 1].Step_temp;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
226 MaxMash = recipe.MashStep[runtime.MashStep + 1].Step_temp;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
227 if (MaxMash >= 75.0)
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
228 MaxMash = 74.75;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 }
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
230 MashState = Sub_Screen = MASH_NONE;
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
231 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
232 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 pumpTime = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 pumpRest = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 runtime.StageResume = Main_Screen;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 updateRuntime = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
237 TopMessage((char *)"Maischen");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 MLT_info(71, 26, false);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 if (_UseHLT) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 HLT_info(71,170, false, true);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 case MAIN_AUTO_TOBOIL:
75
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
245 if (recipe.BoilTime == 0) {
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
246 /* no-boil recipe */
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
247 log_msg(TAG, "No-boil, start cooling");
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
248 Main_Screen = MAIN_AUTO_COOLING_H;
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
249 return true;
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
250 }
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
251
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 driver_state->mlt_sp = stageTemp = config.BoilTemperature;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 driver_state->mlt_mode = MLT_MODE_EXT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255 driver_state->hlt_sp = 0.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 driver_state->hlt_mode = HLT_MODE_NONE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 runtime.StageResume = Main_Screen;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 TempReached = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
264 TopMessage((char *)"Naar koken");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 MLT_info(71, 26, false);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
266 Buttons_Add( 5, 30, 60, 40, (char *)"+sp", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
267 Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 Buttons_Show();
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
269 log_msg(TAG, "Mash done, going to boil.");
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
270 Sub_Screen = 0;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 case MAIN_AUTO_BOILING:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 if (Resume) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 TimeLeft = runtime.StageTimeLeft * 60;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 } else {
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
277 // +1 minute for flameout and for a smooth transition.
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 runtime.StageTimeLeft = TimeLeft = (recipe.BoilTime * 60) + 60;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 runtime.StageResume = Main_Screen;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 runtime.HopAddition = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 SecsCount = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 driver_state->mlt_sp = stageTemp = config.BoilTemperature;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 driver_state->mlt_mode = MLT_MODE_EXT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 SoundPlay(SOUND_TempReached);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 BoilPower = equipment.BoilPower;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 updateRuntime = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
292 TopMessage((char *)"Koken");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 MLT_info(71, 26, false);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
294 Buttons_Add( 3, 30, 60, 40, (char *)"+sp", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
295 Buttons_Add(257, 30, 60, 40, (char *)"-sp", 1);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
296 Buttons_Add( 3, 190, 60, 40, (char *)"+1m", 2);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
297 Buttons_Add(257, 190, 60, 40, (char *)"-1m", 3);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 Buttons_Show();
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
299 log_msg(TAG, "Boil temperature reached, boil %d minutes", (TimeLeft / 60) -1);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
300 log_annotation(ANNOTATION_STAGE, (char *)"Koken");
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
301 Sub_Screen = 0;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 case MAIN_AUTO_COOLING_H:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 case MAIN_AUTO_COOLING_M:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 case MAIN_AUTO_COOLING_C:
79
cb5c73a8ae90 Websocket selectors using jquery style. During cooling display the pump button on the webpage too.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
307 Sub_Screen = 0;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 TempReached = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 runtime.StageResume = Main_Screen;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 runtime.StageTimeLeft = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312 if ((Main_Screen == MAIN_AUTO_COOLING_H) && (! recipe.Whirlpool7)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 // Skip cooling before whirlpool 74 degrees
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 Main_Screen = MAIN_AUTO_COOLING_M;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 return true; //goto startover;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 if ((Main_Screen == MAIN_AUTO_COOLING_M) && (! recipe.Whirlpool6)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 // Skip cooling before whirlpool 63 degrees.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 Main_Screen = MAIN_AUTO_COOLING_C;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 return true; //goto startover;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 }
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
322 log_msg(TAG, "Prompt start cooling");
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
323 TopMessage((char *)"Start koelen?");
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
324 Buttons_Add( 40, 100, 80, 40, (char *)"Start", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
325 Buttons_Add(200, 100, 80, 40, (char *)"Stop", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 Buttons[1].dark = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 SoundPlay(SOUND_Prompt);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 _Prompt = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331
43
2079940c3989 Fixed missing whirlpool 88+ degrees. Some code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents: 42
diff changeset
332 case MAIN_AUTO_WHIRLPOOL9:
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 case MAIN_AUTO_WHIRLPOOL7:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 case MAIN_AUTO_WHIRLPOOL6:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 case MAIN_AUTO_WHIRLPOOL2:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 TempReached = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
337 runtime.StageResume = Main_Screen;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 if ((Main_Screen == MAIN_AUTO_WHIRLPOOL9) && (! recipe.Whirlpool9)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 // Skip whirlpool 93 degrees.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 Main_Screen = MAIN_AUTO_COOLING_H;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 return true; //goto startover;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 if ((Main_Screen == MAIN_AUTO_WHIRLPOOL7) && (! recipe.Whirlpool7)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 // Skip whirlpool 74 degrees.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 Main_Screen = MAIN_AUTO_COOLING_M;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 return true; //goto startover;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 if ((Main_Screen == MAIN_AUTO_WHIRLPOOL6) && (! recipe.Whirlpool6)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 // Skip whirlpool 63 degrees.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 Main_Screen = MAIN_AUTO_COOLING_C;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 return true; //goto startover;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 if ((Main_Screen == MAIN_AUTO_WHIRLPOOL2) && (! recipe.Whirlpool2)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 // Skip final whirlpool.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 Main_Screen = MAIN_AUTO_DONE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 return true; //goto startover;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
360 log_msg(TAG, "Prompt start whirlpool");
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
361 TopMessage((char *)"Start Whirlpool?");
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
362 Buttons_Add( 40, 100, 80, 40, (char *)"Start", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
363 Buttons_Add(200, 100, 80, 40, (char *)"Stop", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364 Buttons[1].dark = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
365 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366 SoundPlay(SOUND_Prompt);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 _Prompt = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 case MAIN_AUTO_DONE:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 case MAIN_AUTO_ABORT:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 driver_state->enable = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 driver_state->mlt_mode = MLT_MODE_NONE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 driver_state->mlt_sp = 0.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376 driver_state->hlt_mode = HLT_MODE_NONE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377 driver_state->hlt_sp = 0.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 driver_state->pump_run = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 _fg = TFT_YELLOW;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 TFT_setFont(DEJAVU24_FONT, NULL);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383 if (Main_Screen == MAIN_AUTO_DONE) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
384 TFT_print((char *)"Brouwen is gereed.", CENTER, CENTER);
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
385 log_msg(TAG, "Brew is done");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386 SoundPlay(SOUND_End);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 } else {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
388 TFT_print((char *)"Brouwen is afgebroken.", CENTER, CENTER);
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
389 log_msg(TAG, "Brew is aborted");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390 SoundPlay(SOUND_Warn);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
392 log_close();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393 runtime.Logfile[0] = '\0';
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394 runtime.BrewStart = (time_t)0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 runtime.AutoModeStarted = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 runtime.StageResume = MAIN_MODE_FREE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397 runtime.PumpCooling = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398 runtime.HopAddition = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 runtime.TimeBrewing = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 runtime.StageTimeLeft = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 updateRuntime = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
402 Buttons_Add(130, 200, 60, 40, (char *)"Ok", 0);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 Buttons[0].dark = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
407 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
410
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
411 return false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
412 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
413
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
414
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
415
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
416 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
417 * Automation loop screens. Mostly non-blocking.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
419 bool Automation_Loop(void)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420 {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
421 static bool beeped = false;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
422 char tmp[32], msg[256];
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
423 uint16_t y;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
424
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
425 switch (Main_Screen) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
426
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
427 case MAIN_AUTO_INIT1:
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
428 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 * Present selected equipment and recipe.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
430 */
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
431 Sub_Screen = 1;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 read_recipe(config.RecipeRec);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
433 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\",\"brew1\":\"%s\",\"brew2\":\"%s\"}",
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
434 Main_Screen, Sub_Screen, equipment.Name, recipe.Name);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
435 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436 y = 28;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
437 TopMessage((char *)"Automaat");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438 TFT_setFont(DEFAULT_FONT, NULL);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
439 ShowText(2,y,(char *)"Installatie", equipment.Name);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 y += 16;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
441 ShowText(2,y,(char *)"Recept", recipe.Name);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 y += 16;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
443 ShowFloat(2, y, (char *)"Maisch in", (char *)" C", recipe.MashStep[0].Infuse_temp, 3);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
444 ShowFloat(162, y, (char *)"Spoelwater", (char *)" C", recipe.SpargeTemp, 2);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 y += 16;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446 _fg = TFT_WHITE;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
447 TFT_print((char *)"Maisch stap", 2, y);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
448 TFT_print((char *)"T", 200, y);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
449 TFT_print((char *)"Temp.", 220, y);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
450 TFT_print((char *)"Rust", 280, y);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
451 _fg = TFT_YELLOW;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
452 y += 16;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
453 for (int i = 0; i < recipe.Mashsteps; i++) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
454 TFT_print(recipe.MashStep[i].Name, 2, y);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
455 if (recipe.MashStep[i].Type < 3)
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
456 strcpy(tmp, mashTypes[recipe.MashStep[i].Type]);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
457 else
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
458 tmp[0] = '?';
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
459 tmp[1] = '\0';
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
460 TFT_print(tmp, 200, y);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
461 sprintf(tmp, "%.2f", recipe.MashStep[i].Step_temp);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
462 TFT_print(tmp, 220, y);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
463 sprintf(tmp, "%2d m", recipe.MashStep[i].Step_time);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
464 TFT_print(tmp, 280, y);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
465 y += 16;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
466 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
467 ShowInteger(2, y, (char *)"Kooktijd", (char *)" min", recipe.BoilTime);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
468 ShowFloat(162, y, (char *)"Koel tot", (char *)" C", recipe.CoolTemp, 2);
75
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
469 if (recipe.BoilTime) {
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
470 y += 16;
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
471 if (recipe.Additions) {
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
472 _fg = TFT_YELLOW;
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
473 sprintf(tmp, "%d ", recipe.Additions);
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
474 TFT_print(tmp, 2, y);
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
475 _fg = TFT_WHITE;
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
476 TFT_print((char *)"toevoegingen om", LASTX, y);
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
477 _fg = TFT_YELLOW;
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
478 for (int i = 1; i <= recipe.Additions; i++) {
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
479 sprintf(tmp, " %d", recipe.Addition[i-1].Time);
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
480 TFT_print(tmp, LASTX, y);
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
481 }
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
482 _fg = TFT_WHITE;
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
483 TFT_print((char *)" minuten", LASTX, y);
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
484 } else {
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
485 _fg = TFT_WHITE;
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
486 TFT_print((char *)"Geen hop toevoegingen.", 2, y);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
487 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
488 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
489 y += 16;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
490 if (recipe.Whirlpool9) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
491 ShowInteger(2, y, (char *)"Whirlpool 88..100 graden", (char *)" minuten", recipe.Whirlpool9);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
492 y += 16;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
493 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
494 if (recipe.Whirlpool7) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
495 ShowInteger(2, y, (char *)"Whirlpool 71..77 graden", (char *)" minuten", recipe.Whirlpool7);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
496 y += 16;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
497 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
498 if (recipe.Whirlpool6) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
499 ShowInteger(2, y, (char *)"Whirlpool 60..66 graden", (char *)" minuten", recipe.Whirlpool6);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
500 y += 16;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
501 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
502 if (recipe.Whirlpool2) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
503 ShowInteger(2, y, (char *)"Whirlpool koud", (char *)" minuten", recipe.Whirlpool2);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
504 y += 16;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
505 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
506 Buttons_Add( 0, 210, 70, 30, (char *)"Stop" , 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
507 Buttons_Add(250, 210, 70, 30, (char *)"Start" , 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
508 Buttons[0].dark = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
509 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
510 loop = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
511 while (loop) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
512 switch (Buttons_Scan()) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
513 case 0: loop = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
514 Main_Screen = MAIN_AUTO_ABORT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
515 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
516
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
517 case 1: loop = false;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
518 Main_Screen = MAIN_AUTO_INIT2;
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
519 log_msg(TAG, "Brew `%s' on `%s'", recipe.Name, equipment.Name);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
520 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
521
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
522 default: break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
523 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
524 vTaskDelay(20 / portTICK_PERIOD_MS);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
525 }
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
526 Buttons_Clear();
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
527 break;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
528
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
529 case MAIN_AUTO_INIT2:
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
530 _UseHLT = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
531 _bg = TFT_BLACK;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
532 TFT_fillScreen(_bg);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
533 TopMessage((char *)"Maisch water aanwezig?");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
534 Buttons_Clear();
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
535 Buttons_Add( 40, 100, 80, 40, (char *)"Ja", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
536 Buttons_Add(200, 100, 80, 40, (char *)"Nee", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
537 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
538 SoundPlay(SOUND_Prompt);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
539 loop = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
540 while (loop) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
541 switch (Buttons_Scan()) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
542 case 0: loop = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
543 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
544
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
545 case 1: loop = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
546 Main_Screen = MAIN_AUTO_ABORT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
547 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
548
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
549 default: break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
550 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
551 vTaskDelay(20 / portTICK_PERIOD_MS);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
552 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
553 if (Main_Screen == MAIN_AUTO_ABORT)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
554 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
555
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
556 if ((equipment.SSR2 == SSR2_HLT_SHARE) || (equipment.SSR2 == SSR2_HLT_IND)) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
557 TopMessage((char *)"Spoelwater aanwezig?");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
558 SoundPlay(SOUND_Prompt);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
559 loop = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
560 while (loop) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
561 switch (Buttons_Scan()) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
562 case 0: loop = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
563 _UseHLT = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
564 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
565
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
566 case 1: loop = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
567 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
568
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
569 default: break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
570 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
571 vTaskDelay(20 / portTICK_PERIOD_MS);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
572 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
573 runtime.UseHLT = _UseHLT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
574 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
575 runtime.UseHLT = _UseHLT = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
576 }
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
577 log_msg(TAG, "Use HLT %s", (_UseHLT)?"true":"false");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
578 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
579 if (_UseHLT) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
580 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
581 * Calculate HLT setpoint for pre-heat. Substract the
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
582 * available Mash rest times, asume 0.5 degrees/minute
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
583 * heat capacity during mash.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
584 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
585 int AvailableTime = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
586 for (int i = 1; i < 6; i++) // Only normal Mash steps
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
587 AvailableTime += recipe.MashStep[i].Step_time;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
588 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
589 driver_state->hlt_sp = recipe.SpargeTemp - ((AvailableTime / 2) + 2);
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
590 log_msg(TAG, "HLT preheat set to %4.2f", driver_state->hlt_sp);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
591 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
594 Buttons_Clear();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
595 Main_Screen = MAIN_AUTO_DELAYSTART;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
596 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
597
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
598 case MAIN_AUTO_DELAYSTART:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
599 Main_Screen = MAIN_AUTO_HEATUP;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
600 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
601
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
602 case MAIN_AUTO_HEATUP:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
603 if (! runtime.UseHLT) { // Skip if HLT is off
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
604 Main_Screen = MAIN_AUTO_MASH;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
605 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
606 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
607
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
608 MLT_info(71, 26, true);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
609 HLT_info(71,150, true, false);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
610 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
611 if (driver_state->hlt_pv >= driver_state->hlt_sp) {
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
612 Main_Screen = MAIN_AUTO_MASH;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
613 driver_state->hlt_sp = recipe.SpargeTemp; // Set final setpoint
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
614 log_msg(TAG, "HLT preheat done");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
615 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
616 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
617 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
618 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
619
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
620 case MAIN_AUTO_MASH:
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
621 temp_MLT = 0.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
622 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
623 temp_MLT = driver_state->mlt_pv;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
624
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
625 if (MashState == MASH_ADD || MashState == MASH_REMOVE || MashState == MASH_INFUSE) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
626 driver_state->pump_run = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
627 } else if (MashState != MASH_NONE) {
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
628 if (runtime.MashStep == 0) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
629 driver_state->pump_run = (equipment.PumpPreMash && ! pumpRest) ? 1 : 0;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
630 } else if (runtime.MashStep == (recipe.Mashsteps -1)) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
631 driver_state->pump_run = (equipment.PumpMashOut && ! pumpRest) ? 1 : 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
632 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
633 driver_state->pump_run = (equipment.PumpOnMash && ! pumpRest) ? 1 : 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
634 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
635 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
636 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
637 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
638 if (MashState == MASH_NONE) {
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
639 if (runtime.MashStep == 0 && ! runtime.MaltAdded && recipe.MashStep[0].Infuse_temp) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
640 stageTemp = recipe.MashStep[0].Infuse_temp;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
641 } else {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
642 stageTemp = recipe.MashStep[runtime.MashStep].Step_temp;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
643 }
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
644 stageTime = recipe.MashStep[runtime.MashStep].Step_time;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
645 TempReached = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
646 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
647 driver_state->mlt_sp = stageTemp;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
648 driver_state->mlt_mode = MLT_MODE_PID;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
649 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
650 }
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
651 MashState = Sub_Screen = MASH_WAITTEMP;
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
652 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
653 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
654 log_msg(TAG, "Mash step %d type: %s time: %d sp: %6.4f sv: %6.4f",
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
655 runtime.MashStep, mashTypes[recipe.MashStep[runtime.MashStep].Type],
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
656 stageTime, stageTemp, temp_MLT);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
657
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
658 if (runtime.MashStep) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
659 // Do not annotate before the log is open.
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
660 if (runtime.MashStep == (recipe.Mashsteps -1)) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
661 log_annotation(ANNOTATION_STAGE, (char *)"Uitmaischen");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
662 } else {
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
663 sprintf(logline, "Maisch: %d", runtime.MashStep);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
664 log_annotation(ANNOTATION_STAGE, logline);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
665 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
666 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
667
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
668 if (! runtime.MaltAdded) {
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
669 TopMessage((char *)"Maischwater opwarmen");
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
670 } else if (strlen(recipe.MashStep[runtime.MashStep].Name)) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
671 TopMessage(recipe.MashStep[runtime.MashStep].Name);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
672 } else {
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
673 sprintf(temp_buf, "Maisch stap #%d", runtime.MashStep);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
674 TopMessage(temp_buf);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
675 }
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
676 if (runtime.MashStep && (runtime.MashStep < recipe.Mashsteps) && (recipe.MashStep[runtime.MashStep].Type != MASHTYPE_TEMPERATURE)) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
677 TFT_fillRect(0, 120, 320, 50, TFT_BLACK);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
678 Buttons_Clear();
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
679 Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0);
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
680 Buttons[0].dark = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
681 Buttons_Add(255,120, 60, 40, (char *)"Ok", 1);
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
682 Buttons_Show();
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
683 _fg = TFT_WHITE;
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
684 _bg = TFT_BLACK;
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
685 TFT_setFont(DEJAVU18_FONT, NULL);
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
686 if (recipe.MashStep[runtime.MashStep].Type == MASHTYPE_INFUSION) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
687 sprintf(temp_buf, "Infusie %.1f L/%.1f C", recipe.MashStep[runtime.MashStep].Infuse_amount,
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
688 recipe.MashStep[runtime.MashStep].Infuse_temp);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
689 MashState = Sub_Screen = MASH_INFUSE;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
690 log_msg(TAG, "Mash infusion prompt");
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
691 } else if (recipe.MashStep[runtime.MashStep].Type == MASHTYPE_DECOCTION) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
692 sprintf(temp_buf, "Decoctie %.1f Liter", recipe.MashStep[runtime.MashStep].Infuse_amount);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
693 MashState = Sub_Screen = MASH_DECOCT;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
694 log_msg(TAG, "Mash decoction prompt");
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
695 }
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
696 TFT_print(temp_buf, CENTER, 135);
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
697 SoundPlay(SOUND_Prompt);
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
698 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"%s\"}", Main_Screen, Sub_Screen, temp_buf);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
699 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
700 if (recipe.MashStep[runtime.MashStep].Type == MASHTYPE_INFUSION) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
701 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
702 // No heating during the infusion.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
703 driver_state->mlt_sp = stageTemp;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
704 driver_state->mlt_mode = MLT_MODE_OFF;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
705 xSemaphoreGive(xSemaphoreDriver);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
706 }
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
707 }
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
708 } else {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
709 Buttons_Add( 5, 30, 60, 40, (char *)"+sp", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
710 Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1);
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
711 Buttons_Show();
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
712 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
713
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
714 } else if (MashState == MASH_WAITTEMP) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
715 pumpRest = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
716 if (temp_MLT < stageTemp) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
717 Steady = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
718 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
719 if ((temp_MLT >= stageTemp) && (Steady > 10)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
720 SoundPlay(SOUND_TempReached);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721 TempReached = true;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
722 MashState = Sub_Screen = MASH_REST;
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
723 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
724 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
725 if (! runtime.MaltAdded && runtime.MashStep == 0) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
726 TimerSet(0);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
727 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
728 if (Resume && (runtime.StageTimeLeft < stageTime))
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
729 TimerSet(runtime.StageTimeLeft * 60);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
730 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
731 TimerSet(stageTime * 60);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
732 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
733 Resume = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
734 runtime.StageTimeLeft = TimeLeft / 60;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
735 updateRuntime = true;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
736 log_msg(TAG, "Mash step %d temperature reached, rest %d minutes", runtime.MashStep, TimeLeft / 60);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
737 Buttons_Clear();
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
738 Buttons_Add( 0, 120, 60, 40, (char *)"+1m", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
739 Buttons_Add(260, 120, 60, 40, (char *)"-1m", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742 switch (Buttons_Scan()) {
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
743 case 0: if (stageTemp < MaxMash)
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
744 change_sp(true);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
745 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
746
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
747 case 1: if (stageTemp > MinMash)
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
748 change_sp(false);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
749 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
752 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
753 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
754 if (NewMinute)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
755 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
756
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
757 } else if (MashState == MASH_REST) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
759 * Mash step rest time and pump control
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
760 */
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
761 if (((runtime.MashStep == (recipe.Mashsteps -1)) && equipment.PumpMashOut) ||
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
762 ((runtime.MashStep < recipe.Mashsteps) && equipment.PumpOnMash)) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763 float DeltaTemp = equipment.PumpRest * stageTemp / 120; // Maximum temperature drop before heating again.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
764 if (pumpTime >= (equipment.PumpCycle + equipment.PumpRest) || ((stageTemp - temp_MLT) > DeltaTemp)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
765 pumpTime = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
766 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
767 if (pumpTime >= equipment.PumpCycle) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
768 if (! pumpRest) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
769 pumpRest = true;
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
770 log_msg(TAG, "Pump stop");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
771 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
772 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
773 if (pumpRest) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
774 pumpRest = false;
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
775 log_msg(TAG, "Pump start");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
776 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
777 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
778 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
779 if (TimeLeft) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
780 switch (Buttons_Scan()) {
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
781 case 0: change_tl(21600);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
782 runtime.StageTimeLeft = TimeLeft / 60;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
783 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
784 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
785
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
786 case 1: change_tl(0);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
787 runtime.StageTimeLeft = TimeLeft / 60;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
788 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
789 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
790
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
791 default: break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
792 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
793 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
794
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
795 if (TimeLeft == 0) {
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
796 runtime.StageTimeLeft = 0;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
797 updateRuntime = true;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
798 if (runtime.MashStep == 0 && ! runtime.MaltAdded && config.AskAdd) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
799 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
800 * Add Mash prompt.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
801 */
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
802 stageTemp = recipe.MashStep[runtime.MashStep].Step_temp; // Set normal step temperature
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
803 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
804 driver_state->mlt_sp = stageTemp;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
805 xSemaphoreGive(xSemaphoreDriver);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
806 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
807 log_annotation(ANNOTATION_EVENT, (char *)"Mout storten");
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
808 TFT_fillRect(0, 120, 320, 50, TFT_BLACK);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
809 Buttons_Clear();
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
810 Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
811 Buttons[0].dark = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
812 Buttons_Add(255,120, 60, 40, (char *)"Ok", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
813 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
814 _fg = TFT_WHITE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
815 _bg = TFT_BLACK;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
816 TFT_setFont(DEJAVU24_FONT, NULL);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
817 TFT_print((char *)"Mout storten?", CENTER, 135);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
818 SoundPlay(SOUND_Prompt);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
819 MashState = Sub_Screen = MASH_ADD;
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
820 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Mout storten?\"}", Main_Screen, Sub_Screen);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
821 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
822 log_msg(TAG, "Mash add prompt");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
823 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
824 }
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
825 if ((runtime.MashStep == LastMashStep) && config.AskIodine) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
826 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
827 * Iodone test prompt.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
828 */
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
829 log_annotation(ANNOTATION_EVENT, (char *)"Jodium test");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
830 TFT_fillRect(0, 120, 320, 50, TFT_BLACK);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
831 Buttons_Clear();
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
832 Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
833 Buttons[0].dark = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
834 Buttons_Add(255,120, 60, 40, (char *)"Ok", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
835 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
836 _fg = TFT_WHITE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
837 _bg = TFT_BLACK;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
838 TFT_setFont(DEJAVU24_FONT, NULL);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
839 TFT_print((char *)"Jodium test?", CENTER, 127);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
840 SoundPlay(SOUND_Prompt);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
841 beeped = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
842 TimerSet(config.IodineTime * 60);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
843 MashState = Sub_Screen = MASH_IODINE;
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
844 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Jodium test?\"}", Main_Screen, Sub_Screen);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
845 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
846 log_msg(TAG, "Mash iodine test prompt");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
847 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
848 }
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
849 if ((runtime.MashStep == (recipe.Mashsteps - 1)) && config.AskRemove) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
850 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
851 * Mash remove prompt.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
852 */
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
853 log_annotation(ANNOTATION_EVENT, (char *)"Mout verwijderen");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
854 TFT_fillRect(0, 120, 320, 50, TFT_BLACK);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
855 Buttons_Clear();
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
856 Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
857 Buttons[0].dark = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
858 Buttons_Add(255,120, 60, 40, (char *)"Ok", 1);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
859 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
860 _fg = TFT_WHITE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
861 _bg = TFT_BLACK;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
862 TFT_setFont(DEJAVU18_FONT, NULL);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
863 TFT_print((char *)"Mout verwijderen?", CENTER, 135);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
864 SoundPlay(SOUND_Prompt);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
865 MashState = Sub_Screen = MASH_REMOVE;
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
866 snprintf(msg, 127, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Mout verwijderen?\"}", Main_Screen, Sub_Screen);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
867 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
868 log_msg(TAG, "Mash remove prompt");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
869 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
870 }
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
871 if (Main_Screen != MAIN_AUTO_ABORT) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
872 runtime.MashStep++;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
873 MashState = Sub_Screen = MASH_NONE;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
874 if (runtime.MashStep == recipe.Mashsteps)
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
875 Main_Screen = MAIN_AUTO_TOBOIL;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
876 updateRuntime = true;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
877 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
878 TempReached = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
879 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
880 TimerShow(TimeLeft, 65, 122);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
881 if (NewMinute) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
882 runtime.StageTimeLeft = TimeLeft / 60;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
883 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
884 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
885 }
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
886 } else if (MashState == MASH_ADD || MashState == MASH_IODINE || MashState == MASH_REMOVE) {
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
887 if (MashState == MASH_IODINE) {
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
888 if (TimeSpent % 45 == 0) {
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
889 if (! beeped) {
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
890 SoundPlay(SOUND_Warn);
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
891 beeped = true;
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
892 }
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
893 } else {
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
894 beeped = false;
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
895 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
896 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
897 switch (Buttons_Scan()) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
898 case 0: Main_Screen = MAIN_AUTO_ABORT;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
899 break;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
900 case 1: //Main_Screen++;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
901 if (MashState == MASH_ADD) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
902 MashState = Sub_Screen = MASH_NONE;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
903 runtime.MaltAdded = true;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
904 updateRuntime = true;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
905 } else if (MashState == MASH_IODINE) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
906 MashState = Sub_Screen = MASH_NONE;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
907 runtime.MashStep++;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
908 if (runtime.MashStep == recipe.Mashsteps)
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
909 Main_Screen = MAIN_AUTO_TOBOIL;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
910 updateRuntime = true;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
911 } else if (MashState == MASH_REMOVE) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
912 Main_Screen = MAIN_AUTO_TOBOIL;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
913 }
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
914 TFT_fillRect(0, 120, 320, 50, TFT_BLACK);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
915 Buttons_Clear();
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
916 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
917 default: break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
918 }
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
919 if (MashState == MASH_IODINE && TimeLeft == 0) {
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
920 MashState = Sub_Screen = MASH_NONE;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
921 runtime.MashStep++;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
922 if (runtime.MashStep == recipe.Mashsteps)
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
923 Main_Screen = MAIN_AUTO_TOBOIL;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
924 updateRuntime = true;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
925 TFT_fillRect(0, 120, 320, 50, TFT_BLACK);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
926 Buttons_Clear();
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
927 }
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
928 } else if (MashState == MASH_INFUSE || MashState == MASH_DECOCT) {
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
929 switch (Buttons_Scan()) {
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
930 case 0: Main_Screen = MAIN_AUTO_ABORT;
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
931 break;
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
932 case 1:
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
933 #ifdef CONFIG_TEMP_SENSORS_SIMULATOR
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
934 if (MashState == MASH_DECOCT) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
935 Fake_MLT = recipe.MashStep[runtime.MashStep].Step_temp - 0.72; // Fake the decoction amt.
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
936 if (xSemaphoreTake(xSemaphoreDS18B20, 10) == pdTRUE) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
937 ds18b20_state->mlt_temperature = ((int)(Fake_MLT * 16)) / 16.0;
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
938 xSemaphoreGive(xSemaphoreDS18B20);
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
939 }
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
940 }
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
941 #endif
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
942 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
943 // Start PID again.
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
944 driver_state->mlt_sp = stageTemp;
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
945 driver_state->mlt_mode = MLT_MODE_PID;
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
946 xSemaphoreGive(xSemaphoreDriver);
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
947 }
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
948 TFT_fillRect(0, 120, 320, 50, TFT_BLACK);
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
949 Buttons_Clear();
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
950 Buttons_Add( 5, 30, 60, 40, (char *)"+sp", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
951 Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1);
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
952 Buttons_Show();
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
953 TFT_fillRect(65, 120, 190, 40, TFT_BLACK);
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
954 if (MashState == MASH_INFUSE) {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
955 log_msg(TAG, "Eind infusie");
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
956 log_annotation(ANNOTATION_EVENT, (char *)"Eind infusie");
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
957 } else {
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
958 log_msg(TAG, "Eind decoctie");
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
959 log_annotation(ANNOTATION_EVENT, (char *)"Eind decoctie");
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
960 }
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
961 MashState = Sub_Screen = MASH_WAITTEMP;
78
b58e0c9897e1 Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents: 77
diff changeset
962 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen);
77
66c77497d86d Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents: 75
diff changeset
963 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
19
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
964 break;
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
965 default: break;
49e2960d4642 Implemented infusion mash.
Michiel Broek <mbroek@mbse.eu>
parents: 1
diff changeset
966 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
967 } /* MashState */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
968 MLT_info(71, 26, true);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
969 if (_UseHLT) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
970 HLT_info(71, 170, true, true);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
971 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
972 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
973
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
974 case MAIN_AUTO_TOBOIL:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
975 Output = 255;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
976 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
977 * Go to the boil temperature and wait until it is steady.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
978 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
979 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
980 if (driver_state->mlt_pv < stageTemp) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
981 Steady = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
982 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
983 if (Steady > 10) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
984 Main_Screen = MAIN_AUTO_BOILING;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
985 TempReached = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
986 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
987 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
988 driver_state->pump_run = (equipment.PumpOnBoil && (driver_state->mlt_pv < equipment.PumpMaxTemp)) ? 1 : 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
989 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
990 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
991
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
992 MLT_info(71, 26, true);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
993 switch (Buttons_Scan()) {
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
994 case 0: if (stageTemp < 105) {
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
995 change_sp(true);
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
996 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
997 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
998
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
999 case 1: if (stageTemp > 80) {
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1000 change_sp(false);
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1001 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1002 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1003
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1004 default: break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1005 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1006 if (Resume)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1007 Resume = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1008 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1009
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1010 case MAIN_AUTO_BOILING:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1011 if (Resume)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1012 Resume = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1013 if (NewMinute) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1014 if ((runtime.HopAddition < recipe.Additions) && (TimeLeft <= ((recipe.Addition[runtime.HopAddition].Time * 60) + 60))) {
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1015 log_msg(TAG, "Hop addition %d at %d minutes", runtime.HopAddition + 1, recipe.Addition[runtime.HopAddition].Time);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1016 TopMessage(recipe.Addition[runtime.HopAddition].Name);
26
373a33699605 Graph title includes beer code. Hop additions now only display the additions themselfes.
Michiel Broek <mbroek@mbse.eu>
parents: 24
diff changeset
1017 log_annotation(ANNOTATION_EVENT, recipe.Addition[runtime.HopAddition].Name);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1018 SoundPlay(SOUND_AddHop);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1019 runtime.HopAddition++;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1020 } else {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1021 TopMessage((char *)"Koken");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1022 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1023 runtime.StageTimeLeft = TimeLeft / 60;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1024 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1025 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1026 if (TimeLeft < 60) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1027 if (Output) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1028 log_annotation(ANNOTATION_STAGE, (char *)"Vlamuit");
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1029 log_msg(TAG, "Boil flame off");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1030 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1031 // Flameout
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1032 Output = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1033 } else if (driver_state->mlt_pv >= stageTemp) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1034 Output = (int)((BoilPower * 255.0) / 100.0);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1035 if (Buttons[4].x == -1) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1036 Buttons_Add( 3,110, 60, 40, (char *)"+%", 4);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1037 Buttons_Add(257,110, 60, 40, (char *)"-%", 5);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1038 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1039 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1040 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1041 Output = 255;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1042 if (Buttons[4].x != -1) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1043 Buttons[4].x = Buttons[5].x = -1;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1044 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1045 TFT_fillRect( 3,110, 60, 40, TFT_BLACK);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1046 TFT_fillRect(257,110, 60, 40, TFT_BLACK);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1047 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1048 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1049
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1050 MLT_info(71, 26, true);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1051 TimerShow(TimeLeft, 65, 190);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1052
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1053 switch (Buttons_Scan()) {
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1054 case 0: if (stageTemp < 105) {
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1055 change_sp(true);
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1056 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1057 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1058
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1059 case 1: if (stageTemp > 80) {
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1060 change_sp(false);
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1061 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1062 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1063
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
1064 case 2: change_tl(21600);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1065 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1066
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
1067 case 3: change_tl(0);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1068 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1069
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1070 case 4: if (BoilPower < 100)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1071 BoilPower++;
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1072 log_msg(TAG, "Increase boilpower to %d%%", BoilPower);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1073 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1074
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1075 case 5: if (BoilPower > 0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1076 BoilPower--;
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1077 log_msg(TAG, "Decrease boilpower to %d%%", BoilPower);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1078 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1079
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1080 default: break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1081 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1082
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1083 if (TimeLeft == 0) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1084 Main_Screen = MAIN_AUTO_WHIRLPOOL9;
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1085 log_msg(TAG, "Boil is ready");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1086 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1087 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1088
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1089 case MAIN_AUTO_COOLING_H:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1090 case MAIN_AUTO_COOLING_M:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1091 case MAIN_AUTO_COOLING_C:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1092 if (_Prompt) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1093 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1094 * Prompt mode
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1095 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1096 switch (Buttons_Scan()) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1097 case 0: _Prompt = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1098 Buttons_Clear();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1099 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1100 case 1: Main_Screen = MAIN_AUTO_DONE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1101 Buttons_Clear();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1102 return true; //goto startover;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1103 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1104 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1105 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1106 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1107
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1108 if (! _Prompt) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1109 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1110 * Starting cooling, setup the screen.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1111 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1112 Buttons_Clear();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1113 TFT_fillScreen(_bg);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
1114 Sub_Screen = 1;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1115 if (Main_Screen == MAIN_AUTO_COOLING_H) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1116 stageTemp = 77.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1117 } else if (Main_Screen == MAIN_AUTO_COOLING_M) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1118 stageTemp = 66.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1119 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1120 stageTemp = recipe.CoolTemp;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1121 }
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
1122 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1123 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1124 CoolBeep = false;
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1125 log_msg(TAG, "Start cooling from %6.2f to %4.1f", ds18b20_state->mlt_temperature, stageTemp);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1126 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1127 driver_state->mlt_mode = MLT_MODE_OFF;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1128 driver_state->mlt_sp = stageTemp;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1129 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1130 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1131 log_annotation(ANNOTATION_STAGE, (char *)"Koelen");
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1132 TopMessage((char *)"Koelen");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1133 MLT_info(71, 26, false);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1134 Buttons_Add( 5, 200, 60, 40, (char *)"Stop", 0);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1135 Buttons[0].dark = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1136 Buttons_Add( 5, 26, 60, 40, (char *)"+1", 1);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1137 Buttons_Add(255, 26, 60, 40, (char *)"-1", 2);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1138 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1139 * The next key is not a mistake, but we need a key entry which
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1140 * will later become the pump key. The keyscan routine will find
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1141 * the original key if pressed.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1142 */
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1143 Buttons_Add(255, 26, 60, 40, (char *)"-1", 3);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1144 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1145 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1146 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1147 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1148 * Not in prompt mode.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1149 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1150 #ifdef CONFIG_TEMP_SENSORS_SIMULATOR
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1151 if (Fake_MLT > 12.0) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1152 if (driver_state->pump_run)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1153 Fake_MLT -= 0.00025 * (Fake_MLT - 12.0);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1154 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1155 Fake_MLT -= 0.00015 * (Fake_MLT - 12.0);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1156 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1157 if (xSemaphoreTake(xSemaphoreDS18B20, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1158 ds18b20_state->mlt_temperature = ((int)(Fake_MLT * 16)) / 16.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1159 xSemaphoreGive(xSemaphoreDS18B20);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1160 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1161 #endif
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1162 MLT_info(71, 26, true);
79
cb5c73a8ae90 Websocket selectors using jquery style. During cooling display the pump button on the webpage too.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1163 if (Sub_Screen == 1 && xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1164 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1165 * If the pump safe temperature is reached, add the control button.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1166 * Redefine key number 3 if it is at the position of key 2.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1167 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1168 if ((driver_state->mlt_pv < equipment.PumpMaxTemp) && (Buttons[3].x == Buttons[2].x) &&(Buttons[3].y == Buttons[2].y)) {
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1169 Buttons_Add(255, 200, 60, 40, (char *)"Pomp", 3);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1170 Buttons_Show();
79
cb5c73a8ae90 Websocket selectors using jquery style. During cooling display the pump button on the webpage too.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1171 Sub_Screen = 2;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1172 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1173 xSemaphoreGive(xSemaphoreDriver);
79
cb5c73a8ae90 Websocket selectors using jquery style. During cooling display the pump button on the webpage too.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1174 if (Sub_Screen == 2) {
cb5c73a8ae90 Websocket selectors using jquery style. During cooling display the pump button on the webpage too.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1175 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen);
cb5c73a8ae90 Websocket selectors using jquery style. During cooling display the pump button on the webpage too.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1176 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
cb5c73a8ae90 Websocket selectors using jquery style. During cooling display the pump button on the webpage too.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
1177 }
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1178 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1179 switch (Buttons_Scan()) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1180 case 1: if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1181 if (Main_Screen == MAIN_AUTO_COOLING_H) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1182 if (driver_state->mlt_sp < 77.0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1183 driver_state->mlt_sp += 1.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1184 } else if (Main_Screen == MAIN_AUTO_COOLING_M) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1185 if (driver_state->mlt_sp < 66.0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1186 driver_state->mlt_sp += 1.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1187 } else if (Main_Screen == MAIN_AUTO_COOLING_C) {
75
224851e81117 Version 0.3.9. Added no-boil handling. Fixed cooling temp during cooling to allow 45 degrees setpoint.
Michiel Broek <mbroek@mbse.eu>
parents: 64
diff changeset
1188 if (driver_state->mlt_sp < 45.0)
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1189 driver_state->mlt_sp += 1.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1190 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1191 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1192 }
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1193 log_msg(TAG, "Increase sp to %.2f", driver_state->mlt_sp);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1194 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1195
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1196 case 0: Buttons_Add( 60, 150, 90, 40, (char *)"Stoppen", 4);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1197 Buttons[4].dark = true;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1198 Buttons_Add(170, 150, 90, 40, (char *)"Sorry", 5);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1199 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1200 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1201
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1202 case 2: if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1203 if (Main_Screen == MAIN_AUTO_COOLING_H) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1204 if (driver_state->mlt_sp > 71.0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1205 driver_state->mlt_sp -= 1.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1206 } else if (Main_Screen == MAIN_AUTO_COOLING_M) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1207 if (driver_state->mlt_sp > 60.0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1208 driver_state->mlt_sp -= 1.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1209 } else if (Main_Screen == MAIN_AUTO_COOLING_C) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1210 if (driver_state->mlt_sp > 10.0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1211 driver_state->mlt_sp -= 1.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1212 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1213 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1214 }
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1215 log_msg(TAG, "Decrease sp to %.2f", driver_state->mlt_sp);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1216 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1217
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1218 case 3: if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1219 if (driver_state->mlt_pv < equipment.PumpMaxTemp) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1220 if (driver_state->pump_run)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1221 driver_state->pump_run = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1222 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1223 driver_state->pump_run = 1;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1224 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1225 driver_state->pump_run = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1226 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1227 runtime.PumpCooling = driver_state->pump_run;
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1228 log_msg(TAG, "Pump turned %s", (driver_state->pump_run)?"on":"off");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1229 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1230 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1231 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1232 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1233
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1234 case 4: Main_Screen++;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1235 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1236
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1237 case 5: Buttons[4].x = Buttons[5].x = -1;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1238 TFT_fillRect(60, 150, 200, 40, TFT_BLACK);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1239 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1240
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1241 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1242 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1243 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1244
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1245 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1246 if (! CoolBeep && (driver_state->mlt_pv < (driver_state->mlt_sp + 2.0))) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1247 SoundPlay(SOUND_Warn);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1248 CoolBeep = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1249 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1250 if (driver_state->mlt_pv <= driver_state->mlt_sp) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1251 SoundPlay(SOUND_TempReached);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1252 Main_Screen++;
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
1253 Sub_Screen = 0;
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1254 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1255 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1256 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1257 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1258 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1259
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1260 case MAIN_AUTO_WHIRLPOOL9:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1261 case MAIN_AUTO_WHIRLPOOL7:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1262 case MAIN_AUTO_WHIRLPOOL6:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1263 case MAIN_AUTO_WHIRLPOOL2:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1264 if (_Prompt) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1265
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1266 switch (Buttons_Scan()) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1267 case 0: _Prompt = false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1268 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1269 case 1: if (Main_Screen == MAIN_AUTO_WHIRLPOOL2) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1270 Main_Screen = MAIN_AUTO_DONE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1271 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1272 Main_Screen++;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1273 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1274 Buttons_Clear();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1275 return true; //goto startover;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1276 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1277 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1278 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1279 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1280
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1281 if (! _Prompt) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1282 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1283 * Prepare the screen for the actual whirpool.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1284 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1285 Buttons_Clear();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1286 TFT_fillScreen(_bg);
42
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
1287 Sub_Screen = 1;
c6a1a6ca5437 Finished websockets screens.
Michiel Broek <mbroek@mbse.eu>
parents: 27
diff changeset
1288 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1289 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg));
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1290 if (Main_Screen == MAIN_AUTO_WHIRLPOOL9) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1291 TimeWhirlPool = recipe.Whirlpool9;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1292 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1293 driver_state->mlt_sp = 93.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1294 driver_state->mlt_mode = MLT_MODE_PID;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1295 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1296 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1297 TopMessage((char *)"Whirlpool 88..100");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1298 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL7) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1299 TimeWhirlPool = recipe.Whirlpool7;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1300 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1301 driver_state->mlt_sp = 74.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1302 driver_state->mlt_mode = MLT_MODE_PID;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1303 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1304 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1305 TopMessage((char *)"Whirlpool 71..77");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1306 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL6) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1307 TimeWhirlPool = recipe.Whirlpool6;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1308 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1309 driver_state->mlt_sp = 63.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1310 driver_state->mlt_mode = MLT_MODE_PID;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1311 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1312 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1313 TopMessage((char *)"Whirlpool 60..66");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1314 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1315 TimeWhirlPool = recipe.Whirlpool2;
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1316 TopMessage((char *)"Koude whirlpool");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1317 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1318 if (Resume) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1319 TimeWhirlPool = runtime.StageTimeLeft;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1320 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1321
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1322 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1323 * If the pump is allowed at the current temperature, turn it on.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1324 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1325 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1326 driver_state->pump_run = (driver_state->mlt_pv < equipment.PumpMaxTemp) ? 1 : 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1327 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1328 }
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1329 log_annotation(ANNOTATION_STAGE, (char *)"Whirlpool");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1330
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1331 TimerSet(TimeWhirlPool * 60);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1332 runtime.StageTimeLeft = TimeWhirlPool;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1333 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1334 MLT_info(71, 26, false);
62
2e90ada37476 Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents: 56
diff changeset
1335 log_msg(TAG, "Whirlpool %d minutes, sp %4.1f", TimeWhirlPool, driver_state->mlt_sp);
54
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1336 Buttons_Add(255, 120, 60, 40, (char *)"+1m", 0);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1337 Buttons_Add( 5, 120, 60, 40, (char *)"-1m", 1);
7b134c27fadb Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 43
diff changeset
1338 Buttons_Add(255, 200, 60, 40, (char *)"Pomp", 2);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1339 Buttons_Show();
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1340 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1341 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1342 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1343 * Not running in prompt mode, do the whirlpool.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1344 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1345 if (TimeLeft == 120) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1346 /*
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1347 * Drop the temperature when whirlpool is almost ready.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1348 * If we are lucky the heater element will cool down so
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1349 * the next cooling stage will not wast too much energy.
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1350 */
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1351 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1352 if (Main_Screen == MAIN_AUTO_WHIRLPOOL9)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1353 driver_state->mlt_sp = 88.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1354 if (Main_Screen == MAIN_AUTO_WHIRLPOOL7)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1355 driver_state->mlt_sp = 71.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1356 if (Main_Screen == MAIN_AUTO_WHIRLPOOL6)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1357 driver_state->mlt_sp = 60.0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1358 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1359 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1360 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1361
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1362 MLT_info(71, 26, true);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1363 TimerShow(TimeLeft, 65, 122);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1364 switch (Buttons_Scan()) {
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
1365 case 0: change_tl(7200);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1366 break;
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
1367 case 1: change_tl(0);
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1368 break;
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
1369 case 2: if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1370 if (driver_state->mlt_pv < equipment.PumpMaxTemp) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1371 if (driver_state->pump_run)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1372 driver_state->pump_run = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1373 else
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1374 driver_state->pump_run = 1;
64
326c38d3681b Added more plain logfile entries. Change some message details. Added anohe function to eliminate duplicated code. Moved the logfile to the web so it can be downloaded or viewed.
Michiel Broek <mbroek@mbse.eu>
parents: 62
diff changeset
1375 log_msg(TAG, "Pump switched %s", (driver_state->pump_run)?"on":"off");
0
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1376 } else {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1377 driver_state->pump_run = 0;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1378 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1379 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1380 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1381 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1382
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1383 if (NewMinute) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1384 runtime.StageTimeLeft = TimeLeft / 60;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1385 updateRuntime = true;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1386 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1387
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1388 if ((TimeLeft == 0)) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1389 if (Main_Screen == MAIN_AUTO_WHIRLPOOL9) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1390 Main_Screen = MAIN_AUTO_COOLING_H;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1391 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1392 driver_state->pump_run = runtime.PumpCooling;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1393 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1394 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1395 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL7) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1396 Main_Screen = MAIN_AUTO_COOLING_M;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1397 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1398 driver_state->pump_run = runtime.PumpCooling;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1399 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1400 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1401 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL6) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1402 Main_Screen = MAIN_AUTO_COOLING_C;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1403 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1404 driver_state->pump_run = runtime.PumpCooling;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1405 xSemaphoreGive(xSemaphoreDriver);
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1406 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1407 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL2) {
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1408 Main_Screen = MAIN_AUTO_DONE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1409 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1410 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1411 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1412 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1413
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1414 case MAIN_AUTO_DONE:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1415 case MAIN_AUTO_ABORT:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1416 if (Buttons_Scan() == 0)
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1417 Main_Screen = MAIN_MODE_FREE;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1418 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1419
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1420 default:
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1421 break;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1422 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1423
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1424 return false;
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1425 }
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1426
b74b0e4902c3 Initial checkin brewboard
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1427

mercurial