[ld2412] Drop the unused gate index from GateThresholdNumber (#19107)

This commit is contained in:
J. Nick Koston
2026-09-16 20:38:33 +12:00
committed by GitHub
parent a5931ea20e
commit 17c5daa245
3 changed files with 4 additions and 6 deletions
+2 -2
View File
@@ -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;
};