diff --git a/esphome/components/mcp4461/output/mcp4461_output.h b/esphome/components/mcp4461/output/mcp4461_output.h index 4ca98e2533..a32509cac1 100644 --- a/esphome/components/mcp4461/output/mcp4461_output.h +++ b/esphome/components/mcp4461/output/mcp4461_output.h @@ -18,9 +18,10 @@ class Mcp4461Wiper : public output::FloatOutput { terminal_a_(terminal_a), terminal_b_(terminal_b), terminal_w_(terminal_w) { + uint8_t wiper_idx = static_cast(wiper); // update wiper connection state - if (!enable && wiper < 4) { - parent->reg_[wiper].enabled = false; + if (!enable && wiper_idx < 4) { + parent->reg_[wiper_idx].enabled = false; parent->disable_terminal(wiper, 'h'); } if (!terminal_a && wiper < 4)