diff -r 1bc6e9263ada -r 96e30a3a3980 main/automation.c --- a/main/automation.c Sat Jun 19 20:46:42 2021 +0200 +++ b/main/automation.c Mon Jun 21 19:04:10 2021 +0200 @@ -6,6 +6,7 @@ #include "config.h" int BoilPower = 100; ///< Boil power 0..100% +int RampPower = 100; ///< Boil ramp power 0..100% int LastMashStep = 0; ///< Last valid mash step char temp_buf[64]; ///< Temporary buffer char logline[128]; ///< Log line buffer @@ -269,11 +270,14 @@ runtime.StageResume = Main_Screen; updateRuntime = true; TempReached = false; + RampPower = equipment.RampPower; TopMessage((char *)"Naar koken"); MLT_info(71, 26, false); - Buttons_Add( 5, 30, 60, 40, (char *)"+sp", 0); - Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1); + Buttons_Add( 5, 30, 60, 40, (char *)"+sp", 0); + Buttons_Add(255, 30, 60, 40, (char *)"-sp", 1); + Buttons_Add( 3, 110, 60, 40, (char *)"+%", 2); + Buttons_Add(257, 110, 60, 40, (char *)"-%", 3); Buttons_Show(); log_msg(TAG, "Mash done, going to boil."); Sub_Screen = 0; @@ -300,10 +304,12 @@ updateRuntime = true; TopMessage((char *)"Koken"); MLT_info(71, 26, false); - Buttons_Add( 3, 30, 60, 40, (char *)"+sp", 0); - Buttons_Add(257, 30, 60, 40, (char *)"-sp", 1); - Buttons_Add( 3, 190, 60, 40, (char *)"+1m", 2); - Buttons_Add(257, 190, 60, 40, (char *)"-1m", 3); + Buttons_Add( 3, 30, 60, 40, (char *)"+sp", 0); + Buttons_Add(257, 30, 60, 40, (char *)"-sp", 1); + Buttons_Add( 3, 110, 60, 40, (char *)"+%", 2); + Buttons_Add(257, 110, 60, 40, (char *)"-%", 3); + Buttons_Add( 3, 190, 60, 40, (char *)"+1m", 4); + Buttons_Add(257, 190, 60, 40, (char *)"-1m", 5); Buttons_Show(); log_msg(TAG, "Boil temperature reached, boil %d minutes", (TimeLeft / 60) -1); log_annotation(ANNOTATION_STAGE, (char *)"Koken"); @@ -1003,7 +1009,7 @@ break; case MAIN_AUTO_TOBOIL: - Output = 255; + Output = (int)((RampPower * 255.0) / 100.0); /* * Go to the boil temperature and wait until it is steady. */ @@ -1032,6 +1038,16 @@ } break; + case 2: if (RampPower < 100) + RampPower++; + log_msg(TAG, "Increase ramppower to %d%%", RampPower); + break; + + case 3: if (RampPower > 0) + RampPower--; + log_msg(TAG, "Decrease ramppower to %d%%", RampPower); + break; + default: break; } if (Resume) @@ -1063,19 +1079,8 @@ Output = 0; } else if (driver_state->mlt_pv >= stageTemp) { Output = (int)((BoilPower * 255.0) / 100.0); - if (Buttons[4].x == -1) { - Buttons_Add( 3,110, 60, 40, (char *)"+%", 4); - Buttons_Add(257,110, 60, 40, (char *)"-%", 5); - Buttons_Show(); - } } else { - Output = 255; - if (Buttons[4].x != -1) { - Buttons[4].x = Buttons[5].x = -1; - Buttons_Show(); - TFT_fillRect( 3,110, 60, 40, TFT_BLACK); - TFT_fillRect(257,110, 60, 40, TFT_BLACK); - } + Output = (int)((RampPower * 255.0) / 100.0);; } MLT_info(71, 26, true); @@ -1092,20 +1097,32 @@ } break; - case 2: change_tl(21600); + case 4: change_tl(21600); break; - case 3: change_tl(0); + case 5: change_tl(0); break; - case 4: if (BoilPower < 100) - BoilPower++; - log_msg(TAG, "Increase boilpower to %d%%", BoilPower); + case 2: if (driver_state->mlt_pv >= stageTemp) { + if (BoilPower < 100) + BoilPower++; + log_msg(TAG, "Increase boilpower to %d%%", BoilPower); + } else { + if (RampPower < 100) + RampPower++; + log_msg(TAG, "Increase ramppower to %d%%", RampPower); + } break; - case 5: if (BoilPower > 0) - BoilPower--; - log_msg(TAG, "Decrease boilpower to %d%%", BoilPower); + case 3: if (driver_state->mlt_pv >= stageTemp) { + if (BoilPower > 0) + BoilPower--; + log_msg(TAG, "Decrease boilpower to %d%%", BoilPower); + } else { + if (RampPower > 0) + RampPower--; + log_msg(TAG, "Decrease ramppower to %d%%", RampPower); + } break; default: break;