253 xSemaphoreGive(xSemaphoreDriver); |
253 xSemaphoreGive(xSemaphoreDriver); |
254 } |
254 } |
255 SoundPlay(SOUND_TempReached); |
255 SoundPlay(SOUND_TempReached); |
256 BoilPower = equipment.BoilPower; |
256 BoilPower = equipment.BoilPower; |
257 updateRuntime = true; |
257 updateRuntime = true; |
258 TopMessage("Koken"); |
258 TopMessage((char *)"Koken"); |
259 MLT_info(71, 26, false); |
259 MLT_info(71, 26, false); |
260 Buttons_Add( 3, 30, 60, 40, "+sp", 0); |
260 Buttons_Add( 3, 30, 60, 40, (char *)"+sp", 0); |
261 Buttons_Add(257, 30, 60, 40, "-sp", 1); |
261 Buttons_Add(257, 30, 60, 40, (char *)"-sp", 1); |
262 Buttons_Add( 3, 190, 60, 40, "+1m", 2); |
262 Buttons_Add( 3, 190, 60, 40, (char *)"+1m", 2); |
263 Buttons_Add(257, 190, 60, 40, "-1m", 3); |
263 Buttons_Add(257, 190, 60, 40, (char *)"-1m", 3); |
264 Buttons_Show(); |
264 Buttons_Show(); |
265 ESP_LOGI(TAG, "Boil temperature reached, boil %d minutes", (TimeLeft / 60) -1); |
265 ESP_LOGI(TAG, "Boil temperature reached, boil %d minutes", (TimeLeft / 60) -1); |
266 log_annotation(ANNOTATION_STAGE, "Koken"); |
266 log_annotation(ANNOTATION_STAGE, (char *)"Koken"); |
267 Sub_Screen = 0; |
267 Sub_Screen = 0; |
268 break; |
268 break; |
269 |
269 |
270 case MAIN_AUTO_COOLING_H: |
270 case MAIN_AUTO_COOLING_H: |
271 case MAIN_AUTO_COOLING_M: |
271 case MAIN_AUTO_COOLING_M: |
393 */ |
393 */ |
394 Sub_Screen = 1; |
394 Sub_Screen = 1; |
395 read_recipe(config.RecipeRec); |
395 read_recipe(config.RecipeRec); |
396 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\",\"brew1\":\"%s\",\"brew2\":\"%s\"}", |
396 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\",\"brew1\":\"%s\",\"brew2\":\"%s\"}", |
397 Main_Screen, Sub_Screen, equipment.Name, recipe.Name); |
397 Main_Screen, Sub_Screen, equipment.Name, recipe.Name); |
398 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
398 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
399 y = 28; |
399 y = 28; |
400 TopMessage("Automaat"); |
400 TopMessage((char *)"Automaat"); |
401 TFT_setFont(DEFAULT_FONT, NULL); |
401 TFT_setFont(DEFAULT_FONT, NULL); |
402 ShowText(2,y,"Installatie", equipment.Name); |
402 ShowText(2,y,(char *)"Installatie", equipment.Name); |
403 y += 16; |
403 y += 16; |
404 ShowText(2,y,"Recept", recipe.Name); |
404 ShowText(2,y,(char *)"Recept", recipe.Name); |
405 y += 16; |
405 y += 16; |
406 ShowFloat(2, y, "Maisch in", " C", recipe.MashStep[0].Temperature, 2); |
406 ShowFloat(2, y, (char *)"Maisch in", (char *)" C", recipe.MashStep[0].Temperature, 2); |
407 ShowFloat(162, y, "Spoelwater", " C", recipe.SpargeTemp, 2); |
407 ShowFloat(162, y, (char *)"Spoelwater", (char *)" C", recipe.SpargeTemp, 2); |
408 y += 16; |
408 y += 16; |
409 _fg = TFT_WHITE; |
409 _fg = TFT_WHITE; |
410 TFT_print("Maisch stap", 2, y); |
410 TFT_print((char *)"Maisch stap", 2, y); |
411 TFT_print("T", 200, y); |
411 TFT_print((char *)"T", 200, y); |
412 TFT_print("Temp.", 220, y); |
412 TFT_print((char *)"Temp.", 220, y); |
413 TFT_print("Rust", 280, y); |
413 TFT_print((char *)"Rust", 280, y); |
414 _fg = TFT_YELLOW; |
414 _fg = TFT_YELLOW; |
415 y += 16; |
415 y += 16; |
416 for (int i = 1; i < 8; i++) { |
416 for (int i = 1; i < 8; i++) { |
417 if (recipe.MashStep[i].Resttime) { |
417 if (recipe.MashStep[i].Resttime) { |
418 TFT_print(recipe.MashStep[i].Name, 2, y); |
418 TFT_print(recipe.MashStep[i].Name, 2, y); |
424 sprintf(tmp, "%2d m", recipe.MashStep[i].Resttime); |
424 sprintf(tmp, "%2d m", recipe.MashStep[i].Resttime); |
425 TFT_print(tmp, 280, y); |
425 TFT_print(tmp, 280, y); |
426 y += 16; |
426 y += 16; |
427 } |
427 } |
428 } |
428 } |
429 ShowInteger(2, y, "Kooktijd", " min", recipe.BoilTime); |
429 ShowInteger(2, y, (char *)"Kooktijd", (char *)" min", recipe.BoilTime); |
430 ShowFloat(162, y, "Koel tot", " C", recipe.CoolTemp, 2); |
430 ShowFloat(162, y, (char *)"Koel tot", (char *)" C", recipe.CoolTemp, 2); |
431 y += 16; |
431 y += 16; |
432 if (recipe.Additions) { |
432 if (recipe.Additions) { |
433 _fg = TFT_YELLOW; |
433 _fg = TFT_YELLOW; |
434 sprintf(tmp, "%d ", recipe.Additions); |
434 sprintf(tmp, "%d ", recipe.Additions); |
435 TFT_print(tmp, 2, y); |
435 TFT_print(tmp, 2, y); |
436 _fg = TFT_WHITE; |
436 _fg = TFT_WHITE; |
437 TFT_print("toevoegingen om", LASTX, y); |
437 TFT_print((char *)"toevoegingen om", LASTX, y); |
438 _fg = TFT_YELLOW; |
438 _fg = TFT_YELLOW; |
439 for (int i = 1; i <= recipe.Additions; i++) { |
439 for (int i = 1; i <= recipe.Additions; i++) { |
440 sprintf(tmp, " %d", recipe.Addition[i-1].Time); |
440 sprintf(tmp, " %d", recipe.Addition[i-1].Time); |
441 TFT_print(tmp, LASTX, y); |
441 TFT_print(tmp, LASTX, y); |
442 } |
442 } |
443 _fg = TFT_WHITE; |
443 _fg = TFT_WHITE; |
444 TFT_print(" minuten", LASTX, y); |
444 TFT_print((char *)" minuten", LASTX, y); |
445 } else { |
445 } else { |
446 _fg = TFT_WHITE; |
446 _fg = TFT_WHITE; |
447 TFT_print("Geen hop toevoegingen.", 2, y); |
447 TFT_print((char *)"Geen hop toevoegingen.", 2, y); |
448 } |
448 } |
449 y += 16; |
449 y += 16; |
450 if (recipe.Whirlpool9) { |
450 if (recipe.Whirlpool9) { |
451 ShowInteger(2, y, "Whirlpool 88..100 graden", " minuten", recipe.Whirlpool9); |
451 ShowInteger(2, y, (char *)"Whirlpool 88..100 graden", (char *)" minuten", recipe.Whirlpool9); |
452 y += 16; |
452 y += 16; |
453 } |
453 } |
454 if (recipe.Whirlpool7) { |
454 if (recipe.Whirlpool7) { |
455 ShowInteger(2, y, "Whirlpool 71..77 graden", " minuten", recipe.Whirlpool7); |
455 ShowInteger(2, y, (char *)"Whirlpool 71..77 graden", (char *)" minuten", recipe.Whirlpool7); |
456 y += 16; |
456 y += 16; |
457 } |
457 } |
458 if (recipe.Whirlpool6) { |
458 if (recipe.Whirlpool6) { |
459 ShowInteger(2, y, "Whirlpool 60..66 graden", " minuten", recipe.Whirlpool6); |
459 ShowInteger(2, y, (char *)"Whirlpool 60..66 graden", (char *)" minuten", recipe.Whirlpool6); |
460 y += 16; |
460 y += 16; |
461 } |
461 } |
462 if (recipe.Whirlpool2) { |
462 if (recipe.Whirlpool2) { |
463 ShowInteger(2, y, "Whirlpool koud", " minuten", recipe.Whirlpool2); |
463 ShowInteger(2, y, (char *)"Whirlpool koud", (char *)" minuten", recipe.Whirlpool2); |
464 y += 16; |
464 y += 16; |
465 } |
465 } |
466 Buttons_Add( 0, 210, 70, 30, "Stop" , 0); |
466 Buttons_Add( 0, 210, 70, 30, (char *)"Stop" , 0); |
467 Buttons_Add(250, 210, 70, 30, "Start" , 1); |
467 Buttons_Add(250, 210, 70, 30, (char *)"Start" , 1); |
468 Buttons[0].dark = true; |
468 Buttons[0].dark = true; |
469 Buttons_Show(); |
469 Buttons_Show(); |
470 loop = true; |
470 loop = true; |
471 while (loop) { |
471 while (loop) { |
472 switch (Buttons_Scan()) { |
472 switch (Buttons_Scan()) { |
613 driver_state->mlt_mode = MLT_MODE_PID; |
613 driver_state->mlt_mode = MLT_MODE_PID; |
614 xSemaphoreGive(xSemaphoreDriver); |
614 xSemaphoreGive(xSemaphoreDriver); |
615 } |
615 } |
616 MashState = Sub_Screen = MASH_WAITTEMP; |
616 MashState = Sub_Screen = MASH_WAITTEMP; |
617 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
617 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
618 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
618 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
619 ESP_LOGI(TAG, "Mash step %d type: %s time: %d temp: %4.1f min: %4.1f max: %4.1f", |
619 ESP_LOGI(TAG, "Mash step %d type: %s time: %d temp: %4.1f min: %4.1f max: %4.1f", |
620 Main_Screen - MAIN_AUTO_MASH_IN, mashTypes[recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Type], |
620 Main_Screen - MAIN_AUTO_MASH_IN, mashTypes[recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Type], |
621 stageTime, stageTemp, MinMash, MaxMash); |
621 stageTime, stageTemp, MinMash, MaxMash); |
622 |
622 |
623 if (Main_Screen > MAIN_AUTO_MASH_IN) { |
623 if (Main_Screen > MAIN_AUTO_MASH_IN) { |
624 // Do not annotate before the log is open. |
624 // Do not annotate before the log is open. |
625 if (Main_Screen == MAIN_AUTO_MASH_OUT) { |
625 if (Main_Screen == MAIN_AUTO_MASH_OUT) { |
626 log_annotation(ANNOTATION_STAGE, "Uitmaischen"); |
626 log_annotation(ANNOTATION_STAGE, (char *)"Uitmaischen"); |
627 } else { |
627 } else { |
628 sprintf(logline, "Maisch: %d", Main_Screen - MAIN_AUTO_MASH_IN); |
628 sprintf(logline, "Maisch: %d", Main_Screen - MAIN_AUTO_MASH_IN); |
629 log_annotation(ANNOTATION_STAGE, logline); |
629 log_annotation(ANNOTATION_STAGE, logline); |
630 } |
630 } |
631 } |
631 } |
636 sprintf(temp_buf, "Maisch stap #%d", Main_Screen - MAIN_AUTO_MASH_IN); |
636 sprintf(temp_buf, "Maisch stap #%d", Main_Screen - MAIN_AUTO_MASH_IN); |
637 TopMessage(temp_buf); |
637 TopMessage(temp_buf); |
638 } |
638 } |
639 if ((Main_Screen > MAIN_AUTO_MASH_IN) && (Main_Screen < MAIN_AUTO_MASH_OUT) && |
639 if ((Main_Screen > MAIN_AUTO_MASH_IN) && (Main_Screen < MAIN_AUTO_MASH_OUT) && |
640 (recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Type == MASHTYPE_INFUSION)) { |
640 (recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Type == MASHTYPE_INFUSION)) { |
641 Buttons_Add( 5,120, 60, 40, "Halt", 0); |
641 Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0); |
642 Buttons[0].dark = true; |
642 Buttons[0].dark = true; |
643 Buttons_Add(255,120, 60, 40, "Ok", 1); |
643 Buttons_Add(255,120, 60, 40, (char *)"Ok", 1); |
644 Buttons_Show(); |
644 Buttons_Show(); |
645 _fg = TFT_WHITE; |
645 _fg = TFT_WHITE; |
646 _bg = TFT_BLACK; |
646 _bg = TFT_BLACK; |
647 TFT_setFont(DEJAVU18_FONT, NULL); |
647 TFT_setFont(DEJAVU18_FONT, NULL); |
648 sprintf(temp_buf, "Infuse %.1f L/%.1f C", recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Infusion_amount, |
648 sprintf(temp_buf, "Infuse %.1f L/%.1f C", recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Infusion_amount, |
649 recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Infusion_temp); |
649 recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Infusion_temp); |
650 TFT_print(temp_buf, CENTER, 135); |
650 TFT_print(temp_buf, CENTER, 135); |
651 SoundPlay(SOUND_Prompt); |
651 SoundPlay(SOUND_Prompt); |
652 MashState = Sub_Screen = MASH_INFUSE; |
652 MashState = Sub_Screen = MASH_INFUSE; |
653 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"%s\"}", Main_Screen, Sub_Screen, temp_buf); |
653 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"%s\"}", Main_Screen, Sub_Screen, temp_buf); |
654 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
654 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
655 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
655 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
656 // No heating during the infusion. |
656 // No heating during the infusion. |
657 driver_state->mlt_sp = stageTemp; |
657 driver_state->mlt_sp = stageTemp; |
658 driver_state->mlt_mode = MLT_MODE_OFF; |
658 driver_state->mlt_mode = MLT_MODE_OFF; |
659 xSemaphoreGive(xSemaphoreDriver); |
659 xSemaphoreGive(xSemaphoreDriver); |
660 } |
660 } |
661 ESP_LOGI(TAG, "Mash infusion prompt"); |
661 ESP_LOGI(TAG, "Mash infusion prompt"); |
662 } else { |
662 } else { |
663 Buttons_Add( 5, 30, 60, 40, "+sp", 0); |
663 Buttons_Add( 5, 30, 60, 40, (char *)"+sp", 0); |
664 Buttons_Add(255, 30, 60, 40, "-sp", 1); |
664 Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1); |
665 Buttons_Show(); |
665 Buttons_Show(); |
666 } |
666 } |
667 |
667 |
668 } else if (MashState == MASH_WAITTEMP) { |
668 } else if (MashState == MASH_WAITTEMP) { |
669 pumpRest = false; |
669 pumpRest = false; |
764 updateRuntime = true; |
764 updateRuntime = true; |
765 if ((Main_Screen == MAIN_AUTO_MASH_IN) && config.AskAdd) { |
765 if ((Main_Screen == MAIN_AUTO_MASH_IN) && config.AskAdd) { |
766 /* |
766 /* |
767 * Add Mash prompt. |
767 * Add Mash prompt. |
768 */ |
768 */ |
769 log_annotation(ANNOTATION_EVENT, "Mout storten"); |
769 log_annotation(ANNOTATION_EVENT, (char *)"Mout storten"); |
770 Buttons_Clear(); |
770 Buttons_Clear(); |
771 Buttons_Add( 5,120, 60, 40, "Halt", 0); |
771 Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0); |
772 Buttons[0].dark = true; |
772 Buttons[0].dark = true; |
773 Buttons_Add(255,120, 60, 40, "Ok", 1); |
773 Buttons_Add(255,120, 60, 40, (char *)"Ok", 1); |
774 Buttons_Show(); |
774 Buttons_Show(); |
775 _fg = TFT_WHITE; |
775 _fg = TFT_WHITE; |
776 _bg = TFT_BLACK; |
776 _bg = TFT_BLACK; |
777 TFT_setFont(DEJAVU24_FONT, NULL); |
777 TFT_setFont(DEJAVU24_FONT, NULL); |
778 TFT_print("Mout storten?", CENTER, 135); |
778 TFT_print((char *)"Mout storten?", CENTER, 135); |
779 SoundPlay(SOUND_Prompt); |
779 SoundPlay(SOUND_Prompt); |
780 MashState = Sub_Screen = MASH_ADD; |
780 MashState = Sub_Screen = MASH_ADD; |
781 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Mout storten?\"}", Main_Screen, Sub_Screen); |
781 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Mout storten?\"}", Main_Screen, Sub_Screen); |
782 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
782 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
783 ESP_LOGI(TAG, "Mash add prompt"); |
783 ESP_LOGI(TAG, "Mash add prompt"); |
784 break; |
784 break; |
785 } |
785 } |
786 if (((Main_Screen - MAIN_AUTO_MASH_IN) == LastMashStep) && config.AskIodine) { |
786 if (((Main_Screen - MAIN_AUTO_MASH_IN) == LastMashStep) && config.AskIodine) { |
787 /* |
787 /* |
788 * Iodone test prompt. |
788 * Iodone test prompt. |
789 */ |
789 */ |
790 log_annotation(ANNOTATION_EVENT, "Jodium test"); |
790 log_annotation(ANNOTATION_EVENT, (char *)"Jodium test"); |
791 TFT_fillRect(0, 120, 320, 50, TFT_BLACK); |
791 TFT_fillRect(0, 120, 320, 50, TFT_BLACK); |
792 Buttons_Clear(); |
792 Buttons_Clear(); |
793 Buttons_Add( 5,120, 60, 40, "Halt", 0); |
793 Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0); |
794 Buttons[0].dark = true; |
794 Buttons[0].dark = true; |
795 Buttons_Add(255,120, 60, 40, "Ok", 1); |
795 Buttons_Add(255,120, 60, 40, (char *)"Ok", 1); |
796 Buttons_Show(); |
796 Buttons_Show(); |
797 _fg = TFT_WHITE; |
797 _fg = TFT_WHITE; |
798 _bg = TFT_BLACK; |
798 _bg = TFT_BLACK; |
799 TFT_setFont(DEJAVU24_FONT, NULL); |
799 TFT_setFont(DEJAVU24_FONT, NULL); |
800 TFT_print("Jodium test?", CENTER, 127); |
800 TFT_print((char *)"Jodium test?", CENTER, 127); |
801 SoundPlay(SOUND_Prompt); |
801 SoundPlay(SOUND_Prompt); |
802 beeped = false; |
802 beeped = false; |
803 TimerSet(config.IodineTime * 60); |
803 TimerSet(config.IodineTime * 60); |
804 MashState = Sub_Screen = MASH_IODINE; |
804 MashState = Sub_Screen = MASH_IODINE; |
805 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Jodium test?\"}", Main_Screen, Sub_Screen); |
805 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Jodium test?\"}", Main_Screen, Sub_Screen); |
806 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
806 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
807 ESP_LOGI(TAG, "Mash iodine test prompt"); |
807 ESP_LOGI(TAG, "Mash iodine test prompt"); |
808 break; |
808 break; |
809 } |
809 } |
810 if ((Main_Screen == MAIN_AUTO_MASH_OUT) && config.AskRemove) { |
810 if ((Main_Screen == MAIN_AUTO_MASH_OUT) && config.AskRemove) { |
811 /* |
811 /* |
812 * Mash remove prompt. |
812 * Mash remove prompt. |
813 */ |
813 */ |
814 log_annotation(ANNOTATION_EVENT, "Mout verwijderen"); |
814 log_annotation(ANNOTATION_EVENT, (char *)"Mout verwijderen"); |
815 TFT_fillRect(0, 120, 320, 50, TFT_BLACK); |
815 TFT_fillRect(0, 120, 320, 50, TFT_BLACK); |
816 Buttons_Clear(); |
816 Buttons_Clear(); |
817 Buttons_Add( 5,120, 60, 40, "Halt", 0); |
817 Buttons_Add( 5,120, 60, 40, (char *)"Halt", 0); |
818 Buttons[0].dark = true; |
818 Buttons[0].dark = true; |
819 Buttons_Add(255,120, 60, 40, "Ok", 1); |
819 Buttons_Add(255,120, 60, 40, (char *)"Ok", 1); |
820 Buttons_Show(); |
820 Buttons_Show(); |
821 _fg = TFT_WHITE; |
821 _fg = TFT_WHITE; |
822 _bg = TFT_BLACK; |
822 _bg = TFT_BLACK; |
823 TFT_setFont(DEJAVU18_FONT, NULL); |
823 TFT_setFont(DEJAVU18_FONT, NULL); |
824 TFT_print("Mout verwijderen?", CENTER, 135); |
824 TFT_print((char *)"Mout verwijderen?", CENTER, 135); |
825 SoundPlay(SOUND_Prompt); |
825 SoundPlay(SOUND_Prompt); |
826 MashState = Sub_Screen = MASH_REMOVE; |
826 MashState = Sub_Screen = MASH_REMOVE; |
827 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Mout verwijderen?\"}", Main_Screen, Sub_Screen); |
827 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Mout verwijderen?\"}", Main_Screen, Sub_Screen); |
828 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
828 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
829 ESP_LOGI(TAG, "Mash remove prompt"); |
829 ESP_LOGI(TAG, "Mash remove prompt"); |
830 break; |
830 break; |
831 } |
831 } |
832 if (Main_Screen != MAIN_AUTO_ABORT) |
832 if (Main_Screen != MAIN_AUTO_ABORT) |
833 Main_Screen++; |
833 Main_Screen++; |
878 switch (Buttons_Scan()) { |
878 switch (Buttons_Scan()) { |
879 case 0: Main_Screen = MAIN_AUTO_ABORT; |
879 case 0: Main_Screen = MAIN_AUTO_ABORT; |
880 break; |
880 break; |
881 case 1: MashState = Sub_Screen = MASH_WAITTEMP; |
881 case 1: MashState = Sub_Screen = MASH_WAITTEMP; |
882 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
882 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
883 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
883 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
884 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
884 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
885 // Start PID again. |
885 // Start PID again. |
886 driver_state->mlt_sp = stageTemp; |
886 driver_state->mlt_sp = stageTemp; |
887 driver_state->mlt_mode = MLT_MODE_PID; |
887 driver_state->mlt_mode = MLT_MODE_PID; |
888 xSemaphoreGive(xSemaphoreDriver); |
888 xSemaphoreGive(xSemaphoreDriver); |
889 } |
889 } |
890 Buttons_Clear(); |
890 Buttons_Clear(); |
891 Buttons_Add( 5, 30, 60, 40, "+sp", 0); |
891 Buttons_Add( 5, 30, 60, 40, (char *)"+sp", 0); |
892 Buttons_Add(255, 30, 60, 40, "-sp", 1); |
892 Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1); |
893 Buttons_Show(); |
893 Buttons_Show(); |
894 TFT_fillRect(65, 120, 190, 40, TFT_BLACK); |
894 TFT_fillRect(65, 120, 190, 40, TFT_BLACK); |
895 log_annotation(ANNOTATION_EVENT, "Eind infusie"); |
895 log_annotation(ANNOTATION_EVENT, (char *)"Eind infusie"); |
896 break; |
896 break; |
897 default: break; |
897 default: break; |
898 } |
898 } |
899 } /* MashState */ |
899 } /* MashState */ |
900 MLT_info(71, 26, true); |
900 MLT_info(71, 26, true); |
950 TopMessage(recipe.Addition[runtime.HopAddition].Name); |
950 TopMessage(recipe.Addition[runtime.HopAddition].Name); |
951 log_annotation(ANNOTATION_EVENT, recipe.Addition[runtime.HopAddition].Name); |
951 log_annotation(ANNOTATION_EVENT, recipe.Addition[runtime.HopAddition].Name); |
952 SoundPlay(SOUND_AddHop); |
952 SoundPlay(SOUND_AddHop); |
953 runtime.HopAddition++; |
953 runtime.HopAddition++; |
954 } else { |
954 } else { |
955 TopMessage("Koken"); |
955 TopMessage((char *)"Koken"); |
956 } |
956 } |
957 runtime.StageTimeLeft = TimeLeft / 60; |
957 runtime.StageTimeLeft = TimeLeft / 60; |
958 updateRuntime = true; |
958 updateRuntime = true; |
959 } |
959 } |
960 if (TimeLeft < 60) { |
960 if (TimeLeft < 60) { |
961 if (Output) { |
961 if (Output) { |
962 log_annotation(ANNOTATION_STAGE, "Vlamuit"); |
962 log_annotation(ANNOTATION_STAGE, (char *)"Vlamuit"); |
963 } |
963 } |
964 // Flameout |
964 // Flameout |
965 Output = 0; |
965 Output = 0; |
966 } else if (driver_state->mlt_pv >= stageTemp) { |
966 } else if (driver_state->mlt_pv >= stageTemp) { |
967 Output = (int)((BoilPower * 255.0) / 100.0); |
967 Output = (int)((BoilPower * 255.0) / 100.0); |
968 if (Buttons[4].x == -1) { |
968 if (Buttons[4].x == -1) { |
969 Buttons_Add( 3,110, 60, 40, "+%", 4); |
969 Buttons_Add( 3,110, 60, 40, (char *)"+%", 4); |
970 Buttons_Add(257,110, 60, 40, "-%", 5); |
970 Buttons_Add(257,110, 60, 40, (char *)"-%", 5); |
971 Buttons_Show(); |
971 Buttons_Show(); |
972 } |
972 } |
973 } else { |
973 } else { |
974 Output = 255; |
974 Output = 255; |
975 if (Buttons[4].x != -1) { |
975 if (Buttons[4].x != -1) { |
1054 stageTemp = 66.0; |
1054 stageTemp = 66.0; |
1055 } else { |
1055 } else { |
1056 stageTemp = recipe.CoolTemp; |
1056 stageTemp = recipe.CoolTemp; |
1057 } |
1057 } |
1058 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
1058 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
1059 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
1059 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
1060 CoolBeep = false; |
1060 CoolBeep = false; |
1061 ESP_LOGI(TAG, "Start cooling from %6.2f to %4.1f", ds18b20_state->mlt_temperature, stageTemp); |
1061 ESP_LOGI(TAG, "Start cooling from %6.2f to %4.1f", ds18b20_state->mlt_temperature, stageTemp); |
1062 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1062 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1063 driver_state->mlt_mode = MLT_MODE_OFF; |
1063 driver_state->mlt_mode = MLT_MODE_OFF; |
1064 driver_state->mlt_sp = stageTemp; |
1064 driver_state->mlt_sp = stageTemp; |
1065 xSemaphoreGive(xSemaphoreDriver); |
1065 xSemaphoreGive(xSemaphoreDriver); |
1066 } |
1066 } |
1067 log_annotation(ANNOTATION_STAGE, "Koelen"); |
1067 log_annotation(ANNOTATION_STAGE, (char *)"Koelen"); |
1068 TopMessage("Koelen"); |
1068 TopMessage((char *)"Koelen"); |
1069 MLT_info(71, 26, false); |
1069 MLT_info(71, 26, false); |
1070 Buttons_Add( 5, 200, 60, 40, "Stop", 0); |
1070 Buttons_Add( 5, 200, 60, 40, (char *)"Stop", 0); |
1071 Buttons[0].dark = true; |
1071 Buttons[0].dark = true; |
1072 Buttons_Add( 5, 26, 60, 40, "+1", 1); |
1072 Buttons_Add( 5, 26, 60, 40, (char *)"+1", 1); |
1073 Buttons_Add(255, 26, 60, 40, "-1", 2); |
1073 Buttons_Add(255, 26, 60, 40, (char *)"-1", 2); |
1074 /* |
1074 /* |
1075 * The next key is not a mistake, but we need a key entry which |
1075 * The next key is not a mistake, but we need a key entry which |
1076 * will later become the pump key. The keyscan routine will find |
1076 * will later become the pump key. The keyscan routine will find |
1077 * the original key if pressed. |
1077 * the original key if pressed. |
1078 */ |
1078 */ |
1079 Buttons_Add(255, 26, 60, 40, "-1", 3); |
1079 Buttons_Add(255, 26, 60, 40, (char *)"-1", 3); |
1080 Buttons_Show(); |
1080 Buttons_Show(); |
1081 } |
1081 } |
1082 } else { |
1082 } else { |
1083 /* |
1083 /* |
1084 * Not in prompt mode. |
1084 * Not in prompt mode. |
1212 */ |
1212 */ |
1213 Buttons_Clear(); |
1213 Buttons_Clear(); |
1214 TFT_fillScreen(_bg); |
1214 TFT_fillScreen(_bg); |
1215 Sub_Screen = 1; |
1215 Sub_Screen = 1; |
1216 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
1216 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
1217 ws_server_send_text_clients("/ws", msg, strlen(msg)); |
1217 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
1218 if (Main_Screen == MAIN_AUTO_WHIRLPOOL9) { |
1218 if (Main_Screen == MAIN_AUTO_WHIRLPOOL9) { |
1219 TimeWhirlPool = recipe.Whirlpool9; |
1219 TimeWhirlPool = recipe.Whirlpool9; |
1220 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1220 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1221 driver_state->mlt_sp = 93.0; |
1221 driver_state->mlt_sp = 93.0; |
1222 driver_state->mlt_mode = MLT_MODE_PID; |
1222 driver_state->mlt_mode = MLT_MODE_PID; |
1223 xSemaphoreGive(xSemaphoreDriver); |
1223 xSemaphoreGive(xSemaphoreDriver); |
1224 } |
1224 } |
1225 TopMessage("Whirlpool 88..100"); |
1225 TopMessage((char *)"Whirlpool 88..100"); |
1226 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL7) { |
1226 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL7) { |
1227 TimeWhirlPool = recipe.Whirlpool7; |
1227 TimeWhirlPool = recipe.Whirlpool7; |
1228 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1228 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1229 driver_state->mlt_sp = 74.0; |
1229 driver_state->mlt_sp = 74.0; |
1230 driver_state->mlt_mode = MLT_MODE_PID; |
1230 driver_state->mlt_mode = MLT_MODE_PID; |
1231 xSemaphoreGive(xSemaphoreDriver); |
1231 xSemaphoreGive(xSemaphoreDriver); |
1232 } |
1232 } |
1233 TopMessage("Whirlpool 71..77"); |
1233 TopMessage((char *)"Whirlpool 71..77"); |
1234 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL6) { |
1234 } else if (Main_Screen == MAIN_AUTO_WHIRLPOOL6) { |
1235 TimeWhirlPool = recipe.Whirlpool6; |
1235 TimeWhirlPool = recipe.Whirlpool6; |
1236 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1236 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1237 driver_state->mlt_sp = 63.0; |
1237 driver_state->mlt_sp = 63.0; |
1238 driver_state->mlt_mode = MLT_MODE_PID; |
1238 driver_state->mlt_mode = MLT_MODE_PID; |
1239 xSemaphoreGive(xSemaphoreDriver); |
1239 xSemaphoreGive(xSemaphoreDriver); |
1240 } |
1240 } |
1241 TopMessage("Whirlpool 60..66"); |
1241 TopMessage((char *)"Whirlpool 60..66"); |
1242 } else { |
1242 } else { |
1243 TimeWhirlPool = recipe.Whirlpool2; |
1243 TimeWhirlPool = recipe.Whirlpool2; |
1244 TopMessage("Koude whirlpool"); |
1244 TopMessage((char *)"Koude whirlpool"); |
1245 } |
1245 } |
1246 if (Resume) { |
1246 if (Resume) { |
1247 TimeWhirlPool = runtime.StageTimeLeft; |
1247 TimeWhirlPool = runtime.StageTimeLeft; |
1248 } |
1248 } |
1249 |
1249 |
1252 */ |
1252 */ |
1253 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1253 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
1254 driver_state->pump_run = (driver_state->mlt_pv < equipment.PumpMaxTemp) ? 1 : 0; |
1254 driver_state->pump_run = (driver_state->mlt_pv < equipment.PumpMaxTemp) ? 1 : 0; |
1255 xSemaphoreGive(xSemaphoreDriver); |
1255 xSemaphoreGive(xSemaphoreDriver); |
1256 } |
1256 } |
1257 log_annotation(ANNOTATION_STAGE, "Whirlpool"); |
1257 log_annotation(ANNOTATION_STAGE, (char *)"Whirlpool"); |
1258 |
1258 |
1259 TimerSet(TimeWhirlPool * 60); |
1259 TimerSet(TimeWhirlPool * 60); |
1260 runtime.StageTimeLeft = TimeWhirlPool; |
1260 runtime.StageTimeLeft = TimeWhirlPool; |
1261 updateRuntime = true; |
1261 updateRuntime = true; |
1262 MLT_info(71, 26, false); |
1262 MLT_info(71, 26, false); |
1263 ESP_LOGI(TAG, "Whirlpool %d minutes, sp %4.1f", TimeWhirlPool, driver_state->mlt_sp); |
1263 ESP_LOGI(TAG, "Whirlpool %d minutes, sp %4.1f", TimeWhirlPool, driver_state->mlt_sp); |
1264 Buttons_Add(255, 120, 60, 40, "+1m", 0); |
1264 Buttons_Add(255, 120, 60, 40, (char *)"+1m", 0); |
1265 Buttons_Add( 5, 120, 60, 40, "-1m", 1); |
1265 Buttons_Add( 5, 120, 60, 40, (char *)"-1m", 1); |
1266 Buttons_Add(255, 200, 60, 40, "Pomp", 2); |
1266 Buttons_Add(255, 200, 60, 40, (char *)"Pomp", 2); |
1267 Buttons_Show(); |
1267 Buttons_Show(); |
1268 } |
1268 } |
1269 } else { |
1269 } else { |
1270 /* |
1270 /* |
1271 * Not running in prompt mode, do the whirlpool. |
1271 * Not running in prompt mode, do the whirlpool. |