From 2b82511a4d970654a2b4af365aae43d4fe83854c Mon Sep 17 00:00:00 2001 From: murmeltier08 <44034211+murmeltier08@users.noreply.github.com> Date: Mon, 26 Dec 2022 21:13:59 +0100 Subject: [PATCH 1/2] add steamsetpoint to website --- src/Storage.cpp | 12 +++++++++++- src/Storage.h | 1 + src/rancilio-pid.cpp | 10 ++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/Storage.cpp b/src/Storage.cpp index aa185dda0..ba1a515ad 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -58,6 +58,7 @@ typedef struct __attribute__((packed)) { char wifiPassword[25 + 1]; double weightsetpoint; double steamkp; + double steamsetpoint; } sto_data_t; // set item defaults @@ -102,7 +103,8 @@ static const sto_data_t itemDefaults PROGMEM = { "", // STO_ITEM_WIFI_SSID "", // STO_ITEM_WIFI_PASSWORD SCALE_WEIGHTSETPOINT, - STEAMKP + STEAMKP, + STEAMSETPOINT }; /** @@ -240,6 +242,14 @@ static inline int32_t getItemAddr(sto_item_id_t itemId, uint16_t* maxItemSize = size = STRUCT_MEMBER_SIZE(sto_data_t,weightsetpoint); break; + case STO_ITEM_STEAM_SETPOINT: + addr = offsetof(sto_data_t,weightsetpoint ); + size = STRUCT_MEMBER_SIZE(sto_data_t,weightsetpoint); + break; + + + + default: debugPrintf("%s(): invalid item ID %i!\n", __func__, itemId); addr = -1; diff --git a/src/Storage.h b/src/Storage.h index b76532181..d982b1c65 100644 --- a/src/Storage.h +++ b/src/Storage.h @@ -39,6 +39,7 @@ typedef enum STO_ITEM_BREW_TEMP_OFFSET, // brew temp offset STO_ITEM_PID_START_PONM, // Use PonM for cold start phase (otherwise use normal PID and same params) STO_ITEM_USE_BD_PID, // use separate PID for brew detection (otherwise continue with regular PID) + STO_ITEM_STEAM_SETPOINT, /* WHEN ADDING NEW ITEMS, THE FOLLOWING HAS TO BE UPDATED: * - storage structure: sto_data_t diff --git a/src/rancilio-pid.cpp b/src/rancilio-pid.cpp index adfc1747a..158e9351b 100644 --- a/src/rancilio-pid.cpp +++ b/src/rancilio-pid.cpp @@ -239,6 +239,7 @@ SysPara sysParaPidKpSteam(&steamKp, PID_KP_STEAM_MIN, PID_KP_STEAM_MAX, SysPara sysParaPidOn(&pidON, 0, 1, STO_ITEM_PID_ON); SysPara sysParaUsePonM(&usePonM, 0, 1, STO_ITEM_PID_START_PONM); SysPara sysParaUseBDPID(&useBDPID, 0, 1, STO_ITEM_USE_BD_PID); +SysPara sysParaSteamSetPoint(&steamSetPoint, STEAM_SETPOINT_MIN, STEAM_SETPOINT_MIN, STO_ITEM_STEAM_SETPOINT); // Other variables int relayON, relayOFF; // used for relay trigger type. Do not change! @@ -1717,7 +1718,11 @@ void setup() { {F("BACKFLUSH_ON"), F("Backflush"), false, "", kUInt8, sOtherSection, []{ return false; }, 0, 1, (void *)&backflushON}, //#25 - {F("VERSION"), F("Version"), false, "", kCString, sOtherSection, []{ return false; }, 0, 1, (void *)sysVersion} + {F("VERSION"), F("Version"), false, "", kCString, sOtherSection, []{ return false; }, 0, 1, (void *)sysVersion}, + //#26 + {F("STEAM_SET_POINT"), F("Steam Set point (°C)"), false, F("The temperature that the PID will attempt for steam"), kDouble, sTempSection, []{ return false; }, STEAM_SETPOINT_MIN, STEAM_SETPOINT_MAX, (void *)&steamSetPoint}, + + }; //when adding parameters, update EDITABLE_VARS_LEN! @@ -2271,7 +2276,7 @@ int readSysParamsFromStorage(void) { if (sysParaPidKpSteam.getStorage() != 0) return -1; if (sysParaUsePonM.getStorage() != 0) return -1; if (sysParaUseBDPID.getStorage() != 0) return -1; - + if (sysParaSteamSetPoint.getStorage() != 0) return -1; return 0; } @@ -2302,6 +2307,7 @@ int writeSysParamsToStorage(void) { if (sysParaPidKpBd.setStorage() != 0) return -1; if (sysParaPidTnBd.setStorage() != 0) return -1; if (sysParaPidTvBd.setStorage() != 0) return -1; + if (sysParaSteamSetPoint.setStorage() != 0) return -1; return storageCommit(); } From a3de07225fe8feaf03df7d09b0e32037b7fdb94e Mon Sep 17 00:00:00 2001 From: murmeltier08 <44034211+murmeltier08@users.noreply.github.com> Date: Mon, 26 Dec 2022 22:05:07 +0100 Subject: [PATCH 2/2] fix steamsetpoint --- src/Storage.cpp | 4 ++-- src/rancilio-pid.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Storage.cpp b/src/Storage.cpp index ba1a515ad..1edf52aba 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -243,8 +243,8 @@ static inline int32_t getItemAddr(sto_item_id_t itemId, uint16_t* maxItemSize = break; case STO_ITEM_STEAM_SETPOINT: - addr = offsetof(sto_data_t,weightsetpoint ); - size = STRUCT_MEMBER_SIZE(sto_data_t,weightsetpoint); + addr = offsetof(sto_data_t,steamsetpoint ); + size = STRUCT_MEMBER_SIZE(sto_data_t,steamsetpoint); break; diff --git a/src/rancilio-pid.cpp b/src/rancilio-pid.cpp index 158e9351b..c02d2f649 100644 --- a/src/rancilio-pid.cpp +++ b/src/rancilio-pid.cpp @@ -239,7 +239,7 @@ SysPara sysParaPidKpSteam(&steamKp, PID_KP_STEAM_MIN, PID_KP_STEAM_MAX, SysPara sysParaPidOn(&pidON, 0, 1, STO_ITEM_PID_ON); SysPara sysParaUsePonM(&usePonM, 0, 1, STO_ITEM_PID_START_PONM); SysPara sysParaUseBDPID(&useBDPID, 0, 1, STO_ITEM_USE_BD_PID); -SysPara sysParaSteamSetPoint(&steamSetPoint, STEAM_SETPOINT_MIN, STEAM_SETPOINT_MIN, STO_ITEM_STEAM_SETPOINT); +SysPara sysParaSteamSetPoint(&steamSetPoint, STEAM_SETPOINT_MIN, STEAM_SETPOINT_MAX, STO_ITEM_STEAM_SETPOINT); // Other variables int relayON, relayOFF; // used for relay trigger type. Do not change!