bugfix/static-code-analysis (#28)
The claude.ai LLM performed a static code analysis. Reviewed-on: #28 Co-authored-by: localhorst <localhorst@mosad.xyz> Co-committed-by: localhorst <localhorst@mosad.xyz>
This commit is contained in:
@ -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)
|
||||
@ -55,7 +72,17 @@ void initOutputs(void)
|
||||
|
||||
eOutput getCirculationPumpState(void)
|
||||
{
|
||||
return sCirculationPumpState;
|
||||
eOutput ret = ENABLED;
|
||||
if (xSemaphoreTakeRecursive(xMutexAccessOutputs, pdMS_TO_TICKS(5000)) == pdTRUE)
|
||||
{
|
||||
ret = sCirculationPumpState;
|
||||
xSemaphoreGiveRecursive(xMutexAccessOutputs);
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGE(TAG, "Unable to take mutex: getCirculationPumpState()");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void setCirculationPumpState(eOutput in)
|
||||
@ -70,6 +97,7 @@ void setCirculationPumpState(eOutput in)
|
||||
break;
|
||||
case DISABLED:
|
||||
gpio_set_level(uCirculationPumpGpioPin, 1U); // Switch off Circulation Pump
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -108,6 +136,7 @@ void setBurnerState(eOutput in)
|
||||
break;
|
||||
case DISABLED:
|
||||
gpio_set_level(uBurnerGpioPin, 1U); // Switch off Burner
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -146,6 +175,7 @@ void setSafetyControlState(eOutput in)
|
||||
break;
|
||||
case DISABLED:
|
||||
gpio_set_level(uSafetyContactGpioPin, 1U); // Switch off power for Burner
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user