hot-fermentation/t_temperature_sensor.ino

21 lines
565 B
C++

LP_TIMER(1000, HandleTemperatureSensor);
void HandleTemperatureSensor() {
#ifdef TempSensorDallas
Input = (double) sensors.getTempCByIndex(0);
sensors.requestTemperatures(); // Send the command to get temperatures
#endif
#ifdef TempSensorMax // to go into the read temp function, rename from dallas temp
Input = thermocouple.readCelsius();
#endif
if (isnan(Input) || Input < 20 || Input > 95) {
failedReadingLastValue = (float) Input;
failedReadingCount++;
temperatureSensorError = true;
}
else {
temperatureSensorError = false;
}
}