From 893da19858b5e37b8edd59485c35989460d2a66d Mon Sep 17 00:00:00 2001 From: Lorenz Uhlig <98092139+LoQue90@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:41:02 +0200 Subject: [PATCH] fixes after rebase --- src/brewHandler.h | 84 ----------------------------------------------- src/defaults.h | 79 +++++++++++++++++++++----------------------- src/main.cpp | 8 ++--- 3 files changed, 42 insertions(+), 129 deletions(-) diff --git a/src/brewHandler.h b/src/brewHandler.h index e3c850b7..675f2ec7 100644 --- a/src/brewHandler.h +++ b/src/brewHandler.h @@ -157,90 +157,6 @@ void checkbrewswitch() { } } -/** - * @brief Backflush - */ -void backflush() { - if (backflushState != kBackflushWaitBrewswitchOn && backflushOn == 0) { - backflushState = kBackflushWaitBrewswitchOff; // Force reset in case backflushOn is reset during backflush! - LOG(INFO, "Backflush: Disabled via Webinterface"); - } - else if (offlineMode == 1 || currBrewState > kBrewIdle || backflushCycles <= 0 || backflushOn == 0) { - return; - } - - if (bPID.GetMode() == 1) { // Deactivate PID - bPID.SetMode(0); - pidOutput = 0; - } - - heaterRelay.off(); // Stop heating - - checkbrewswitch(); - - if (currStateBrewSwitch == LOW && backflushState != kBackflushWaitBrewswitchOn) { // Abort function for state machine from every state - backflushState = kBackflushWaitBrewswitchOff; - } - - // State machine for backflush - switch (backflushState) { - case kBackflushWaitBrewswitchOn: - if (currStateBrewSwitch == HIGH && backflushOn) { - startingTime = millis(); - backflushState = kBackflushFillingStart; - } - - break; - - case kBackflushFillingStart: - LOG(INFO, "Backflush: Portafilter filling..."); - valveRelay.on(); - pumpRelay.on(); - backflushState = kBackflushFilling; - - break; - - case kBackflushFilling: - if (millis() - startingTime > (backflushFillTime * 1000)) { - startingTime = millis(); - backflushState = kBackflushFlushingStart; - } - - break; - - case kBackflushFlushingStart: - LOG(INFO, "Backflush: Flushing to drip tray..."); - valveRelay.off(); - pumpRelay.off(); - currBackflushCycles++; - backflushState = kBackflushFlushing; - - break; - - case kBackflushFlushing: - if (millis() - startingTime > (backflushFlushTime * 1000) && currBackflushCycles < backflushCycles) { - startingTime = millis(); - backflushState = kBackflushFillingStart; - } - else if (currBackflushCycles >= backflushCycles) { - backflushState = kBackflushWaitBrewswitchOff; - } - - break; - - case kBackflushWaitBrewswitchOff: - if (currStateBrewSwitch == LOW) { - LOG(INFO, "Backflush: Finished!"); - valveRelay.off(); - pumpRelay.off(); - currBackflushCycles = 0; - backflushState = kBackflushWaitBrewswitchOn; - } - - break; - } -} - #if (FEATURE_BREWCONTROL == 0) /** * @brief Brew timer diff --git a/src/defaults.h b/src/defaults.h index 973b6da3..8e1a4e3a 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -48,50 +48,47 @@ int writeSysParamsToStorage(void); #define BACKFLUSH_FILL_TIME 5 // time in seconds the pump is running during backflush #define BACKFLUSH_FLUSH_TIME 10 // time in seconds the 3-way valve is open during backflush -#define PID_KP_START_MIN 0 -#define PID_KP_START_MAX 999 -#define PID_TN_START_MIN 0 -#define PID_TN_START_MAX 999 -#define PID_KP_REGULAR_MIN 0 -#define PID_KP_REGULAR_MAX 999 -#define PID_TN_REGULAR_MIN 0 -#define PID_TN_REGULAR_MAX 999 -#define PID_TV_REGULAR_MIN 0 -#define PID_TV_REGULAR_MAX 999 -#define PID_I_MAX_REGULAR_MIN 0 -#define PID_I_MAX_REGULAR_MAX 999 -#define PID_KP_BD_MIN 0 -#define PID_KP_BD_MAX 999 -#define PID_TN_BD_MIN 0 -#define PID_TN_BD_MAX 999 -#define PID_TV_BD_MIN 0 -#define PID_TV_BD_MAX 999 -#define BREW_SETPOINT_MIN 20 -#define BREW_SETPOINT_MAX 110 -#define STEAM_SETPOINT_MIN 100 -#define STEAM_SETPOINT_MAX 140 -#define BREW_TEMP_OFFSET_MIN 0 -#define BREW_TEMP_OFFSET_MAX 20 -#define BREW_TEMP_TIME_MIN 1 -#define BREW_TEMP_TIME_MAX 180 -#define BREW_TIME_MIN 0 -#define BREW_TIME_MAX 180 -#define BREW_PID_DELAY_MIN 0 -#define BREW_PID_DELAY_MAX 60 -#define PRE_INFUSION_TIME_MIN 0 -#define PRE_INFUSION_TIME_MAX 60 -#define PRE_INFUSION_PAUSE_MIN 0 -#define PRE_INFUSION_PAUSE_MAX 60 -#define WEIGHTSETPOINT_MIN 0 -#define WEIGHTSETPOINT_MAX 500 -#define PID_KP_STEAM_MIN 0 -#define PID_KP_STEAM_MAX 500 -#define STANDBY_MODE_TIME_MIN 30 -#define STANDBY_MODE_TIME_MAX 120 +#define PID_KP_START_MIN 0 +#define PID_KP_START_MAX 999 +#define PID_TN_START_MIN 0 +#define PID_TN_START_MAX 999 +#define PID_KP_REGULAR_MIN 0 +#define PID_KP_REGULAR_MAX 999 +#define PID_TN_REGULAR_MIN 0 +#define PID_TN_REGULAR_MAX 999 +#define PID_TV_REGULAR_MIN 0 +#define PID_TV_REGULAR_MAX 999 +#define PID_I_MAX_REGULAR_MIN 0 +#define PID_I_MAX_REGULAR_MAX 999 +#define PID_KP_BD_MIN 0 +#define PID_KP_BD_MAX 999 +#define PID_TN_BD_MIN 0 +#define PID_TN_BD_MAX 999 +#define PID_TV_BD_MIN 0 +#define PID_TV_BD_MAX 999 +#define BREW_SETPOINT_MIN 20 +#define BREW_SETPOINT_MAX 110 +#define STEAM_SETPOINT_MIN 100 +#define STEAM_SETPOINT_MAX 140 +#define BREW_TEMP_OFFSET_MIN 0 +#define BREW_TEMP_OFFSET_MAX 20 +#define BREW_TIME_MIN 0 +#define BREW_TIME_MAX 180 +#define BREW_PID_DELAY_MIN 0 +#define BREW_PID_DELAY_MAX 60 +#define PRE_INFUSION_TIME_MIN 0 +#define PRE_INFUSION_TIME_MAX 60 +#define PRE_INFUSION_PAUSE_MIN 0 +#define PRE_INFUSION_PAUSE_MAX 60 +#define WEIGHTSETPOINT_MIN 0 +#define WEIGHTSETPOINT_MAX 500 +#define PID_KP_STEAM_MIN 0 +#define PID_KP_STEAM_MAX 500 +#define STANDBY_MODE_TIME_MIN 30 +#define STANDBY_MODE_TIME_MAX 120 #define BACKFLUSH_CYCLES_MIN 2 #define BACKFLUSH_CYCLES_MAX 20 #define BACKFLUSH_FILL_TIME_MIN 5 #define BACKFLUSH_FILL_TIME_MAX 20 #define BACKFLUSH_FLUSH_TIME_MIN 5 #define BACKFLUSH_FLUSH_TIME_MAX 20 - diff --git a/src/main.cpp b/src/main.cpp index 1a8cd480..c8cfaa67 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1167,7 +1167,7 @@ void setup() { .type = kUInt8, .section = sBDSection, .position = 22, - .show = [] { return true && FEATURE_BREWDETECTION == 1; }, + .show = [] { return true && FEATURE_BREWSWITCH == 1; }, .minValue = 0, .maxValue = 1, .ptr = (void*)&useBDPID}; @@ -1185,7 +1185,7 @@ void setup() { .type = kDouble, .section = sBDSection, .position = 23, - .show = [] { return true && FEATURE_BREWDETECTION == 1 && useBDPID; }, + .show = [] { return true && FEATURE_BREWSWITCH == 1 && useBDPID; }, .minValue = PID_KP_BD_MIN, .maxValue = PID_KP_BD_MAX, .ptr = (void*)&aggbKp}; @@ -1197,7 +1197,7 @@ void setup() { .type = kDouble, .section = sBDSection, .position = 24, - .show = [] { return true && FEATURE_BREWDETECTION == 1 && useBDPID; }, + .show = [] { return true && FEATURE_BREWSWITCH == 1 && useBDPID; }, .minValue = PID_TN_BD_MIN, .maxValue = PID_TN_BD_MAX, .ptr = (void*)&aggbTn}; @@ -1209,7 +1209,7 @@ void setup() { .type = kDouble, .section = sBDSection, .position = 25, - .show = [] { return true && FEATURE_BREWDETECTION == 1 && useBDPID; }, + .show = [] { return true && FEATURE_BREWSWITCH == 1 && useBDPID; }, .minValue = PID_TV_BD_MIN, .maxValue = PID_TV_BD_MAX, .ptr = (void*)&aggbTv};