From f75cbe5f6c38689724aa12fedc0060628a7e5fd4 Mon Sep 17 00:00:00 2001 From: Chris Giacofei Date: Thu, 20 Jan 2022 14:12:00 -0500 Subject: [PATCH] Use begin() method for temp controller. --- boil_kettle/boil_kettle.ino | 3 ++- boil_kettle/thermoControl.cpp | 3 +-- boil_kettle/thermoControl.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/boil_kettle/boil_kettle.ino b/boil_kettle/boil_kettle.ino index d0e9bfd..f21d397 100644 --- a/boil_kettle/boil_kettle.ino +++ b/boil_kettle/boil_kettle.ino @@ -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(); diff --git a/boil_kettle/thermoControl.cpp b/boil_kettle/thermoControl.cpp index 61e80af..cda0931 100644 --- a/boil_kettle/thermoControl.cpp +++ b/boil_kettle/thermoControl.cpp @@ -3,7 +3,7 @@ #include #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() { diff --git a/boil_kettle/thermoControl.h b/boil_kettle/thermoControl.h index 1e93aa4..f980506 100644 --- a/boil_kettle/thermoControl.h +++ b/boil_kettle/thermoControl.h @@ -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);