mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
[code-quality] fix clang-tidy sprinkler (#7222)
* fix clang-tidy * fix build error * clang-tidy * clang-tidy
This commit is contained in:
parent
4b91ef5123
commit
9a9757ddeb
2 changed files with 3 additions and 3 deletions
|
@ -647,7 +647,7 @@ void Sprinkler::set_valve_run_duration(const optional<size_t> valve_number, cons
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto call = this->valve_[valve_number.value()].run_duration_number->make_call();
|
auto call = this->valve_[valve_number.value()].run_duration_number->make_call();
|
||||||
if (this->valve_[valve_number.value()].run_duration_number->traits.get_unit_of_measurement() == min_str) {
|
if (this->valve_[valve_number.value()].run_duration_number->traits.get_unit_of_measurement() == MIN_STR) {
|
||||||
call.set_value(run_duration.value() / 60.0);
|
call.set_value(run_duration.value() / 60.0);
|
||||||
} else {
|
} else {
|
||||||
call.set_value(run_duration.value());
|
call.set_value(run_duration.value());
|
||||||
|
@ -729,7 +729,7 @@ uint32_t Sprinkler::valve_run_duration(const size_t valve_number) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (this->valve_[valve_number].run_duration_number != nullptr) {
|
if (this->valve_[valve_number].run_duration_number != nullptr) {
|
||||||
if (this->valve_[valve_number].run_duration_number->traits.get_unit_of_measurement() == min_str) {
|
if (this->valve_[valve_number].run_duration_number->traits.get_unit_of_measurement() == MIN_STR) {
|
||||||
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state * 60));
|
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state * 60));
|
||||||
} else {
|
} else {
|
||||||
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state));
|
return static_cast<uint32_t>(roundf(this->valve_[valve_number].run_duration_number->state));
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace sprinkler {
|
namespace sprinkler {
|
||||||
|
|
||||||
const std::string min_str = "min";
|
const std::string MIN_STR = "min";
|
||||||
|
|
||||||
enum SprinklerState : uint8_t {
|
enum SprinklerState : uint8_t {
|
||||||
// NOTE: these states are used by both SprinklerValveOperator and Sprinkler (the controller)!
|
// NOTE: these states are used by both SprinklerValveOperator and Sprinkler (the controller)!
|
||||||
|
|
Loading…
Reference in a new issue