Use overloaded functions for get/set.
This commit is contained in:
parent
9a535c665b
commit
be781f1275
@ -120,8 +120,8 @@ void setup() {
|
||||
mqtt_client.setCallback(MessageReceived);
|
||||
|
||||
KettleController.begin(I_CS1);
|
||||
KettleController.SetHysteresis(config.hysteresis);
|
||||
KettleController.SetThreshPWR(config.threshold);
|
||||
KettleController.Hysteresis(config.hysteresis);
|
||||
KettleController.ThreshPWR(config.threshold);
|
||||
|
||||
// if you get a connection, report back via serial:
|
||||
if (Ethernet.linkStatus() == LinkON) {
|
||||
|
@ -10,8 +10,8 @@ void thermoControl::begin(int pinRTD) {
|
||||
outMax = 100;
|
||||
outMin = 10;
|
||||
OpMode = OFF;
|
||||
SampleTime = 100;
|
||||
lastTime = millis()-SampleTime;
|
||||
SampleInterval = 100;
|
||||
lastTime = millis()-SampleInterval;
|
||||
output_pwm = 0;
|
||||
control_temp = 0;
|
||||
hysteresis = 1.0;
|
||||
@ -25,8 +25,8 @@ void thermoControl::begin(int pinRTD, double temp, double duty, double mpt, doub
|
||||
outMax = 100;
|
||||
outMin = 10;
|
||||
OpMode = OFF;
|
||||
SampleTime = 100;
|
||||
lastTime = millis()-SampleTime;
|
||||
SampleInterval = 100;
|
||||
lastTime = millis()-SampleInterval;
|
||||
|
||||
output_pwm = duty;
|
||||
control_temp = temp;
|
||||
@ -40,7 +40,7 @@ bool thermoControl::Compute() {
|
||||
|
||||
double temp = RTD->temperature(r_nominal, r_ref);
|
||||
|
||||
if(timeChange>=SampleTime && OpMode == AUTOMATIC) {
|
||||
if(timeChange>=SampleInterval && OpMode == AUTOMATIC) {
|
||||
double output;
|
||||
double error = control_temp - temp;
|
||||
|
||||
@ -78,18 +78,26 @@ void thermoControl::Setpoint(double temp) {
|
||||
control_temp = temp;
|
||||
}
|
||||
|
||||
void thermoControl::SetSampleTime(int NewSampleTime) {
|
||||
void thermoControl::SampleTime(int NewSampleTime) {
|
||||
if (NewSampleTime > 0) {
|
||||
SampleTime = (unsigned long)NewSampleTime;
|
||||
SampleInterval = (unsigned long)NewSampleTime;
|
||||
}
|
||||
}
|
||||
|
||||
void thermoControl::SetPowerLimits(double Max, double Min) {
|
||||
void thermoControl::PowerLimits(double Max, double Min) {
|
||||
if(Min >= Max) return;
|
||||
outMax = Max;
|
||||
outMin = Min;
|
||||
}
|
||||
|
||||
void thermoControl::Hysteresis(double hys) {
|
||||
hysteresis = hys;
|
||||
}
|
||||
|
||||
void thermoControl::ThreshPWR(double thresh) {
|
||||
max_pwr_threshold = thresh;
|
||||
}
|
||||
|
||||
void thermoControl::Mode(modes newMode) {
|
||||
OpMode = newMode;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class thermoControl {
|
||||
|
||||
modes OpMode;
|
||||
|
||||
unsigned long SampleTime;
|
||||
unsigned long SampleInterval;
|
||||
unsigned long lastTime;
|
||||
|
||||
public:
|
||||
@ -30,10 +30,12 @@ class thermoControl {
|
||||
void Power(double);
|
||||
double Setpoint();
|
||||
void Setpoint(double);
|
||||
void SetSampleTime(int);
|
||||
void SetPowerLimits(double, double);
|
||||
void SetHysteresis(double);
|
||||
void SetThreshPWR(double);
|
||||
void SampleTime(int);
|
||||
void PowerLimits(double, double);
|
||||
void Hysteresis(double);
|
||||
void Hysteresis();
|
||||
void ThreshPWR(double);
|
||||
void ThreshPWR();
|
||||
void Mode(modes);
|
||||
modes Mode();
|
||||
modes CycleMode();
|
||||
|
Loading…
Reference in New Issue
Block a user