Skip to content

Commit

Permalink
remove Brew PID Time
Browse files Browse the repository at this point in the history
remove brew PID time (former Brew SW Time) because it isn´t used anymore after removing sw brew detection
  • Loading branch information
LoQue90 committed Sep 8, 2024
1 parent 8d3dc17 commit 9944da9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 42 deletions.
3 changes: 0 additions & 3 deletions src/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ int writeSysParamsToStorage(void);
#define AGGBTN 0 // PID Tn (brew detection phase)
#define AGGBTV 20 // PID Tv (brew detection phase)
#define BREW_TIME 25 // brew time in seconds (only used if pump is being controlled)
#define BREW_PID_TIME 25 // keep brew PID params for this many seconds after detection
#define BREW_PID_DELAY 10 // delay until enabling PID controller during brew (no heating during this time)
#define PRE_INFUSION_TIME 2 // pre-infusion time in seconds
#define PRE_INFUSION_PAUSE_TIME 5 // pre-infusion pause time in seconds
Expand Down Expand Up @@ -76,8 +75,6 @@ int writeSysParamsToStorage(void);
#define BREW_TIME_MAX 180
#define BREW_PID_DELAY_MIN 0
#define BREW_PID_DELAY_MAX 60
#define BREW_PID_TIME_MIN 1
#define BREW_PID_TIME_MAX 180
#define PRE_INFUSION_TIME_MIN 0
#define PRE_INFUSION_TIME_MAX 60
#define PRE_INFUSION_PAUSE_MIN 0
Expand Down
2 changes: 1 addition & 1 deletion src/embeddedWebserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void serverSetup();
void setEepromWriteFcn(int (*fcnPtr)(void));

// editable vars are specified in main.cpp
#define EDITABLE_VARS_LEN 31
#define EDITABLE_VARS_LEN 30
extern std::map<String, editable_t> editableVars;

// EEPROM
Expand Down
33 changes: 8 additions & 25 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ double aggbKi = aggbKp / aggbTn;
#endif

double aggbKd = aggbTv * aggbKp;
double brewPidTime = BREW_PID_TIME; // Time while Brew PID is running
double brewPIDDelay = BREW_PID_DELAY; // Time PID will be disabled after brew started

uint8_t standbyModeOn = 0;
Expand All @@ -240,7 +239,6 @@ SysPara<double> sysParaTempOffset(&brewTempOffset, BREW_TEMP_OFFSET_MIN, BREW_TE
SysPara<double> sysParaBrewPIDDelay(&brewPIDDelay, BREW_PID_DELAY_MIN, BREW_PID_DELAY_MAX, STO_ITEM_BREW_PID_DELAY);
SysPara<uint8_t> sysParaUseBDPID(&useBDPID, 0, 1, STO_ITEM_USE_BD_PID);
SysPara<double> sysParaBrewTime(&brewTime, BREW_TIME_MIN, BREW_TIME_MAX, STO_ITEM_BREW_TIME);
SysPara<double> sysParaBrewPidTime(&brewPidTime, BREW_PID_TIME_MIN, BREW_PID_TIME_MAX, STO_ITEM_BREW_PID_TIME);
SysPara<uint8_t> sysParaWifiCredentialsSaved(&wifiCredentialsSaved, 0, 1, STO_ITEM_WIFI_CREDENTIALS_SAVED);
SysPara<double> sysParaPreInfTime(&preinfusion, PRE_INFUSION_TIME_MIN, PRE_INFUSION_TIME_MAX, STO_ITEM_PRE_INFUSION_TIME);
SysPara<double> sysParaPreInfPause(&preinfusionPause, PRE_INFUSION_PAUSE_MIN, PRE_INFUSION_PAUSE_MAX, STO_ITEM_PRE_INFUSION_PAUSE);
Expand Down Expand Up @@ -1192,30 +1190,18 @@ void setup() {
.maxValue = PID_TV_BD_MAX,
.ptr = (void*)&aggbTv};

editableVars["PID_BD_TIME"] = {.displayName = F("PID BD Time (s)"),
.hasHelpText = true,
.helpText = F("Fixed time in seconds for which the BD PID will stay "
"enabled (also after Brew switch is inactive again)."),
.type = kDouble,
.section = sBDSection,
.position = 23,
.show = [] { return true && FEATURE_BREWSWITCH == 1 && useBDPID; },
.minValue = BREW_PID_TIME_MIN,
.maxValue = BREW_PID_TIME_MAX,
.ptr = (void*)&brewPidTime};

editableVars["STEAM_MODE"] = {
.displayName = F("Steam Mode"), .hasHelpText = false, .helpText = "", .type = kUInt8, .section = sOtherSection, .position = 24, .show = [] { return false; }, .minValue = 0, .maxValue = 1, .ptr = (void*)&steamON};
.displayName = F("Steam Mode"), .hasHelpText = false, .helpText = "", .type = kUInt8, .section = sOtherSection, .position = 23, .show = [] { return false; }, .minValue = 0, .maxValue = 1, .ptr = (void*)&steamON};

