1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-13 22:28:14 +00:00

Update esphome/components/mcp4461/mcp4461.cpp

Co-authored-by: Djordje Mandic <6750655+DjordjeMandic@users.noreply.github.com>
This commit is contained in:
Oliver Kleinecke 2025-02-20 12:37:57 +01:00 committed by GitHub
parent a5e40134c5
commit 6c63f1bc8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,7 +24,7 @@ void Mcp4461Component::begin_() {
// save WP/WL status
this->update_write_protection_status_();
for (uint8_t i = 0; i < 8; i++) {
if (this->reg_[i].initial_value.has_value()) {
if (this->reg_[i].initial_value.has_value() && std::isfinite(this->reg_[i].initial_value.value())) {
uint16_t initial_state;
initial_state = static_cast<uint16_t>(*this->reg_[i].initial_value * 256.0f);
this->write_wiper_level_(i, initial_state);