read 1-Wire again if error occurred

This commit is contained in:
Hendrik Schutter 2024-12-15 10:24:44 +01:00
parent 03fe849fec
commit 1fb4b4b0e4

View File

@ -7,6 +7,7 @@
#include "inputs.h"
#define MAX_DN18B20_SENSORS 4U
#define ONE_WIRE_LOOPS 2U // try to read the 1-Wire sensors that often
#define PERIODIC_INTERVAL 1U // read and compute the inputs every 1sec
static const char *TAG = "smart-oil-heater-control-system-inputs";
@ -157,6 +158,8 @@ void taskInput(void *pvParameters)
ESP_LOGW(TAG, "More 1-Wire devices found than expected!");
}
for (size_t iReadLoop = 0; iReadLoop < ONE_WIRE_LOOPS; iReadLoop++)
{
if (ds18x20_measure_and_read_multi(uDS18B20Pin, uOneWireAddresses, sSensorCount, fDS18B20Temps) != ESP_OK)
{
ESP_LOGE(TAG, "1-Wire devices read error");
@ -194,6 +197,8 @@ void taskInput(void *pvParameters)
break;
}
}
break;
}
}
}
xSemaphoreGiveRecursive(xMutexAccessInputs);