AutoFilm-ESP32/AutoFilmESP32/temperature.cpp
2024-06-25 21:17:14 +01:00

30 lines
680 B
C++

#include "temperature.h"
void readTemperature() {
sensors.requestTemperatures();
float temperatureC = sensors.getTempCByIndex(0);
lcd.setCursor(13, 3);
lcd.write(byte(0));
if (temperatureC == DEVICE_DISCONNECTED_C) {
lcd.print("--");
} else {
lcd.print(temperatureC, 1);
lcd.print("C");
}
}
void updateTempDisplay(void* parameter) {
sensors.requestTemperatures();
float temperatureC = sensors.getTempCByIndex(0);
lcd.setCursor(13, 3);
lcd.write(byte(0));
if (temperatureC == DEVICE_DISCONNECTED_C) {
lcd.print("--");
} else {
lcd.print(temperatureC, 1);
lcd.print("C");
}
vTaskDelete(NULL); // Delete the task when done
}