improve fault handling
This commit is contained in:
parent
2717f4a8e6
commit
c50f36d8a9
@ -62,6 +62,14 @@ void taskControl(void *pvParameters)
|
||||
{
|
||||
ESP_LOGW(TAG, "Control not possible due to safety fault!");
|
||||
sControlState = CONTROL_FAULT_SAFETY;
|
||||
if (bHeatingInAction == true)
|
||||
{
|
||||
ESP_LOGI(TAG, "Control not possible due to safety fault: Disable burner");
|
||||
bHeatingInAction = false;
|
||||
setCirculationPumpState(ENABLED);
|
||||
setBurnerState(DISABLED);
|
||||
setSafetyControlState(ENABLED);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -69,6 +77,14 @@ void taskControl(void *pvParameters)
|
||||
{
|
||||
ESP_LOGW(TAG, "Control not possible due to sntp fault!");
|
||||
sControlState = CONTROL_FAULT_SNTP;
|
||||
if (bHeatingInAction == true)
|
||||
{
|
||||
ESP_LOGI(TAG, "Control not possible due to sntp fault: Disable burner");
|
||||
bHeatingInAction = false;
|
||||
setCirculationPumpState(ENABLED);
|
||||
setBurnerState(DISABLED);
|
||||
setSafetyControlState(ENABLED);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -7,7 +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 ONE_WIRE_LOOPS 4U // 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";
|
||||
@ -163,6 +163,7 @@ void taskInput(void *pvParameters)
|
||||
if (ds18x20_measure_and_read_multi(uDS18B20Pin, uOneWireAddresses, sSensorCount, fDS18B20Temps) != ESP_OK)
|
||||
{
|
||||
ESP_LOGE(TAG, "1-Wire devices read error");
|
||||
vTaskDelay(PERIODIC_INTERVAL * 100U / portTICK_PERIOD_MS); //Wait 100ms if bus error occurred
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -155,16 +155,5 @@ void getSensorSanityStates(sSensorSanityCheck *pSensorSanityChecks)
|
||||
|
||||
eSafetyState getSafetyState(void)
|
||||
{
|
||||
eSafetyState state = SAFETY_NO_ERROR;
|
||||
if (xSemaphoreTakeRecursive(xMutexAccessSafety, pdMS_TO_TICKS(5000)) == pdTRUE)
|
||||
{
|
||||
state = sSafetyState;
|
||||
xSemaphoreGiveRecursive(xMutexAccessSafety);
|
||||
}
|
||||
else
|
||||
{
|
||||
state = SAFETY_INTERNAL_ERROR;
|
||||
ESP_LOGE(TAG, "Unable to take mutex: getSafetyState()");
|
||||
}
|
||||
return state;
|
||||
return sSafetyState;
|
||||
}
|
Loading…
Reference in New Issue
Block a user