mirror of
https://github.com/esphome/esphome.git
synced 2025-01-12 07:33:19 +01:00
[midea] Use std clamp instead of min max
This commit is contained in:
parent
196ea2eb99
commit
adcfdc9e4c
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue