[modbus] More clean-up (#7921)

This commit is contained in:
Keith Burzinski 2024-12-05 20:41:53 -06:00 committed by GitHub
parent b0e3ac01e8
commit 749a5e3348
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -152,9 +152,9 @@ void ModbusController::on_modbus_read_registers(uint8_t function_code, uint16_t
}
SensorSet ModbusController::find_sensors_(ModbusRegisterType register_type, uint16_t start_address) const {
auto reg_it = find_if(begin(this->register_ranges_), end(this->register_ranges_), [=](RegisterRange const &r) {
return (r.start_address == start_address && r.register_type == register_type);
});
auto reg_it = std::find_if(
std::begin(this->register_ranges_), std::end(this->register_ranges_),
[=](RegisterRange const &r) { return (r.start_address == start_address && r.register_type == register_type); });
if (reg_it == this->register_ranges_.end()) {
ESP_LOGE(TAG, "No matching range for sensor found - start_address : 0x%X", start_address);
@ -375,12 +375,12 @@ void ModbusController::loop() {
if (!this->incoming_queue_.empty()) {
auto &message = this->incoming_queue_.front();
if (message != nullptr)
process_modbus_data_(message.get());
this->process_modbus_data_(message.get());
this->incoming_queue_.pop();
} else {
// all messages processed send pending commands
send_next_command_();
this->send_next_command_();
}
}

View File

@ -97,7 +97,7 @@ void ModbusSwitch::write_state(bool state) {
}
}
this->parent_->queue_command(cmd);
publish_state(state);
this->publish_state(state);
}
// ModbusSwitch end
} // namespace modbus_controller