Files
MeshCore-Solo/src/helpers/radiolib/CustomSX1276Wrapper.h
T
JakubandClaude Opus 5.5 22eba3c244 fix(radio): keep the radio serviced while an e-ink refresh blocks the loop
GxEPD2 polls the panel's BUSY pin for the whole refresh (up to ~1-2s),
stalling the main loop. A TX finishing in that window left the SX126x in
standby -- deaf -- until the refresh ended; packets received meanwhile could
be lost (only the latest is readable, and a later CRC failure rejects a good
one still pending). Hook GxEPD2's busy callback to finish TX / drain RX into
a small staging queue and re-arm right away, without touching dispatch/UI.
Wired only where the display driver supports it (GxEPD2: the two e-ink Solo
boards); OLED and sim builds are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 15:21:38 +02:00

37 lines
1.2 KiB
C++

#pragma once
#include "CustomSX1276.h"
#include "RadioLibWrappers.h"
#ifndef USE_SX1276
#define USE_SX1276
#endif
class CustomSX1276Wrapper : public RadioLibWrapper {
public:
CustomSX1276Wrapper(CustomSX1276& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
void setParams(float freq, float bw, uint8_t sf, uint8_t cr) override {
((CustomSX1276 *)_radio)->setFrequency(freq);
((CustomSX1276 *)_radio)->setSpreadingFactor(sf);
((CustomSX1276 *)_radio)->setBandwidth(bw);
((CustomSX1276 *)_radio)->setCodingRate(cr);
updatePreamble(sf);
}
bool isReceivingPacket() override {
return ((CustomSX1276 *)_radio)->isReceiving();
}
float getCurrentRSSI() override {
return ((CustomSX1276 *)_radio)->getRSSI(false);
}
float readLiveRSSI() const override { return ((CustomSX1276 *)_radio)->getRSSI(); }
float readLiveSNR() const override { return ((CustomSX1276 *)_radio)->getSNR(); }
float packetScore(float snr, int packet_len) override {
int sf = ((CustomSX1276 *)_radio)->spreadingFactor;
return packetScoreInt(snr, sf, packet_len);
}
uint8_t getSpreadingFactor() const override { return ((CustomSX1276 *)_radio)->spreadingFactor; }
};