Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

lib/lora: Fix manual add of channels 64-71 #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/lora/mac/region/RegionAU915.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,8 @@ LoRaMacStatus_t RegionAU915ChannelManualAdd( ChannelAddParams_t* channelAdd )
return LORAMAC_STATUS_PARAMETER_INVALID;
}

// Validate the datarate range for min: must be DR_0
if( channelAdd->NewChannel->DrRange.Fields.Min != DR_0 )
// Validate the datarate range for min: must be DR_0 for channels 0-63
if( id < 64 && channelAdd->NewChannel->DrRange.Fields.Min != DR_0 )
{
drInvalid = true;
}
Expand All @@ -852,6 +852,12 @@ LoRaMacStatus_t RegionAU915ChannelManualAdd( ChannelAddParams_t* channelAdd )
drInvalid = true;
}

// Sanity check that Min is not greater then Max
if (channelAdd->NewChannel->DrRange.Fields.Min > channelAdd->NewChannel->DrRange.Fields.Max)
{
drInvalid = true;
}

// Check frequency
if( ( channelAdd->NewChannel->Frequency < 915000000 ) || ( channelAdd->NewChannel->Frequency > 928000000 ) )
{
Expand Down
10 changes: 8 additions & 2 deletions lib/lora/mac/region/RegionUS915.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,8 @@ LoRaMacStatus_t RegionUS915ChannelManualAdd( ChannelAddParams_t* channelAdd )
return LORAMAC_STATUS_PARAMETER_INVALID;
}

// Validate the datarate range for min: must be DR_0
if( channelAdd->NewChannel->DrRange.Fields.Min != DR_0 )
// Validate the datarate range for min: must be DR_0 for channels 0-63
if( id < 64 && channelAdd->NewChannel->DrRange.Fields.Min != DR_0 )
{
drInvalid = true;
}
Expand All @@ -860,6 +860,12 @@ LoRaMacStatus_t RegionUS915ChannelManualAdd( ChannelAddParams_t* channelAdd )
drInvalid = true;
}

// Sanity check that Min is not greater then Max
if (channelAdd->NewChannel->DrRange.Fields.Min > channelAdd->NewChannel->DrRange.Fields.Max)
{
drInvalid = true;
}

// Check frequency
if( ( channelAdd->NewChannel->Frequency < 902000000 ) || ( channelAdd->NewChannel->Frequency > 928000000 ) )
{
Expand Down