ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
gate_config_number.cpp
Go to the documentation of this file.
3#include "esphome/core/log.h"
4
5ESPHOME_LOG_TAG(TAG, "ld2420.number");
6
7namespace esphome::ld2420 {
8
9void LD2420MinDistanceNumber::control(float min_gate) {
10 if ((uint16_t) min_gate > this->parent_->new_config.max_gate) {
11 min_gate = this->parent_->get_min_gate_distance_value();
12 } else {
13 this->parent_->new_config.min_gate = (uint16_t) min_gate;
14 }
15 this->publish_state(min_gate);
16}
17
19 if ((uint16_t) max_gate < this->parent_->new_config.min_gate) {
20 max_gate = this->parent_->get_max_gate_distance_value();
21 } else {
22 this->parent_->new_config.max_gate = (uint16_t) max_gate;
23 }
24 this->publish_state(max_gate);
25}
26
27void LD2420GateSelectNumber::control(float gate_select) {
28 const uint8_t gate = (uint8_t) gate_select;
29 this->publish_state(gate_select);
30 this->parent_->publish_gate_move_threshold(gate);
31 this->parent_->publish_gate_still_threshold(gate);
32}
33
34} // namespace esphome::ld2420
void control(float gate_select) override
void publish_state(float state)
Definition number.cpp:20
ESPHOME_LOG_TAG(TAG, "ld2420.number")