24 char _xml_add_name[64]; ///< Mash name |
24 char _xml_add_name[64]; ///< Mash name |
25 int _xml_add_type; ///< Mash type |
25 int _xml_add_type; ///< Mash type |
26 int _xml_add_time; ///< Mash rest time |
26 int _xml_add_time; ///< Mash rest time |
27 int _xml_add_ramp; ///< Mash ramp time |
27 int _xml_add_ramp; ///< Mash ramp time |
28 float _xml_add_temp; ///< Mash temperature |
28 float _xml_add_temp; ///< Mash temperature |
|
29 float _xml_add_amount; ///< Mash infusion amount |
|
30 float _xml_add_infusion; ///< Mash infusion temperature |
29 float _xml_tun_temp; ///< TUN temperature |
31 float _xml_tun_temp; ///< TUN temperature |
30 bool _xml_add_valid; ///< Add is valid |
32 bool _xml_add_valid; ///< Add is valid |
31 |
33 |
32 static const char *TAG = "recipes"; |
34 static const char *TAG = "recipes"; |
33 |
35 |
212 if (strcmp("NAME", _xml_element[5]) == 0) { |
214 if (strcmp("NAME", _xml_element[5]) == 0) { |
213 snprintf(_xml_add_name, 31, "%s", char_data_buffer); |
215 snprintf(_xml_add_name, 31, "%s", char_data_buffer); |
214 } else if (strcmp("TYPE", _xml_element[5]) == 0) { |
216 } else if (strcmp("TYPE", _xml_element[5]) == 0) { |
215 // Temperature Infusion Decoction |
217 // Temperature Infusion Decoction |
216 _xml_add_valid = (strcmp("Temperature", char_data_buffer) == 0); |
218 _xml_add_valid = (strcmp("Temperature", char_data_buffer) == 0); |
|
219 if (strcmp("Infusion", char_data_buffer) == 0) |
|
220 _xml_add_type = MASHTYPE_INFUSION; |
|
221 else if (strcmp("Temperature", char_data_buffer) == 0) |
|
222 _xml_add_type = MASHTYPE_TEMPERATURE; |
|
223 else if (strcmp("Decoction", char_data_buffer) == 0) |
|
224 _xml_add_type = MASHTYPE_DECOCTION; |
217 } else if (strcmp("STEP_TEMP", _xml_element[5]) == 0) { |
225 } else if (strcmp("STEP_TEMP", _xml_element[5]) == 0) { |
218 _xml_add_temp = atof(char_data_buffer); |
226 _xml_add_temp = atof(char_data_buffer); |
219 } else if (strcmp("STEP_TIME", _xml_element[5]) == 0) { |
227 } else if (strcmp("STEP_TIME", _xml_element[5]) == 0) { |
220 _xml_add_time = atoi(char_data_buffer); |
228 _xml_add_time = atoi(char_data_buffer); |
221 } else if (strcmp("RAMP_TIME", _xml_element[5]) == 0) { |
229 } else if (strcmp("RAMP_TIME", _xml_element[5]) == 0) { |
222 _xml_add_ramp = atoi(char_data_buffer); |
230 _xml_add_ramp = atoi(char_data_buffer); |
|
231 } else if (strcmp("INFUSE_AMOUNT", _xml_element[5]) == 0) { |
|
232 _xml_add_amount = atof(char_data_buffer); |
|
233 } else if (strcmp("INFUSE_TEMP", _xml_element[5]) == 0) { |
|
234 _xml_add_infusion = atof(char_data_buffer); |
223 } |
235 } |
224 } else if ((_xml_depth >= 4) && (strcmp("TUN_TEMP", _xml_element[3]) == 0)) { |
236 } else if ((_xml_depth >= 4) && (strcmp("TUN_TEMP", _xml_element[3]) == 0)) { |
225 // Save this and check later if this is the strike temperature. |
237 // Save this and check later if this is the strike temperature. |
226 _xml_tun_temp = atof(char_data_buffer); |
238 _xml_tun_temp = atof(char_data_buffer); |
227 } else if ((_xml_depth >= 4) && (strcmp("SPARGE_TEMP", _xml_element[3]) == 0)) { |
239 } else if ((_xml_depth >= 4) && (strcmp("SPARGE_TEMP", _xml_element[3]) == 0)) { |
276 } |
288 } |
277 if ((_xml_depth == 5) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) { |
289 if ((_xml_depth == 5) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) { |
278 // printf("Flush End MASH_STEP %d %s\n", _xml_depth, _xml_add_name); |
290 // printf("Flush End MASH_STEP %d %s\n", _xml_depth, _xml_add_name); |
279 _xml_mashsteps++; |
291 _xml_mashsteps++; |
280 sprintf(recipe.MashStep[_xml_mashsteps].Name, "%s", _xml_add_name); |
292 sprintf(recipe.MashStep[_xml_mashsteps].Name, "%s", _xml_add_name); |
|
293 recipe.MashStep[_xml_mashsteps].Type = _xml_add_type; |
281 recipe.MashStep[_xml_mashsteps].Temperature = _xml_add_temp; |
294 recipe.MashStep[_xml_mashsteps].Temperature = _xml_add_temp; |
282 recipe.MashStep[_xml_mashsteps].Resttime = _xml_add_time; |
295 recipe.MashStep[_xml_mashsteps].Resttime = _xml_add_time; |
283 recipe.MashStep[_xml_mashsteps].Steptime = _xml_add_ramp; |
296 recipe.MashStep[_xml_mashsteps].Ramptime = _xml_add_ramp; |
|
297 if (_xml_add_type == MASHTYPE_INFUSION) { |
|
298 recipe.MashStep[_xml_mashsteps].Infusion_temp = _xml_add_infusion; |
|
299 recipe.MashStep[_xml_mashsteps].Infusion_amount = _xml_add_amount; |
|
300 } else { |
|
301 recipe.MashStep[_xml_mashsteps].Infusion_temp = 0.0; |
|
302 recipe.MashStep[_xml_mashsteps].Infusion_amount = 0.0; |
|
303 } |
284 } |
304 } |
285 _xml_depth--; |
305 _xml_depth--; |
286 } |
306 } |
287 |
307 |
288 |
308 |
342 for (int i = 6; i > 1; i--) { |
362 for (int i = 6; i > 1; i--) { |
343 if (recipe.MashStep[i].Resttime) { |
363 if (recipe.MashStep[i].Resttime) { |
344 // Got it, move. |
364 // Got it, move. |
345 sprintf(recipe.MashStep[7].Name, "%s", recipe.MashStep[i].Name); |
365 sprintf(recipe.MashStep[7].Name, "%s", recipe.MashStep[i].Name); |
346 recipe.MashStep[i].Name[0] = '\0'; |
366 recipe.MashStep[i].Name[0] = '\0'; |
|
367 recipe.MashStep[7].Type = recipe.MashStep[i].Type; |
|
368 recipe.MashStep[i].Type = 0; |
347 recipe.MashStep[7].Temperature = recipe.MashStep[i].Temperature; |
369 recipe.MashStep[7].Temperature = recipe.MashStep[i].Temperature; |
348 recipe.MashStep[i].Temperature = 0.0; |
370 recipe.MashStep[i].Temperature = 0.0; |
349 recipe.MashStep[7].Resttime = recipe.MashStep[i].Resttime; |
371 recipe.MashStep[7].Resttime = recipe.MashStep[i].Resttime; |
350 recipe.MashStep[i].Resttime = 0; |
372 recipe.MashStep[i].Resttime = 0; |
351 recipe.MashStep[7].Steptime = recipe.MashStep[i].Steptime; |
373 recipe.MashStep[7].Ramptime = recipe.MashStep[i].Ramptime; |
352 recipe.MashStep[i].Steptime = 0; |
374 recipe.MashStep[i].Ramptime = 0; |
|
375 recipe.MashStep[7].Infusion_temp = recipe.MashStep[i].Infusion_temp; |
|
376 recipe.MashStep[i].Infusion_temp = 0.0; |
|
377 recipe.MashStep[7].Infusion_amount = recipe.MashStep[i].Infusion_amount; |
|
378 recipe.MashStep[i].Infusion_amount = 0.0; |
353 break; |
379 break; |
354 } |
380 } |
355 } |
381 } |
356 } |
382 } |
357 |
383 |
358 #if 0 |
384 #if 1 |
359 printf("Recipe: %s\n", recipe.Name); |
385 printf("Recipe: %s\n", recipe.Name); |
360 printf("Code : %s\n", recipe.Code); |
386 printf("Code : %s\n", recipe.Code); |
361 printf("Boil time %d minutes\n", recipe.BoilTime); |
387 printf("Boil time %d minutes\n", recipe.BoilTime); |
362 printf("n Stepname temp time ramp\n"); |
388 printf("n Stepname T temp time ramp inft infa\n"); |
363 printf("- ------------------------------ ----- ---- ----\n"); |
389 printf("- ------------------------------ - ----- ---- ---- ----- -----\n"); |
364 for (int i = 0; i < 8; i++) { |
390 for (int i = 0; i < 8; i++) { |
365 if (recipe.MashStep[i].Resttime) { |
391 if (recipe.MashStep[i].Resttime) { |
366 printf("%d %-31s %5.2f %4d %4d\n", i, recipe.MashStep[i].Name, recipe.MashStep[i].Temperature, |
392 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].Temperature, |
367 recipe.MashStep[i].Resttime, recipe.MashStep[i].Steptime); |
393 recipe.MashStep[i].Resttime, recipe.MashStep[i].Ramptime, |
|
394 recipe.MashStep[i].Infusion_temp, recipe.MashStep[i].Infusion_amount); |
368 } |
395 } |
369 } |
396 } |
370 printf("%d additions\n", recipe.Additions); |
397 printf("%d additions\n", recipe.Additions); |
371 printf("n Addition name t Tim\n"); |
398 printf("n Addition name t Tim\n"); |
372 printf("- --------------------------------------------------------------- - ---\n"); |
399 printf("- --------------------------------------------------------------- - ---\n"); |
674 EditFloat(tmp, &recipe.MashStep[i].Temperature, mintemp, 74, 2); |
701 EditFloat(tmp, &recipe.MashStep[i].Temperature, mintemp, 74, 2); |
675 recipe.MashStep[i].Temperature = ((int)(recipe.MashStep[i].Temperature * 4)) / 4.0; |
702 recipe.MashStep[i].Temperature = ((int)(recipe.MashStep[i].Temperature * 4)) / 4.0; |
676 sprintf(tmp, "Maisch stap %d rusttijd in minuten", i); |
703 sprintf(tmp, "Maisch stap %d rusttijd in minuten", i); |
677 EditUint16(tmp, &recipe.MashStep[i].Resttime, 1, 480); |
704 EditUint16(tmp, &recipe.MashStep[i].Resttime, 1, 480); |
678 if (i == 1) { |
705 if (i == 1) { |
679 recipe.MashStep[i].Steptime = 1; |
706 recipe.MashStep[i].Ramptime = 1; |
680 } else { |
707 } else { |
681 recipe.MashStep[i].Steptime = (int)(recipe.MashStep[i].Temperature - recipe.MashStep[i - 1].Temperature); |
708 recipe.MashStep[i].Ramptime = (int)(recipe.MashStep[i].Temperature - recipe.MashStep[i - 1].Temperature); |
682 } |
709 } |
683 } |
710 } |
684 mintemp = recipe.MashStep[mashsteps].Temperature; |
711 mintemp = recipe.MashStep[mashsteps].Temperature; |
685 EditFloat("Uitmaischen temperatuur", &recipe.MashStep[7].Temperature, mintemp, 80, 2); |
712 EditFloat("Uitmaischen temperatuur", &recipe.MashStep[7].Temperature, mintemp, 80, 2); |
686 recipe.MashStep[7].Temperature = ((int)(recipe.MashStep[7].Temperature * 4)) / 4.0; |
713 recipe.MashStep[7].Temperature = ((int)(recipe.MashStep[7].Temperature * 4)) / 4.0; |
687 EditUint16("Uitmaischen tijd in minuten", &recipe.MashStep[7].Resttime, 1, 15); |
714 EditUint16("Uitmaischen tijd in minuten", &recipe.MashStep[7].Resttime, 1, 15); |
688 recipe.MashStep[7].Steptime = (int)(recipe.MashStep[7].Temperature - recipe.MashStep[mashsteps].Temperature); |
715 recipe.MashStep[7].Ramptime = (int)(recipe.MashStep[7].Temperature - recipe.MashStep[mashsteps].Temperature); |
689 // Zero any higher steps to diable them. |
716 // Zero any higher steps to diable them. |
690 for (int i = (mashsteps + 1); i < 7; i++) |
717 for (int i = (mashsteps + 1); i < 7; i++) |
691 recipe.MashStep[i].Resttime = 0; |
718 recipe.MashStep[i].Resttime = 0; |
692 |
719 |
693 EditUint16("Kook tijd in minuten", &recipe.BoilTime, 3, 480); |
720 EditUint16("Kook tijd in minuten", &recipe.BoilTime, 3, 480); |