fixes bugs introduced in last commit

This commit is contained in:
NP v/d Spek 2024-11-20 18:24:05 +01:00
parent 535c8dd70f
commit 55c361ec67
2 changed files with 49 additions and 50 deletions

View file

@ -425,8 +425,8 @@ void ESPNowComponent::on_data_sent(const uint8_t *mac_addr, esp_now_send_status_
/* ESPNowProtocol ********************************************************************** */
bool ESPNowProtocol::send(uint64_t peer, const uint8_t *data, uint8_t len, uint8_t command) {
if (peer == 0x0) {
peer = this->get_keeper();
if (peer == 0x0 && this->parent_ != nullptr) {
peer = this->parent_->get_keeper();
}
ESPNowPacket packet(peer, data, len, this->get_protocol_id(), command); // NOLINT

View file

@ -260,9 +260,7 @@ class ESPNowComponent : public Component {
void set_retries(uint8_t value) { this->retries_ = value; }
void set_pairing_protocol(ESPNowProtocol *pairing_protocol) { this->pairing_protocol_ = pairing_protocol; }
void set_keeper(uint64_t keeper) { this->keeper_ = keeper; }
} uint64_t get_keeper() {
return this->keeper_;
}
uint64_t get_keeper() { return this->keeper_; }
uint64_t get_own_peer_address() { return this->own_peer_address_; }
void setup() override;
@ -304,6 +302,7 @@ uint64_t own_peer_address_{0};
uint8_t wifi_channel_{0};
uint32_t conformation_timeout_{5000};
uint8_t retries_{5};
uint64_t keeper_{0};
bool auto_add_peer_{false};
bool use_sent_check_{true};