Wed, 19 May 2021 17:21:33 +0200
Version 0.3.14. Log brewing essentials at brew start.
0 | 1 | /** |
2 | * @file recipes.c | |
4 | 3 | * @brief Recipes management. If new beerxml recipes are detected in |
4 | * the /recipe directory on the SD card they will be imported | |
5 | * when you enter the recipes menu. After successfull import the | |
6 | * xml file extensions will be changed to xok to prevent that | |
7 | * the recipe is imported again. After the import the recipe | |
8 | * editor is shown. | |
0 | 9 | */ |
10 | ||
11 | #include "config.h" | |
12 | ||
13 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
14 | extern sButton Buttons[MAXBUTTONS]; ///< Buttons definitions |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
15 | extern int Main_Screen; ///< Current screen |
0 | 16 | |
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
17 | bool r_UpdateRec = false; ///< Update record flag |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
18 | int r_CurrentRec = 1; ///< Current record |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
19 | int r_Records = 1; ///< Total records |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
20 | int r_Imported = 0; ///< Total imported |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
21 | char _xml_element[10][32]; ///< XML element array |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
22 | int _xml_depth; ///< Current depths |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
23 | char _xml_add_name[64]; ///< Mash name |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
24 | int _xml_add_type; ///< Mash type |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
25 | int _xml_add_time; ///< Mash rest time |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
26 | int _xml_add_ramp; ///< Mash ramp time |
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:
76
diff
changeset
|
27 | float _xml_add_temp; ///< Mash start 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:
76
diff
changeset
|
28 | float _xml_add_end; ///< Mash end temperature |
15
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
29 | float _xml_add_amount; ///< Mash infusion amount |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
30 | float _xml_add_infusion; ///< Mash infusion temperature |
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
31 | float _xml_tun_temp; ///< TUN temperature |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
32 | bool _xml_add_valid; ///< Add is valid |
0 | 33 | |
34 | static const char *TAG = "recipes"; | |
35 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
36 | char char_data_buffer[1024]; ///< Data buffer |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
37 | size_t offs; ///< Offset in buffer |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
38 | bool overflow; ///< Overflow in buffer |
0 | 39 | |
19 | 40 | extern const char *mashTypes[]; |
41 | ||
0 | 42 | |
43 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
44 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
45 | * @brief Add addition to the recipe. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
46 | * @param Name The addition name. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
47 | * @param Type The addition type. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
48 | * @param Time The addition time to add. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
49 | */ |
0 | 50 | void Addition_Add(char *Name, uint8_t Type, uint16_t Time) |
51 | { | |
52 | if (! recipe.Additions) { | |
53 | // No entries yet, add the first one. | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
54 | snprintf(recipe.Addition[recipe.Additions].Name, 63, "%s", Name); |
0 | 55 | recipe.Addition[recipe.Additions].Type = Type; |
56 | recipe.Addition[recipe.Additions].Time = Time; | |
57 | recipe.Additions++; | |
58 | return; | |
59 | } | |
60 | ||
61 | // See if we already got one with the same time. | |
62 | for (int i = 0; i < recipe.Additions; i++) { | |
63 | if (recipe.Addition[i].Time == Time) { | |
64 | // Yes, update the name. | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
65 | strncat(recipe.Addition[i].Name, ", ", 63 - strlen(recipe.Addition[i].Name)); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
66 | strncat(recipe.Addition[i].Name, Name, 63 - strlen(recipe.Addition[i].Name)); |
0 | 67 | return; |
68 | } | |
69 | } | |
70 | ||
71 | // A new entry and we already have some. Add it and keep the list sorted. | |
72 | for (int i = 0; i < recipe.Additions; i++) { | |
73 | if (Time > recipe.Addition[i].Time) { | |
17
f3451031d6c6
Version 0.2.5. Removed debug console messages during recipe import. Removed old SyncDirs code to install /spiffs from the SD card since we now do this via the internet.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
74 | // Make room |
0 | 75 | for (int j = i; j < recipe.Additions; j++) { |
76 | sprintf(recipe.Addition[j+1].Name, "%s", recipe.Addition[j].Name); | |
77 | recipe.Addition[j+1].Type = recipe.Addition[j].Type; | |
78 | recipe.Addition[j+1].Time = recipe.Addition[j].Time; | |
79 | } | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
80 | snprintf(recipe.Addition[i].Name, 63, "%s", Name); |
0 | 81 | recipe.Addition[i].Type = Type; |
82 | recipe.Addition[i].Time = Time; | |
83 | recipe.Additions++; | |
84 | return; | |
85 | } | |
86 | } | |
87 | ||
88 | // Just append. | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
89 | snprintf(recipe.Addition[recipe.Additions].Name, 63, "%s", Name); |
0 | 90 | recipe.Addition[recipe.Additions].Type = Type; |
91 | recipe.Addition[recipe.Additions].Time = Time; | |
92 | recipe.Additions++; | |
93 | } | |
94 | ||
95 | ||
96 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
97 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
98 | * @brief Reset the parser buffer. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
99 | */ |
0 | 100 | void reset_char_data_buffer (void) |
101 | { | |
102 | offs = 0; | |
103 | overflow = false; | |
104 | } | |
105 | ||
106 | ||
107 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
108 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
109 | * @brief Datahandler get bytes into the data buffer. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
110 | */ |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
111 | void char_data(void *userData, const XML_Char *s, int len) |
0 | 112 | { |
113 | if (!overflow) { | |
114 | if (len + offs >= sizeof(char_data_buffer) ) { | |
115 | overflow = true; | |
116 | } else { | |
117 | memcpy(char_data_buffer + offs, s, len); | |
118 | offs += len; | |
119 | } | |
120 | } | |
121 | } | |
122 | ||
123 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
124 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
125 | * @brief Process the XML parser data buffer. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
126 | */ |
0 | 127 | void process_char_data_buffer (void) |
128 | { | |
129 | bool allspace = true; | |
130 | ||
131 | if (offs > 0) { | |
132 | char_data_buffer[ offs ] = '\0'; | |
133 | ||
134 | /* | |
135 | * If all spaces and control characters, the data is invalid. | |
136 | */ | |
137 | for (int i = 0; i < strlen(char_data_buffer); i++) { | |
138 | if (char_data_buffer[i] > ' ') | |
139 | allspace = false; | |
140 | } | |
141 | if (allspace) | |
142 | return; | |
143 | ||
144 | if ((_xml_depth > 2) && (strcmp(_xml_element[0], "RECIPES") == 0) && (strcmp(_xml_element[1], "RECIPE") == 0)) { | |
145 | /* | |
146 | * We are in a recipe | |
147 | */ | |
148 | if ((_xml_depth == 3) && (strcmp("NAME", _xml_element[2]) == 0)) { | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
149 | recipe.Name[0] = '\0'; |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
150 | strncat(recipe.Name, char_data_buffer, 127); |
0 | 151 | } else if ((_xml_depth == 3) && (strcmp("BOIL_TIME", _xml_element[2]) == 0)) { |
152 | recipe.BoilTime = atoi(char_data_buffer); | |
93
24cb415af787
Version 0.3.13. Recipe import parse BMS_COOLING_TO to set the cooling temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
89
diff
changeset
|
153 | } else if ((_xml_depth == 3) && (strcmp("BMS_COOLING_TO", _xml_element[2]) == 0)) { |
24cb415af787
Version 0.3.13. Recipe import parse BMS_COOLING_TO to set the cooling temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
89
diff
changeset
|
154 | recipe.CoolTemp = atoi(char_data_buffer); |
0 | 155 | } else if ((_xml_depth == 5) && (strcmp("HOPS", _xml_element[2]) == 0) && (strcmp("HOP", _xml_element[3]) == 0)) { |
156 | /* | |
157 | * Hops that are added during the boil. | |
158 | * But check for whirlpool hops too. | |
159 | */ | |
160 | if (strcmp("NAME", _xml_element[4]) == 0) { | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
161 | _xml_add_name[0] = '\0'; |
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
162 | strncat(_xml_add_name, char_data_buffer, 63); |
0 | 163 | } else if (strcmp("USE", _xml_element[4]) == 0) { |
164 | _xml_add_valid = (strcmp("Boil", char_data_buffer) == 0); // Only "Boil" is a valid hop | |
165 | if (strcmp("Aroma", char_data_buffer) == 0) { | |
166 | recipe.Whirlpool7 = 30; | |
167 | } | |
168 | } else if (strcmp("TIME", _xml_element[4]) == 0) { | |
169 | _xml_add_time = atoi(char_data_buffer); | |
170 | } | |
171 | } else if ((_xml_depth >= 3) && (strcmp("STYLE", _xml_element[2]) == 0)) { | |
172 | // Ignore | |
173 | } else if ((_xml_depth >= 3) && (strcmp("EQUIPMENT", _xml_element[2]) == 0)) { | |
174 | // Ignora | |
175 | } else if ((_xml_depth >= 3) && (strcmp("YEASTS", _xml_element[2]) == 0)) { | |
176 | // Ignore | |
177 | } else if ((_xml_depth >= 3) && (strcmp("WATERS", _xml_element[2]) == 0)) { | |
178 | // Ignore | |
179 | } else if ((_xml_depth == 5) && (strcmp("FERMENTABLES", _xml_element[2]) == 0) && (strcmp("FERMENTABLE", _xml_element[3]) == 0)) { | |
180 | /* | |
181 | * Fermentabes that must be added during the boil. | |
182 | */ | |
183 | if (strcmp("NAME", _xml_element[4]) == 0) { | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
184 | _xml_add_name[0] = '\0'; |
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
185 | strncat(_xml_add_name, char_data_buffer, 63); |
0 | 186 | } else if (strcmp("TYPE", _xml_element[4]) == 0) { |
187 | if ((strcmp("Sugar", char_data_buffer) == 0)/* || (strcmp("Adjunct", char_data_buffer) == 0)*/) { | |
188 | _xml_add_type = ADDITION_FERMENTABLE; | |
189 | _xml_add_time = 10; | |
190 | } else { | |
191 | _xml_add_type = -1; | |
192 | } | |
193 | } else if (strcmp("ADD_AFTER_BOIL", _xml_element[4]) == 0) { | |
194 | _xml_add_valid = (strcmp("FALSE", char_data_buffer) == 0); | |
195 | } | |
196 | } else if ((_xml_depth == 5) && (strcmp("MISCS", _xml_element[2]) == 0) && (strcmp("MISC", _xml_element[3]) == 0)) { | |
197 | /* | |
198 | * Check for Misc additions to add during the boil. | |
199 | */ | |
200 | if (strcmp("NAME", _xml_element[4]) == 0) { | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
201 | _xml_add_name[0] = '\0'; |
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
202 | strncat(_xml_add_name, char_data_buffer, 63); |
0 | 203 | } else if (strcmp("USE", _xml_element[4]) == 0) { |
204 | _xml_add_valid = (strcmp("Boil", char_data_buffer) == 0); // Only "Boil" is a valid hop. | |
205 | } else if (strcmp("TYPE", _xml_element[4]) == 0) { | |
206 | if (strcmp("Spice", char_data_buffer) == 0) | |
207 | _xml_add_type = ADDITION_SPICE; | |
208 | if (strcmp("Fining", char_data_buffer) == 0) | |
209 | _xml_add_type = ADDITION_FINING; | |
210 | if (strcmp("Herb", char_data_buffer) == 0) | |
211 | _xml_add_type = ADDITION_HERB; | |
212 | if (strcmp("Flavor", char_data_buffer) == 0) | |
213 | _xml_add_type = ADDITION_FLAVOR; | |
214 | if (strcmp("Other", char_data_buffer) == 0) | |
215 | _xml_add_type = ADDITION_OTHER; | |
216 | } else if (strcmp("TIME", _xml_element[4]) == 0) { | |
217 | _xml_add_time = atoi(char_data_buffer); | |
218 | } | |
219 | } else if ((_xml_depth >= 4) && (strcmp("MASH", _xml_element[2]) == 0)) { | |
220 | if ((_xml_depth >= 6) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) { | |
221 | if (strcmp("NAME", _xml_element[5]) == 0) { | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
222 | _xml_add_name[0] = '\0'; |
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
223 | strncat(_xml_add_name, char_data_buffer, 63); |
0 | 224 | } else if (strcmp("TYPE", _xml_element[5]) == 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:
76
diff
changeset
|
225 | // Step_temp Infusion 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:
76
diff
changeset
|
226 | _xml_add_valid = (strcmp("Step_temp", char_data_buffer) == 0); |
15
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
227 | if (strcmp("Infusion", char_data_buffer) == 0) |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
228 | _xml_add_type = MASHTYPE_INFUSION; |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
229 | else if (strcmp("Temperature", char_data_buffer) == 0) |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
230 | _xml_add_type = MASHTYPE_TEMPERATURE; |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
231 | else if (strcmp("Decoction", char_data_buffer) == 0) |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
232 | _xml_add_type = MASHTYPE_DECOCTION; |
0 | 233 | } else if (strcmp("STEP_TEMP", _xml_element[5]) == 0) { |
234 | _xml_add_temp = atof(char_data_buffer); | |
235 | } else if (strcmp("STEP_TIME", _xml_element[5]) == 0) { | |
236 | _xml_add_time = atoi(char_data_buffer); | |
237 | } else if (strcmp("RAMP_TIME", _xml_element[5]) == 0) { | |
238 | _xml_add_ramp = atoi(char_data_buffer); | |
15
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
239 | } else if (strcmp("INFUSE_AMOUNT", _xml_element[5]) == 0) { |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
240 | _xml_add_amount = atof(char_data_buffer); |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
241 | } else if (strcmp("INFUSE_TEMP", _xml_element[5]) == 0) { |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
242 | _xml_add_infusion = atof(char_data_buffer); |
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:
76
diff
changeset
|
243 | } else if (strcmp("DECOCTION_AMT", _xml_element[5]) == 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:
76
diff
changeset
|
244 | _xml_add_amount = atof(char_data_buffer); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
245 | } else if (strcmp("END_TEMP", _xml_element[5]) == 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:
76
diff
changeset
|
246 | _xml_add_end = atof(char_data_buffer); |
0 | 247 | } |
248 | } else if ((_xml_depth >= 4) && (strcmp("TUN_TEMP", _xml_element[3]) == 0)) { | |
249 | // Save this and check later if this is the strike temperature. | |
250 | _xml_tun_temp = atof(char_data_buffer); | |
251 | } else if ((_xml_depth >= 4) && (strcmp("SPARGE_TEMP", _xml_element[3]) == 0)) { | |
252 | recipe.SpargeTemp = atof(char_data_buffer); | |
253 | } | |
254 | } | |
255 | } | |
256 | } | |
257 | } | |
258 | ||
259 | ||
260 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
261 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
262 | * @brief Start new XML element. |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
263 | * @param userData |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
264 | * @param name XML element name |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
265 | * @param attr XML element attribute |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
266 | */ |
0 | 267 | void startElement(void *userData, const char *name, const char **attr) |
268 | { | |
269 | sprintf(_xml_element[_xml_depth], "%s", name); | |
270 | _xml_depth++; | |
271 | process_char_data_buffer(); | |
272 | reset_char_data_buffer(); | |
273 | } | |
274 | ||
275 | ||
276 | ||
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
277 | /** |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
278 | * @brief End XML element |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
279 | * @param userData |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
280 | * @param name XML element name |
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
281 | */ |
0 | 282 | void endElement(void *userData, const char *name) |
283 | { | |
284 | process_char_data_buffer(); | |
285 | reset_char_data_buffer(); | |
286 | if ((_xml_depth == 4) && (strcmp("HOP", _xml_element[3]) == 0)) { | |
287 | if (_xml_add_valid) { | |
288 | Addition_Add(_xml_add_name, ADDITION_HOP, _xml_add_time); | |
289 | } | |
290 | } | |
291 | if ((_xml_depth == 4) && (strcmp("FERMENTABLE", _xml_element[3]) == 0)) { | |
292 | if (_xml_add_valid && (_xml_add_type == ADDITION_FERMENTABLE)) { | |
293 | Addition_Add(_xml_add_name, _xml_add_type, _xml_add_time); | |
294 | } | |
295 | } | |
296 | if ((_xml_depth == 4) && (strcmp("MISC", _xml_element[3]) == 0)) { | |
297 | if (_xml_add_valid) { | |
298 | Addition_Add(_xml_add_name, _xml_add_type, _xml_add_time); | |
299 | } | |
300 | } | |
301 | if ((_xml_depth == 5) && (strcmp("MASH_STEP", _xml_element[4]) == 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:
76
diff
changeset
|
302 | recipe.MashStep[recipe.Mashsteps].Name[0] = '\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:
76
diff
changeset
|
303 | strncat(recipe.MashStep[recipe.Mashsteps].Name, _xml_add_name, 31); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
304 | recipe.MashStep[recipe.Mashsteps].Type = _xml_add_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:
76
diff
changeset
|
305 | recipe.MashStep[recipe.Mashsteps].Step_temp = _xml_add_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:
76
diff
changeset
|
306 | recipe.MashStep[recipe.Mashsteps].Step_time = _xml_add_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:
76
diff
changeset
|
307 | recipe.MashStep[recipe.Mashsteps].Ramp_time = _xml_add_ramp; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
308 | recipe.MashStep[recipe.Mashsteps].End_temp = _xml_add_end; |
15
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
309 | if (_xml_add_type == MASHTYPE_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:
76
diff
changeset
|
310 | recipe.MashStep[recipe.Mashsteps].Infuse_temp = _xml_add_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:
76
diff
changeset
|
311 | recipe.MashStep[recipe.Mashsteps].Infuse_amount = _xml_add_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:
76
diff
changeset
|
312 | } else if (_xml_add_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:
76
diff
changeset
|
313 | recipe.MashStep[recipe.Mashsteps].Infuse_temp = 0.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:
76
diff
changeset
|
314 | recipe.MashStep[recipe.Mashsteps].Infuse_amount = _xml_add_amount; |
15
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
315 | } 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:
76
diff
changeset
|
316 | recipe.MashStep[recipe.Mashsteps].Infuse_temp = 0.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:
76
diff
changeset
|
317 | recipe.MashStep[recipe.Mashsteps].Infuse_amount = 0.0; |
15
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
318 | } |
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:
76
diff
changeset
|
319 | recipe.Mashsteps++; |
0 | 320 | } |
321 | _xml_depth--; | |
322 | } | |
323 | ||
324 | ||
325 | ||
326 | int ParseRecipe(char *fn, char *code) | |
327 | { | |
328 | char buf[512]; | |
329 | ||
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:
76
diff
changeset
|
330 | memset(&recipe, 0, recipe_hdr.recsize); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
331 | for (int i = 0; i < recipe_hdr.mashmax; 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:
76
diff
changeset
|
332 | recipe.MashStep[i].Type = 255; |
0 | 333 | XML_Parser parser = XML_ParserCreate(NULL); |
334 | ||
335 | int done; | |
336 | _xml_depth = 0; | |
337 | _xml_tun_temp = 0.0; | |
93
24cb415af787
Version 0.3.13. Recipe import parse BMS_COOLING_TO to set the cooling temperature.
Michiel Broek <mbroek@mbse.eu>
parents:
89
diff
changeset
|
338 | recipe.CoolTemp = 20.0; |
0 | 339 | |
340 | XML_SetElementHandler(parser, startElement, endElement); | |
341 | XML_SetCharacterDataHandler(parser, char_data); | |
342 | ||
343 | FILE *fp = fopen(fn, "r"); | |
344 | ||
345 | do { | |
346 | int len = (int)fread(buf, 1, sizeof(buf), fp); | |
347 | done = len < sizeof(buf); | |
348 | if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) { | |
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:
76
diff
changeset
|
349 | ESP_LOGE(TAG, "%s at line %5lu", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); |
0 | 350 | return 1; |
351 | } | |
352 | vTaskDelay(2 / portTICK_PERIOD_MS); | |
353 | } while (!done); | |
354 | ||
355 | XML_ParserFree(parser); | |
356 | fclose(fp); | |
357 | ||
358 | /* | |
359 | * Fix missing things. | |
360 | */ | |
361 | snprintf(recipe.Code, 31, "%s", code); | |
362 | // The code is created from the recipe filename. | |
363 | for (int i = 0; i < strlen(recipe.Code); i++) { | |
364 | if ((recipe.Code[i] == ' ') || (recipe.Code[i] == '.')) { | |
365 | recipe.Code[i] = '\0'; | |
366 | break; | |
367 | } | |
368 | } | |
369 | ||
17
f3451031d6c6
Version 0.2.5. Removed debug console messages during recipe import. Removed old SyncDirs code to install /spiffs from the SD card since we now do this via the internet.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
370 | #if 0 |
0 | 371 | printf("Recipe: %s\n", recipe.Name); |
372 | printf("Code : %s\n", recipe.Code); | |
373 | printf("Boil time %d minutes\n", recipe.BoilTime); | |
15
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
374 | printf("n Stepname T temp time ramp inft infa\n"); |
34b1eb93e71a
Added extra mash step fields for infusion steps. Added these fields in recipe import too.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
375 | printf("- ------------------------------ - ----- ---- ---- ----- -----\n"); |
0 | 376 | for (int i = 0; i < 8; i++) { |
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:
76
diff
changeset
|
377 | if (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:
76
diff
changeset
|
378 | printf("%d %-30s %d %5.2f %4d %4d %5.2f %5.2f\n", i, recipe.MashStep[i].Name, recipe.MashStep[i].Type, 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:
76
diff
changeset
|
379 | recipe.MashStep[i].Step_time, recipe.MashStep[i].Ramp_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:
76
diff
changeset
|
380 | recipe.MashStep[i].Infuse_temp, recipe.MashStep[i].Infuse_amount); |
0 | 381 | } |
382 | } | |
383 | printf("%d additions\n", recipe.Additions); | |
384 | printf("n Addition name t Tim\n"); | |
385 | printf("- --------------------------------------------------------------- - ---\n"); | |
386 | for (int i = 0; i < recipe.Additions; i++) { | |
387 | printf("%d %-63s %d %3d\n", i, recipe.Addition[i].Name, recipe.Addition[i].Type, recipe.Addition[i].Time); | |
388 | } | |
389 | printf("Cooltemp %5.2f\n", recipe.CoolTemp); | |
390 | if (recipe.Whirlpool9) | |
391 | printf("Whirlpool9 %d\n", recipe.Whirlpool9); | |
392 | if (recipe.Whirlpool7) | |
393 | printf("Whirlpool7 %d\n", recipe.Whirlpool7); | |
394 | if (recipe.Whirlpool6) | |
395 | printf("Whirlpool6 %d\n", recipe.Whirlpool6); | |
396 | if (recipe.Whirlpool2) | |
397 | printf("Whirlpool2 %d\n", recipe.Whirlpool2); | |
398 | printf("SpargeTemp %5.2f\n", recipe.SpargeTemp); | |
1
ad2c8b13eb88
Updated lots of doxygen comments
Michiel Broek <mbroek@mbse.eu>
parents:
0
diff
changeset
|
399 | #endif |
0 | 400 | |
401 | return 0; | |
402 | } | |
403 | ||
404 | ||
405 | ||
406 | /* | |
407 | * Recipes init function, only runs once a new screen is entered. | |
408 | */ | |
409 | void Recipes_Init(void) | |
410 | { | |
411 | FILE *f; | |
412 | DIR *dir; | |
413 | struct dirent *de; | |
414 | size_t bytes; | |
415 | uint8_t *dst; | |
416 | uint16_t y; | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
417 | char filename[288], newname[288]; |
0 | 418 | int rc; |
419 | ||
420 | switch (Main_Screen) { | |
421 | case MAIN_TOOLS_RECIPE: | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
422 | TopMessage((char *)"Recepten importeren"); |
0 | 423 | r_Imported = 0; |
424 | TFT_setFont(DEFAULT_FONT, NULL); | |
425 | y = 28; | |
426 | if ((dir = opendir("/sdcard/recipe"))) { | |
427 | de = readdir(dir); | |
428 | while (de) { | |
429 | if (strstr(de->d_name, ".xml") || strstr(de->d_name, ".XML")) { | |
430 | _fg = TFT_YELLOW; | |
431 | TFT_print(de->d_name, 2, y); | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
432 | snprintf(filename, 287, "/sdcard/recipe/%s", de->d_name); |
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
433 | snprintf(newname, 287, "/sdcard/recipe/%s", de->d_name); |
0 | 434 | newname[strlen(newname) -2] = 'o'; |
435 | newname[strlen(newname) -1] = 'k'; | |
436 | rc = ParseRecipe(filename, de->d_name); | |
437 | ESP_LOGI(TAG, "Recipe %s parsed, rc=%d", filename, rc); | |
438 | if (rc == 0) { | |
439 | append_recipe(); | |
440 | rename(filename, newname); | |
441 | _fg = TFT_GREEN; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
442 | TFT_print((char *)" Ok", LASTX, y); |
0 | 443 | } else { |
444 | _fg = TFT_RED; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
445 | TFT_print((char *)" Fout", LASTX, y); |
0 | 446 | } |
447 | r_Imported++; // Count them all | |
448 | y += 16; | |
449 | } | |
450 | de = readdir(dir); | |
451 | } | |
452 | closedir(dir); | |
453 | } | |
454 | ||
455 | f = fopen("/spiffs/etc/recipe.conf", "r"); | |
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:
76
diff
changeset
|
456 | fseek(f, recipe_hdr.hdrsize, SEEK_SET); |
0 | 457 | dst = (uint8_t*)&recipe; |
458 | r_Records = 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:
76
diff
changeset
|
459 | while ((bytes = fread(dst, 1, recipe_hdr.recsize, f))) { |
0 | 460 | r_Records++; |
461 | } | |
462 | fclose(f); | |
463 | // Load the default record. | |
464 | r_CurrentRec = config.RecipeRec; | |
465 | r_UpdateRec = true; | |
466 | break; | |
467 | ||
468 | case MAIN_TOOLS_RECIPE_EDIT: | |
469 | break; | |
470 | ||
471 | default: break; | |
472 | } | |
473 | } | |
474 | ||
475 | ||
476 | ||
477 | /* | |
478 | * Recipes management loop, non-blocking. | |
479 | */ | |
480 | void Recipes_Loop(void) | |
481 | { | |
482 | uint32_t crc1, crc2; | |
483 | uint8_t *dst; | |
484 | uint16_t y; | |
56
756d1a63d129
Adjusted more strings for new compiler warnings. There should now be no buffer overflows in the app. Changed the date display on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
54
diff
changeset
|
485 | char tmp[64]; |
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:
76
diff
changeset
|
486 | float mintemp, maxtemp; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
487 | int i; |
0 | 488 | |
489 | switch (Main_Screen) { | |
490 | case MAIN_TOOLS_RECIPE: | |
491 | if (r_Imported) { | |
492 | Buttons_Clear(); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
493 | Buttons_Add(135, 210, 50, 30, (char *)"Ok" , 0); |
0 | 494 | Buttons_Show(); |
495 | ||
496 | while (true) { | |
497 | if (Buttons_Scan() == 0) | |
498 | break; | |
499 | vTaskDelay(20 / portTICK_PERIOD_MS); | |
500 | } | |
501 | Buttons_Clear(); | |
502 | r_Imported = 0; | |
503 | } | |
504 | if (r_UpdateRec) { | |
505 | _bg = TFT_BLACK; | |
506 | TFT_fillScreen(_bg); | |
507 | TFT_resetclipwin(); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
508 | TopMessage((char *)"Recepten"); |
0 | 509 | r_UpdateRec = false; |
510 | read_recipe(r_CurrentRec); | |
511 | 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:
19
diff
changeset
|
512 | ShowText(2, 28, (char *)"Naam", recipe.Name); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
513 | ShowText(2, 44, (char *)"Code", recipe.Code); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
514 | ShowInteger(162, 44, (char *)"Record", NULL, r_CurrentRec); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
515 | ShowInteger(2, 60, (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:
19
diff
changeset
|
516 | ShowFloat(162, 60, (char *)"Koel tot", (char *)" C", recipe.CoolTemp, 2); |
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:
76
diff
changeset
|
517 | ShowFloat(2, 76, (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:
19
diff
changeset
|
518 | ShowFloat(162, 76, (char *)"Spoelwater", (char *)" C", recipe.SpargeTemp, 2); |
0 | 519 | y = 92; |
520 | _fg = TFT_WHITE; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
521 | TFT_print((char *)"Maisch stap", 2, y); |
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:
76
diff
changeset
|
522 | TFT_print((char *)"T", 180, 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:
76
diff
changeset
|
523 | TFT_print((char *)"Temp.", 200, y); |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
524 | TFT_print((char *)"Rust", 280, y); |
0 | 525 | _fg = TFT_YELLOW; |
526 | 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:
76
diff
changeset
|
527 | for (i = 0; i < recipe_hdr.mashmax; i++) { |
89
fa44bd094e01
Added power usage counters to manual mode.
Michiel Broek <mbroek@mbse.eu>
parents:
77
diff
changeset
|
528 | ESP_LOGD(TAG, "%2d %-31s %3d %5.2f %5.2f %2d %2d %7.4f %6.3f", i, recipe.MashStep[i].Name, recipe.MashStep[i].Type, |
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:
76
diff
changeset
|
529 | recipe.MashStep[i].Step_temp, recipe.MashStep[i].End_temp, recipe.MashStep[i].Step_time, recipe.MashStep[i].Ramp_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:
76
diff
changeset
|
530 | recipe.MashStep[i].Infuse_temp, recipe.MashStep[i].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:
76
diff
changeset
|
531 | if (recipe.MashStep[i].Type != 255) { |
0 | 532 | TFT_print(recipe.MashStep[i].Name, 2, y); |
19 | 533 | strcpy(tmp, mashTypes[recipe.MashStep[i].Type]); |
534 | tmp[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:
76
diff
changeset
|
535 | TFT_print(tmp, 180, 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:
76
diff
changeset
|
536 | sprintf(tmp, "%.1f %.1f", recipe.MashStep[i].Step_temp, recipe.MashStep[i].End_temp); |
19 | 537 | TFT_print(tmp, 200, y); |
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:
76
diff
changeset
|
538 | sprintf(tmp, "%2d m", recipe.MashStep[i].Step_time); |
16 | 539 | TFT_print(tmp, 280, y); |
0 | 540 | y += 16; |
541 | } | |
542 | } | |
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:
70
diff
changeset
|
543 | 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:
70
diff
changeset
|
544 | 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:
70
diff
changeset
|
545 | _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:
70
diff
changeset
|
546 | 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:
70
diff
changeset
|
547 | 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:
70
diff
changeset
|
548 | _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:
70
diff
changeset
|
549 | 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:
70
diff
changeset
|
550 | _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:
70
diff
changeset
|
551 | 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:
70
diff
changeset
|
552 | 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:
70
diff
changeset
|
553 | 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:
70
diff
changeset
|
554 | } |
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:
70
diff
changeset
|
555 | _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:
70
diff
changeset
|
556 | 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:
70
diff
changeset
|
557 | } 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:
70
diff
changeset
|
558 | _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:
70
diff
changeset
|
559 | TFT_print((char *)"Geen hop toevoegingen.", 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:
70
diff
changeset
|
560 | } |
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:
70
diff
changeset
|
561 | y += 16; |
0 | 562 | } |
563 | if (recipe.Whirlpool9 || recipe.Whirlpool7 || recipe.Whirlpool6 || recipe.Whirlpool2) { | |
564 | _fg = TFT_WHITE; | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
565 | TFT_print((char *)"Whirlpool ", 2, y); |
0 | 566 | _fg = TFT_YELLOW; |
567 | if (recipe.Whirlpool9) | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
568 | TFT_print((char *)"88+ ", LASTX, y); |
0 | 569 | if (recipe.Whirlpool7) |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
570 | TFT_print((char *)"71+ ", LASTX, y); |
0 | 571 | if (recipe.Whirlpool6) |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
572 | TFT_print((char *)"60+ ", LASTX, y); |
0 | 573 | if (recipe.Whirlpool2) |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
574 | TFT_print((char *)"koud", LASTX, y); |
0 | 575 | } |
576 | ||
577 | Buttons_Clear(); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
578 | Buttons_Add( 0, 210, 45, 30, (char *)"Ok" , 0); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
579 | Buttons_Add( 46, 210, 45, 30, (char *)"+" , 1); |
0 | 580 | if (r_CurrentRec != config.RecipeRec) |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
581 | Buttons_Add( 92, 210, 45, 30, (char *)"-", 2); |
0 | 582 | else |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
583 | Buttons_Add( 92, 210, 45, 30, (char *)"" , 2); |
0 | 584 | if (r_CurrentRec > 1) |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
585 | Buttons_Add(138, 210, 45, 30, (char *)"<", 3); |
0 | 586 | else |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
587 | Buttons_Add(138, 210, 45, 30, (char *)"", 3); |
0 | 588 | if (r_CurrentRec < r_Records) |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
589 | Buttons_Add(184, 210, 45, 30, (char *)">", 4); |
0 | 590 | else |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
591 | Buttons_Add(184, 210, 45, 30, (char *)"", 4); |
0 | 592 | if (r_CurrentRec != config.RecipeRec) |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
593 | Buttons_Add(230, 210, 45, 30, (char *)"Std", 5); |
0 | 594 | else |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
595 | Buttons_Add(230, 210, 45, 30, (char *)"", 5); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
596 | Buttons_Add(276, 210, 45, 30, (char *)"Ed" , 6); |
0 | 597 | Buttons[0].dark = true; |
598 | Buttons_Show(); | |
599 | } /* if (r_UpdateRec) */ | |
600 | switch (Buttons_Scan()) { | |
601 | case 0: Main_Screen = MAIN_TOOLS; | |
602 | break; | |
603 | ||
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:
76
diff
changeset
|
604 | case 1: memset(&recipe, 0, sizeof(recipe)); // new recipe |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
605 | for (i = 1; i < recipe_hdr.mashmax; 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:
76
diff
changeset
|
606 | recipe.MashStep[i].Type = 255; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
607 | sprintf(recipe.Name, "Recept %d", r_Records + 1); |
0 | 608 | sprintf(recipe.Code, "00%d", r_Records + 1); |
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:
76
diff
changeset
|
609 | sprintf(recipe.MashStep[0].Name, "Maischen"); |
16 | 610 | recipe.MashStep[0].Type = MASHTYPE_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:
76
diff
changeset
|
611 | recipe.MashStep[0].Step_temp = recipe.MashStep[0].End_temp = 67.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:
76
diff
changeset
|
612 | recipe.MashStep[0].Infuse_temp = 67.5; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
613 | recipe.MashStep[0].Infuse_amount = 15.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:
76
diff
changeset
|
614 | recipe.MashStep[0].Step_time = 75; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
615 | recipe.MashStep[0].Ramp_time = 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:
76
diff
changeset
|
616 | sprintf(recipe.MashStep[1].Name, "Mash-out"); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
617 | recipe.MashStep[1].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:
76
diff
changeset
|
618 | recipe.MashStep[1].Step_temp = recipe.MashStep[1].End_temp = 78.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:
76
diff
changeset
|
619 | recipe.MashStep[1].Step_time = 10; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
620 | recipe.MashStep[1].Ramp_time = 13; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
621 | recipe.Mashsteps = 2; |
0 | 622 | recipe.BoilTime = 60; |
623 | recipe.Additions = 2; | |
16 | 624 | sprintf(recipe.Addition[0].Name, "Bitterhop"); |
0 | 625 | recipe.Addition[0].Time = 60; |
626 | recipe.Addition[0].Type = ADDITION_HOP; | |
16 | 627 | sprintf(recipe.Addition[1].Name, "Aromahop"); |
0 | 628 | recipe.Addition[1].Time = 10; |
629 | recipe.Addition[1].Type = ADDITION_HOP; | |
630 | recipe.CoolTemp = 20.0; | |
631 | recipe.Whirlpool9 = 0; | |
632 | recipe.Whirlpool7 = 0; | |
633 | recipe.Whirlpool6 = 0; | |
634 | recipe.Whirlpool2 = 0; | |
635 | recipe.SpargeTemp = 85.0; | |
636 | append_recipe(); | |
637 | r_Records++; | |
638 | r_CurrentRec = r_Records; | |
639 | r_UpdateRec = true; | |
6
e84200edc852
Updated esp-ide. Removed VNC server corre encoding because no clients would use it. Enabled WiFi error logmessages. Write runtime record is now debug logging. Removed recipe.Record number, not usefull and was wrong too. Removed console print of json log data.
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
640 | ESP_LOGI(TAG, "New recipe record %d", r_CurrentRec); |
0 | 641 | break; |
642 | ||
643 | case 2: if ((r_CurrentRec != config.RecipeRec) && (r_Records > 1)) { | |
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:
76
diff
changeset
|
644 | _bg = 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:
76
diff
changeset
|
645 | TFT_fillScreen(_bg); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
646 | TFT_resetclipwin(); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
647 | TopMessage((char *)"Recept verwijderen"); |
0 | 648 | delete_recipe(r_CurrentRec); |
649 | r_Records--; | |
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:
76
diff
changeset
|
650 | if (r_CurrentRec >= r_Records) |
0 | 651 | r_CurrentRec = r_Records; |
652 | r_UpdateRec = true; | |
653 | } | |
654 | break; | |
655 | ||
656 | case 3: if (r_CurrentRec > 1) { | |
657 | r_CurrentRec--; | |
658 | r_UpdateRec = true; | |
659 | } | |
660 | break; | |
661 | ||
662 | case 4: if (r_CurrentRec < r_Records) { | |
663 | r_CurrentRec++; | |
664 | r_UpdateRec = true; | |
665 | } | |
666 | break; | |
667 | ||
668 | case 5: if (r_CurrentRec != config.RecipeRec) { | |
669 | config.RecipeRec = r_CurrentRec; | |
670 | write_config(); | |
671 | r_UpdateRec = true; | |
672 | ESP_LOGI(TAG, "Recipe %d `%s' set as default", r_CurrentRec, recipe.Name); | |
673 | } | |
674 | break; | |
675 | ||
676 | case 6: Main_Screen = MAIN_TOOLS_RECIPE_EDIT; | |
677 | break; | |
678 | ||
679 | default: break; | |
680 | } | |
681 | break; | |
682 | ||
683 | case MAIN_TOOLS_RECIPE_EDIT: | |
684 | dst = (uint8_t*)&recipe; | |
685 | crc1 = crc32_le(0, dst, sizeof(recipe)); | |
686 | ||
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
687 | EditText((char *)"Naam", recipe.Name, 31); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
688 | EditText((char *)"Code", recipe.Code, 31); |
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:
76
diff
changeset
|
689 | EditUint8((char *)"Maisch stappen", &recipe.Mashsteps, 1, 6); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
690 | for (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:
76
diff
changeset
|
691 | int step = i + 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:
76
diff
changeset
|
692 | if (i == (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:
76
diff
changeset
|
693 | mintemp = 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:
76
diff
changeset
|
694 | maxtemp = 80.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:
76
diff
changeset
|
695 | } 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:
76
diff
changeset
|
696 | mintemp = 35.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:
76
diff
changeset
|
697 | maxtemp = 74.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:
76
diff
changeset
|
698 | } |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
699 | if (recipe.MashStep[i].Type == 255) { |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
700 | // A new step, set default values. |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
701 | recipe.MashStep[i].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:
76
diff
changeset
|
702 | recipe.MashStep[i].Step_time = 20; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
703 | if (i == 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:
76
diff
changeset
|
704 | recipe.MashStep[i].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:
76
diff
changeset
|
705 | recipe.MashStep[i].Step_temp = recipe.MashStep[i].End_temp = 62.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:
76
diff
changeset
|
706 | recipe.MashStep[i].Infuse_temp = 62.5; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
707 | recipe.MashStep[i].Infuse_amount = 15; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
708 | recipe.MashStep[i].Ramp_time = 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:
76
diff
changeset
|
709 | } else if (i == (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:
76
diff
changeset
|
710 | recipe.MashStep[i].Step_temp = recipe.MashStep[i].End_temp = 78.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:
76
diff
changeset
|
711 | recipe.MashStep[i].Step_time = 10; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
712 | recipe.MashStep[i].Ramp_time = (int)(recipe.MashStep[i].Step_temp - recipe.MashStep[i - 1].Step_temp + 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:
76
diff
changeset
|
713 | } 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:
76
diff
changeset
|
714 | recipe.MashStep[i].Step_temp = recipe.MashStep[i].End_temp = recipe.MashStep[i - 1].Step_temp + 2.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:
76
diff
changeset
|
715 | recipe.MashStep[i].Ramp_time = (int)(recipe.MashStep[i].Step_temp - recipe.MashStep[i - 1].Step_temp + 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:
76
diff
changeset
|
716 | } |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
717 | } |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
718 | sprintf(tmp, "Maisch stap %d naam", step); |
0 | 719 | EditText(tmp, recipe.MashStep[i].Name, 31); |
19 | 720 | EditMashType(&recipe.MashStep[i].Type); |
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:
76
diff
changeset
|
721 | sprintf(tmp, "Maisch stap %d start temperatuur", step); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
722 | EditFloat(tmp, &recipe.MashStep[i].Step_temp, mintemp, maxtemp, 2); |
76
3ff381bfa469
Version 0.3.10 Updated the webui. The recipe mash infusiont temperature rounding from 0.25 to 0.0625 degrees.
Michiel Broek <mbroek@mbse.eu>
parents:
75
diff
changeset
|
723 | // Round to 0.25 values |
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:
76
diff
changeset
|
724 | recipe.MashStep[i].Step_temp = ((int)(recipe.MashStep[i].Step_temp * 4)) / 4.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:
76
diff
changeset
|
725 | sprintf(tmp, "Maisch stap %d eind temperatuur", step); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
726 | EditFloat(tmp, &recipe.MashStep[i].End_temp, mintemp, maxtemp, 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:
76
diff
changeset
|
727 | recipe.MashStep[i].End_temp = ((int)(recipe.MashStep[i].End_temp * 4)) / 4.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:
76
diff
changeset
|
728 | sprintf(tmp, "Maisch stap %d rusttijd in minuten", step); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
729 | EditUint16(tmp, &recipe.MashStep[i].Step_time, 1, 480); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
730 | if (recipe.MashStep[i].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:
76
diff
changeset
|
731 | sprintf(tmp, "Stap %d infusie temperatuur", step); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
732 | EditFloat(tmp, &recipe.MashStep[i].Infuse_temp, 10, 99, 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:
76
diff
changeset
|
733 | recipe.MashStep[i].Infuse_temp = ((int)(recipe.MashStep[i].Infuse_temp * 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:
76
diff
changeset
|
734 | sprintf(tmp, "Stap %d infusie volume", step); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
735 | EditFloat(tmp, &recipe.MashStep[i].Infuse_amount, 0.5, 1000.0, 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:
76
diff
changeset
|
736 | recipe.MashStep[i].Ramp_time = 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:
76
diff
changeset
|
737 | } else if (recipe.MashStep[i].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:
76
diff
changeset
|
738 | recipe.MashStep[i].Infuse_temp = 0.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:
76
diff
changeset
|
739 | recipe.MashStep[i].Ramp_time = 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:
76
diff
changeset
|
740 | sprintf(tmp, "Stap %d decoctie volume", step); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
741 | EditFloat(tmp, &recipe.MashStep[i].Infuse_amount, 0.5, 1000.0, 3); |
0 | 742 | } 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:
76
diff
changeset
|
743 | recipe.MashStep[i].Infuse_temp = recipe.MashStep[i].Infuse_amount = 0.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:
76
diff
changeset
|
744 | sprintf(tmp, "Stap %d opwarm tijd", step); |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
745 | EditUint16(tmp, &recipe.MashStep[i].Ramp_time, 1, 480); |
19 | 746 | } |
0 | 747 | } |
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:
76
diff
changeset
|
748 | for (i = recipe.Mashsteps; i < recipe_hdr.mashmax; 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:
76
diff
changeset
|
749 | recipe.MashStep[i].Type = 255; |
66c77497d86d
Changed the recipe database so that it is expandable, version 2. More mash fields and allow 16 steps. Allow 20 Additions. Removed separate mash steps from the state machine, the steps are moved to the runtime data. There is no fixed step number for mashout anymore. There is no fixed step for mash-in anymore, just use the first step and heat to the infusion temperature. After malt add, switch to the normal step temperature. Implemented decoction steps.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
750 | recipe.MashStep[i].Step_temp = recipe.MashStep[i].End_temp = recipe.MashStep[i].Infuse_temp = recipe.MashStep[i].Infuse_amount = 0.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:
76
diff
changeset
|
751 | recipe.MashStep[i].Step_time = recipe.MashStep[i].Ramp_time = 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:
76
diff
changeset
|
752 | recipe.MashStep[i].Name[0] = '\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:
76
diff
changeset
|
753 | } |
0 | 754 | |
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:
70
diff
changeset
|
755 | EditUint16((char *)"Kook tijd in minuten", &recipe.BoilTime, 0, 480); |
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:
70
diff
changeset
|
756 | 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:
70
diff
changeset
|
757 | EditUint8((char *)"Hop/kruiden toevoegingen", &recipe.Additions, 1, 10); |
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:
70
diff
changeset
|
758 | for (uint8_t i = 0; 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:
70
diff
changeset
|
759 | sprintf(tmp, "Toevoeging %d naam", i+1); |
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:
70
diff
changeset
|
760 | if (strlen(recipe.Addition[i].Name) == 00) { |
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:
70
diff
changeset
|
761 | sprintf(recipe.Addition[i].Name, "Hop %d", (int)i+1); |
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:
70
diff
changeset
|
762 | } |
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:
70
diff
changeset
|
763 | EditText(tmp, recipe.Addition[i].Name, 40); |
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:
70
diff
changeset
|
764 | sprintf(tmp, "Toevoeging %d tijd", i+1); |
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:
70
diff
changeset
|
765 | if (i == 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:
70
diff
changeset
|
766 | EditUint16(tmp, &recipe.Addition[i].Time, 0, 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:
70
diff
changeset
|
767 | } 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:
70
diff
changeset
|
768 | EditUint16(tmp, &recipe.Addition[i].Time, 0, recipe.Addition[i-1].Time - 1); |
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:
70
diff
changeset
|
769 | } |
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:
70
diff
changeset
|
770 | recipe.Addition[i].Type = ADDITION_HOP; |
0 | 771 | } |
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:
76
diff
changeset
|
772 | } 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:
76
diff
changeset
|
773 | recipe.Additions = 0; |
0 | 774 | } |
775 | ||
70
d6838a268020
Version 0.3.7. The WiFi task uses the new event handlers. Cooling temperature top is now 45 instead of 30 degreees for pitching Kveik. One extra cosmetic message during OTA update.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
776 | EditFloat((char *)"Koel temperatuur", &recipe.CoolTemp, 10, 45, 2); |
0 | 777 | recipe.CoolTemp = ((int)(recipe.CoolTemp * 4)) / 4.0; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
778 | EditFloat((char *)"Spoelwater temperatuur", &recipe.SpargeTemp, 75, 98, 2); |
0 | 779 | recipe.SpargeTemp = ((int)(recipe.SpargeTemp * 4)) / 4.0; |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
780 | EditUint16((char *)"Whirlpool 88..100 graden, 0 = niet", &recipe.Whirlpool9, 0, 120); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
781 | EditUint16((char *)"Whirlpool 71..77 graden, 0 = niet", &recipe.Whirlpool7, 0, 120); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
782 | EditUint16((char *)"Whirlpool 60..66 graden, 0 = niet", &recipe.Whirlpool6, 0, 120); |
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
783 | EditUint16((char *)"Whirlpool koud, 0 = niet", &recipe.Whirlpool2, 0, 120); |
0 | 784 | |
785 | crc2 = crc32_le(0, dst, sizeof(recipe)); | |
54
7b134c27fadb
Upgraded esp-ide and compilers. Adjusted the sources for the new compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents:
19
diff
changeset
|
786 | if ((crc1 != crc2) && Confirm((char *)"Gewijzigd, opslaan?", (char *)"Ja", (char *)"Nee")) { |
6
e84200edc852
Updated esp-ide. Removed VNC server corre encoding because no clients would use it. Enabled WiFi error logmessages. Write runtime record is now debug logging. Removed recipe.Record number, not usefull and was wrong too. Removed console print of json log data.
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
787 | write_recipe(r_CurrentRec); |
0 | 788 | } |
789 | Main_Screen = MAIN_TOOLS_RECIPE; | |
790 | break; | |
791 | ||
792 | default: break; | |
793 | } | |
794 | } | |
795 | ||
796 |