Skip to content

Commit

Permalink
backporting fix for issue #771 from LoRaMac-node
Browse files Browse the repository at this point in the history
  • Loading branch information
gasagna committed Feb 20, 2023
1 parent 6c14f83 commit 6aaee0b
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions libraries/LoraWan102/src/radio/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,22 +1158,24 @@ void RadioIrqProcess( void )

if( ( irqRegs & IRQ_RX_DONE ) == IRQ_RX_DONE )
{
//printf("rx done\r\n");
uint8_t size;
TimerStop( &RxTimeoutTimer );
SX126xGetPayload( RadioRxPayload, &size , 255 );
SX126xGetPacketStatus( &RadioPktStatus );
if( ( RadioEvents != NULL ) && ( RadioEvents->RxDone != NULL ) && ( irqRegs & IRQ_CRC_ERROR ) != IRQ_CRC_ERROR)
if( ( irqRegs & IRQ_CRC_ERROR ) == IRQ_CRC_ERROR )
{
RadioEvents->RxDone( RadioRxPayload, size, RadioPktStatus.Params.LoRa.RssiPkt, RadioPktStatus.Params.LoRa.SnrPkt );
if( ( RadioEvents != NULL ) && ( RadioEvents->RxError ) )
{
RadioEvents->RxError( );
}
}
}

if( ( irqRegs & IRQ_CRC_ERROR ) == IRQ_CRC_ERROR )
{
if( ( RadioEvents != NULL ) && ( RadioEvents->RxError ) )
else
{
RadioEvents->RxError( );
//printf("rx done\r\n");
uint8_t size;
TimerStop( &RxTimeoutTimer );
SX126xGetPayload( RadioRxPayload, &size , 255 );
SX126xGetPacketStatus( &RadioPktStatus );
if( ( RadioEvents != NULL ) && ( RadioEvents->RxDone != NULL ) && ( irqRegs & IRQ_CRC_ERROR ) != IRQ_CRC_ERROR)
{
RadioEvents->RxDone( RadioRxPayload, size, RadioPktStatus.Params.LoRa.RssiPkt, RadioPktStatus.Params.LoRa.SnrPkt );
}
}
}

Expand Down

0 comments on commit 6aaee0b

Please sign in to comment.