Skip to content

Commit

Permalink
Issue #1091 - Changed initialization location for the region. Remove …
Browse files Browse the repository at this point in the history
…verification of unknown channel plan for CN470.
  • Loading branch information
Daniel Jaeckle authored and mluis1 committed May 25, 2021
1 parent 8697eae commit 6e9b844
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
14 changes: 7 additions & 7 deletions src/mac/LoRaMac.c
Original file line number Diff line number Diff line change
Expand Up @@ -3301,6 +3301,13 @@ LoRaMacStatus_t LoRaMacInitialization( LoRaMacPrimitives_t* primitives, LoRaMacC
// Setup version
Nvm.MacGroup2.Version.Value = LORAMAC_VERSION;

InitDefaultsParams_t params;
params.Type = INIT_TYPE_DEFAULTS;
params.NvmGroup1 = &Nvm.RegionGroup1;
params.NvmGroup2 = &Nvm.RegionGroup2;
params.Bands = &RegionBands;
RegionInitDefaults( Nvm.MacGroup2.Region, &params );

// Reset to defaults
getPhy.Attribute = PHY_DUTY_CYCLE;
phyParam = RegionGetPhyParam( Nvm.MacGroup2.Region, &getPhy );
Expand Down Expand Up @@ -3389,13 +3396,6 @@ LoRaMacStatus_t LoRaMacInitialization( LoRaMacPrimitives_t* primitives, LoRaMacC
// FPort 224 is enabled by default.
Nvm.MacGroup2.IsCertPortOn = true;

InitDefaultsParams_t params;
params.Type = INIT_TYPE_DEFAULTS;
params.NvmGroup1 = &Nvm.RegionGroup1;
params.NvmGroup2 = &Nvm.RegionGroup2;
params.Bands = &RegionBands;
RegionInitDefaults( Nvm.MacGroup2.Region, &params );

ResetMacParameters( );

Nvm.MacGroup2.PublicNetwork = true;
Expand Down
12 changes: 4 additions & 8 deletions src/mac/region/RegionCN470.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,10 @@ void RegionCN470InitDefaults( InitDefaultsParams_t* params )
// Default bands
memcpy1( ( uint8_t* )RegionBands, ( uint8_t* )bands, sizeof( Band_t ) * CN470_MAX_NB_BANDS );

// Verify that a default channel plan is available
if( RegionNvmGroup2->ChannelPlan == CHANNEL_PLAN_UNKNOWN )
{
// 125 kHz channels
RegionNvmGroup2->ChannelPlan = REGION_CN470_DEFAULT_CHANNEL_PLAN;
RegionNvmGroup2->CommonJoinChannelIndex = 0;
RegionNvmGroup2->IsOtaaDevice = false;
}
// 125 kHz channels
RegionNvmGroup2->ChannelPlan = REGION_CN470_DEFAULT_CHANNEL_PLAN;
RegionNvmGroup2->CommonJoinChannelIndex = 0;
RegionNvmGroup2->IsOtaaDevice = false;

// Apply the channel plan configuration
ApplyChannelPlanConfig( RegionNvmGroup2->ChannelPlan, &ChannelPlanCtx );
Expand Down

0 comments on commit 6e9b844

Please sign in to comment.