diff -r 5d4a40fe9967 -r 49e2960d4642 main/automation.c --- a/main/automation.c Fri Oct 26 13:29:14 2018 +0200 +++ b/main/automation.c Fri Oct 26 21:23:46 2018 +0200 @@ -53,6 +53,8 @@ extern float Fake_HLT; #endif +extern const char *mashTypes[]; + static const char *TAG = "automation"; @@ -393,21 +395,26 @@ y += 16; _fg = TFT_WHITE; TFT_print("Maisch stap", 2, y); - TFT_print("Temp.", 200, y); - TFT_print("Rust", 260, y); + TFT_print("T", 200, y); + TFT_print("Temp.", 220, y); + TFT_print("Rust", 280, y); _fg = TFT_YELLOW; y += 16; for (int i = 1; i < 8; i++) { if (recipe.MashStep[i].Resttime) { TFT_print(recipe.MashStep[i].Name, 2, y); - sprintf(tmp, "%.2f", recipe.MashStep[i].Temperature); + strcpy(tmp, mashTypes[recipe.MashStep[i].Type]); + tmp[1] = '\0'; TFT_print(tmp, 200, y); - sprintf(tmp, "%2d min", recipe.MashStep[i].Resttime); - TFT_print(tmp, 260, y); + sprintf(tmp, "%.2f", recipe.MashStep[i].Temperature); + TFT_print(tmp, 220, y); + sprintf(tmp, "%2d m", recipe.MashStep[i].Resttime); + TFT_print(tmp, 280, y); y += 16; } } - ShowInteger(2, y, "Kooktijd", " miniuten", recipe.BoilTime); + ShowInteger(2, y, "Kooktijd", " min", recipe.BoilTime); + ShowFloat(162, y, "Koel tot", " C", recipe.CoolTemp, 2); y += 16; if (recipe.Additions) { _fg = TFT_YELLOW; @@ -427,7 +434,6 @@ TFT_print("Geen hop toevoegingen.", 2, y); } y += 16; - ShowFloat(2, y, "Koelen tot", " C", recipe.CoolTemp, 2); if (recipe.Whirlpool9) { ShowInteger(2, y, "Whirlpool 88..100 graden", " minuten", recipe.Whirlpool9); y += 16; @@ -593,8 +599,9 @@ xSemaphoreGive(xSemaphoreDriver); } MashState = MASH_WAITTEMP; - ESP_LOGI(TAG, "Mash step %d time: %d temp: %4.1f min: %4.1f max: %4.1f", - Main_Screen - MAIN_AUTO_MASH_IN, stageTime, stageTemp, MinMash, MaxMash); + ESP_LOGI(TAG, "Mash step %d type: %s time: %d temp: %4.1f min: %4.1f max: %4.1f", + Main_Screen - MAIN_AUTO_MASH_IN, mashTypes[recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Type], + stageTime, stageTemp, MinMash, MaxMash); if (Main_Screen > MAIN_AUTO_MASH_IN) { // Do not annotate before the log is open. @@ -612,9 +619,32 @@ sprintf(temp_buf, "Maisch stap #%d", Main_Screen - MAIN_AUTO_MASH_IN); TopMessage(temp_buf); } - Buttons_Add( 5, 30, 60, 40, "+sp", 0); - Buttons_Add(255, 30, 60, 40, "-sp", 1); - Buttons_Show(); + if ((Main_Screen > MAIN_AUTO_MASH_IN) && (Main_Screen < MAIN_AUTO_MASH_OUT) && + (recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Type == MASHTYPE_INFUSION)) { + Buttons_Add( 5,120, 60, 40, "Halt", 0); + Buttons[0].dark = true; + Buttons_Add(255,120, 60, 40, "Ok", 1); + Buttons_Show(); + _fg = TFT_WHITE; + _bg = TFT_BLACK; + TFT_setFont(DEJAVU18_FONT, NULL); + sprintf(temp_buf, "Infuse %.1f L/%.1f C", recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Infusion_amount, + recipe.MashStep[Main_Screen - MAIN_AUTO_MASH_IN].Infusion_temp); + TFT_print(temp_buf, CENTER, 135); + SoundPlay(SOUND_Prompt); + MashState = MASH_INFUSE; + if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { + // No heating during the infusion. + driver_state->mlt_sp = stageTemp; + driver_state->mlt_mode = MLT_MODE_OFF; + xSemaphoreGive(xSemaphoreDriver); + } + ESP_LOGI(TAG, "Mash infusion prompt"); + } else { + Buttons_Add( 5, 30, 60, 40, "+sp", 0); + Buttons_Add(255, 30, 60, 40, "-sp", 1); + Buttons_Show(); + } } else if (MashState == MASH_WAITTEMP) { pumpRest = false; @@ -817,6 +847,25 @@ break; default: break; } + } else if (MashState == MASH_INFUSE) { + switch (Buttons_Scan()) { + case 0: Main_Screen = MAIN_AUTO_ABORT; + break; + case 1: MashState = MASH_WAITTEMP; + if (xSemaphoreTake(xSemaphoreDriver, 10) == pdTRUE) { + // Start PID again. + driver_state->mlt_sp = stageTemp; + driver_state->mlt_mode = MLT_MODE_PID; + xSemaphoreGive(xSemaphoreDriver); + } + Buttons_Clear(); + Buttons_Add( 5, 30, 60, 40, "+sp", 0); + Buttons_Add(255, 30, 60, 40, "-sp", 1); + Buttons_Show(); + TFT_fillRect(65, 120, 190, 40, TFT_BLACK); + break; + default: break; + } } /* MashState */ MLT_info(71, 26, true); if (_UseHLT) {