Use begin() method for temp controller.

This commit is contained in:
Chris Giacofei 2022-01-20 14:12:00 -05:00
parent a1eb11b81a
commit f75cbe5f6c
3 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ LiquidCrystal_I2C lcd(0x27,20,4);
// Internal I/O
Adafruit_MAX31865 KettleThermo = Adafruit_MAX31865(kettleRTDCS);
slowPWM boilPWM;
thermoControl KettleController = thermoControl(&KettleTemp, &KettleSetpoint, &KettleDuty, &ThreshPWR, &Hysteresis);
thermoControl KettleController;
void MessageReceived(char*, byte*, unsigned int);
@ -115,6 +115,7 @@ void setup() {
boilPWM.begin(kettlePWM, PeriodPWM);
KettleThermo.begin(MAX31865_3WIRE);
KettleController.begin(&KettleTemp, &KettleSetpoint, &KettleDuty, config.threshold, config.hysteresis);
// if you get a connection, report back via serial:
if (Ethernet.linkStatus() == LinkON) {
ConnectMQTT();

View File

@ -3,7 +3,7 @@
#include <EEPROM.h>
#include "thermoControl.h"
thermoControl::thermoControl(uint8_t* input_temp, uint8_t* setpoint_temp, uint8_t* output_pwm, uint8_t* max_threshold, uint8_t* hysteresis) {
void thermoControl::begin(uint8_t* input_temp, uint8_t* setpoint_temp, uint8_t* output_pwm, uint8_t max_threshold, uint8_t hysteresis) {
output_pwm = output_pwm;
input_temp = input_temp;
setpoint_temp = setpoint_temp;
@ -14,7 +14,6 @@ thermoControl::thermoControl(uint8_t* input_temp, uint8_t* setpoint_temp, uint8_
OpMode = OFF;
SampleTime = 100;
lastTime = millis()-SampleTime;
}
bool thermoControl::Compute() {

View File

@ -19,7 +19,7 @@ class thermoControl {
unsigned long lastTime;
public:
thermoControl(uint8_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*);
void begin(uint8_t*, uint8_t*, uint8_t*, uint8_t, uint8_t);
bool Compute();
void SetSampleTime(int);
void SetPowerLimits(uint8_t, uint8_t);