mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
use vector in SendCommand
This commit is contained in:
parent
636e30bef6
commit
ce44dd9b1b
3 changed files with 6 additions and 6 deletions
|
@ -197,7 +197,7 @@ optional<SendCommand> EbusSensorBase::prepare_command() {
|
|||
|
||||
if (this->send_poll_) {
|
||||
command = SendCommand( //
|
||||
this->parent_->get_primary_address(), this->address_, this->command_, this->payload_.size(), &this->payload_[0]);
|
||||
this->parent_->get_primary_address(), this->address_, this->command_, this->payload_);
|
||||
}
|
||||
return command;
|
||||
}
|
||||
|
|
|
@ -104,15 +104,15 @@ bool Telegram::is_request_valid() {
|
|||
|
||||
SendCommand::SendCommand() { this->state_ = TelegramState::endCompleted; }
|
||||
|
||||
SendCommand::SendCommand(uint8_t qq, uint8_t zz, uint16_t command, uint8_t nn, uint8_t *data) {
|
||||
SendCommand::SendCommand(uint8_t qq, uint8_t zz, uint16_t command, std::vector<uint8_t> &data) {
|
||||
this->state_ = TelegramState::waitForSend;
|
||||
this->push_req_data(qq);
|
||||
this->push_req_data(zz);
|
||||
this->push_req_data(command >> 8);
|
||||
this->push_req_data(command & 0xFF);
|
||||
this->push_req_data(nn);
|
||||
for (int i = 0; i < nn; i++) {
|
||||
this->push_req_data(data[i]);
|
||||
this->push_req_data(data.size());
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
this->push_req_data(data.at(i));
|
||||
}
|
||||
this->push_req_data(this->request_rolling_crc_);
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ class Telegram : public TelegramBase {
|
|||
class SendCommand : public TelegramBase {
|
||||
public:
|
||||
SendCommand();
|
||||
SendCommand(uint8_t qq, uint8_t zz, uint16_t command, uint8_t nn, uint8_t *data);
|
||||
SendCommand(uint8_t qq, uint8_t zz, uint16_t command, std::vector<uint8_t> &data);
|
||||
bool can_retry(int8_t max_tries);
|
||||
uint8_t get_crc();
|
||||
|
||||
|
|
Loading…
Reference in a new issue