ExpressLRS - Fix an edge-case when a receiver can have both of
it's ISR flags set. This has not been observed on the bench but is more of a safeguard so that the task doesn't stall and can decide what to do.
This commit is contained in:
parent
882e216f8a
commit
3c5a5728b2
|
@ -445,7 +445,9 @@ uint8_t sx127xGetIrqReason(void)
|
||||||
{
|
{
|
||||||
uint8_t irqFlags = sx127xGetIrqFlags();
|
uint8_t irqFlags = sx127xGetIrqFlags();
|
||||||
sx127xClearIrqFlags();
|
sx127xClearIrqFlags();
|
||||||
if ((irqFlags & SX127X_CLEAR_IRQ_FLAG_TX_DONE)) {
|
if ((irqFlags & SX127X_CLEAR_IRQ_FLAG_TX_DONE) && (irqFlags & SX127X_CLEAR_IRQ_FLAG_RX_DONE)) {
|
||||||
|
return 3;
|
||||||
|
} else if ((irqFlags & SX127X_CLEAR_IRQ_FLAG_TX_DONE)) {
|
||||||
return 2;
|
return 2;
|
||||||
} else if ((irqFlags & SX127X_CLEAR_IRQ_FLAG_RX_DONE)) {
|
} else if ((irqFlags & SX127X_CLEAR_IRQ_FLAG_RX_DONE)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -418,8 +418,11 @@ void sx1280ClearIrqStatus(const uint16_t irqMask)
|
||||||
uint8_t sx1280GetIrqReason(void)
|
uint8_t sx1280GetIrqReason(void)
|
||||||
{
|
{
|
||||||
uint16_t irqStatus = sx1280GetIrqStatus();
|
uint16_t irqStatus = sx1280GetIrqStatus();
|
||||||
|
|
||||||
sx1280ClearIrqStatus(SX1280_IRQ_RADIO_ALL);
|
sx1280ClearIrqStatus(SX1280_IRQ_RADIO_ALL);
|
||||||
if ((irqStatus & SX1280_IRQ_TX_DONE)) {
|
if ((irqStatus & SX1280_IRQ_TX_DONE) && (irqStatus & SX1280_IRQ_RX_DONE)) {
|
||||||
|
return 3;
|
||||||
|
} else if ((irqStatus & SX1280_IRQ_TX_DONE)) {
|
||||||
return 2;
|
return 2;
|
||||||
} else if ((irqStatus & SX1280_IRQ_RX_DONE)) {
|
} else if ((irqStatus & SX1280_IRQ_RX_DONE)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -1073,7 +1073,9 @@ rx_spi_received_e expressLrsDataReceived(uint8_t *payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t irqReason = receiver.rxISR(&isrTimeStampUs);
|
uint8_t irqReason = receiver.rxISR(&isrTimeStampUs);
|
||||||
if (irqReason == ELRS_DIO_TX_DONE) {
|
if (irqReason == ELRS_DIO_RX_AND_TX_DONE) {
|
||||||
|
startReceiving();
|
||||||
|
} else if (irqReason == ELRS_DIO_TX_DONE) {
|
||||||
startReceiving();
|
startReceiving();
|
||||||
} else if (irqReason == ELRS_DIO_RX_DONE) {
|
} else if (irqReason == ELRS_DIO_RX_DONE) {
|
||||||
result = processRFPacket(payload, isrTimeStampUs);
|
result = processRFPacket(payload, isrTimeStampUs);
|
||||||
|
|
|
@ -33,7 +33,8 @@ typedef enum {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ELRS_DIO_UNKNOWN = 0,
|
ELRS_DIO_UNKNOWN = 0,
|
||||||
ELRS_DIO_RX_DONE = 1,
|
ELRS_DIO_RX_DONE = 1,
|
||||||
ELRS_DIO_TX_DONE = 2
|
ELRS_DIO_TX_DONE = 2,
|
||||||
|
ELRS_DIO_RX_AND_TX_DONE = 3,
|
||||||
} dioReason_e;
|
} dioReason_e;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
Loading…
Reference in New Issue