wip checking crash issue

This commit is contained in:
NP v/d Spek 2024-07-28 15:14:35 +02:00
parent e190af38ba
commit 95e0d0219d
2 changed files with 8 additions and 5 deletions

View file

@ -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; }

View file

@ -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);
}