editableVars["BACKFLUSH_ON"] = {
.displayName = F("Backflush"), .hasHelpText = false, .helpText = "", .type = kUInt8, .section = sOtherSection, .position = 25, .show = [] { return false; }, .minValue = 0, .maxValue = 1, .ptr = (void*)&backflushOn};
.displayName = F("Backflush"), .hasHelpText = false, .helpText = "", .type = kUInt8, .section = sOtherSection, .position = 24, .show = [] { return false; }, .minValue = 0, .maxValue = 1, .ptr = (void*)&backflushOn};

editableVars["STANDBY_MODE_ON"] = {.displayName = F("Enable Standby Timer"),
.hasHelpText = true,
.helpText = F("Turn heater off after standby time has elapsed."),
.type = kUInt8,
.section = sPowerSection,
.position = 26,
.position = 25,
.show = [] { return true; },
.minValue = 0,
.maxValue = 1,
Expand All @@ -1226,7 +1212,7 @@ void setup() {
.helpText = F("Time in minutes until the heater is turned off. Timer is reset by brew detection."),
.type = kDouble,
.section = sPowerSection,
.position = 27,
.position = 26,
.show = [] { return true; },
.minValue = STANDBY_MODE_TIME_MIN,
.maxValue = STANDBY_MODE_TIME_MAX,
Expand All @@ -1241,7 +1227,7 @@ void setup() {
.helpText = "",
.type = kUInt8,
.section = sScaleSection,
.position = 28,
.position = 27,
.show = [] { return false; },
.minValue = 0,
.maxValue = 1,
Expand All @@ -1252,7 +1238,7 @@ void setup() {
.helpText = "",
.type = kFloat,
.section = sScaleSection,
.position = 29,
.position = 28,
.show = [] { return true; },
.minValue = 0,
.maxValue = 2000,
Expand All @@ -1263,7 +1249,7 @@ void setup() {
.helpText = "",
.type = kFloat,
.section = sScaleSection,
.position = 30,
.position = 29,
.show = [] { return true; },
.minValue = -100000,
.maxValue = 100000,
Expand All @@ -1274,7 +1260,7 @@ void setup() {
.helpText = "",
.type = kFloat,
.section = sScaleSection,
.position = 31,
.position = 30,
.show = [] { return SCALE_TYPE == 0; },
.minValue = -100000,
.maxValue = 100000,
Expand Down Expand Up @@ -1560,7 +1546,6 @@ void looppid() {
LOGF(TRACE, "Current PID Output: %f", pidOutput);
LOGF(TRACE, "Current Machinestate: %s", machinestateEnumToString(machineState));
LOGF(TRACE, "timeBrewed %f", timeBrewed);
LOGF(TRACE, "Brew PID time %f", brewPidTime);
LOGF(TRACE, "Brew detected %i", brewOn);
}
}
Expand Down Expand Up @@ -1814,7 +1799,6 @@ int readSysParamsFromStorage(void) {
if (sysParaPidTnBd.getStorage() != 0) return -1;
if (sysParaPidTvBd.getStorage() != 0) return -1;
if (sysParaBrewTime.getStorage() != 0) return -1;
if (sysParaBrewPidTime.getStorage() != 0) return -1;
if (sysParaPreInfTime.getStorage() != 0) return -1;
if (sysParaPreInfPause.getStorage() != 0) return -1;
if (sysParaPidKpSteam.getStorage() != 0) return -1;
Expand Down Expand Up @@ -1852,7 +1836,6 @@ int writeSysParamsToStorage(void) {
if (sysParaPidTnBd.setStorage() != 0) return -1;
if (sysParaPidTvBd.setStorage() != 0) return -1;
if (sysParaBrewTime.setStorage() != 0) return -1;
if (sysParaBrewPidTime.setStorage() != 0) return -1;
if (sysParaPreInfTime.setStorage() != 0) return -1;
if (sysParaPreInfPause.setStorage() != 0) return -1;
if (sysParaPidKpSteam.setStorage() != 0) return -1;
Expand Down
20 changes: 7 additions & 13 deletions src/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ typedef enum {
STO_ITEM_BREW_TEMP_OFFSET, // brew temp offset
STO_ITEM_USE_BD_PID, // use separate PID for brew detection (otherwise continue with regular PID)
STO_ITEM_BREW_TIME, // brew time
STO_ITEM_BREW_PID_TIME, // brew PID time
STO_ITEM_BREW_PID_DELAY, // brew PID delay
STO_ITEM_WIFI_CREDENTIALS_SAVED, // flag for wifisetup
STO_ITEM_PRE_INFUSION_TIME, // pre-infusion time
Expand Down Expand Up @@ -90,18 +89,18 @@ typedef struct __attribute__((packed)) {
uint8_t freeToUse8[2];
double pidTvBd;
uint8_t freeToUse9[2];
double brewPidTimeSec;
double freeToUse10;
double brewPIDDelaySec;
uint8_t freeToUse10;
double freeToUse11;
uint8_t freeToUse11;
double freeToUse12;
uint8_t wifiCredentialsSaved;
uint8_t useStartPonM;
double pidKpStart;
uint8_t freeToUse12[2];
uint8_t freeToUse13[2];
uint8_t softApEnabledCheck;
uint8_t freeToUse13[9];
uint8_t freeToUse14[9];
double pidTnStart;
uint8_t freeToUse14[2];
uint8_t freeToUse15[2];
char wifiSSID[25 + 1];
char wifiPassword[25 + 1];
double weightSetpoint;
Expand Down Expand Up @@ -137,7 +136,7 @@ static const sto_data_t itemDefaults PROGMEM = {
{0xFF, 0xFF}, // free to use
AGGBTV, // STO_ITEM_PID_TV_BD
{0xFF, 0xFF}, // free to use
BREW_PID_TIME, // STO_ITEM_BREW_PID_TIME
0xFF, // free to use
BREW_PID_DELAY, // STO_ITEM_BREW_PID_DELAY
0xFF, // free to use
0xFF, // free to use
Expand Down Expand Up @@ -243,11 +242,6 @@ static inline int32_t getItemAddr(sto_item_id_t itemId, uint16_t* maxItemSize =
size = STRUCT_MEMBER_SIZE(sto_data_t, pidTvBd);
break;

case STO_ITEM_BREW_PID_TIME:
addr = offsetof(sto_data_t, brewPidTimeSec);
size = STRUCT_MEMBER_SIZE(sto_data_t, brewPidTimeSec);
break;

case STO_ITEM_WIFI_CREDENTIALS_SAVED:
addr = offsetof(sto_data_t, wifiCredentialsSaved);
size = STRUCT_MEMBER_SIZE(sto_data_t, wifiCredentialsSaved);
Expand Down

0 comments on commit 9944da9

Please sign in to comment.