From 2717f4a8e60bccc5979a1751c69beee9beebf4f67124cae95c417e6ac6b1134d Mon Sep 17 00:00:00 2001 From: localhorst Date: Wed, 25 Dec 2024 17:26:26 +0100 Subject: [PATCH] more contro fault states --- README.md | 17 +++++++++-------- main/control.c | 6 +++--- main/control.h | 3 ++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5e80aad..bf80127 100644 --- a/README.md +++ b/README.md @@ -131,14 +131,15 @@ wifi_rssi -63 ##### Control Loop - control_state -| Enum eControlState in [control.h](main/control.h) | Value | Description | -|---------------------------------------------------|-------|-----------------------| -| CONTROL_STARTING | 0 | | -| CONTROL_HEATING | 1 | Burner running | -| CONTROL_OUTDOOR_TOO_WARM | 2 | Heating not needed | -| CONTROL_RETURN_FLOW_TOO_WARM | 3 | Heating not needed | -| CONTROL_BURNER_FAULT | 4 | Burner reported fault | -| CONTROL_FAULT | 5 | Unable to control | +| Enum eControlState in [control.h](main/control.h) | Value | Description | +|---------------------------------------------------|-------|------------------------------------| +| CONTROL_STARTING | 0 | | +| CONTROL_HEATING | 1 | Burner running | +| CONTROL_OUTDOOR_TOO_WARM | 2 | Heating not needed | +| CONTROL_RETURN_FLOW_TOO_WARM | 3 | Heating not needed | +| CONTROL_BURNER_FAULT | 4 | Burner reported fault | +| CONTROL_FAULT_SAFETY | 5 | Unable to control due safety fault | +| CONTROL_FAULT_SNTP | 6 | Unable to control due SNTP fault | ##### SNTP Client - sntp_state diff --git a/main/control.c b/main/control.c index 4d55b01..0806907 100644 --- a/main/control.c +++ b/main/control.c @@ -61,19 +61,19 @@ void taskControl(void *pvParameters) if (getSafetyState() != SAFETY_NO_ERROR) { ESP_LOGW(TAG, "Control not possible due to safety fault!"); - sControlState = CONTROL_FAULT; + sControlState = CONTROL_FAULT_SAFETY; continue; } if (getSntpState() != SYNC_SUCCESSFUL) { ESP_LOGW(TAG, "Control not possible due to sntp fault!"); - sControlState = CONTROL_FAULT; + sControlState = CONTROL_FAULT_SNTP; continue; } sControlTemperatureEntry currentControlEntry = getCurrentTemperatureEntry(); - ESP_LOGI(TAG, "Control Entry Hour: %i Minute: %i ChamberTemp: %lf ReturnFlowTemp: %lf", currentControlEntry.timestamp.hour, currentControlEntry.timestamp.minute, currentControlEntry.fChamberTemperature, currentControlEntry.fReturnFlowTemperature); + // ESP_LOGI(TAG, "Control Entry Hour: %i Minute: %i ChamberTemp: %lf ReturnFlowTemp: %lf", currentControlEntry.timestamp.hour, currentControlEntry.timestamp.minute, currentControlEntry.fChamberTemperature, currentControlEntry.fReturnFlowTemperature); if (bHeatingInAction == true) { diff --git a/main/control.h b/main/control.h index d62b061..d5085ee 100644 --- a/main/control.h +++ b/main/control.h @@ -10,7 +10,8 @@ typedef enum _ControlState CONTROL_OUTDOOR_TOO_WARM, CONTROL_RETURN_FLOW_TOO_WARM, CONTROL_BURNER_FAULT, - CONTROL_FAULT, + CONTROL_FAULT_SAFETY, + CONTROL_FAULT_SNTP, } eControlState; typedef enum _ControlWeekday