diff --git a/Config.h b/Config.h index 2869c61..80865d6 100644 --- a/Config.h +++ b/Config.h @@ -88,7 +88,7 @@ #define CSMA_CW_BANDS 4 #define CSMA_CW_MIN 0 #define CSMA_CW_PER_BAND_WINDOWS 15 - #define CSMA_BAND_1_MAX_AIRTIME 6 + #define CSMA_BAND_1_MAX_AIRTIME 7 #define CSMA_BAND_N_MIN_AIRTIME 85 int csma_slot_ms = CSMA_SLOT_MIN_MS; long difs_ms = CSMA_SIFS_MS + 2*csma_slot_ms; diff --git a/Display.h b/Display.h index 6f1f6d1..b77934b 100644 --- a/Display.h +++ b/Display.h @@ -558,7 +558,7 @@ void draw_signal_bars(int px, int py) { } #if MODEM == SX1280 - #define WF_TX_SIZE 3 + #define WF_TX_SIZE 5 #else #define WF_TX_SIZE 5 #endif diff --git a/sx128x.cpp b/sx128x.cpp index 89fb70a..cb4e7b9 100644 --- a/sx128x.cpp +++ b/sx128x.cpp @@ -107,34 +107,28 @@ bool ISR_VECT sx128x::getPacketValidity() { void ISR_VECT sx128x::onDio0Rise() { BaseType_t int_status = taskENTER_CRITICAL_FROM_ISR(); - if (sx128x_modem.getPacketValidity()) { sx128x_modem.handleDio0Rise(); } // On the SX1280, there is a bug which can cause the busy line // to remain high if a high amount of packets are received when // in continuous RX mode. This is documented as Errata 16.1 in // the SX1280 datasheet v3.2 (page 149) // Therefore, the modem is set into receive mode each time a packet is received. - sx128x_modem.receive(); + if (sx128x_modem.getPacketValidity()) { sx128x_modem.receive(); sx128x_modem.handleDio0Rise(); } + else { sx128x_modem.receive(); } + taskEXIT_CRITICAL_FROM_ISR(int_status); } void sx128x::handleDio0Rise() { - // received a packet _packetIndex = 0; - uint8_t rxbuf[2] = {0}; executeOpcodeRead(OP_RX_BUFFER_STATUS_8X, rxbuf, 2); // If implicit header mode is enabled, read packet length as payload length instead. // See SX1280 datasheet v3.2, page 92 - if (_implicitHeaderMode == 0x80) { - _rxPacketLength = _payloadLength; - } else { - _rxPacketLength = rxbuf[0]; - } + if (_implicitHeaderMode == 0x80) { _rxPacketLength = _payloadLength; } + else { _rxPacketLength = rxbuf[0]; } - if (_onReceive) { - _onReceive(_rxPacketLength); - } + if (_onReceive) { _onReceive(_rxPacketLength); } } bool sx128x::preInit() {