[midea] Use std clamp instead of min max

This commit is contained in:
Djordje 2024-11-13 20:10:12 +01:00
parent 196ea2eb99
commit adcfdc9e4c

View file

@ -131,7 +131,7 @@ void AirConditioner::do_follow_me(float temperature, bool beeper) {
// Round and convert temperature to long, then clamp and convert it to uint8_t
uint8_t temp_uint8 =
static_cast<uint8_t>(std::max(0L, std::min(static_cast<long>(UINT8_MAX), std::lroundf(temperature))));
static_cast<uint8_t>(std::clamp<long>(std::lroundf(temperature), 0L, static_cast<long>(UINT8_MAX)));
ESP_LOGD(Constants::TAG, "Follow me action called with temperature: %f °C, rounded to: %u °C", temperature,
temp_uint8);