CubeCell-Arduino icon indicating copy to clipboard operation
CubeCell-Arduino copied to clipboard

LoraWan102 - RadioEvents->RxDone callback is not supporting GFSK packets.

Open SylwBar opened this issue 2 years ago • 0 comments

Hi. In: libraries/LoraWan102/src/radio/radio.c file in RadioIrqProcess function, line 1166, there is support for reporting LoRa parameters only:

line 1166:
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 );
}

It is not supporting PACKET_TYPE_GFSK parameters reporting. My proposal is to add dedicated code for different packet type parameters:

if( ( RadioEvents != NULL ) && ( RadioEvents->RxDone != NULL ) && ( irqRegs & IRQ_CRC_ERROR ) != IRQ_CRC_ERROR)
{
    if (RadioPktStatus.packetType==PACKET_TYPE_LORA) 
       RadioEvents->RxDone( RadioRxPayload, size, RadioPktStatus.Params.LoRa.RssiPkt, RadioPktStatus.Params.LoRa.SnrPkt );
    else
       RadioEvents->RxDone( RadioRxPayload, size, RadioPktStatus.Params.Gfsk.RssiAvg, 0 );
}

This code snippet is just design idea, showing how this part could be improved.

Regards Sylwester

SylwBar avatar Jun 03 '22 20:06 SylwBar