[ld6002b] Brace the entity lookup chains

This commit is contained in:
J. Nick Koston
2026-10-16 12:19:39 -10:00
parent 3db32a284c
commit afa42646fe
+20 -17
View File
@@ -1372,26 +1372,27 @@ void LD6002BComponent::wake_() {
void LD6002BComponent::set_number_value(number::Number *entity, float value) {
// Found by pointer, so the entities share one generated class instead of storing a type each
NumberType type;
if (entity == this->hold_delay_number_)
if (entity == this->hold_delay_number_) {
type = NumberType::HOLD_DELAY;
else if (entity == this->z_min_number_)
} else if (entity == this->z_min_number_) {
type = NumberType::Z_MIN;
else if (entity == this->z_max_number_)
} else if (entity == this->z_max_number_) {
type = NumberType::Z_MAX;
else if (entity == this->low_power_sleep_number_)
} else if (entity == this->low_power_sleep_number_) {
type = NumberType::LOW_POWER_SLEEP;
else if (entity == this->area_x_min_number_)
} else if (entity == this->area_x_min_number_) {
type = NumberType::AREA_X_MIN;
else if (entity == this->area_x_max_number_)
} else if (entity == this->area_x_max_number_) {
type = NumberType::AREA_X_MAX;
else if (entity == this->area_y_min_number_)
} else if (entity == this->area_y_min_number_) {
type = NumberType::AREA_Y_MIN;
else if (entity == this->area_y_max_number_)
} else if (entity == this->area_y_max_number_) {
type = NumberType::AREA_Y_MAX;
else if (entity == this->area_z_min_number_)
} else if (entity == this->area_z_min_number_) {
type = NumberType::AREA_Z_MIN;
else // Only registered entities call this, so the last one needs no compare
} else { // Only registered entities call this, so the last one needs no compare
type = NumberType::AREA_Z_MAX;
}
switch (type) {
case NumberType::HOLD_DELAY: {
uint32_t delay = static_cast<uint32_t>(value);
@@ -1447,14 +1448,15 @@ void LD6002BComponent::set_number_value(number::Number *entity, float value) {
void LD6002BComponent::set_select_value(select::Select *entity, size_t index) {
// Found by pointer, so the entities share one generated class instead of storing a type each
SelectType type;
if (entity == this->sensitivity_select_)
if (entity == this->sensitivity_select_) {
type = SelectType::SENSITIVITY;
else if (entity == this->trigger_speed_select_)
} else if (entity == this->trigger_speed_select_) {
type = SelectType::TRIGGER_SPEED;
else if (entity == this->installation_select_)
} else if (entity == this->installation_select_) {
type = SelectType::INSTALLATION_MODE;
else // Only registered entities call this, so the last one needs no compare
} else { // Only registered entities call this, so the last one needs no compare
type = SelectType::AREA_ID;
}
switch (type) {
case SelectType::SENSITIVITY:
if (index == 0) {
@@ -1821,12 +1823,13 @@ void LD6002BComponent::clear_target_state_() {
void LD6002BComponent::set_switch_state(switch_::Switch *entity, bool state) {
// Found by pointer, so the entities share one generated class instead of storing a type each
SwitchType type;
if (entity == this->low_power_switch_)
if (entity == this->low_power_switch_) {
type = SwitchType::LOW_POWER;
else if (entity == this->point_cloud_switch_)
} else if (entity == this->point_cloud_switch_) {
type = SwitchType::POINT_CLOUD;
else // Only registered entities call this, so the last one needs no compare
} else { // Only registered entities call this, so the last one needs no compare
type = SwitchType::TARGET_DISPLAY;
}
switch (type) {
case SwitchType::LOW_POWER:
this->low_power_enabled_ = state;