Skip to content

Commit

Permalink
Merge pull request rancilio-pid#294 from murmeltier08/murmeltier08/ra…
Browse files Browse the repository at this point in the history
…nciliopid

add steamsetpoint to website
  • Loading branch information
murmeltier08 authored Jan 4, 2023
2 parents adea64d + a3de072 commit 15ea194
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/Storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedef struct __attribute__((packed)) {
char wifiPassword[25 + 1];
double weightsetpoint;
double steamkp;
double steamsetpoint;
} sto_data_t;

// set item defaults
Expand Down Expand Up @@ -102,7 +103,8 @@ static const sto_data_t itemDefaults PROGMEM = {
"", // STO_ITEM_WIFI_SSID
"", // STO_ITEM_WIFI_PASSWORD
SCALE_WEIGHTSETPOINT,
STEAMKP
STEAMKP,
STEAMSETPOINT
};

/**
Expand Down Expand Up @@ -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,steamsetpoint );
size = STRUCT_MEMBER_SIZE(sto_data_t,steamsetpoint);
break;




default:
debugPrintf("%s(): invalid item ID %i!\n", __func__, itemId);
addr = -1;
Expand Down
1 change: 1 addition & 0 deletions src/Storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions src/rancilio-pid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ SysPara<double> sysParaPidKpSteam(&steamKp, PID_KP_STEAM_MIN, PID_KP_STEAM_MAX,
SysPara<uint8_t> sysParaPidOn(&pidON, 0, 1, STO_ITEM_PID_ON);
SysPara<uint8_t> sysParaUsePonM(&usePonM, 0, 1, STO_ITEM_PID_START_PONM);
SysPara<uint8_t> sysParaUseBDPID(&useBDPID, 0, 1, STO_ITEM_USE_BD_PID);
SysPara<double> 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!
Expand Down Expand Up @@ -1726,7 +1727,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!

Expand Down Expand Up @@ -2280,7 +2285,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;
}

Expand Down Expand Up @@ -2311,6 +2316,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();
}
Expand Down

0 comments on commit 15ea194

Please sign in to comment.