add control status

This commit is contained in:
2024-12-21 22:02:16 +01:00
parent 9abf64f9dd
commit 4ef6c8bd08
6 changed files with 95 additions and 18 deletions

View File

@ -10,7 +10,7 @@
#define PERIODIC_INTERVAL 1U // run safety checks every 1sec
static const char *TAG = "smart-oil-heater-control-system-control";
static eControlState sControlState = CONTROL_STARTING;
void taskControl(void *pvParameters);
void initControl(void)
@ -44,12 +44,14 @@ void taskControl(void *pvParameters)
if (getSafetyState() != SAFETY_NO_ERROR)
{
ESP_LOGW(TAG, "Control not possible due to safety fault!");
sControlState = CONTROL_FAULT;
continue;
}
if (getSntpState() != SYNC_SUCCESSFUL)
{
ESP_LOGW(TAG, "Control not possible due to sntp fault!");
sControlState = CONTROL_FAULT;
continue;
}
@ -58,4 +60,9 @@ void taskControl(void *pvParameters)
setBurnerState(ENABLED);
setSafetyControlState(ENABLED);
}
}
}
eControlState getControlState(void)
{
return sControlState;
}