Files
reflowplate/reflow_plate_fw/src/thermo.cpp

34 lines
835 B
C++

#include "thermo.h"
Thermocouple *thermocouple = NULL;
uint32_t thermo_lastTime = 0;
double lastTemperature = 0;
// the setup function runs once when you press reset or power the board
void initThermo()
{
Thermocouple *originThermocouple = new MAX6675_Thermocouple(THERM_CL, THERM_CS, THERM_SO);
thermocouple = new SmoothThermocouple(originThermocouple, SMOOTHING_FACTOR);
}
// the loop function runs over and over again forever
void handleThermo(void)
{
// Reads temperature
uint32_t timeNow = millis();
if (timeNow - thermo_lastTime > THERMO_INTERVAL)
{
lastTemperature = thermocouple->readCelsius();
Serial.printf("Thermocouple = %d\n",lastTemperature);
}
//delay(100); // optionally, only to delay the output of information in the example.
}
double getTemperature(void)
{
return lastTemperature;
}