mirror of
https://github.com/esphome/esphome.git
synced 2026-09-18 02:28:42 +00:00
[ld2412] Drop the unused gate index from GateThresholdNumber (#19107)
This commit is contained in:
@@ -109,14 +109,14 @@ async def to_code(config: ConfigType) -> None:
|
||||
for x in range(14):
|
||||
if gate_conf := config.get(f"gate_{x}"):
|
||||
move_config = gate_conf[CONF_MOVE_THRESHOLD]
|
||||
n = cg.new_Pvariable(move_config[CONF_ID], x)
|
||||
n = cg.new_Pvariable(move_config[CONF_ID])
|
||||
await number.register_number(
|
||||
n, move_config, min_value=0, max_value=100, step=1
|
||||
)
|
||||
await cg.register_parented(n, config[CONF_LD2412_ID])
|
||||
cg.add(LD2412_component.set_gate_move_threshold_number(x, n))
|
||||
still_config = gate_conf[CONF_STILL_THRESHOLD]
|
||||
n = cg.new_Pvariable(still_config[CONF_ID], x)
|
||||
n = cg.new_Pvariable(still_config[CONF_ID])
|
||||
await number.register_number(
|
||||
n, still_config, min_value=0, max_value=100, step=1
|
||||
)
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace esphome::ld2412 {
|
||||
|
||||
GateThresholdNumber::GateThresholdNumber(uint8_t gate) : gate_(gate) {}
|
||||
|
||||
void GateThresholdNumber::control(float value) {
|
||||
this->publish_state(value);
|
||||
this->parent_->set_gate_threshold();
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace esphome::ld2412 {
|
||||
|
||||
class GateThresholdNumber final : public number::Number, public Parented<LD2412Component> {
|
||||
public:
|
||||
GateThresholdNumber(uint8_t gate);
|
||||
// Not "= default": that makes new(p) T() zero-fill the object at every codegen site before the ctor runs.
|
||||
GateThresholdNumber() {}
|
||||
|
||||
protected:
|
||||
uint8_t gate_;
|
||||
void control(float value) override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user