From 28bb6f5507b68df4c92fd0398ec3e987f7fbbdc7 Mon Sep 17 00:00:00 2001 From: CptSkippy Date: Fri, 31 May 2024 08:29:11 -0700 Subject: [PATCH] Bug with undeclared numbers --- esphome/components/ld2415h/ld2415h.cpp | 34 ++++++++++++++------------ esphome/components/ld2415h/ld2415h.h | 1 - 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/esphome/components/ld2415h/ld2415h.cpp b/esphome/components/ld2415h/ld2415h.cpp index 5fc5ffc2c5..4985432d9d 100644 --- a/esphome/components/ld2415h/ld2415h.cpp +++ b/esphome/components/ld2415h/ld2415h.cpp @@ -110,6 +110,7 @@ void LD2415HComponent::loop() { } } +#ifdef USE_NUMBER void LD2415HComponent::set_min_speed_threshold(uint8_t speed) { this->min_speed_threshold_ = speed; this->update_speed_angle_sense_ = true; @@ -125,6 +126,23 @@ void LD2415HComponent::set_sensitivity(uint8_t sensitivity) { this->update_speed_angle_sense_ = true; } +void LD2415HComponent::set_vibration_correction(uint8_t correction) { + this->vibration_correction_ = correction; + this->update_anti_vib_comp_ = true; +} + +void LD2415HComponent::set_relay_trigger_duration(uint8_t duration) { + this->relay_trigger_duration_ = duration; + this->update_relay_duration_speed_ = true; +} + +void LD2415HComponent::set_relay_trigger_speed(uint8_t speed) { + this->relay_trigger_speed_ = speed; + this->update_relay_duration_speed_ = true; +} +#endif + +#ifdef USE_SELECT void LD2415HComponent::set_tracking_mode(const std::string &state) { uint8_t mode = TRACKING_MODE_STR_TO_INT.at(state); this->set_tracking_mode(mode); @@ -149,21 +167,7 @@ void LD2415HComponent::set_sample_rate(uint8_t rate) { this->sample_rate_ = rate; this->update_mode_rate_uom_ = true; } - -void LD2415HComponent::set_vibration_correction(uint8_t correction) { - this->vibration_correction_ = correction; - this->update_anti_vib_comp_ = true; -} - -void LD2415HComponent::set_relay_trigger_duration(uint8_t duration) { - this->relay_trigger_duration_ = duration; - this->update_relay_duration_speed_ = true; -} - -void LD2415HComponent::set_relay_trigger_speed(uint8_t speed) { - this->relay_trigger_speed_ = speed; - this->update_relay_duration_speed_ = true; -} +#endif void LD2415HComponent::issue_command_(const uint8_t cmd[], uint8_t size) { for (uint8_t i = 0; i < size; i++) diff --git a/esphome/components/ld2415h/ld2415h.h b/esphome/components/ld2415h/ld2415h.h index cb753f0e36..87a7f65bae 100644 --- a/esphome/components/ld2415h/ld2415h.h +++ b/esphome/components/ld2415h/ld2415h.h @@ -56,7 +56,6 @@ class LD2415HComponent : public Component, public uart::UARTDevice { void set_tracking_mode_select(select::Select *selector) { this->tracking_mode_selector_ = selector; }; #endif float get_setup_priority() const override { return setup_priority::HARDWARE; } - // void set_speed_sensor(sensor::Sensor *speed_sensor) { this->speed_sensor_ = speed_sensor; } void register_listener(LD2415HListener *listener) { this->listeners_.push_back(listener); } void set_min_speed_threshold(uint8_t speed);