From 5d58b135b1e90abb2dfe344eb99480dd0c26f51a Mon Sep 17 00:00:00 2001 From: Oliver Kleinecke Date: Fri, 7 Feb 2025 11:46:01 +0100 Subject: [PATCH] Update mcp4461_output.cpp --- esphome/components/mcp4461/output/mcp4461_output.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/esphome/components/mcp4461/output/mcp4461_output.cpp b/esphome/components/mcp4461/output/mcp4461_output.cpp index c315992db7..442759f0a8 100644 --- a/esphome/components/mcp4461/output/mcp4461_output.cpp +++ b/esphome/components/mcp4461/output/mcp4461_output.cpp @@ -78,6 +78,10 @@ void Mcp4461Wiper::enable_wiper() { } void Mcp4461Wiper::disable_wiper() { + if (this->parent_->is_failed()) { + ESP_LOGW(TAG, "Parent MCP4461 component has failed! Aborting"); + return; + } uint8_t wiper_idx = static_cast(this->wiper_); if (wiper_idx > 3) { ESP_LOGW(TAG, "Cannot disable nonvolatile wiper %" PRIu8 " !", wiper_idx); @@ -117,6 +121,10 @@ void Mcp4461Wiper::decrease_wiper() { } void Mcp4461Wiper::enable_terminal(char terminal) { + if (this->parent_->is_failed()) { + ESP_LOGW(TAG, "Parent MCP4461 component has failed! Aborting"); + return; + } uint8_t wiper_idx = static_cast(this->wiper_); if (wiper_idx > 3) { ESP_LOGW(TAG, "Cannot get/set terminals nonvolatile wiper %" PRIu8 " !", wiper_idx); @@ -126,6 +134,10 @@ void Mcp4461Wiper::enable_terminal(char terminal) { } void Mcp4461Wiper::disable_terminal(char terminal) { + if (this->parent_->is_failed()) { + ESP_LOGW(TAG, "Parent MCP4461 component has failed! Aborting"); + return; + } uint8_t wiper_idx = static_cast(this->wiper_); if (wiper_idx > 3) { ESP_LOGW(TAG, "Cannot get/set terminals for nonvolatile wiper %" PRIu8 " !", wiper_idx);