AnsweredAssumed Answered

LRWN V1.1.0 LoRaMac.c Bug

Question asked by segal.ron on Apr 3, 2017

In function OnMacStateCheckTimerEvent there is a line:

LoRaMacParams.ChannelsDatarate = MAX( LoRaMacParams.ChannelsDatarate - 1, getPhy.Param.Value );

 

The problem is that LoRaMacParams.ChannelsDatarate is an unsigned 8 bit integer that can take a value of 0, i.e. DR_0. So 0 - 1 results in an illegal value.  Needs a test for zero.

E.g. if (LoRaMacParams.ChannelsDatarate == 0) {

          LoRaMacParams.ChannelsDatarate = getPhy.Param.Value;

        }

        else {

             LoRaMacParams.ChannelsDatarate = MAX( LoRaMacParams.ChannelsDatarate - 1, getPhy.Param.Value );

         }

 

Cheers

Ron

Outcomes