Skip to content

Commit 5216c06

Browse files
committed
Read temperature at startup only if heater has temperature sensor
1 parent 81d067d commit 5216c06

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/heater.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ APB::Heater::Mode APB::Heater::mode() const {
292292

293293
void APB::Heater::Private::loop()
294294
{
295-
if(smoothThermistor) {
296-
readTemperature();
297-
}
295+
readTemperature();
298296

299297
if(temperature.has_value() && temperature.value() < -50) {
300298
#ifdef DEBUG_HEATER_STATUS
@@ -382,6 +380,9 @@ void APB::Heater::Private::privateSetup() {
382380
}
383381

384382
void APB::Heater::Private::readTemperature() {
383+
if(!smoothThermistor) {
384+
return;
385+
}
385386
auto rawValue = analogRead(pinout->thermistor);
386387
temperature = smoothThermistor->temperature();
387388
#ifdef DEBUG_HEATER_STATUS

0 commit comments

Comments
 (0)