diff --git a/components/tc_bus/tc_bus.cpp b/components/tc_bus/tc_bus.cpp index f20d064..9bda37e 100644 --- a/components/tc_bus/tc_bus.cpp +++ b/components/tc_bus/tc_bus.cpp @@ -633,23 +633,23 @@ namespace esphome bool is_long = (command > 0xFFFF); CommandData cmd_data = parseCommand(command, is_long); - enqueue_command(cmd_data, wait_duration); + send_command(cmd_data, wait_duration); } void TCBusComponent::send_command(uint32_t command, bool is_long, uint32_t wait_duration) { CommandData cmd_data = parseCommand(command, is_long); - enqueue_command(cmd_data, wait_duration); + send_command(cmd_data, wait_duration); } void TCBusComponent::send_command(CommandType type, uint8_t address, uint32_t payload, uint32_t serial_number, uint32_t wait_duration) { - CommandData cmd_data{}; - cmd_data.type = type; - cmd_data.address = address; - cmd_data.payload = payload; - cmd_data.serial_number = serial_number; + CommandData cmd_data = buildCommand(type, address, payload, serial_number); + send_command(cmd_data, wait_duration); + } + void TCBusComponent::send_command(CommandData cmd_data, uint32_t wait_duration) + { enqueue_command(cmd_data, wait_duration); } diff --git a/components/tc_bus/tc_bus.h b/components/tc_bus/tc_bus.h index 1fa33c0..32d27fa 100644 --- a/components/tc_bus/tc_bus.h +++ b/components/tc_bus/tc_bus.h @@ -136,7 +136,7 @@ namespace esphome void send_command(uint32_t command, uint32_t wait_duration = 200); void send_command(uint32_t command, bool is_long, uint32_t wait_duration = 200); void send_command(CommandType type, uint8_t address = 0, uint32_t payload = 0, uint32_t serial_number = 0, uint32_t wait_duration = 200); - + void send_command(CommandData cmd_data, uint32_t wait_duration = 200) void process_command_queue(); void enqueue_command(CommandData cmd_data, uint32_t wait_duration = 200); void transmit_command(CommandData cmd_data);