1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-01 00:18:18 +01:00

Update mcp4461.cpp

This commit is contained in:
Oliver Kleinecke 2025-02-05 00:52:22 +01:00 committed by GitHub
parent 1d138e5607
commit 0524e0b96f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,6 +167,10 @@ void Mcp4461Component::set_wiper_level(Mcp4461WiperIdx wiper, uint16_t value) {
ESP_LOGW(TAG, "ignoring invalid wiper level %" PRIu16 "!");
return;
}
if (!(this->reg_[wiper_idx].enabled)) {
ESP_LOGW(TAG, "writing to disabled volatile wiper %" PRIu8 " is prohibited", wiper_idx);
return static_cast<uint16_t>(0);
}
ESP_LOGV(TAG, "Setting MCP4461 wiper %" PRIu8 " to %" PRIu16 "!", wiper_idx, value);
this->reg_[wiper_idx].state = value;
this->update_ = true;