[sx126x] Avoid heap allocation for packet trigger

This commit is contained in:
J. Nick Koston
2026-02-02 04:24:34 +01:00
parent 1ff2f3b6a3
commit 60b1f6a5b3
2 changed files with 3 additions and 3 deletions

View File

@@ -343,7 +343,7 @@ void SX126x::call_listeners_(const std::vector<uint8_t> &packet, float rssi, flo
for (auto &listener : this->listeners_) {
listener->on_packet(packet, rssi, snr);
}
this->packet_trigger_->trigger(packet, rssi, snr);
this->packet_trigger_.trigger(packet, rssi, snr);
}
void SX126x::loop() {

View File

@@ -97,7 +97,7 @@ class SX126x : public Component,
void configure();
SX126xError transmit_packet(const std::vector<uint8_t> &packet);
void register_listener(SX126xListener *listener) { this->listeners_.push_back(listener); }
Trigger<std::vector<uint8_t>, float, float> *get_packet_trigger() const { return this->packet_trigger_; };
Trigger<std::vector<uint8_t>, float, float> *get_packet_trigger() { return &this->packet_trigger_; }
protected:
void configure_fsk_ook_();
@@ -111,7 +111,7 @@ class SX126x : public Component,
void read_register_(uint16_t reg, uint8_t *data, uint8_t size);
void call_listeners_(const std::vector<uint8_t> &packet, float rssi, float snr);
void wait_busy_();
Trigger<std::vector<uint8_t>, float, float> *packet_trigger_{new Trigger<std::vector<uint8_t>, float, float>()};
Trigger<std::vector<uint8_t>, float, float> packet_trigger_;
std::vector<SX126xListener *> listeners_;
std::vector<uint8_t> packet_;
std::vector<uint8_t> sync_value_;