ESPHome 2026.1.0-dev
Loading...
Searching...
No Matches
gate_config_number.cpp
Go to the documentation of this file.
3#include "esphome/core/log.h"
4
5static const char *const TAG = "ld2420.number";
6
7namespace esphome::ld2420 {
8
9void LD2420TimeoutNumber::control(float timeout) {
10 this->publish_state(timeout);
11 this->parent_->new_config.timeout = timeout;
12}
13
15 if ((uint16_t) min_gate > this->parent_->new_config.max_gate) {
16 min_gate = this->parent_->get_min_gate_distance_value();
17 } else {
18 this->parent_->new_config.min_gate = (uint16_t) min_gate;
19 }
20 this->publish_state(min_gate);
21}
22
24 if ((uint16_t) max_gate < this->parent_->new_config.min_gate) {
25 max_gate = this->parent_->get_max_gate_distance_value();
26 } else {
27 this->parent_->new_config.max_gate = (uint16_t) max_gate;
28 }
29 this->publish_state(max_gate);
30}
31
32void LD2420GateSelectNumber::control(float gate_select) {
33 const uint8_t gate = (uint8_t) gate_select;
34 this->publish_state(gate_select);
35 this->parent_->publish_gate_move_threshold(gate);
36 this->parent_->publish_gate_still_threshold(gate);
37}
38
39void LD2420MoveSensFactorNumber::control(float move_factor) {
40 this->publish_state(move_factor);
41 this->parent_->gate_move_sensitivity_factor = move_factor;
42}
43
44void LD2420StillSensFactorNumber::control(float still_factor) {
45 this->publish_state(still_factor);
46 this->parent_->gate_still_sensitivity_factor = still_factor;
47}
48
50
51void LD2420MoveThresholdNumbers::control(float move_threshold) {
52 this->publish_state(move_threshold);
53 if (!this->parent_->is_gate_select()) {
54 this->parent_->new_config.move_thresh[this->gate_] = move_threshold;
55 } else {
56 this->parent_->new_config.move_thresh[this->parent_->get_gate_select_value()] = move_threshold;
57 }
58}
59
61
62void LD2420StillThresholdNumbers::control(float still_threshold) {
63 this->publish_state(still_threshold);
64 if (!this->parent_->is_gate_select()) {
65 this->parent_->new_config.still_thresh[this->gate_] = still_threshold;
66 } else {
67 this->parent_->new_config.still_thresh[this->parent_->get_gate_select_value()] = still_threshold;
68 }
69}
70
71} // namespace esphome::ld2420
void control(float gate_select) override
void control(float move_threshold) override
void control(float still_factor) override
void control(float still_threshold) override
void control(float timeout) override
void publish_state(float state)
Definition number.cpp:31