mirror of
https://github.com/esphome/esphome.git
synced 2024-11-15 03:28:12 +01:00
wip checking crash issue
This commit is contained in:
parent
e190af38ba
commit
95e0d0219d
2 changed files with 8 additions and 5 deletions
|
@ -53,8 +53,10 @@ ESPNowPackage::ESPNowPackage(const uint64_t mac_address, const std::vector<uint8
|
|||
}
|
||||
|
||||
ESPNowPackage::ESPNowPackage(const uint64_t mac_address, const uint8_t *data, size_t len) {
|
||||
this->data_.resize(len);
|
||||
std::copy_n(data, len, this->data_.begin());
|
||||
this->mac_address_ = mac_address;
|
||||
this->data_.clear();
|
||||
// this->data_.insert(this->data_.begin(), len, *data)
|
||||
// std::copy_n(data, len, this->data_.begin());
|
||||
}
|
||||
|
||||
ESPNowComponent::ESPNowComponent() { global_esp_now = this; }
|
||||
|
|
|
@ -137,12 +137,13 @@ class ESPNowComponent : public Component {
|
|||
void set_wifi_channel(uint8_t channel) { this->wifi_channel_ = channel; }
|
||||
|
||||
ESPNowPackage *send_package(const uint64_t mac_address, const uint8_t *data, int len) {
|
||||
auto package = new ESPNowPackage(mac_address, data, len);
|
||||
return this->send_package(package);
|
||||
// ESPNowPackage * package = new ESPNowPackage(mac_address, data, len);
|
||||
// return this->send_package(package);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ESPNowPackage *send_package(const uint64_t mac_address, const std::vector<uint8_t> data) {
|
||||
auto package = new ESPNowPackage(mac_address, data);
|
||||
ESPNowPackage *package = new ESPNowPackage(mac_address, data);
|
||||
return this->send_package(package);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue