cancel
Showing results for 
Search instead for 
Did you mean: 

LRWN V1.1.0 LoRaMac.c Bug

ron239955_stm1_st
Associate II
Posted on April 03, 2017 at 10:55

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

0 REPLIES 0