226 MaxMash = recipe.MashStep[runtime.MashStep + 1].Step_temp; |
226 MaxMash = recipe.MashStep[runtime.MashStep + 1].Step_temp; |
227 if (MaxMash >= 75.0) |
227 if (MaxMash >= 75.0) |
228 MaxMash = 74.75; |
228 MaxMash = 74.75; |
229 } |
229 } |
230 MashState = Sub_Screen = MASH_NONE; |
230 MashState = Sub_Screen = MASH_NONE; |
231 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"step\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen, runtime.MashStep); |
231 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
232 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
232 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
233 ESP_LOGI(TAG, "%s", msg); |
|
234 pumpTime = 0; |
233 pumpTime = 0; |
235 pumpRest = false; |
234 pumpRest = false; |
236 runtime.StageResume = Main_Screen; |
235 runtime.StageResume = Main_Screen; |
237 updateRuntime = true; |
236 updateRuntime = true; |
238 TopMessage((char *)"Maischen"); |
237 TopMessage((char *)"Maischen"); |
647 driver_state->mlt_sp = stageTemp; |
646 driver_state->mlt_sp = stageTemp; |
648 driver_state->mlt_mode = MLT_MODE_PID; |
647 driver_state->mlt_mode = MLT_MODE_PID; |
649 xSemaphoreGive(xSemaphoreDriver); |
648 xSemaphoreGive(xSemaphoreDriver); |
650 } |
649 } |
651 MashState = Sub_Screen = MASH_WAITTEMP; |
650 MashState = Sub_Screen = MASH_WAITTEMP; |
652 ESP_LOGI(TAG, "** Step %d Stage %d Malt %s", runtime.MashStep, MashState, runtime.MaltAdded ? (char *)"yes":(char *)"no"); |
651 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
653 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"step\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen, runtime.MashStep); |
|
654 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
652 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
655 log_msg(TAG, "Mash step %d type: %s time: %d sp: %6.4f sv: %6.4f", |
653 log_msg(TAG, "Mash step %d type: %s time: %d sp: %6.4f sv: %6.4f", |
656 runtime.MashStep, mashTypes[recipe.MashStep[runtime.MashStep].Type], |
654 runtime.MashStep, mashTypes[recipe.MashStep[runtime.MashStep].Type], |
657 stageTime, stageTemp, temp_MLT); |
655 stageTime, stageTemp, temp_MLT); |
658 |
656 |
665 log_annotation(ANNOTATION_STAGE, logline); |
663 log_annotation(ANNOTATION_STAGE, logline); |
666 } |
664 } |
667 } |
665 } |
668 |
666 |
669 if (! runtime.MaltAdded) { |
667 if (! runtime.MaltAdded) { |
670 TopMessage((char *)"Opwarmen MLT"); |
668 TopMessage((char *)"Maischwater opwarmen"); |
671 } else if (strlen(recipe.MashStep[runtime.MashStep].Name)) { |
669 } else if (strlen(recipe.MashStep[runtime.MashStep].Name)) { |
672 TopMessage(recipe.MashStep[runtime.MashStep].Name); |
670 TopMessage(recipe.MashStep[runtime.MashStep].Name); |
673 } else { |
671 } else { |
674 sprintf(temp_buf, "Maisch stap #%d", runtime.MashStep); |
672 sprintf(temp_buf, "Maisch stap #%d", runtime.MashStep); |
675 TopMessage(temp_buf); |
673 TopMessage(temp_buf); |
694 MashState = Sub_Screen = MASH_DECOCT; |
692 MashState = Sub_Screen = MASH_DECOCT; |
695 log_msg(TAG, "Mash decoction prompt"); |
693 log_msg(TAG, "Mash decoction prompt"); |
696 } |
694 } |
697 TFT_print(temp_buf, CENTER, 135); |
695 TFT_print(temp_buf, CENTER, 135); |
698 SoundPlay(SOUND_Prompt); |
696 SoundPlay(SOUND_Prompt); |
699 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"step\":\"%d\",\"timer\":\"%s\"}", |
697 snprintf(msg, 255, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"%s\"}", Main_Screen, Sub_Screen, temp_buf); |
700 Main_Screen, Sub_Screen, runtime.MashStep, temp_buf); |
|
701 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
698 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
702 if (recipe.MashStep[runtime.MashStep].Type == MASHTYPE_INFUSION) { |
699 if (recipe.MashStep[runtime.MashStep].Type == MASHTYPE_INFUSION) { |
703 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
700 if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { |
704 // No heating during the infusion. |
701 // No heating during the infusion. |
705 driver_state->mlt_sp = stageTemp; |
702 driver_state->mlt_sp = stageTemp; |
720 } |
717 } |
721 if ((temp_MLT >= stageTemp) && (Steady > 10)) { |
718 if ((temp_MLT >= stageTemp) && (Steady > 10)) { |
722 SoundPlay(SOUND_TempReached); |
719 SoundPlay(SOUND_TempReached); |
723 TempReached = true; |
720 TempReached = true; |
724 MashState = Sub_Screen = MASH_REST; |
721 MashState = Sub_Screen = MASH_REST; |
725 ESP_LOGI(TAG, "** Step %d Stage %d Malt %s", runtime.MashStep, MashState, runtime.MaltAdded ? (char *)"yes":(char *)"no"); |
722 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
726 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"step\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen, runtime.MashStep); |
|
727 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
723 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
728 if (! runtime.MaltAdded && runtime.MashStep == 0) { |
724 if (! runtime.MaltAdded && runtime.MashStep == 0) { |
729 TimerSet(0); |
725 TimerSet(0); |
730 } else { |
726 } else { |
731 if (Resume && (runtime.StageTimeLeft < stageTime)) |
727 if (Resume && (runtime.StageTimeLeft < stageTime)) |
819 _bg = TFT_BLACK; |
814 _bg = TFT_BLACK; |
820 TFT_setFont(DEJAVU24_FONT, NULL); |
815 TFT_setFont(DEJAVU24_FONT, NULL); |
821 TFT_print((char *)"Mout storten?", CENTER, 135); |
816 TFT_print((char *)"Mout storten?", CENTER, 135); |
822 SoundPlay(SOUND_Prompt); |
817 SoundPlay(SOUND_Prompt); |
823 MashState = Sub_Screen = MASH_ADD; |
818 MashState = Sub_Screen = MASH_ADD; |
824 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"step\":\"%d\",\"timer\":\"Mout storten?\"}", |
819 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Mout storten?\"}", Main_Screen, Sub_Screen); |
825 Main_Screen, Sub_Screen, runtime.MashStep); |
|
826 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
820 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
827 log_msg(TAG, "Mash add prompt"); |
821 log_msg(TAG, "Mash add prompt"); |
828 break; |
822 break; |
829 } |
823 } |
830 if ((runtime.MashStep == LastMashStep) && config.AskIodine) { |
824 if ((runtime.MashStep == LastMashStep) && config.AskIodine) { |
844 TFT_print((char *)"Jodium test?", CENTER, 127); |
838 TFT_print((char *)"Jodium test?", CENTER, 127); |
845 SoundPlay(SOUND_Prompt); |
839 SoundPlay(SOUND_Prompt); |
846 beeped = false; |
840 beeped = false; |
847 TimerSet(config.IodineTime * 60); |
841 TimerSet(config.IodineTime * 60); |
848 MashState = Sub_Screen = MASH_IODINE; |
842 MashState = Sub_Screen = MASH_IODINE; |
849 ESP_LOGI(TAG, "** Step %d Stage %d Malt %s", runtime.MashStep, MashState, runtime.MaltAdded ? (char *)"yes":(char *)"no"); |
843 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Jodium test?\"}", Main_Screen, Sub_Screen); |
850 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"step\":\"%d\",\"timer\":\"Jodium test?\"}", |
|
851 Main_Screen, Sub_Screen, runtime.MashStep); |
|
852 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
844 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
853 log_msg(TAG, "Mash iodine test prompt"); |
845 log_msg(TAG, "Mash iodine test prompt"); |
854 break; |
846 break; |
855 } |
847 } |
856 if ((runtime.MashStep == (recipe.Mashsteps - 1)) && config.AskRemove) { |
848 if ((runtime.MashStep == (recipe.Mashsteps - 1)) && config.AskRemove) { |
868 _bg = TFT_BLACK; |
860 _bg = TFT_BLACK; |
869 TFT_setFont(DEJAVU18_FONT, NULL); |
861 TFT_setFont(DEJAVU18_FONT, NULL); |
870 TFT_print((char *)"Mout verwijderen?", CENTER, 135); |
862 TFT_print((char *)"Mout verwijderen?", CENTER, 135); |
871 SoundPlay(SOUND_Prompt); |
863 SoundPlay(SOUND_Prompt); |
872 MashState = Sub_Screen = MASH_REMOVE; |
864 MashState = Sub_Screen = MASH_REMOVE; |
873 ESP_LOGI(TAG, "** Step %d Stage %d Malt %s", runtime.MashStep, MashState, runtime.MaltAdded ? (char *)"yes":(char *)"no"); |
865 snprintf(msg, 127, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"Mout verwijderen?\"}", Main_Screen, Sub_Screen); |
874 snprintf(msg, 127, "{\"main\":\"%d\",\"sub\":\"%d\",\"step\":\"%d\",\"timer\":\"Mout verwijderen?\"}", |
|
875 Main_Screen, Sub_Screen, runtime.MashStep); |
|
876 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
866 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
877 log_msg(TAG, "Mash remove prompt"); |
867 log_msg(TAG, "Mash remove prompt"); |
878 break; |
868 break; |
879 } |
869 } |
880 if (Main_Screen != MAIN_AUTO_ABORT) { |
870 if (Main_Screen != MAIN_AUTO_ABORT) { |
920 } else if (MashState == MASH_REMOVE) { |
910 } else if (MashState == MASH_REMOVE) { |
921 Main_Screen = MAIN_AUTO_TOBOIL; |
911 Main_Screen = MAIN_AUTO_TOBOIL; |
922 } |
912 } |
923 TFT_fillRect(0, 120, 320, 50, TFT_BLACK); |
913 TFT_fillRect(0, 120, 320, 50, TFT_BLACK); |
924 Buttons_Clear(); |
914 Buttons_Clear(); |
925 ESP_LOGI(TAG, "** Step %d Stage %d Malt %s", runtime.MashStep, MashState, runtime.MaltAdded ? (char *)"yes":(char *)"no"); |
|
926 break; |
915 break; |
927 default: break; |
916 default: break; |
928 } |
917 } |
929 if (MashState == MASH_IODINE && TimeLeft == 0) { |
918 if (MashState == MASH_IODINE && TimeLeft == 0) { |
930 MashState = Sub_Screen = MASH_NONE; |
919 MashState = Sub_Screen = MASH_NONE; |
967 } else { |
956 } else { |
968 log_msg(TAG, "Eind decoctie"); |
957 log_msg(TAG, "Eind decoctie"); |
969 log_annotation(ANNOTATION_EVENT, (char *)"Eind decoctie"); |
958 log_annotation(ANNOTATION_EVENT, (char *)"Eind decoctie"); |
970 } |
959 } |
971 MashState = Sub_Screen = MASH_WAITTEMP; |
960 MashState = Sub_Screen = MASH_WAITTEMP; |
972 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"step\":\"%d\",\"timer\":\"\"}", |
961 snprintf(msg, 63, "{\"main\":\"%d\",\"sub\":\"%d\",\"timer\":\"\"}", Main_Screen, Sub_Screen); |
973 Main_Screen, Sub_Screen, runtime.MashStep); |
|
974 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
962 ws_server_send_text_clients((char *)"/ws", msg, strlen(msg)); |
975 break; |
963 break; |
976 default: break; |
964 default: break; |
977 } |
965 } |
978 } /* MashState */ |
966 } /* MashState */ |