From 10f9645580d890be641933b57ffdf5a9a5f2ed0d27680273d08e823000e8bf2b Mon Sep 17 00:00:00 2001 From: localhorst Date: Sat, 10 Jan 2026 11:39:37 +0100 Subject: [PATCH] Unchecked gpio_config returns --- main/inputs.c | 7 ++++++- main/outputs.c | 23 ++++++++++++++++++++--- main/sntp.c | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/main/inputs.c b/main/inputs.c index ad6be27..93b2adf 100644 --- a/main/inputs.c +++ b/main/inputs.c @@ -49,7 +49,12 @@ void initInputs(void) .intr_type = GPIO_INTR_DISABLE // Disable interrupts }; - gpio_config(&ioConfBurnerFault); + esp_err_t ret = gpio_config(&ioConfBurnerFault); + if (ret != ESP_OK) + { + ESP_LOGE(TAG, "GPIO config failed: %s", esp_err_to_name(ret)); + return; + } xMutexAccessInputs = xSemaphoreCreateRecursiveMutex(); if (xMutexAccessInputs == NULL) diff --git a/main/outputs.c b/main/outputs.c index c96ff41..6644413 100644 --- a/main/outputs.c +++ b/main/outputs.c @@ -41,9 +41,26 @@ void initOutputs(void) .intr_type = GPIO_INTR_DISABLE // Disable interrupts }; - gpio_config(&ioConfCirculationPump); - gpio_config(&ioConfBurner); - gpio_config(&ioConfSafetyContact); + esp_err_t ret = gpio_config(&ioConfCirculationPump); + if (ret != ESP_OK) + { + ESP_LOGE(TAG, "GPIO config failed: %s", esp_err_to_name(ret)); + return; + } + + ret = gpio_config(&ioConfBurner); + if (ret != ESP_OK) + { + ESP_LOGE(TAG, "GPIO config failed: %s", esp_err_to_name(ret)); + return; + } + + ret = gpio_config(&ioConfSafetyContact); + if (ret != ESP_OK) + { + ESP_LOGE(TAG, "GPIO config failed: %s", esp_err_to_name(ret)); + return; + } xMutexAccessOutputs = xSemaphoreCreateRecursiveMutex(); if (xMutexAccessOutputs == NULL) diff --git a/main/sntp.c b/main/sntp.c index 638bfa4..fab2d6f 100644 --- a/main/sntp.c +++ b/main/sntp.c @@ -6,7 +6,7 @@ #include "sntp.h" static const char *TAG = "smart-oil-heater-control-system-sntp"; -static eSntpState sntpState = SYNC_NOT_STARTED; +static volatile eSntpState sntpState = SYNC_NOT_STARTED; void time_sync_notification_cb(struct timeval *tv); void initSntp(void)