Tue, 16 Jan 2024 09:51:55 +0100
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
0 | 1 | /** |
2 | * @file automation.c | |
3 | * @brief Automation functions. | |
4 | */ | |
5 | ||
6 | #include "config.h" | |
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 | 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 | 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 | 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 | 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 | 56 | #ifdef CONFIG_TEMP_SENSORS_SIMULATOR |
57 | extern float Fake_MLT; | |
58 | extern float Fake_HLT; | |
59 | #endif | |
60 | ||
19 | 61 | extern const char *mashTypes[]; |
62 | ||
0 | 63 | static const char *TAG = "automation"; |
64 | ||
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 | 99 | /* |
100 | * Automation init function that only runs once when a | |
101 | * new screen is entered. | |
102 | */ | |
103 | bool Automation_Init(void) | |
104 | { | |
42 | 105 | char msg[64]; |
106 | ||
0 | 107 | switch (Main_Screen) { |
42 | 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 | 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; |
121
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
112 | Fake_HLT = recipe.SpargeTemp - 45; |
0 | 113 | if (xSemaphoreTake(xSemaphoreDS18B20, 10) == pdTRUE) { |
114 | ds18b20_state->mlt_temperature = ((int)(Fake_MLT * 16)) / 16.0; | |
115 | ds18b20_state->hlt_temperature = ((int)(Fake_HLT * 16)) / 16.0; | |
116 | xSemaphoreGive(xSemaphoreDS18B20); | |
117 | } | |
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 | 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 | 129 | // Check for a crashed session. |
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 | 134 | Buttons_Show(); |
135 | SoundPlay(SOUND_Prompt); | |
136 | loop = true; | |
137 | while (loop) { | |
138 | switch (Buttons_Scan()) { | |
139 | case 0: loop = false; | |
140 | Resume = true; | |
141 | Main_Screen = runtime.StageResume; | |
142 | TimeLeft = runtime.StageTimeLeft; | |
143 | TimeBrewing = runtime.TimeBrewing; | |
144 | _UseHLT = runtime.UseHLT; | |
145 | MashState = MASH_NONE; | |
146 | pumpTime = 0; | |
147 | pumpRest = false; | |
148 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
149 | driver_state->enable = true; | |
150 | if (_UseHLT) { | |
151 | driver_state->hlt_sp = recipe.SpargeTemp; | |
152 | driver_state->hlt_mode = HLT_MODE_BANG; | |
153 | } | |
154 | xSemaphoreGive(xSemaphoreDriver); | |
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 | 157 | log_begin((time_t)0); |
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 | 160 | return true; |
161 | break; | |
162 | ||
163 | case 1: loop = false; | |
164 | Resume = false; | |
165 | break; | |
166 | ||
167 | default: | |
168 | break; | |
169 | } | |
170 | vTaskDelay(50 / portTICK_PERIOD_MS); | |
171 | } | |
172 | Buttons_Clear(); | |
173 | TFT_fillScreen(_bg); | |
174 | } | |
175 | ||
176 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
177 | driver_state->enable = true; | |
178 | xSemaphoreGive(xSemaphoreDriver); | |
179 | } | |
180 | runtime.AutoModeStarted = true; | |
181 | runtime.UseHLT = _UseHLT = false; | |
182 | runtime.TimeBrewing = 0; | |
183 | TimeBrewing = 0; | |
42 | 184 | runtime.StageResume = MAIN_AUTO_INIT1; |
0 | 185 | runtime.StageTimeLeft = 0; |
186 | runtime.HopAddition = 0; | |
187 | runtime.Logfile[0] = '\0'; | |
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 | 193 | write_runtime(); |
194 | power_MLT = power_HLT = counts = 0; | |
195 | log_clean(); | |
196 | vTaskDelay(250 / portTICK_PERIOD_MS); // Allow some time | |
197 | break; | |
198 | ||
42 | 199 | case MAIN_AUTO_INIT2: |
0 | 200 | break; |
201 | ||
202 | case MAIN_AUTO_HEATUP: | |
203 | if (runtime.UseHLT) { | |
204 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
205 | driver_state->hlt_mode = HLT_MODE_BANG; | |
206 | xSemaphoreGive(xSemaphoreDriver); | |
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 | 209 | MLT_info(71, 26, false); |
210 | HLT_info(71,150, false, false); | |
211 | } | |
212 | break; | |
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 | 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 | 218 | TimeBrewing = 0; |
219 | runtime.TimeBrewing = 0; | |
220 | if (System_TimeOk) { | |
221 | time(&now); | |
222 | localtime_r(&now, &timeinfo); | |
223 | log_begin(now); | |
224 | runtime.BrewStart = now; | |
225 | } else { | |
226 | log_begin((time_t)0); | |
227 | runtime.BrewStart = (time_t)0; | |
228 | } | |
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 | 231 | MinMash = 75.0; |
232 | MaxMash = 80.0; | |
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 | 238 | } |
42 | 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 | 242 | pumpTime = 0; |
243 | pumpRest = false; | |
244 | runtime.StageResume = Main_Screen; | |
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 | 247 | MLT_info(71, 26, false); |
248 | if (_UseHLT) { | |
249 | HLT_info(71,170, false, true); | |
250 | } | |
251 | break; | |
252 | ||
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 | 261 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
262 | driver_state->mlt_sp = stageTemp = config.BoilTemperature; | |
263 | driver_state->mlt_mode = MLT_MODE_EXT; | |
264 | driver_state->hlt_sp = 0.0; | |
265 | driver_state->hlt_mode = HLT_MODE_NONE; | |
266 | xSemaphoreGive(xSemaphoreDriver); | |
267 | } | |
268 | ||
269 | runtime.StageResume = Main_Screen; | |
270 | updateRuntime = true; | |
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 | 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 | 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 | 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 | 282 | Sub_Screen = 0; |
0 | 283 | break; |
284 | ||
285 | case MAIN_AUTO_BOILING: | |
286 | if (Resume) { | |
287 | TimeLeft = runtime.StageTimeLeft * 60; | |
288 | } else { | |
42 | 289 | // +1 minute for flameout and for a smooth transition. |
0 | 290 | runtime.StageTimeLeft = TimeLeft = (recipe.BoilTime * 60) + 60; |
291 | runtime.StageResume = Main_Screen; | |
292 | runtime.HopAddition = 0; | |
293 | } | |
294 | SecsCount = 0; | |
295 | ||
296 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
297 | driver_state->mlt_sp = stageTemp = config.BoilTemperature; | |
298 | driver_state->mlt_mode = MLT_MODE_EXT; | |
299 | xSemaphoreGive(xSemaphoreDriver); | |
300 | } | |
301 | SoundPlay(SOUND_TempReached); | |
302 | BoilPower = equipment.BoilPower; | |
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 | 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 | 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 | 315 | Sub_Screen = 0; |
0 | 316 | break; |
317 | ||
318 | case MAIN_AUTO_COOLING_H: | |
319 | case MAIN_AUTO_COOLING_M: | |
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 | 322 | TempReached = false; |
323 | runtime.StageResume = Main_Screen; | |
324 | runtime.StageTimeLeft = 0; | |
325 | updateRuntime = true; | |
326 | if ((Main_Screen == MAIN_AUTO_COOLING_H) && (! recipe.Whirlpool7)) { | |
327 | // Skip cooling before whirlpool 74 degrees | |
328 | Main_Screen = MAIN_AUTO_COOLING_M; | |
329 | return true; //goto startover; | |
330 | } | |
331 | if ((Main_Screen == MAIN_AUTO_COOLING_M) && (! recipe.Whirlpool6)) { | |
332 | // Skip cooling before whirlpool 63 degrees. | |
333 | Main_Screen = MAIN_AUTO_COOLING_C; | |
334 | return true; //goto startover; | |
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 | 340 | Buttons[1].dark = true; |
341 | Buttons_Show(); | |
342 | SoundPlay(SOUND_Prompt); | |
343 | _Prompt = true; | |
344 | break; | |
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 | 347 | case MAIN_AUTO_WHIRLPOOL7: |
348 | case MAIN_AUTO_WHIRLPOOL6: | |
349 | case MAIN_AUTO_WHIRLPOOL2: | |
350 | TempReached = true; | |
351 | runtime.StageResume = Main_Screen; | |
352 | updateRuntime = true; | |
353 | if ((Main_Screen == MAIN_AUTO_WHIRLPOOL9) && (! recipe.Whirlpool9)) { | |
354 | // Skip whirlpool 93 degrees. | |
355 | Main_Screen = MAIN_AUTO_COOLING_H; | |
356 | return true; //goto startover; | |
357 | } | |
358 | if ((Main_Screen == MAIN_AUTO_WHIRLPOOL7) && (! recipe.Whirlpool7)) { | |
359 | // Skip whirlpool 74 degrees. | |
360 | Main_Screen = MAIN_AUTO_COOLING_M; | |
361 | return true; //goto startover; | |
362 | } | |
363 | if ((Main_Screen == MAIN_AUTO_WHIRLPOOL6) && (! recipe.Whirlpool6)) { | |
364 | // Skip whirlpool 63 degrees. | |
365 | Main_Screen = MAIN_AUTO_COOLING_C; | |
366 | return true; //goto startover; | |
367 | } | |
368 | if ((Main_Screen == MAIN_AUTO_WHIRLPOOL2) && (! recipe.Whirlpool2)) { | |
369 | // Skip final whirlpool. | |
370 | Main_Screen = MAIN_AUTO_DONE; | |
371 | return true; //goto startover; | |
372 | } | |
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 | 378 | Buttons[1].dark = true; |
379 | Buttons_Show(); | |
380 | SoundPlay(SOUND_Prompt); | |
381 | _Prompt = true; | |
382 | break; | |
383 | ||
384 | case MAIN_AUTO_DONE: | |
385 | case MAIN_AUTO_ABORT: | |
386 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
387 | driver_state->enable = false; | |
388 | driver_state->mlt_mode = MLT_MODE_NONE; | |
389 | driver_state->mlt_sp = 0.0; | |
390 | driver_state->hlt_mode = HLT_MODE_NONE; | |
391 | driver_state->hlt_sp = 0.0; | |
392 | driver_state->pump_run = 0; | |
393 | xSemaphoreGive(xSemaphoreDriver); | |
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 | 398 | _fg = TFT_YELLOW; |
399 | TFT_setFont(DEJAVU24_FONT, NULL); | |
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 | 403 | SoundPlay(SOUND_End); |
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 | 407 | SoundPlay(SOUND_Warn); |
408 | } | |
409 | log_close(); | |
410 | runtime.Logfile[0] = '\0'; | |
411 | runtime.BrewStart = (time_t)0; | |
412 | runtime.AutoModeStarted = false; | |
413 | runtime.StageResume = MAIN_MODE_FREE; | |
414 | runtime.PumpCooling = false; | |
415 | runtime.HopAddition = 0; | |
416 | runtime.TimeBrewing = 0; | |
417 | runtime.StageTimeLeft = 0; | |
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 | 420 | Buttons[0].dark = true; |
421 | Buttons_Show(); | |
422 | break; | |
423 | ||
424 | default: | |
425 | break; | |
426 | } | |
427 | ||
428 | return false; | |
429 | } | |
430 | ||
431 | ||
432 | ||
433 | /* | |
434 | * Automation loop screens. Mostly non-blocking. | |
435 | */ | |
436 | bool Automation_Loop(void) | |
437 | { | |
438 | static bool beeped = false; | |
42 | 439 | char tmp[32], msg[256]; |
0 | 440 | uint16_t y; |
441 | ||
442 | switch (Main_Screen) { | |
443 | ||
42 | 444 | case MAIN_AUTO_INIT1: |
0 | 445 | /* |
446 | * Present selected equipment and recipe. | |
447 | */ | |
42 | 448 | Sub_Screen = 1; |
0 | 449 | read_recipe(config.RecipeRec); |
42 | 450 | snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\",\"brew1\":\"%s\",\"brew2\":\"%s\"}", |
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 | 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 | 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 | 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 | 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 | 462 | y += 16; |
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 | 468 | _fg = TFT_YELLOW; |
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 | 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 | 504 | } |
505 | } | |
506 | y += 16; | |
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 | 509 | y += 16; |
510 | } | |
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 | 513 | y += 16; |
514 | } | |
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 | 517 | y += 16; |
518 | } | |
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 | 521 | y += 16; |
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 | 525 | Buttons[0].dark = true; |
526 | Buttons_Show(); | |
527 | loop = true; | |
528 | while (loop) { | |
529 | switch (Buttons_Scan()) { | |
530 | case 0: loop = false; | |
531 | Main_Screen = MAIN_AUTO_ABORT; | |
532 | break; | |
533 | ||
534 | case 1: loop = false; | |
42 | 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 | 537 | break; |
538 | ||
539 | default: break; | |
540 | } | |
541 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
542 | } | |
42 | 543 | Buttons_Clear(); |
544 | break; | |
0 | 545 | |
42 | 546 | case MAIN_AUTO_INIT2: |
0 | 547 | _UseHLT = false; |
548 | _bg = TFT_BLACK; | |
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 | 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 | 554 | Buttons_Show(); |
555 | SoundPlay(SOUND_Prompt); | |
556 | loop = true; | |
557 | while (loop) { | |
558 | switch (Buttons_Scan()) { | |
559 | case 0: loop = false; | |
560 | break; | |
561 | ||
562 | case 1: loop = false; | |
563 | Main_Screen = MAIN_AUTO_ABORT; | |
564 | break; | |
565 | ||
566 | default: break; | |
567 | } | |
568 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
569 | } | |
570 | if (Main_Screen == MAIN_AUTO_ABORT) | |
571 | break; | |
572 | ||
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 | 575 | SoundPlay(SOUND_Prompt); |
576 | loop = true; | |
577 | while (loop) { | |
578 | switch (Buttons_Scan()) { | |
579 | case 0: loop = false; | |
580 | _UseHLT = true; | |
581 | break; | |
582 | ||
583 | case 1: loop = false; | |
584 | break; | |
585 | ||
586 | default: break; | |
587 | } | |
588 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
589 | } | |
590 | runtime.UseHLT = _UseHLT; | |
591 | } else { | |
592 | runtime.UseHLT = _UseHLT = false; | |
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 | 595 | updateRuntime = true; |
596 | if (_UseHLT) { | |
121
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
597 | /* |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
598 | * Calculate HLT setpoint for pre-heat. |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
599 | * Substract the available Mash rest plus ramp times, |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
600 | * asume 0.67 degrees/minute heat capacity during mash. |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
601 | */ |
0 | 602 | int AvailableTime = 0; |
121
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
603 | for (int i = 0; i < recipe.Mashsteps; i++) { |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
604 | if (recipe.MashStep[i].Step_temp < 75) { |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
605 | AvailableTime += (recipe.MashStep[i].Step_time + recipe.MashStep[i].Ramp_time); |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
606 | } |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
607 | } |
0 | 608 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
121
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
609 | driver_state->hlt_sp = recipe.SpargeTemp - ((AvailableTime / 1.5) + 2); |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
610 | if (driver_state->hlt_sp < 10.0) |
30aca5888d2b
Version 0.3.21. Changed HLT heatup speed calculation to 0.67 degrees/minute. Include the mash ramp times in the calculation for the initial temperature. With a combined HLT and MLT setup, the HLT preheat time is now much shorter. Fixed problems reading beerxml if there is an aroma hop. If the time was 0 or missing it was assumed to be a whirlpool hop. Now it's treated as flameout hop as it should be. Fixed sorting hop/misc additions, this could lead to missing ingredients warnings. The recipe cool temperature was treated as an integer value.
Michiel Broek <mbroek@mbse.eu>
parents:
119
diff
changeset
|
611 | driver_state->hlt_sp = 10.0; |
62
2e90ada37476
Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
612 | log_msg(TAG, "HLT preheat set to %4.2f", driver_state->hlt_sp); |
0 | 613 | xSemaphoreGive(xSemaphoreDriver); |
614 | } | |
615 | } | |
616 | Buttons_Clear(); | |
617 | Main_Screen = MAIN_AUTO_HEATUP; | |
618 | break; | |
619 | ||
620 | case MAIN_AUTO_HEATUP: | |
621 | 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
|
622 | Main_Screen = MAIN_AUTO_MASH; |
0 | 623 | break; |
624 | } | |
625 | ||
626 | MLT_info(71, 26, true); | |
627 | HLT_info(71,150, true, false); | |
628 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
629 | 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
|
630 | Main_Screen = MAIN_AUTO_MASH; |
0 | 631 | 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
|
632 | ESP_LOGD(TAG, "HLT preheat done"); |
0 | 633 | } |
634 | xSemaphoreGive(xSemaphoreDriver); | |
635 | } | |
636 | break; | |
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 | case MAIN_AUTO_MASH: |
0 | 639 | temp_MLT = 0.0; |
640 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
641 | temp_MLT = driver_state->mlt_pv; | |
642 | ||
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 | if (MashState == MASH_ADD || MashState == MASH_REMOVE || MashState == MASH_INFUSE) { |
0 | 644 | driver_state->pump_run = 0; |
645 | } 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
|
646 | if (runtime.MashStep == 0) { |
0 | 647 | 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
|
648 | } else if (runtime.MashStep == (recipe.Mashsteps -1)) { |
0 | 649 | driver_state->pump_run = (equipment.PumpMashOut && ! pumpRest) ? 1 : 0; |
650 | } else { | |
651 | driver_state->pump_run = (equipment.PumpOnMash && ! pumpRest) ? 1 : 0; | |
652 | } | |
653 | } | |
654 | xSemaphoreGive(xSemaphoreDriver); | |
655 | } | |
656 | 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
|
657 | 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
|
658 | stageTemp = recipe.MashStep[0].Infuse_temp; |
126
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
659 | } else if (recipe.MashStep[runtime.MashStep].Type != MASHTYPE_DECOCTION) { |
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
660 | /* Only change temperature if not doing decoction */ |
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
|
661 | 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
|
662 | } |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
75
diff
changeset
|
663 | stageTime = recipe.MashStep[runtime.MashStep].Step_time; |
0 | 664 | TempReached = false; |
665 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
666 | driver_state->mlt_sp = stageTemp; | |
667 | driver_state->mlt_mode = MLT_MODE_PID; | |
668 | xSemaphoreGive(xSemaphoreDriver); | |
669 | } | |
42 | 670 | 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
|
671 | 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
|
672 | 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
|
673 | 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
|
674 | runtime.MashStep, mashTypes[recipe.MashStep[runtime.MashStep].Type], |
126
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
675 | stageTime, recipe.MashStep[runtime.MashStep].Step_temp, recipe.MashStep[runtime.MashStep].End_temp, temp_MLT); |
0 | 676 | |
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
|
677 | if (runtime.MashStep) { |
0 | 678 | // 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
|
679 | 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
|
680 | log_annotation(ANNOTATION_STAGE, (char *)"Uitmaischen"); |
0 | 681 | } 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
|
682 | sprintf(logline, "Maisch: %d", runtime.MashStep); |
0 | 683 | log_annotation(ANNOTATION_STAGE, logline); |
684 | } | |
685 | } | |
686 | ||
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
|
687 | if (! runtime.MaltAdded) { |
78
b58e0c9897e1
Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
688 | 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
|
689 | } 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
|
690 | TopMessage(recipe.MashStep[runtime.MashStep].Name); |
0 | 691 | } 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
|
692 | sprintf(temp_buf, "Maisch stap #%d", runtime.MashStep); |
0 | 693 | TopMessage(temp_buf); |
694 | } | |
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
|
695 | 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
|
696 | 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
|
697 | 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
|
698 | Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0); |
19 | 699 | 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
|
700 | Buttons_Add(255,120, 60, 40, (char *)"Ok", 1); |
19 | 701 | Buttons_Show(); |
702 | _fg = TFT_WHITE; | |
703 | _bg = TFT_BLACK; | |
704 | 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
|
705 | 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
|
706 | 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
|
707 | 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
|
708 | 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
|
709 | 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
|
710 | } 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
|
711 | 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
|
712 | 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
|
713 | 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
|
714 | } |
19 | 715 | TFT_print(temp_buf, CENTER, 135); |
716 | SoundPlay(SOUND_Prompt); | |
78
b58e0c9897e1
Added reconnect-websocket javascript. Removed some debugging log messages.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
717 | 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
|
718 | 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
|
719 | 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
|
720 | 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
|
721 | // 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
|
722 | 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
|
723 | 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
|
724 | 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
|
725 | } |
19 | 726 | } |
727 | } 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
|
728 | 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
|
729 | Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1); |
19 | 730 | Buttons_Show(); |
731 | } | |
0 | 732 | |
733 | } else if (MashState == MASH_WAITTEMP) { | |
734 | pumpRest = false; | |
735 | if (temp_MLT < stageTemp) { | |
736 | Steady = 0; | |
737 | } | |
738 | if ((temp_MLT >= stageTemp) && (Steady > 10)) { | |
739 | SoundPlay(SOUND_TempReached); | |
740 | TempReached = true; | |
81
72c715ac0444
Added mash temperature adjust steps if different begin and end temperatures.
Michiel Broek <mbroek@mbse.eu>
parents:
79
diff
changeset
|
741 | newTemp = stageTemp; |
42 | 742 | 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
|
743 | 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
|
744 | 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
|
745 | if (! runtime.MaltAdded && runtime.MashStep == 0) { |
0 | 746 | TimerSet(0); |
747 | } else { | |
748 | if (Resume && (runtime.StageTimeLeft < stageTime)) | |
749 | TimerSet(runtime.StageTimeLeft * 60); | |
750 | else | |
751 | TimerSet(stageTime * 60); | |
752 | } | |
753 | Resume = false; | |
754 | 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
|
755 | oldTimeLeft = TimeLeft; |
0 | 756 | 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
|
757 | log_msg(TAG, "Mash step %d temperature reached, rest %d minutes", runtime.MashStep, TimeLeft / 60); |
0 | 758 | 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
|
759 | 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
|
760 | Buttons_Add(260, 120, 60, 40, (char *)"-1m", 1); |
0 | 761 | Buttons_Show(); |
762 | } | |
763 | 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
|
764 | 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
|
765 | change_sp(true); |
0 | 766 | break; |
767 | ||
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
|
768 | 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
|
769 | change_sp(false); |
0 | 770 | break; |
771 | ||
772 | default: | |
773 | break; | |
774 | } | |
775 | if (NewMinute) | |
776 | updateRuntime = true; | |
777 | ||
778 | } else if (MashState == MASH_REST) { | |
779 | /* | |
780 | * Mash step rest time and pump control | |
781 | */ | |
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
|
782 | 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
|
783 | ((runtime.MashStep < recipe.Mashsteps) && equipment.PumpOnMash)) { |
0 | 784 | float DeltaTemp = equipment.PumpRest * stageTemp / 120; // Maximum temperature drop before heating again. |
785 | if (pumpTime >= (equipment.PumpCycle + equipment.PumpRest) || ((stageTemp - temp_MLT) > DeltaTemp)) { | |
786 | pumpTime = 0; | |
787 | } | |
788 | if (pumpTime >= equipment.PumpCycle) { | |
789 | if (! pumpRest) { | |
790 | 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
|
791 | log_msg(TAG, "Pump stop"); |
0 | 792 | } |
793 | } else { | |
794 | if (pumpRest) { | |
795 | 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
|
796 | log_msg(TAG, "Pump start"); |
0 | 797 | } |
798 | } | |
799 | } | |
800 | if (TimeLeft) { | |
801 | 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
|
802 | case 0: change_tl(21600); |
0 | 803 | runtime.StageTimeLeft = TimeLeft / 60; |
804 | updateRuntime = true; | |
805 | break; | |
806 | ||
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
|
807 | case 1: change_tl(0); |
0 | 808 | runtime.StageTimeLeft = TimeLeft / 60; |
809 | updateRuntime = true; | |
810 | break; | |
811 | ||
812 | default: break; | |
813 | } | |
814 | } | |
815 | ||
81
72c715ac0444
Added mash temperature adjust steps if different begin and end temperatures.
Michiel Broek <mbroek@mbse.eu>
parents:
79
diff
changeset
|
816 | 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
|
817 | (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
|
818 | 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
|
819 | 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
|
820 | 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
|
821 | if (newTemp != stageTemp) { |
72c715ac0444
Added mash temperature adjust steps if different begin and end temperatures.
Michiel Broek <mbroek@mbse.eu>
parents:
79
diff
changeset
|
822 | stageTemp = newTemp; |
72c715ac0444
Added mash temperature adjust steps if different begin and end temperatures.
Michiel Broek <mbroek@mbse.eu>
parents:
79
diff
changeset
|
823 | 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
|
824 | 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
|
825 | xSemaphoreGive(xSemaphoreDriver); |
72c715ac0444
Added mash temperature adjust steps if different begin and end temperatures.
Michiel Broek <mbroek@mbse.eu>
parents:
79
diff
changeset
|
826 | } |
119
1cef3c25426b
Version 0.3.19. Real sensors and code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
117
diff
changeset
|
827 | //ESP_LOGD(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
|
828 | } |
72c715ac0444
Added mash temperature adjust steps if different begin and end temperatures.
Michiel Broek <mbroek@mbse.eu>
parents:
79
diff
changeset
|
829 | } |
72c715ac0444
Added mash temperature adjust steps if different begin and end temperatures.
Michiel Broek <mbroek@mbse.eu>
parents:
79
diff
changeset
|
830 | oldTimeLeft = TimeLeft; |
72c715ac0444
Added mash temperature adjust steps if different begin and end temperatures.
Michiel Broek <mbroek@mbse.eu>
parents:
79
diff
changeset
|
831 | |
0 | 832 | 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
|
833 | runtime.StageTimeLeft = 0; |
0 | 834 | 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
|
835 | 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
|
836 | 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
|
837 | 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
|
838 | |
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
|
839 | if (runtime.MashStep == 0 && ! runtime.MaltAdded && config.AskAdd) { |
0 | 840 | /* |
841 | * Add Mash prompt. | |
842 | */ | |
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
|
843 | 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
|
844 | 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
|
845 | 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
|
846 | 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
|
847 | } |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
43
diff
changeset
|
848 | log_annotation(ANNOTATION_EVENT, (char *)"Mout storten"); |
0 | 849 | 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
|
850 | Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0); |
0 | 851 | 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
|
852 | Buttons_Add(255,120, 60, 40, (char *)"Ok", 1); |
0 | 853 | Buttons_Show(); |
854 | _fg = TFT_WHITE; | |
855 | _bg = TFT_BLACK; | |
856 | 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
|
857 | TFT_print((char *)"Mout storten?", CENTER, 135); |
0 | 858 | SoundPlay(SOUND_Prompt); |
42 | 859 | 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
|
860 | 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
|
861 | 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
|
862 | log_msg(TAG, "Mash add prompt"); |
0 | 863 | break; |
864 | } | |
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
|
865 | if ((runtime.MashStep == LastMashStep) && config.AskIodine) { |
0 | 866 | /* |
867 | * Iodone test prompt. | |
868 | */ | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
43
diff
changeset
|
869 | log_annotation(ANNOTATION_EVENT, (char *)"Jodium test"); |
0 | 870 | 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
|
871 | Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0); |
0 | 872 | 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
|
873 | Buttons_Add(255,120, 60, 40, (char *)"Ok", 1); |
0 | 874 | Buttons_Show(); |
875 | _fg = TFT_WHITE; | |
876 | _bg = TFT_BLACK; | |
877 | 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
|
878 | TFT_print((char *)"Jodium test?", CENTER, 127); |
0 | 879 | SoundPlay(SOUND_Prompt); |
880 | beeped = false; | |
881 | TimerSet(config.IodineTime * 60); | |
42 | 882 | 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
|
883 | 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
|
884 | 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
|
885 | log_msg(TAG, "Mash iodine test prompt"); |
0 | 886 | break; |
887 | } | |
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
|
888 | if ((runtime.MashStep == (recipe.Mashsteps - 1)) && config.AskRemove) { |
0 | 889 | /* |
890 | * Mash remove prompt. | |
891 | */ | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
43
diff
changeset
|
892 | log_annotation(ANNOTATION_EVENT, (char *)"Mout verwijderen"); |
0 | 893 | 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
|
894 | Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0); |
0 | 895 | 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
|
896 | Buttons_Add(255,120, 60, 40, (char *)"Ok", 1); |
0 | 897 | Buttons_Show(); |
898 | _fg = TFT_WHITE; | |
899 | _bg = TFT_BLACK; | |
900 | 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
|
901 | TFT_print((char *)"Mout verwijderen?", CENTER, 135); |
0 | 902 | SoundPlay(SOUND_Prompt); |
42 | 903 | 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
|
904 | 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
|
905 | 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
|
906 | log_msg(TAG, "Mash remove prompt"); |
0 | 907 | break; |
908 | } | |
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
|
909 | 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
|
910 | 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
|
911 | 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
|
912 | 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
|
913 | 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
|
914 | 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
|
915 | } |
0 | 916 | TempReached = false; |
917 | } else { | |
918 | TimerShow(TimeLeft, 65, 122); | |
919 | if (NewMinute) { | |
920 | runtime.StageTimeLeft = TimeLeft / 60; | |
921 | updateRuntime = true; | |
922 | } | |
923 | } | |
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
|
924 | } 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
|
925 | 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
|
926 | 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
|
927 | 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
|
928 | 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
|
929 | 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
|
930 | } |
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
|
931 | } 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
|
932 | 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
|
933 | } |
0 | 934 | } |
935 | switch (Buttons_Scan()) { | |
936 | case 0: Main_Screen = MAIN_AUTO_ABORT; | |
937 | 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
|
938 | 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
|
939 | 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
|
940 | 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
|
941 | 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
|
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_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
|
944 | 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
|
945 | 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
|
946 | 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
|
947 | 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
|
948 | 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
|
949 | } 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
|
950 | 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
|
951 | } |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to 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 | 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
|
953 | Buttons_Clear(); |
0 | 954 | break; |
955 | default: break; | |
956 | } | |
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
|
957 | 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
|
958 | 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
|
959 | 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
|
960 | 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
|
961 | 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
|
962 | 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
|
963 | 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
|
964 | Buttons_Clear(); |
0 | 965 | } |
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
|
966 | } else if (MashState == MASH_INFUSE || MashState == MASH_DECOCT) { |
19 | 967 | switch (Buttons_Scan()) { |
968 | case 0: Main_Screen = MAIN_AUTO_ABORT; | |
969 | 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
|
970 | 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
|
971 | #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
|
972 | if (MashState == MASH_DECOCT) { |
126
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
973 | temp_MLT = Fake_MLT = recipe.MashStep[runtime.MashStep].Step_temp - 0.72; // Fake the decoction amt. |
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
|
974 | 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
|
975 | 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
|
976 | 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
|
977 | } |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
75
diff
changeset
|
978 | } |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
75
diff
changeset
|
979 | #endif |
126
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
980 | if (MashState == MASH_DECOCT) { |
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
981 | /* After decoction set the desired step temperature */ |
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
982 | stageTemp = recipe.MashStep[runtime.MashStep].Step_temp; |
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
983 | } |
19 | 984 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
985 | // Start PID again. | |
986 | driver_state->mlt_sp = stageTemp; | |
987 | driver_state->mlt_mode = MLT_MODE_PID; | |
988 | xSemaphoreGive(xSemaphoreDriver); | |
989 | } | |
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
|
990 | TFT_fillRect(0, 120, 320, 50, TFT_BLACK); |
19 | 991 | 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
|
992 | 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
|
993 | Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1); |
19 | 994 | Buttons_Show(); |
995 | 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
|
996 | if (MashState == MASH_INFUSE) { |
126
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
997 | log_msg(TAG, "End infusion"); |
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
|
998 | 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
|
999 | } else { |
126
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
1000 | log_msg(TAG, "End decoction, sp: %6.4f-%6.4f sv: %6.4f", |
e133a292ad21
Version 0.3.23. In a decoction mash step during wait for confirm prompt, leave the setpoint as it was. Set the new temperature after confirmation. Log this.
Michiel Broek <mbroek@mbse.eu>
parents:
121
diff
changeset
|
1001 | recipe.MashStep[runtime.MashStep].Step_temp, recipe.MashStep[runtime.MashStep].End_temp, temp_MLT); |
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
|
1002 | 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
|
1003 | } |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
75
diff
changeset
|
1004 | 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
|
1005 | 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
|
1006 | ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
19 | 1007 | break; |
1008 | default: break; | |
1009 | } | |
0 | 1010 | } /* MashState */ |
1011 | MLT_info(71, 26, true); | |
1012 | if (_UseHLT) { | |
1013 | HLT_info(71, 170, true, true); | |
1014 | } | |
1015 | break; | |
1016 | ||
1017 | 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
|
1018 | Output = (int)((RampPower * 255.0) / 100.0); |
0 | 1019 | /* |
1020 | * Go to the boil temperature and wait until it is steady. | |
1021 | */ | |
1022 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1023 | if (driver_state->mlt_pv < stageTemp) { | |
1024 | Steady = 0; | |
1025 | } else { | |
1026 | if (Steady > 10) { | |
1027 | Main_Screen = MAIN_AUTO_BOILING; | |
1028 | TempReached = true; | |
1029 | } | |
1030 | } | |
1031 | driver_state->pump_run = (equipment.PumpOnBoil && (driver_state->mlt_pv < equipment.PumpMaxTemp)) ? 1 : 0; | |
1032 | xSemaphoreGive(xSemaphoreDriver); | |
1033 | } | |
1034 | ||
1035 | MLT_info(71, 26, true); | |
1036 | 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
|
1037 | 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
|
1038 | 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
|
1039 | } |
0 | 1040 | break; |
1041 | ||
62
2e90ada37476
Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
1042 | 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
|
1043 | 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
|
1044 | } |
0 | 1045 | break; |
1046 | ||
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
|
1047 | 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
|
1048 | 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
|
1049 | 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
|
1050 | 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
|
1051 | |
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
|
1052 | 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
|
1053 | 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
|
1054 | 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
|
1055 | 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
|
1056 | |
0 | 1057 | default: break; |
1058 | } | |
1059 | if (Resume) | |
1060 | Resume = false; | |
1061 | break; | |
1062 | ||
1063 | case MAIN_AUTO_BOILING: | |
1064 | if (Resume) | |
1065 | Resume = false; | |
1066 | if (NewMinute) { | |
1067 | 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
|
1068 | log_msg(TAG, "Hop addition %d at %d minutes", runtime.HopAddition + 1, recipe.Addition[runtime.HopAddition].Time); |
0 | 1069 | 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
|
1070 | log_annotation(ANNOTATION_EVENT, recipe.Addition[runtime.HopAddition].Name); |
0 | 1071 | SoundPlay(SOUND_AddHop); |
1072 | runtime.HopAddition++; | |
1073 | } 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
|
1074 | TopMessage((char *)"Koken"); |
0 | 1075 | } |
1076 | runtime.StageTimeLeft = TimeLeft / 60; | |
1077 | updateRuntime = true; | |
1078 | } | |
1079 | if (TimeLeft < 60) { | |
1080 | 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
|
1081 | 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
|
1082 | log_msg(TAG, "Boil flame off"); |
0 | 1083 | } |
1084 | // Flameout | |
1085 | Output = 0; | |
1086 | } else if (driver_state->mlt_pv >= stageTemp) { | |
1087 | Output = (int)((BoilPower * 255.0) / 100.0); | |
1088 | } else { | |
119
1cef3c25426b
Version 0.3.19. Real sensors and code cleanup.
Michiel Broek <mbroek@mbse.eu>
parents:
117
diff
changeset
|
1089 | Output = (int)((RampPower * 255.0) / 100.0); |
0 | 1090 | } |
1091 | ||
1092 | MLT_info(71, 26, true); | |
1093 | TimerShow(TimeLeft, 65, 190); | |
1094 | ||
1095 | 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
|
1096 | 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
|
1097 | 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
|
1098 | } |
0 | 1099 | break; |
1100 | ||
62
2e90ada37476
Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
1101 | 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
|
1102 | 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
|
1103 | } |
0 | 1104 | break; |
1105 | ||
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
|
1106 | case 4: change_tl(21600); |
0 | 1107 | break; |
1108 | ||
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
|
1109 | case 5: change_tl(0); |
0 | 1110 | break; |
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 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
|
1113 | 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
|
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, "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
|
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 < 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
|
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, "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
|
1120 | } |
0 | 1121 | break; |
1122 | ||
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
|
1123 | 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
|
1124 | 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
|
1125 | 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
|
1126 | 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
|
1127 | } 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
|
1128 | 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
|
1129 | 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
|
1130 | 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
|
1131 | } |
0 | 1132 | break; |
1133 | ||
1134 | default: break; | |
1135 | } | |
1136 | ||
1137 | if (TimeLeft == 0) { | |
1138 | 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
|
1139 | log_msg(TAG, "Boil is ready"); |
0 | 1140 | } |
1141 | break; | |
1142 | ||
1143 | case MAIN_AUTO_COOLING_H: | |
1144 | case MAIN_AUTO_COOLING_M: | |
1145 | case MAIN_AUTO_COOLING_C: | |
1146 | if (_Prompt) { | |
1147 | /* | |
1148 | * Prompt mode | |
1149 | */ | |
1150 | switch (Buttons_Scan()) { | |
1151 | case 0: _Prompt = false; | |
1152 | Buttons_Clear(); | |
1153 | break; | |
1154 | case 1: Main_Screen = MAIN_AUTO_DONE; | |
1155 | Buttons_Clear(); | |
1156 | return true; //goto startover; | |
1157 | break; | |
1158 | default: | |
1159 | break; | |
1160 | } | |
1161 | ||
1162 | if (! _Prompt) { | |
1163 | /* | |
1164 | * Starting cooling, setup the screen. | |
1165 | */ | |
1166 | Buttons_Clear(); | |
1167 | TFT_fillScreen(_bg); | |
42 | 1168 | Sub_Screen = 1; |
0 | 1169 | if (Main_Screen == MAIN_AUTO_COOLING_H) { |
1170 | stageTemp = 77.0; | |
1171 | } else if (Main_Screen == MAIN_AUTO_COOLING_M) { | |
1172 | stageTemp = 66.0; | |
1173 | } else { | |
1174 | stageTemp = recipe.CoolTemp; | |
1175 | } | |
42 | 1176 | 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
|
1177 | ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
0 | 1178 | 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
|
1179 | log_msg(TAG, "Start cooling from %6.2f to %4.1f", ds18b20_state->mlt_temperature, stageTemp); |
0 | 1180 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1181 | driver_state->mlt_mode = MLT_MODE_OFF; | |
1182 | driver_state->mlt_sp = stageTemp; | |
1183 | xSemaphoreGive(xSemaphoreDriver); | |
1184 | } | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
43
diff
changeset
|
1185 | 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
|
1186 | TopMessage((char *)"Koelen"); |
0 | 1187 | 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
|
1188 | Buttons_Add( 5, 200, 60, 40, (char *)"Stop", 0); |
0 | 1189 | 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
|
1190 | 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
|
1191 | Buttons_Add(255, 26, 60, 40, (char *)"-0.5", 2); |
0 | 1192 | /* |
1193 | * The next key is not a mistake, but we need a key entry which | |
1194 | * will later become the pump key. The keyscan routine will find | |
1195 | * the original key if pressed. | |
1196 | */ | |
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
|
1197 | Buttons_Add(255, 26, 60, 40, (char *)"-0.5", 3); |
0 | 1198 | Buttons_Show(); |
1199 | } | |
1200 | } else { | |
1201 | /* | |
1202 | * Not in prompt mode. | |
1203 | */ | |
1204 | #ifdef CONFIG_TEMP_SENSORS_SIMULATOR | |
1205 | if (Fake_MLT > 12.0) { | |
1206 | if (driver_state->pump_run) | |
1207 | Fake_MLT -= 0.00025 * (Fake_MLT - 12.0); | |
1208 | else | |
1209 | Fake_MLT -= 0.00015 * (Fake_MLT - 12.0); | |
1210 | } | |
1211 | if (xSemaphoreTake(xSemaphoreDS18B20, 10) == pdTRUE) { | |
1212 | ds18b20_state->mlt_temperature = ((int)(Fake_MLT * 16)) / 16.0; | |
1213 | xSemaphoreGive(xSemaphoreDS18B20); | |
1214 | } | |
1215 | #endif | |
1216 | 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
|
1217 | if (Sub_Screen == 1 && xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
0 | 1218 | /* |
1219 | * If the pump safe temperature is reached, add the control button. | |
1220 | * Redefine key number 3 if it is at the position of key 2. | |
1221 | */ | |
1222 | 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
|
1223 | Buttons_Add(255, 200, 60, 40, (char *)"Pomp", 3); |
0 | 1224 | 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
|
1225 | Sub_Screen = 2; |
0 | 1226 | } |
1227 | 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
|
1228 | 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
|
1229 | 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
|
1230 | 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
|
1231 | } |
0 | 1232 | } |
1233 | switch (Buttons_Scan()) { | |
1234 | case 1: if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1235 | if (Main_Screen == MAIN_AUTO_COOLING_H) { | |
1236 | 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
|
1237 | driver_state->mlt_sp += 0.5; |
0 | 1238 | } else if (Main_Screen == MAIN_AUTO_COOLING_M) { |
1239 | 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
|
1240 | driver_state->mlt_sp += 0.5; |
0 | 1241 | } 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
|
1242 | 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
|
1243 | driver_state->mlt_sp += 0.5; |
0 | 1244 | } |
1245 | xSemaphoreGive(xSemaphoreDriver); | |
1246 | } | |
62
2e90ada37476
Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
1247 | log_msg(TAG, "Increase sp to %.2f", driver_state->mlt_sp); |
0 | 1248 | break; |
1249 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
43
diff
changeset
|
1250 | case 0: Buttons_Add( 60, 150, 90, 40, (char *)"Stoppen", 4); |
0 | 1251 | 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
|
1252 | Buttons_Add(170, 150, 90, 40, (char *)"Sorry", 5); |
0 | 1253 | Buttons_Show(); |
1254 | break; | |
1255 | ||
1256 | case 2: if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1257 | if (Main_Screen == MAIN_AUTO_COOLING_H) { | |
1258 | 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
|
1259 | driver_state->mlt_sp -= 0.5; |
0 | 1260 | } else if (Main_Screen == MAIN_AUTO_COOLING_M) { |
1261 | 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
|
1262 | driver_state->mlt_sp -= 0.5; |
0 | 1263 | } else if (Main_Screen == MAIN_AUTO_COOLING_C) { |
1264 | 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
|
1265 | driver_state->mlt_sp -= 0.5; |
0 | 1266 | } |
1267 | xSemaphoreGive(xSemaphoreDriver); | |
1268 | } | |
62
2e90ada37476
Added syslog like logging on the sdcard for the manual and automatic processes.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
1269 | log_msg(TAG, "Decrease sp to %.2f", driver_state->mlt_sp); |
0 | 1270 | break; |
1271 | ||
1272 | case 3: if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1273 | if (driver_state->mlt_pv < equipment.PumpMaxTemp) { | |
1274 | if (driver_state->pump_run) | |
1275 | driver_state->pump_run = 0; | |
1276 | else | |
1277 | driver_state->pump_run = 1; | |
1278 | } else { | |
1279 | driver_state->pump_run = 0; | |
1280 | } | |
1281 | 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
|
1282 | log_msg(TAG, "Pump turned %s", (driver_state->pump_run)?"on":"off"); |
0 | 1283 | updateRuntime = true; |
1284 | xSemaphoreGive(xSemaphoreDriver); | |
1285 | } | |
1286 | break; | |
1287 | ||
1288 | case 4: Main_Screen++; | |
1289 | break; | |
1290 | ||
1291 | case 5: Buttons[4].x = Buttons[5].x = -1; | |
1292 | TFT_fillRect(60, 150, 200, 40, TFT_BLACK); | |
1293 | break; | |
1294 | ||
1295 | default: | |
1296 | break; | |
1297 | } | |
1298 | ||
1299 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1300 | if (! CoolBeep && (driver_state->mlt_pv < (driver_state->mlt_sp + 2.0))) { | |
1301 | SoundPlay(SOUND_Warn); | |
1302 | CoolBeep = true; | |
1303 | } | |
1304 | if (driver_state->mlt_pv <= driver_state->mlt_sp) { | |
1305 | SoundPlay(SOUND_TempReached); | |
1306 | Main_Screen++; | |
42 | 1307 | Sub_Screen = 0; |
0 | 1308 | } |
1309 | xSemaphoreGive(xSemaphoreDriver); | |
1310 | } | |
1311 | } | |
1312 | break; | |
1313 | ||
1314 | case MAIN_AUTO_WHIRLPOOL9: | |
1315 | case MAIN_AUTO_WHIRLPOOL7: | |
1316 | case MAIN_AUTO_WHIRLPOOL6: | |
1317 | case MAIN_AUTO_WHIRLPOOL2: | |
1318 | if (_Prompt) { | |
1319 | ||
1320 | switch (Buttons_Scan()) { | |
1321 | case 0: _Prompt = false; | |
1322 | break; | |
1323 | case 1: if (Main_Screen == MAIN_AUTO_WHIRLPOOL2) { | |
1324 | Main_Screen = MAIN_AUTO_DONE; | |
1325 | } else { | |
1326 | Main_Screen++; | |
1327 | } | |
1328 | Buttons_Clear(); | |
1329 | return true; //goto startover; | |
1330 | break; | |
1331 | default: | |
1332 | break; | |
1333 | } | |
1334 | ||
1335 | if (! _Prompt) { | |
1336 | /* | |
1337 | * Prepare the screen for the actual whirpool. | |
1338 | */ | |
1339 | Buttons_Clear(); | |
1340 | TFT_fillScreen(_bg); | |
42 | 1341 | Sub_Screen = 1; |
1342 | 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
|
1343 | ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
0 | 1344 | if (Main_Screen == MAIN_AUTO_WHIRLPOOL9) { |
1345 | TimeWhirlPool = recipe.Whirlpool9; | |
1346 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1347 | driver_state->mlt_sp = 93.0; | |
1348 | driver_state->mlt_mode = MLT_MODE_PID; | |
1349 | xSemaphoreGive(xSemaphoreDriver); | |
1350 | } | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
43
diff
changeset
|
1351 | TopMessage((char *)"Whirlpool 88..100"); |
0 | 1352 | } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL7) { |
1353 | TimeWhirlPool = recipe.Whirlpool7; | |
1354 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1355 | driver_state->mlt_sp = 74.0; | |
1356 | driver_state->mlt_mode = MLT_MODE_PID; | |
1357 | xSemaphoreGive(xSemaphoreDriver); | |
1358 | } | |
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 *)"Whirlpool 71..77"); |
0 | 1360 | } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL6) { |
1361 | TimeWhirlPool = recipe.Whirlpool6; | |
1362 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1363 | driver_state->mlt_sp = 63.0; | |
1364 | driver_state->mlt_mode = MLT_MODE_PID; | |
1365 | xSemaphoreGive(xSemaphoreDriver); | |
1366 | } | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
43
diff
changeset
|
1367 | TopMessage((char *)"Whirlpool 60..66"); |
0 | 1368 | } else { |
1369 | 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
|
1370 | TopMessage((char *)"Koude whirlpool"); |
0 | 1371 | } |
1372 | if (Resume) { | |
1373 | TimeWhirlPool = runtime.StageTimeLeft; | |
1374 | } | |
1375 | ||
1376 | /* | |
1377 | * If the pump is allowed at the current temperature, turn it on. | |
1378 | */ | |
1379 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1380 | driver_state->pump_run = (driver_state->mlt_pv < equipment.PumpMaxTemp) ? 1 : 0; | |
1381 | xSemaphoreGive(xSemaphoreDriver); | |
1382 | } | |
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
|
1383 | log_annotation(ANNOTATION_EVENT, (char *)"Whirlpool"); |
0 | 1384 | |
1385 | TimerSet(TimeWhirlPool * 60); | |
1386 | runtime.StageTimeLeft = TimeWhirlPool; | |
1387 | updateRuntime = true; | |
1388 | 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
|
1389 | 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
|
1390 | 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
|
1391 | 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
|
1392 | Buttons_Add(255, 200, 60, 40, (char *)"Pomp", 2); |
0 | 1393 | Buttons_Show(); |
1394 | } | |
1395 | } else { | |
1396 | /* | |
1397 | * Not running in prompt mode, do the whirlpool. | |
1398 | */ | |
1399 | if (TimeLeft == 120) { | |
1400 | /* | |
1401 | * Drop the temperature when whirlpool is almost ready. | |
1402 | * If we are lucky the heater element will cool down so | |
1403 | * the next cooling stage will not wast too much energy. | |
1404 | */ | |
1405 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1406 | if (Main_Screen == MAIN_AUTO_WHIRLPOOL9) | |
1407 | driver_state->mlt_sp = 88.0; | |
1408 | if (Main_Screen == MAIN_AUTO_WHIRLPOOL7) | |
1409 | driver_state->mlt_sp = 71.0; | |
1410 | if (Main_Screen == MAIN_AUTO_WHIRLPOOL6) | |
1411 | driver_state->mlt_sp = 60.0; | |
1412 | xSemaphoreGive(xSemaphoreDriver); | |
1413 | } | |
1414 | } | |
1415 | ||
1416 | MLT_info(71, 26, true); | |
1417 | TimerShow(TimeLeft, 65, 122); | |
1418 | 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
|
1419 | case 0: change_tl(7200); |
0 | 1420 | 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
|
1421 | case 1: change_tl(0); |
0 | 1422 | 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
|
1423 | case 2: if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
0 | 1424 | if (driver_state->mlt_pv < equipment.PumpMaxTemp) { |
1425 | if (driver_state->pump_run) | |
1426 | driver_state->pump_run = 0; | |
1427 | else | |
1428 | 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
|
1429 | log_msg(TAG, "Pump switched %s", (driver_state->pump_run)?"on":"off"); |
0 | 1430 | } else { |
1431 | driver_state->pump_run = 0; | |
1432 | } | |
1433 | xSemaphoreGive(xSemaphoreDriver); | |
1434 | } | |
1435 | } | |
1436 | ||
1437 | if (NewMinute) { | |
1438 | runtime.StageTimeLeft = TimeLeft / 60; | |
1439 | updateRuntime = true; | |
1440 | } | |
1441 | ||
1442 | if ((TimeLeft == 0)) { | |
1443 | if (Main_Screen == MAIN_AUTO_WHIRLPOOL9) { | |
1444 | Main_Screen = MAIN_AUTO_COOLING_H; | |
1445 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1446 | driver_state->pump_run = runtime.PumpCooling; | |
1447 | xSemaphoreGive(xSemaphoreDriver); | |
1448 | } | |
1449 | } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL7) { | |
1450 | Main_Screen = MAIN_AUTO_COOLING_M; | |
1451 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1452 | driver_state->pump_run = runtime.PumpCooling; | |
1453 | xSemaphoreGive(xSemaphoreDriver); | |
1454 | } | |
1455 | } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL6) { | |
1456 | Main_Screen = MAIN_AUTO_COOLING_C; | |
1457 | if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { | |
1458 | driver_state->pump_run = runtime.PumpCooling; | |
1459 | xSemaphoreGive(xSemaphoreDriver); | |
1460 | } | |
1461 | } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL2) { | |
1462 | Main_Screen = MAIN_AUTO_DONE; | |
1463 | } | |
1464 | } | |
1465 | } | |
1466 | break; | |
1467 | ||
1468 | case MAIN_AUTO_DONE: | |
1469 | case MAIN_AUTO_ABORT: | |
1470 | if (Buttons_Scan() == 0) | |
1471 | Main_Screen = MAIN_MODE_FREE; | |
1472 | break; | |
1473 | ||
1474 | default: | |
1475 | break; | |
1476 | } | |
1477 | ||
1478 | return false; | |
1479 | } | |
1480 | ||
1481 |