only publish height if it has changed

This commit is contained in:
Samuel Sieb
2023-09-16 19:36:12 -07:00
parent be43d1c96f
commit 680b52de09

View File

@@ -55,9 +55,11 @@ void Desky::loop() {
break;
case 3:
value = (high_byte << 8) + c;
this->current_pos_ = value;
if (this->height_sensor_ != nullptr)
this->height_sensor_->publish_state(value);
if (this->current_pos_ != value) {
this->current_pos_ = value;
if (this->height_sensor_ != nullptr)
this->height_sensor_->publish_state(value);
}
state = 0;
break;
}