ESPHome 2025.5.0
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 {
8namespace ld2420 {
9
10void LD2420TimeoutNumber::control(float timeout) {
11 this->publish_state(timeout);
12 this->parent_->new_config.timeout = timeout;
13}
14
16 if ((uint16_t) min_gate > this->parent_->new_config.max_gate) {
17 min_gate = this->parent_->get_min_gate_distance_value();
18 } else {
19 this->parent_->new_config.min_gate = (uint16_t) min_gate;
20 }
21 this->publish_state(min_gate);
22}
23
25 if ((uint16_t) max_gate < this->parent_->new_config.min_gate) {
26 max_gate = this->parent_->get_max_gate_distance_value();
27 } else {
28 this->parent_->new_config.max_gate = (uint16_t) max_gate;
29 }
30 this->publish_state(max_gate);
31}
32
33void LD2420GateSelectNumber::control(float gate_select) {
34 const uint8_t gate = (uint8_t) gate_select;
35 this->publish_state(gate_select);
36 this->parent_->publish_gate_move_threshold(gate);
37 this->parent_->publish_gate_still_threshold(gate);
38}
39
40void LD2420MoveSensFactorNumber::control(float move_factor) {
41 this->publish_state(move_factor);
42 this->parent_->gate_move_sensitivity_factor = move_factor;
43}
44
45void LD2420StillSensFactorNumber::control(float still_factor) {
46 this->publish_state(still_factor);
47 this->parent_->gate_still_sensitivity_factor = still_factor;
48}
49
51
52void LD2420MoveThresholdNumbers::control(float move_threshold) {
53 this->publish_state(move_threshold);
54 if (!this->parent_->is_gate_select()) {
55 this->parent_->new_config.move_thresh[this->gate_] = move_threshold;
56 } else {
57 this->parent_->new_config.move_thresh[this->parent_->get_gate_select_value()] = move_threshold;
58 }
59}
60
62
63void LD2420StillThresholdNumbers::control(float still_threshold) {
64 this->publish_state(still_threshold);
65 if (!this->parent_->is_gate_select()) {
66 this->parent_->new_config.still_thresh[this->gate_] = still_threshold;
67 } else {
68 this->parent_->new_config.still_thresh[this->parent_->get_gate_select_value()] = still_threshold;
69 }
70}
71
72} // namespace ld2420
73} // namespace esphome
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:9
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7