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