main/automation.c

Fri, 30 Jul 2021 19:39:02 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 30 Jul 2021 19:39:02 +0200
changeset 117
b6d5c4cb61bb
parent 104
03c38ad63e8c
child 119
1cef3c25426b
permissions
-rw-r--r--

Removed Delay Start code leftovers.

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

mercurial