50 void Addition_Add(char *Name, uint8_t Type, uint16_t Time) |
50 void Addition_Add(char *Name, uint8_t Type, uint16_t Time) |
51 { |
51 { |
52 if (! recipe.Additions) { |
52 if (! recipe.Additions) { |
53 // No entries yet, add the first one. |
53 // No entries yet, add the first one. |
54 snprintf(recipe.Addition[recipe.Additions].Name, 63, "%s", Name); |
54 snprintf(recipe.Addition[recipe.Additions].Name, 63, "%s", Name); |
55 // recipe.Addition[recipe.Additions].Name = ""; |
|
56 // strncat(recipe.Addition[recipe.Additions].Name, Name, 63); |
|
57 recipe.Addition[recipe.Additions].Type = Type; |
55 recipe.Addition[recipe.Additions].Type = Type; |
58 recipe.Addition[recipe.Additions].Time = Time; |
56 recipe.Addition[recipe.Additions].Time = Time; |
59 recipe.Additions++; |
57 recipe.Additions++; |
60 return; |
58 return; |
61 } |
59 } |
62 |
60 |
63 // See if we already got one with the same time. |
61 // See if we already got one with the same time. |
64 for (int i = 0; i < recipe.Additions; i++) { |
62 for (int i = 0; i < recipe.Additions; i++) { |
65 if (recipe.Addition[i].Time == Time) { |
63 if (recipe.Addition[i].Time == Time) { |
66 // Yes, update the name. |
64 // Yes, update the name. |
67 //snprintf(recipe.Addition[i].Name, 63, "%s, %s", recipe.Addition[i].Name, Name); |
|
68 strncat(recipe.Addition[i].Name, ", ", 63 - strlen(recipe.Addition[i].Name)); |
65 strncat(recipe.Addition[i].Name, ", ", 63 - strlen(recipe.Addition[i].Name)); |
69 strncat(recipe.Addition[i].Name, Name, 63 - strlen(recipe.Addition[i].Name)); |
66 strncat(recipe.Addition[i].Name, Name, 63 - strlen(recipe.Addition[i].Name)); |
70 return; |
67 return; |
71 } |
68 } |
72 } |
69 } |
221 if ((_xml_depth >= 6) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) { |
218 if ((_xml_depth >= 6) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) { |
222 if (strcmp("NAME", _xml_element[5]) == 0) { |
219 if (strcmp("NAME", _xml_element[5]) == 0) { |
223 _xml_add_name[0] = '\0'; |
220 _xml_add_name[0] = '\0'; |
224 strncat(_xml_add_name, char_data_buffer, 63); |
221 strncat(_xml_add_name, char_data_buffer, 63); |
225 } else if (strcmp("TYPE", _xml_element[5]) == 0) { |
222 } else if (strcmp("TYPE", _xml_element[5]) == 0) { |
226 // Temperature Infusion Decoction |
223 // Step_temp Infusion Decoction |
227 _xml_add_valid = (strcmp("Temperature", char_data_buffer) == 0); |
224 _xml_add_valid = (strcmp("Step_temp", char_data_buffer) == 0); |
228 if (strcmp("Infusion", char_data_buffer) == 0) |
225 if (strcmp("Infusion", char_data_buffer) == 0) |
229 _xml_add_type = MASHTYPE_INFUSION; |
226 _xml_add_type = MASHTYPE_INFUSION; |
230 else if (strcmp("Temperature", char_data_buffer) == 0) |
227 else if (strcmp("Temperature", char_data_buffer) == 0) |
231 _xml_add_type = MASHTYPE_TEMPERATURE; |
228 _xml_add_type = MASHTYPE_TEMPERATURE; |
232 else if (strcmp("Decoction", char_data_buffer) == 0) |
229 else if (strcmp("Decoction", char_data_buffer) == 0) |
294 if (_xml_add_valid) { |
295 if (_xml_add_valid) { |
295 Addition_Add(_xml_add_name, _xml_add_type, _xml_add_time); |
296 Addition_Add(_xml_add_name, _xml_add_type, _xml_add_time); |
296 } |
297 } |
297 } |
298 } |
298 if ((_xml_depth == 5) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) { |
299 if ((_xml_depth == 5) && (strcmp("MASH_STEP", _xml_element[4]) == 0)) { |
299 _xml_mashsteps++; |
300 recipe.MashStep[recipe.Mashsteps].Name[0] = '\0'; |
300 recipe.MashStep[_xml_mashsteps].Name[0] = '\0'; |
301 strncat(recipe.MashStep[recipe.Mashsteps].Name, _xml_add_name, 31); |
301 strncat(recipe.MashStep[_xml_mashsteps].Name, _xml_add_name, 31); |
302 recipe.MashStep[recipe.Mashsteps].Type = _xml_add_type; |
302 recipe.MashStep[_xml_mashsteps].Type = _xml_add_type; |
303 recipe.MashStep[recipe.Mashsteps].Step_temp = _xml_add_temp; |
303 recipe.MashStep[_xml_mashsteps].Temperature = _xml_add_temp; |
304 recipe.MashStep[recipe.Mashsteps].Step_time = _xml_add_time; |
304 recipe.MashStep[_xml_mashsteps].Resttime = _xml_add_time; |
305 recipe.MashStep[recipe.Mashsteps].Ramp_time = _xml_add_ramp; |
305 recipe.MashStep[_xml_mashsteps].Ramptime = _xml_add_ramp; |
306 recipe.MashStep[recipe.Mashsteps].End_temp = _xml_add_end; |
306 if (_xml_add_type == MASHTYPE_INFUSION) { |
307 if (_xml_add_type == MASHTYPE_INFUSION) { |
307 recipe.MashStep[_xml_mashsteps].Infusion_temp = _xml_add_infusion; |
308 recipe.MashStep[recipe.Mashsteps].Infuse_temp = _xml_add_infusion; |
308 recipe.MashStep[_xml_mashsteps].Infusion_amount = _xml_add_amount; |
309 recipe.MashStep[recipe.Mashsteps].Infuse_amount = _xml_add_amount; |
|
310 } else if (_xml_add_type == MASHTYPE_DECOCTION) { |
|
311 recipe.MashStep[recipe.Mashsteps].Infuse_temp = 0.0; |
|
312 recipe.MashStep[recipe.Mashsteps].Infuse_amount = _xml_add_amount; |
309 } else { |
313 } else { |
310 recipe.MashStep[_xml_mashsteps].Infusion_temp = 0.0; |
314 recipe.MashStep[recipe.Mashsteps].Infuse_temp = 0.0; |
311 recipe.MashStep[_xml_mashsteps].Infusion_amount = 0.0; |
315 recipe.MashStep[recipe.Mashsteps].Infuse_amount = 0.0; |
312 } |
316 } |
|
317 recipe.Mashsteps++; |
313 } |
318 } |
314 _xml_depth--; |
319 _xml_depth--; |
315 } |
320 } |
316 |
321 |
317 |
322 |
318 |
323 |
319 int ParseRecipe(char *fn, char *code) |
324 int ParseRecipe(char *fn, char *code) |
320 { |
325 { |
321 char buf[512]; |
326 char buf[512]; |
322 |
327 |
323 memset(&recipe, 0, sizeof(recipe)); |
328 memset(&recipe, 0, recipe_hdr.recsize); |
|
329 for (int i = 0; i < recipe_hdr.mashmax; i++) |
|
330 recipe.MashStep[i].Type = 255; |
324 XML_Parser parser = XML_ParserCreate(NULL); |
331 XML_Parser parser = XML_ParserCreate(NULL); |
325 |
332 |
326 int done; |
333 int done; |
327 _xml_depth = 0; |
334 _xml_depth = 0; |
328 _xml_mashsteps = 0; |
|
329 _xml_tun_temp = 0.0; |
335 _xml_tun_temp = 0.0; |
330 |
336 |
331 XML_SetElementHandler(parser, startElement, endElement); |
337 XML_SetElementHandler(parser, startElement, endElement); |
332 XML_SetCharacterDataHandler(parser, char_data); |
338 XML_SetCharacterDataHandler(parser, char_data); |
333 |
339 |
356 recipe.Code[i] = '\0'; |
362 recipe.Code[i] = '\0'; |
357 break; |
363 break; |
358 } |
364 } |
359 } |
365 } |
360 recipe.CoolTemp = 20.0; |
366 recipe.CoolTemp = 20.0; |
361 sprintf(recipe.MashStep[0].Name, "Mash-in"); |
|
362 if ((recipe.MashStep[1].Type == MASHTYPE_INFUSION) && (recipe.MashStep[1].Infusion_temp > 0.0)) { |
|
363 /* If next (first original) step is infusion, take that temperature. */ |
|
364 recipe.MashStep[0].Temperature = recipe.MashStep[1].Infusion_temp; |
|
365 } else if (_xml_tun_temp > recipe.MashStep[1].Temperature) { |
|
366 recipe.MashStep[0].Temperature = _xml_tun_temp; |
|
367 } else { |
|
368 recipe.MashStep[0].Temperature = recipe.MashStep[1].Temperature + 1.25; |
|
369 } |
|
370 recipe.MashStep[0].Resttime = recipe.MashStep[0].Ramptime = 1; |
|
371 recipe.MashStep[0].Type = MASHTYPE_INFUSION; |
|
372 /* |
|
373 * Because we inserted the first infusion step and the next (original first) |
|
374 * step is infusion, change that one into temperature. |
|
375 */ |
|
376 if (recipe.MashStep[1].Type == MASHTYPE_INFUSION) { |
|
377 recipe.MashStep[1].Type = MASHTYPE_TEMPERATURE; |
|
378 recipe.MashStep[1].Infusion_temp = recipe.MashStep[1].Infusion_amount = 0.0; |
|
379 } |
|
380 |
|
381 if (! recipe.MashStep[7].Resttime) { |
|
382 // Move last mash step to position 7. |
|
383 for (int i = 6; i > 1; i--) { |
|
384 if (recipe.MashStep[i].Resttime) { |
|
385 // Got it, move. |
|
386 sprintf(recipe.MashStep[7].Name, "%s", recipe.MashStep[i].Name); |
|
387 recipe.MashStep[i].Name[0] = '\0'; |
|
388 recipe.MashStep[7].Type = recipe.MashStep[i].Type; |
|
389 recipe.MashStep[i].Type = 0; |
|
390 recipe.MashStep[7].Temperature = recipe.MashStep[i].Temperature; |
|
391 recipe.MashStep[i].Temperature = 0.0; |
|
392 recipe.MashStep[7].Resttime = recipe.MashStep[i].Resttime; |
|
393 recipe.MashStep[i].Resttime = 0; |
|
394 recipe.MashStep[7].Ramptime = recipe.MashStep[i].Ramptime; |
|
395 recipe.MashStep[i].Ramptime = 0; |
|
396 recipe.MashStep[7].Infusion_temp = recipe.MashStep[i].Infusion_temp; |
|
397 recipe.MashStep[i].Infusion_temp = 0.0; |
|
398 recipe.MashStep[7].Infusion_amount = recipe.MashStep[i].Infusion_amount; |
|
399 recipe.MashStep[i].Infusion_amount = 0.0; |
|
400 break; |
|
401 } |
|
402 } |
|
403 } |
|
404 |
367 |
405 #if 0 |
368 #if 0 |
406 printf("Recipe: %s\n", recipe.Name); |
369 printf("Recipe: %s\n", recipe.Name); |
407 printf("Code : %s\n", recipe.Code); |
370 printf("Code : %s\n", recipe.Code); |
408 printf("Boil time %d minutes\n", recipe.BoilTime); |
371 printf("Boil time %d minutes\n", recipe.BoilTime); |
409 printf("n Stepname T temp time ramp inft infa\n"); |
372 printf("n Stepname T temp time ramp inft infa\n"); |
410 printf("- ------------------------------ - ----- ---- ---- ----- -----\n"); |
373 printf("- ------------------------------ - ----- ---- ---- ----- -----\n"); |
411 for (int i = 0; i < 8; i++) { |
374 for (int i = 0; i < 8; i++) { |
412 if (recipe.MashStep[i].Resttime) { |
375 if (recipe.MashStep[i].Step_time) { |
413 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, |
376 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, |
414 recipe.MashStep[i].Resttime, recipe.MashStep[i].Ramptime, |
377 recipe.MashStep[i].Step_time, recipe.MashStep[i].Ramp_time, |
415 recipe.MashStep[i].Infusion_temp, recipe.MashStep[i].Infusion_amount); |
378 recipe.MashStep[i].Infuse_temp, recipe.MashStep[i].Infuse_amount); |
416 } |
379 } |
417 } |
380 } |
418 printf("%d additions\n", recipe.Additions); |
381 printf("%d additions\n", recipe.Additions); |
419 printf("n Addition name t Tim\n"); |
382 printf("n Addition name t Tim\n"); |
420 printf("- --------------------------------------------------------------- - ---\n"); |
383 printf("- --------------------------------------------------------------- - ---\n"); |
546 ShowText(2, 28, (char *)"Naam", recipe.Name); |
510 ShowText(2, 28, (char *)"Naam", recipe.Name); |
547 ShowText(2, 44, (char *)"Code", recipe.Code); |
511 ShowText(2, 44, (char *)"Code", recipe.Code); |
548 ShowInteger(162, 44, (char *)"Record", NULL, r_CurrentRec); |
512 ShowInteger(162, 44, (char *)"Record", NULL, r_CurrentRec); |
549 ShowInteger(2, 60, (char *)"Kooktijd", (char *)" min", recipe.BoilTime); |
513 ShowInteger(2, 60, (char *)"Kooktijd", (char *)" min", recipe.BoilTime); |
550 ShowFloat(162, 60, (char *)"Koel tot", (char *)" C", recipe.CoolTemp, 2); |
514 ShowFloat(162, 60, (char *)"Koel tot", (char *)" C", recipe.CoolTemp, 2); |
551 ShowFloat(2, 76, (char *)"Maisch in", (char *)" C", recipe.MashStep[0].Temperature, 2); |
515 ShowFloat(2, 76, (char *)"Maisch in", (char *)" C", recipe.MashStep[0].Infuse_temp, 3); |
552 ShowFloat(162, 76, (char *)"Spoelwater", (char *)" C", recipe.SpargeTemp, 2); |
516 ShowFloat(162, 76, (char *)"Spoelwater", (char *)" C", recipe.SpargeTemp, 2); |
553 y = 92; |
517 y = 92; |
554 _fg = TFT_WHITE; |
518 _fg = TFT_WHITE; |
555 TFT_print((char *)"Maisch stap", 2, y); |
519 TFT_print((char *)"Maisch stap", 2, y); |
556 TFT_print((char *)"T", 200, y); |
520 TFT_print((char *)"T", 180, y); |
557 TFT_print((char *)"Temp.", 220, y); |
521 TFT_print((char *)"Temp.", 200, y); |
558 TFT_print((char *)"Rust", 280, y); |
522 TFT_print((char *)"Rust", 280, y); |
559 _fg = TFT_YELLOW; |
523 _fg = TFT_YELLOW; |
560 y += 16; |
524 y += 16; |
561 for (int i = 1; i < 8; i++) { |
525 for (i = 0; i < recipe_hdr.mashmax; i++) { |
562 if (recipe.MashStep[i].Resttime) { |
526 ESP_LOGI(TAG, "%2d %-31s %3d %5.2f %5.2f %2d %2d %7.4f %6.3f", i, recipe.MashStep[i].Name, recipe.MashStep[i].Type, |
|
527 recipe.MashStep[i].Step_temp, recipe.MashStep[i].End_temp, recipe.MashStep[i].Step_time, recipe.MashStep[i].Ramp_time, |
|
528 recipe.MashStep[i].Infuse_temp, recipe.MashStep[i].Infuse_amount); |
|
529 if (recipe.MashStep[i].Type != 255) { |
563 TFT_print(recipe.MashStep[i].Name, 2, y); |
530 TFT_print(recipe.MashStep[i].Name, 2, y); |
564 strcpy(tmp, mashTypes[recipe.MashStep[i].Type]); |
531 strcpy(tmp, mashTypes[recipe.MashStep[i].Type]); |
565 tmp[1] = '\0'; |
532 tmp[1] = '\0'; |
|
533 TFT_print(tmp, 180, y); |
|
534 sprintf(tmp, "%.1f %.1f", recipe.MashStep[i].Step_temp, recipe.MashStep[i].End_temp); |
566 TFT_print(tmp, 200, y); |
535 TFT_print(tmp, 200, y); |
567 sprintf(tmp, "%.2f", recipe.MashStep[i].Temperature); |
536 sprintf(tmp, "%2d m", recipe.MashStep[i].Step_time); |
568 TFT_print(tmp, 220, y); |
|
569 sprintf(tmp, "%2d m", recipe.MashStep[i].Resttime); |
|
570 TFT_print(tmp, 280, y); |
537 TFT_print(tmp, 280, y); |
571 y += 16; |
538 y += 16; |
572 } |
539 } |
573 } |
540 } |
574 if (recipe.BoilTime) { |
541 if (recipe.BoilTime) { |
630 } /* if (r_UpdateRec) */ |
597 } /* if (r_UpdateRec) */ |
631 switch (Buttons_Scan()) { |
598 switch (Buttons_Scan()) { |
632 case 0: Main_Screen = MAIN_TOOLS; |
599 case 0: Main_Screen = MAIN_TOOLS; |
633 break; |
600 break; |
634 |
601 |
635 case 1: memset(&recipe, 0, sizeof(recipe)); |
602 case 1: memset(&recipe, 0, sizeof(recipe)); // new recipe |
636 recipe.Version = 1; |
603 for (i = 1; i < recipe_hdr.mashmax; i++) |
637 for (int i = 1; i < 8; i++) |
604 recipe.MashStep[i].Type = 255; |
638 recipe.MashStep[i].Type = MASHTYPE_TEMPERATURE; |
605 sprintf(recipe.Name, "Recept %d", r_Records + 1); |
639 sprintf(recipe.Name, "Recipe %d", r_Records + 1); |
|
640 sprintf(recipe.Code, "00%d", r_Records + 1); |
606 sprintf(recipe.Code, "00%d", r_Records + 1); |
641 sprintf(recipe.MashStep[0].Name, "Mash-in"); |
607 sprintf(recipe.MashStep[0].Name, "Maischen"); |
642 recipe.MashStep[0].Type = MASHTYPE_INFUSION; |
608 recipe.MashStep[0].Type = MASHTYPE_INFUSION; |
643 recipe.MashStep[0].Temperature = recipe.MashStep[0].Infusion_temp = 67.5; |
609 recipe.MashStep[0].Step_temp = recipe.MashStep[0].End_temp = 67.0; |
644 recipe.MashStep[0].Infusion_amount = 15.0; |
610 recipe.MashStep[0].Infuse_temp = 67.5; |
645 recipe.MashStep[0].Resttime = 1; |
611 recipe.MashStep[0].Infuse_amount = 15.0; |
646 recipe.MashStep[0].Ramptime = 1; |
612 recipe.MashStep[0].Step_time = 75; |
647 sprintf(recipe.MashStep[1].Name, "Mash"); |
613 recipe.MashStep[0].Ramp_time = 1; |
648 recipe.MashStep[1].Temperature = 67.0; |
614 sprintf(recipe.MashStep[1].Name, "Mash-out"); |
649 recipe.MashStep[1].Resttime = 75; |
615 recipe.MashStep[1].Type = MASHTYPE_TEMPERATURE; |
650 recipe.MashStep[1].Ramptime = 1; |
616 recipe.MashStep[1].Step_temp = recipe.MashStep[1].End_temp = 78.0; |
651 sprintf(recipe.MashStep[7].Name, "Mash-out"); |
617 recipe.MashStep[1].Step_time = 10; |
652 recipe.MashStep[7].Temperature = 78.0; |
618 recipe.MashStep[1].Ramp_time = 13; |
653 recipe.MashStep[7].Resttime = 5; |
619 recipe.Mashsteps = 2; |
654 recipe.MashStep[7].Ramptime = 11; |
|
655 recipe.BoilTime = 60; |
620 recipe.BoilTime = 60; |
656 recipe.Additions = 2; |
621 recipe.Additions = 2; |
657 sprintf(recipe.Addition[0].Name, "Bitterhop"); |
622 sprintf(recipe.Addition[0].Name, "Bitterhop"); |
658 recipe.Addition[0].Time = 60; |
623 recipe.Addition[0].Time = 60; |
659 recipe.Addition[0].Type = ADDITION_HOP; |
624 recipe.Addition[0].Type = ADDITION_HOP; |
713 dst = (uint8_t*)&recipe; |
682 dst = (uint8_t*)&recipe; |
714 crc1 = crc32_le(0, dst, sizeof(recipe)); |
683 crc1 = crc32_le(0, dst, sizeof(recipe)); |
715 |
684 |
716 EditText((char *)"Naam", recipe.Name, 31); |
685 EditText((char *)"Naam", recipe.Name, 31); |
717 EditText((char *)"Code", recipe.Code, 31); |
686 EditText((char *)"Code", recipe.Code, 31); |
718 mashsteps = 0; |
687 EditUint8((char *)"Maisch stappen", &recipe.Mashsteps, 1, 6); |
719 for (int i = 1; i < 7; i++) { |
688 for (i = 0; i < recipe.Mashsteps; i++) { |
720 if (recipe.MashStep[i].Resttime) |
689 int step = i + 1; |
721 mashsteps++; |
690 if (i == (recipe.Mashsteps - 1)) { |
722 } |
691 mintemp = 75.0; |
723 EditInt((char *)"Maisch stappen", &mashsteps, 1, 6); |
692 maxtemp = 80.0; |
724 EditFloat((char *)"Inmaisch temperatuur", &recipe.MashStep[0].Temperature, 38, 74, 2); |
693 } else { |
725 // Round to 0.0625 values |
694 mintemp = 35.0; |
726 recipe.MashStep[0].Temperature = ((int)(recipe.MashStep[0].Temperature * 16)) / 16.0; |
695 maxtemp = 74.0; |
727 for (int i = 1; i <= mashsteps; i++) { |
696 } |
728 sprintf(tmp, "Maisch stap %d naam", i); |
697 if (recipe.MashStep[i].Type == 255) { |
|
698 // A new step, set default values. |
|
699 recipe.MashStep[i].Type = MASHTYPE_TEMPERATURE; |
|
700 recipe.MashStep[i].Step_time = 20; |
|
701 if (i == 0) { |
|
702 recipe.MashStep[i].Type = MASHTYPE_INFUSION; |
|
703 recipe.MashStep[i].Step_temp = recipe.MashStep[i].End_temp = 62.0; |
|
704 recipe.MashStep[i].Infuse_temp = 62.5; |
|
705 recipe.MashStep[i].Infuse_amount = 15; |
|
706 recipe.MashStep[i].Ramp_time = 1; |
|
707 } else if (i == (recipe.Mashsteps - 1)) { |
|
708 recipe.MashStep[i].Step_temp = recipe.MashStep[i].End_temp = 78.0; |
|
709 recipe.MashStep[i].Step_time = 10; |
|
710 recipe.MashStep[i].Ramp_time = (int)(recipe.MashStep[i].Step_temp - recipe.MashStep[i - 1].Step_temp + 2); |
|
711 } else { |
|
712 recipe.MashStep[i].Step_temp = recipe.MashStep[i].End_temp = recipe.MashStep[i - 1].Step_temp + 2.0; |
|
713 recipe.MashStep[i].Ramp_time = (int)(recipe.MashStep[i].Step_temp - recipe.MashStep[i - 1].Step_temp + 2); |
|
714 } |
|
715 } |
|
716 sprintf(tmp, "Maisch stap %d naam", step); |
729 EditText(tmp, recipe.MashStep[i].Name, 31); |
717 EditText(tmp, recipe.MashStep[i].Name, 31); |
730 EditMashType(&recipe.MashStep[i].Type); |
718 EditMashType(&recipe.MashStep[i].Type); |
731 sprintf(tmp, "Maisch stap %d temperatuur", i); |
719 sprintf(tmp, "Maisch stap %d start temperatuur", step); |
732 if (i == 1) |
720 EditFloat(tmp, &recipe.MashStep[i].Step_temp, mintemp, maxtemp, 2); |
733 mintemp = recipe.MashStep[0].Temperature - 5; |
|
734 else |
|
735 mintemp = recipe.MashStep[i - 1].Temperature; |
|
736 EditFloat(tmp, &recipe.MashStep[i].Temperature, mintemp, 74, 2); |
|
737 // Round to 0.25 values |
721 // Round to 0.25 values |
738 recipe.MashStep[i].Temperature = ((int)(recipe.MashStep[i].Temperature * 4)) / 4.0; |
722 recipe.MashStep[i].Step_temp = ((int)(recipe.MashStep[i].Step_temp * 4)) / 4.0; |
739 sprintf(tmp, "Maisch stap %d rusttijd in minuten", i); |
723 sprintf(tmp, "Maisch stap %d eind temperatuur", step); |
740 EditUint16(tmp, &recipe.MashStep[i].Resttime, 1, 480); |
724 EditFloat(tmp, &recipe.MashStep[i].End_temp, mintemp, maxtemp, 2); |
741 if (i == 1) { |
725 recipe.MashStep[i].End_temp = ((int)(recipe.MashStep[i].End_temp * 4)) / 4.0; |
742 recipe.MashStep[i].Ramptime = 1; |
726 sprintf(tmp, "Maisch stap %d rusttijd in minuten", step); |
|
727 EditUint16(tmp, &recipe.MashStep[i].Step_time, 1, 480); |
|
728 if (recipe.MashStep[i].Type == MASHTYPE_INFUSION) { |
|
729 sprintf(tmp, "Stap %d infusie temperatuur", step); |
|
730 EditFloat(tmp, &recipe.MashStep[i].Infuse_temp, 10, 99, 3); |
|
731 recipe.MashStep[i].Infuse_temp = ((int)(recipe.MashStep[i].Infuse_temp * 16)) / 16.0; |
|
732 sprintf(tmp, "Stap %d infusie volume", step); |
|
733 EditFloat(tmp, &recipe.MashStep[i].Infuse_amount, 0.5, 1000.0, 3); |
|
734 recipe.MashStep[i].Ramp_time = 2; |
|
735 } else if (recipe.MashStep[i].Type == MASHTYPE_DECOCTION) { |
|
736 recipe.MashStep[i].Infuse_temp = 0.0; |
|
737 recipe.MashStep[i].Ramp_time = 2; |
|
738 sprintf(tmp, "Stap %d decoctie volume", step); |
|
739 EditFloat(tmp, &recipe.MashStep[i].Infuse_amount, 0.5, 1000.0, 3); |
743 } else { |
740 } else { |
744 recipe.MashStep[i].Ramptime = (int)(recipe.MashStep[i].Temperature - recipe.MashStep[i - 1].Temperature); |
741 recipe.MashStep[i].Infuse_temp = recipe.MashStep[i].Infuse_amount = 0.0; |
745 } |
742 sprintf(tmp, "Stap %d opwarm tijd", step); |
746 if (recipe.MashStep[i].Type == MASHTYPE_INFUSION) { |
743 EditUint16(tmp, &recipe.MashStep[i].Ramp_time, 1, 480); |
747 sprintf(tmp, "Stap %d infusie temperatuur", i); |
|
748 mintemp = recipe.MashStep[i].Temperature; |
|
749 EditFloat(tmp, &recipe.MashStep[i].Infusion_temp, mintemp, 100, 2); |
|
750 sprintf(tmp, "Stap %d infusie volume", i); |
|
751 EditFloat(tmp, &recipe.MashStep[i].Infusion_amount, 0.5, 1000.0, 2); |
|
752 } else { |
|
753 recipe.MashStep[i].Infusion_temp = recipe.MashStep[i].Infusion_amount = 0.0; |
|
754 } |
744 } |
755 } |
745 } |
756 mintemp = recipe.MashStep[mashsteps].Temperature; |
746 for (i = recipe.Mashsteps; i < recipe_hdr.mashmax; i++) { |
757 EditFloat((char *)"Uitmaischen temperatuur", &recipe.MashStep[7].Temperature, mintemp, 80, 2); |
747 recipe.MashStep[i].Type = 255; |
758 recipe.MashStep[7].Temperature = ((int)(recipe.MashStep[7].Temperature * 4)) / 4.0; |
748 recipe.MashStep[i].Step_temp = recipe.MashStep[i].End_temp = recipe.MashStep[i].Infuse_temp = recipe.MashStep[i].Infuse_amount = 0.0; |
759 EditUint16((char *)"Uitmaischen tijd in minuten", &recipe.MashStep[7].Resttime, 1, 15); |
749 recipe.MashStep[i].Step_time = recipe.MashStep[i].Ramp_time = 0; |
760 recipe.MashStep[7].Ramptime = (int)(recipe.MashStep[7].Temperature - recipe.MashStep[mashsteps].Temperature); |
750 recipe.MashStep[i].Name[0] = '\0'; |
761 // Zero any higher steps to diable them. |
751 } |
762 for (int i = (mashsteps + 1); i < 7; i++) |
|
763 recipe.MashStep[i].Resttime = 0; |
|
764 |
752 |
765 EditUint16((char *)"Kook tijd in minuten", &recipe.BoilTime, 0, 480); |
753 EditUint16((char *)"Kook tijd in minuten", &recipe.BoilTime, 0, 480); |
766 if (recipe.BoilTime) { |
754 if (recipe.BoilTime) { |
767 EditUint8((char *)"Hop/kruiden toevoegingen", &recipe.Additions, 1, 10); |
755 EditUint8((char *)"Hop/kruiden toevoegingen", &recipe.Additions, 1, 10); |
768 for (uint8_t i = 0; i < recipe.Additions; i++) { |
756 for (uint8_t i = 0; i < recipe.Additions; i++) { |