simplified the calls

This commit is contained in:
overkillfpv
2026-03-08 05:37:49 +11:00
parent 6fd8c28522
commit a434f9eff5
3 changed files with 4 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ public:
void onSendFinished() override {
RadioLibWrapper::onSendFinished();
_radio->setPreambleLength(getSpreadingFactor() <= 8 ? 32 : 16); // overcomes weird issues with small and big pkts
_radio->setPreambleLength(preambleLengthForSF(getSpreadingFactor())); // overcomes weird issues with small and big pkts
}
float getLastRSSI() const override { return ((CustomLR1110 *)_radio)->getRSSI(); }

View File

@@ -27,7 +27,7 @@ void setFlag(void) {
void RadioLibWrapper::begin() {
_radio->setPacketReceivedAction(setFlag); // this is also SentComplete interrupt
_preamble_sf = getSpreadingFactor();
_radio->setPreambleLength(_preamble_sf <= 8 ? 32 : 16); // longer preamble for lower SF improves reliability
_radio->setPreambleLength(preambleLengthForSF(_preamble_sf)); // longer preamble for lower SF improves reliability
state = STATE_IDLE;
if (_board->getStartupReason() == BD_STARTUP_RX_PACKET) { // received a LoRa packet (while in deep sleep)
@@ -147,7 +147,7 @@ bool RadioLibWrapper::startSendRaw(const uint8_t* bytes, int len) {
uint8_t sf = getSpreadingFactor();
if (sf != _preamble_sf) {
_preamble_sf = sf;
_radio->setPreambleLength(sf <= 8 ? 32 : 16); // update preamble when SF has changed
_radio->setPreambleLength(preambleLengthForSF(sf)); // update preamble when SF has changed
}
int err = _radio->startTransmit((uint8_t *) bytes, len);
if (err == RADIOLIB_ERR_NONE) {

View File

@@ -40,6 +40,7 @@ public:
virtual float getCurrentRSSI() =0;
virtual uint8_t getSpreadingFactor() const { return LORA_SF; }
static uint16_t preambleLengthForSF(uint8_t sf) { return sf <= 8 ? 32 : 16; }
int getNoiseFloor() const override { return _noise_floor; }
void triggerNoiseFloorCalibrate(int threshold) override;