diff -r 9fbdf8e0bd52 -r 34b1eb93e71a main/recipes.c --- a/main/recipes.c Wed Oct 24 23:17:41 2018 +0200 +++ b/main/recipes.c Thu Oct 25 17:36:02 2018 +0200 @@ -26,6 +26,8 @@ int _xml_add_time; ///< Mash rest time int _xml_add_ramp; ///< Mash ramp time float _xml_add_temp; ///< Mash temperature +float _xml_add_amount; ///< Mash infusion amount +float _xml_add_infusion; ///< Mash infusion temperature float _xml_tun_temp; ///< TUN temperature bool _xml_add_valid; ///< Add is valid @@ -214,12 +216,22 @@ } else if (strcmp("TYPE", _xml_element[5]) == 0) { // Temperature Infusion Decoction _xml_add_valid = (strcmp("Temperature", char_data_buffer) == 0); + if (strcmp("Infusion", char_data_buffer) == 0) + _xml_add_type = MASHTYPE_INFUSION; + else if (strcmp("Temperature", char_data_buffer) == 0) + _xml_add_type = MASHTYPE_TEMPERATURE; + else if (strcmp("Decoction", char_data_buffer) == 0) + _xml_add_type = MASHTYPE_DECOCTION; } else if (strcmp("STEP_TEMP", _xml_element[5]) == 0) { _xml_add_temp = atof(char_data_buffer); } else if (strcmp("STEP_TIME", _xml_element[5]) == 0) { _xml_add_time = atoi(char_data_buffer); } else if (strcmp("RAMP_TIME", _xml_element[5]) == 0) { _xml_add_ramp = atoi(char_data_buffer); + } else if (strcmp("INFUSE_AMOUNT", _xml_element[5]) == 0) { + _xml_add_amount = atof(char_data_buffer); + } else if (strcmp("INFUSE_TEMP", _xml_element[5]) == 0) { + _xml_add_infusion = atof(char_data_buffer); } } else if ((_xml_depth >= 4) && (strcmp("TUN_TEMP", _xml_element[3]) == 0)) { // Save this and check later if this is the strike temperature. @@ -278,9 +290,17 @@ // printf("Flush End MASH_STEP %d %s\n", _xml_depth, _xml_add_name); _xml_mashsteps++; sprintf(recipe.MashStep[_xml_mashsteps].Name, "%s", _xml_add_name); + recipe.MashStep[_xml_mashsteps].Type = _xml_add_type; recipe.MashStep[_xml_mashsteps].Temperature = _xml_add_temp; recipe.MashStep[_xml_mashsteps].Resttime = _xml_add_time; - recipe.MashStep[_xml_mashsteps].Steptime = _xml_add_ramp; + recipe.MashStep[_xml_mashsteps].Ramptime = _xml_add_ramp; + if (_xml_add_type == MASHTYPE_INFUSION) { + recipe.MashStep[_xml_mashsteps].Infusion_temp = _xml_add_infusion; + recipe.MashStep[_xml_mashsteps].Infusion_amount = _xml_add_amount; + } else { + recipe.MashStep[_xml_mashsteps].Infusion_temp = 0.0; + recipe.MashStep[_xml_mashsteps].Infusion_amount = 0.0; + } } _xml_depth--; } @@ -344,27 +364,34 @@ // Got it, move. sprintf(recipe.MashStep[7].Name, "%s", recipe.MashStep[i].Name); recipe.MashStep[i].Name[0] = '\0'; + recipe.MashStep[7].Type = recipe.MashStep[i].Type; + recipe.MashStep[i].Type = 0; recipe.MashStep[7].Temperature = recipe.MashStep[i].Temperature; recipe.MashStep[i].Temperature = 0.0; recipe.MashStep[7].Resttime = recipe.MashStep[i].Resttime; recipe.MashStep[i].Resttime = 0; - recipe.MashStep[7].Steptime = recipe.MashStep[i].Steptime; - recipe.MashStep[i].Steptime = 0; + recipe.MashStep[7].Ramptime = recipe.MashStep[i].Ramptime; + recipe.MashStep[i].Ramptime = 0; + recipe.MashStep[7].Infusion_temp = recipe.MashStep[i].Infusion_temp; + recipe.MashStep[i].Infusion_temp = 0.0; + recipe.MashStep[7].Infusion_amount = recipe.MashStep[i].Infusion_amount; + recipe.MashStep[i].Infusion_amount = 0.0; break; } } } -#if 0 +#if 1 printf("Recipe: %s\n", recipe.Name); printf("Code : %s\n", recipe.Code); printf("Boil time %d minutes\n", recipe.BoilTime); - printf("n Stepname temp time ramp\n"); - printf("- ------------------------------ ----- ---- ----\n"); + printf("n Stepname T temp time ramp inft infa\n"); + printf("- ------------------------------ - ----- ---- ---- ----- -----\n"); for (int i = 0; i < 8; i++) { if (recipe.MashStep[i].Resttime) { - printf("%d %-31s %5.2f %4d %4d\n", i, recipe.MashStep[i].Name, recipe.MashStep[i].Temperature, - recipe.MashStep[i].Resttime, recipe.MashStep[i].Steptime); + 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, + recipe.MashStep[i].Resttime, recipe.MashStep[i].Ramptime, + recipe.MashStep[i].Infusion_temp, recipe.MashStep[i].Infusion_amount); } } printf("%d additions\n", recipe.Additions); @@ -676,16 +703,16 @@ sprintf(tmp, "Maisch stap %d rusttijd in minuten", i); EditUint16(tmp, &recipe.MashStep[i].Resttime, 1, 480); if (i == 1) { - recipe.MashStep[i].Steptime = 1; + recipe.MashStep[i].Ramptime = 1; } else { - recipe.MashStep[i].Steptime = (int)(recipe.MashStep[i].Temperature - recipe.MashStep[i - 1].Temperature); + recipe.MashStep[i].Ramptime = (int)(recipe.MashStep[i].Temperature - recipe.MashStep[i - 1].Temperature); } } mintemp = recipe.MashStep[mashsteps].Temperature; EditFloat("Uitmaischen temperatuur", &recipe.MashStep[7].Temperature, mintemp, 80, 2); recipe.MashStep[7].Temperature = ((int)(recipe.MashStep[7].Temperature * 4)) / 4.0; EditUint16("Uitmaischen tijd in minuten", &recipe.MashStep[7].Resttime, 1, 15); - recipe.MashStep[7].Steptime = (int)(recipe.MashStep[7].Temperature - recipe.MashStep[mashsteps].Temperature); + recipe.MashStep[7].Ramptime = (int)(recipe.MashStep[7].Temperature - recipe.MashStep[mashsteps].Temperature); // Zero any higher steps to diable them. for (int i = (mashsteps + 1); i < 7; i++) recipe.MashStep[i].Resttime = 0;