fix: Better handle fractional setpoints

This commit is contained in:
KazWolfe
2023-10-07 18:37:34 -07:00
committed by GitHub
parent 5fab934d8c
commit 1fa581be3d

View File

@@ -1712,7 +1712,7 @@ class AirCon : public esphome::Component, public esphome::climate::Climate {
pack->body[2] = (pack->body[2] & ~AC_TEMP_TARGET_INT_PART_MASK) | (((uint8_t)(cmd->temp_target) - 8) << 3);
// дробная часть температуры
if (cmd->temp_target - (uint8_t)(cmd->temp_target) > 0) {
if (cmd->temp_target - (uint8_t)(cmd->temp_target) >= 0.5) {
pack->body[4] = (pack->body[4] | AC_TEMP_TARGET_FRAC_PART_MASK);
} else {
pack->body[4] = (pack->body[4] & ~AC_TEMP_TARGET_FRAC_PART_MASK);
@@ -3388,4 +3388,4 @@ class AirCon : public esphome::Component, public esphome::climate::Climate {
};
} // namespace aux_ac
} // namespace esphome
} // namespace esphome