Skip to content

Commit cf58dcc

Browse files
authored
Merge pull request #53 from fpistm/1.4.0_update
chore: update to latest STM32CubeWL 1.4.0
2 parents 6c1e985 + d0cdfc3 commit cf58dcc

23 files changed

+734
-458
lines changed

src/STM32CubeWL/LoRaWAN/Mac/LoRaMac.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ typedef struct sLoRaMacCtx
329329
* Buffer containing the MAC layer commands
330330
*/
331331
uint8_t MacCommandsBuffer[LORA_MAC_COMMAND_MAX_LENGTH];
332+
/*
333+
* Stores the reference time at at 1st JoinReq or ReJoinReq.
334+
*
335+
* \remark Used for the BACKOFF_DC computation.
336+
*/
337+
SysTime_t TxBackoffRefTime;
338+
/*
339+
* Indicates if \ref TxBackoffRefTime must be initialized or not.
340+
* \ref TxBackoffRefTime must be initialized for 1st JoinReq or RejoinReq event.
341+
*
342+
* \remark Used for the BACKOFF_DC computation.
343+
*/
344+
bool IsFirstJoinReqTx;
332345
}LoRaMacCtx_t;
333346

334347
/*!
@@ -1076,7 +1089,7 @@ static void ProcessRadioTxDone( void )
10761089
// Update last tx done time for the current channel
10771090
txDone.Channel = MacCtx.Channel;
10781091
txDone.LastTxDoneTime = TxDoneParams.CurTime;
1079-
txDone.ElapsedTimeSinceStartUp = SysTimeSub( SysTimeGetMcuTime( ), Nvm.MacGroup2.InitializationTime );
1092+
txDone.ElapsedTimeSinceTxBackoffRefTime = SysTimeSub( SysTimeGetMcuTime( ), MacCtx.TxBackoffRefTime );
10801093
txDone.LastTxAirTime = MacCtx.TxTimeOnAir;
10811094
txDone.Joined = true;
10821095
if( Nvm.MacGroup2.NetworkActivation == ACTIVATION_TYPE_NONE )
@@ -1398,6 +1411,9 @@ static void ProcessRadioRxDone( void )
13981411
ResetMacParameters( true );
13991412
}
14001413
#endif /* LORAMAC_VERSION */
1414+
// Restarts the retransmission backoff algorithm by indicating that the next JoinReq or ReJoinReq
1415+
// is the first one.
1416+
MacCtx.IsFirstJoinReqTx = true;
14011417
}
14021418
else
14031419
{
@@ -3471,6 +3487,13 @@ static LoRaMacStatus_t SendReJoinReq( JoinReqIdentifier_t joinReqType )
34713487
break;
34723488
}
34733489

3490+
if( MacCtx.IsFirstJoinReqTx == true )
3491+
{
3492+
MacCtx.IsFirstJoinReqTx = false;
3493+
// Store the current time as reference time for the retransmission backoff algorithm
3494+
MacCtx.TxBackoffRefTime = SysTimeGetMcuTime( );
3495+
}
3496+
34743497
// Schedule frame
34753498
status = ScheduleTx( allowDelayedTx );
34763499
return status;
@@ -3618,7 +3641,7 @@ static LoRaMacStatus_t ScheduleTx( bool allowDelayedTx )
36183641
nextChan.AggrTimeOff = Nvm.MacGroup1.AggregatedTimeOff;
36193642
nextChan.Datarate = Nvm.MacGroup1.ChannelsDatarate;
36203643
nextChan.DutyCycleEnabled = Nvm.MacGroup2.DutyCycleOn;
3621-
nextChan.ElapsedTimeSinceStartUp = SysTimeSub( SysTimeGetMcuTime( ), Nvm.MacGroup2.InitializationTime );
3644+
nextChan.ElapsedTimeSinceTxBackoffRefTime = SysTimeSub( SysTimeGetMcuTime( ), MacCtx.TxBackoffRefTime );
36223645
nextChan.LastAggrTx = Nvm.MacGroup1.LastTxDoneTime;
36233646
nextChan.LastTxIsJoinRequest = false;
36243647
nextChan.Joined = true;
@@ -4698,8 +4721,8 @@ LoRaMacStatus_t LoRaMacInitialization( LoRaMacPrimitives_t* primitives, LoRaMacC
46984721
TimerInit( &MacCtx.ForceRejoinReqCycleTimer, OnForceRejoinReqCycleTimerEvent );
46994722
#endif /* LORAMAC_VERSION */
47004723

4701-
// Store the current initialization time
4702-
Nvm.MacGroup2.InitializationTime = SysTimeGetMcuTime( );
4724+
// At stack initialization no JoinReq has been transmitted yet
4725+
MacCtx.IsFirstJoinReqTx = true;
47034726

47044727
#if (defined( LORAMAC_VERSION ) && (( LORAMAC_VERSION == 0x01000400 ) || ( LORAMAC_VERSION == 0x01010100 )))
47054728
// Initialize MAC radio events

src/STM32CubeWL/LoRaWAN/Mac/LoRaMacInterfaces.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,10 +1125,11 @@ typedef struct sLoRaMacNvmDataGroup2
11251125
* Aggregated duty cycle management
11261126
*/
11271127
uint16_t AggregatedDCycle;
1128-
/*!
1128+
/*!
11291129
* Stores the time at LoRaMac initialization.
1130+
* This value is no more used as defined by the LoRaWAN Specification v1.0.4.
11301131
*
1131-
* \remark Used for the BACKOFF_DC computation.
1132+
* \remark Taken in the structure only for Backward compatibility.
11321133
*/
11331134
SysTime_t InitializationTime;
11341135
/*!

src/STM32CubeWL/LoRaWAN/Mac/Region/Region.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ typedef struct sSetBandTxDoneParams
466466
/*!
467467
* Elapsed time since initialization.
468468
*/
469-
SysTime_t ElapsedTimeSinceStartUp;
469+
SysTime_t ElapsedTimeSinceTxBackoffRefTime;
470470
}SetBandTxDoneParams_t;
471471

472472
/*!
@@ -814,7 +814,7 @@ typedef struct sNextChanParams
814814
/*!
815815
* Elapsed time since the start of the node.
816816
*/
817-
SysTime_t ElapsedTimeSinceStartUp;
817+
SysTime_t ElapsedTimeSinceTxBackoffRefTime;
818818
/*!
819819
* Joined Set to true, if the last uplink was a join request
820820
*/

src/STM32CubeWL/LoRaWAN/Mac/Region/RegionAS923.c

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
#define AS923_MIN_RF_FREQUENCY 915000000
100100
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
101101
#define AS923_MAX_RF_FREQUENCY 921000000
102-
#else
102+
#else
103103
#define AS923_MAX_RF_FREQUENCY 928000000
104104
#endif
105105

@@ -169,9 +169,6 @@
169169
#undef AS923_RX_MAX_DATARATE
170170
#define AS923_RX_MAX_DATARATE DR_5
171171

172-
#undef AS923_DEFAULT_MAX_EIRP
173-
#define AS923_DEFAULT_MAX_EIRP 13.0f
174-
175172
/*!
176173
* STD-T108 Ver1.4 does not require dwell-time enforcement when using LBT on channels 28 to 38
177174
*/
@@ -202,9 +199,6 @@
202199
#undef AS923_RX_MAX_DATARATE
203200
#define AS923_RX_MAX_DATARATE DR_5
204201

205-
#undef AS923_DEFAULT_MAX_EIRP
206-
#define AS923_DEFAULT_MAX_EIRP 13.0f
207-
208202
/*!
209203
* STD-T108 Ver1.4 does not require dwell-time enforcement when using DC on channels 28 to 38
210204
*/
@@ -217,19 +211,19 @@
217211
#undef AS923_DUTY_CYCLE_ENABLED
218212
#define AS923_DUTY_CYCLE_ENABLED 1
219213

220-
#elif ( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP_CH37_CH61_LBT_DC )
214+
#elif ( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP_CH33_CH61_LBT_DC )
221215

222216
/*
223-
* STD-T108 Ver1.4 allows the use of channels 37 to 61 with LBT and DC.
217+
* STD-T108 Ver1.4 allows the use of channels 33 to 61 with LBT and DC.
224218
* However dwell time enforcement must be enabled
225219
*/
226220

227-
// Channel plan CHANNEL_PLAN_GROUP_AS923_1_JP_CH37_CH61_LBT_DC
221+
// Channel plan CHANNEL_PLAN_GROUP_AS923_1_JP_CH33_CH61_LBT_DC
228222

229223
#define REGION_AS923_FREQ_OFFSET 0
230224

231225
/*!
232-
* Restrict AS923 frequencies to channels 37 to 61
226+
* Restrict AS923 frequencies to channels 33 to 61
233227
* Center frequencies 922.4 MHz to 928.0 MHz @ 200 kHz max bandwidth
234228
*/
235229
#define AS923_MIN_RF_FREQUENCY 922400000
@@ -241,17 +235,14 @@
241235
#undef AS923_RX_MAX_DATARATE
242236
#define AS923_RX_MAX_DATARATE DR_5
243237

244-
#undef AS923_DEFAULT_MAX_EIRP
245-
#define AS923_DEFAULT_MAX_EIRP 13.0f
246-
247238
/*!
248239
* Enable duty cycle enforcement
249240
*/
250241
#undef AS923_DUTY_CYCLE_ENABLED
251242
#define AS923_DUTY_CYCLE_ENABLED 1
252243

253244
/*!
254-
* STD-T108 Ver1.4 requires a carrier sense time of at least 128 us on channels 37 to 61
245+
* STD-T108 Ver1.4 requires a carrier sense time of at least 128 us on channels 33 to 61
255246
*/
256247
#undef AS923_CARRIER_SENSE_TIME
257248
#define AS923_CARRIER_SENSE_TIME 1
@@ -562,10 +553,10 @@ void RegionAS923SetBandTxDone( SetBandTxDoneParams_t* txDone )
562553
#if defined( REGION_AS923 )
563554
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x01010003 ))
564555
RegionCommonSetBandTxDone( &RegionNvmGroup1->Bands[RegionNvmGroup2->Channels[txDone->Channel].Band],
565-
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceStartUp );
556+
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceTxBackoffRefTime );
566557
#elif (defined( REGION_VERSION ) && (( REGION_VERSION == 0x02010001 ) || ( REGION_VERSION == 0x02010003 )))
567558
RegionCommonSetBandTxDone( &RegionBands[RegionNvmGroup2->Channels[txDone->Channel].Band],
568-
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceStartUp );
559+
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceTxBackoffRefTime );
569560
#endif /* REGION_VERSION */
570561
#endif /* REGION_AS923 */
571562
}
@@ -617,7 +608,7 @@ void RegionAS923InitDefaults( InitDefaultsParams_t* params )
617608

618609
#if ( ( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP ) || \
619610
( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP_CH24_CH38_LBT ) || \
620-
( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP_CH37_CH61_LBT_DC ) )
611+
( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP_CH33_CH61_LBT_DC ) )
621612
RegionNvmGroup2->RssiFreeThreshold = AS923_RSSI_FREE_TH;
622613
RegionNvmGroup2->CarrierSenseTime = AS923_CARRIER_SENSE_TIME;
623614
#endif
@@ -1023,7 +1014,6 @@ uint8_t RegionAS923RxParamSetupReq( RxParamSetupReqParams_t* rxParamSetupReq )
10231014
{
10241015
uint8_t status = 0x07;
10251016
#if defined( REGION_AS923 )
1026-
10271017
// Verify radio frequency
10281018
if( VerifyRfFreq( rxParamSetupReq->Frequency ) == false )
10291019
{
@@ -1181,7 +1171,7 @@ LoRaMacStatus_t RegionAS923NextChannel( NextChanParams_t* nextChanParams, uint8_
11811171
identifyChannelsParam.DutyCycleEnabled = nextChanParams->DutyCycleEnabled;
11821172
identifyChannelsParam.MaxBands = AS923_MAX_NB_BANDS;
11831173

1184-
identifyChannelsParam.ElapsedTimeSinceStartUp = nextChanParams->ElapsedTimeSinceStartUp;
1174+
identifyChannelsParam.ElapsedTimeSinceTxBackoffRefTime = nextChanParams->ElapsedTimeSinceTxBackoffRefTime;
11851175
identifyChannelsParam.LastTxIsJoinRequest = nextChanParams->LastTxIsJoinRequest;
11861176
identifyChannelsParam.ExpectedTimeOnAir = GetTimeOnAir( nextChanParams->Datarate, nextChanParams->PktLen );
11871177

@@ -1194,7 +1184,7 @@ LoRaMacStatus_t RegionAS923NextChannel( NextChanParams_t* nextChanParams, uint8_
11941184
{
11951185
#if (( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP ) || \
11961186
( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP_CH24_CH38_LBT ) || \
1197-
( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP_CH37_CH61_LBT_DC ) )
1187+
( REGION_AS923_DEFAULT_CHANNEL_PLAN == CHANNEL_PLAN_GROUP_AS923_1_JP_CH33_CH61_LBT_DC ) )
11981188
// Executes the LBT algorithm when operating in Japan
11991189
uint8_t channelNext = 0;
12001190

src/STM32CubeWL/LoRaWAN/Mac/Region/RegionAS923.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ extern "C"
9999
#define CHANNEL_PLAN_GROUP_AS923_1_JP_CH24_CH38_DC 6
100100

101101
/*!
102-
* Channel plan group AS923-1 for Japan - channels 37 to 61 Listen Before Talk + Duty Cycle
102+
* Channel plan group AS923-1 for Japan - channels 33 to 61 Listen Before Talk + Duty Cycle
103103
* AS923_FREQ_OFFSET = 0
104104
*/
105-
#define CHANNEL_PLAN_GROUP_AS923_1_JP_CH37_CH61_LBT_DC 7
105+
#define CHANNEL_PLAN_GROUP_AS923_1_JP_CH33_CH61_LBT_DC 7
106106
#endif
107107

108108
/*!

src/STM32CubeWL/LoRaWAN/Mac/Region/RegionAU915.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,10 @@ void RegionAU915SetBandTxDone( SetBandTxDoneParams_t* txDone )
376376
#if defined( REGION_AU915 )
377377
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x01010003 ))
378378
RegionCommonSetBandTxDone( &RegionNvmGroup1->Bands[RegionNvmGroup2->Channels[txDone->Channel].Band],
379-
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceStartUp );
379+
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceTxBackoffRefTime );
380380
#elif (defined( REGION_VERSION ) && (( REGION_VERSION == 0x02010001 ) || ( REGION_VERSION == 0x02010003 )))
381381
RegionCommonSetBandTxDone( &RegionBands[RegionNvmGroup2->Channels[txDone->Channel].Band],
382-
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceStartUp );
382+
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceTxBackoffRefTime );
383383
#endif /* REGION_VERSION */
384384
#endif /* REGION_AU915 */
385385
}
@@ -976,7 +976,7 @@ LoRaMacStatus_t RegionAU915NextChannel( NextChanParams_t* nextChanParams, uint8_
976976
identifyChannelsParam.DutyCycleEnabled = nextChanParams->DutyCycleEnabled;
977977
identifyChannelsParam.MaxBands = AU915_MAX_NB_BANDS;
978978

979-
identifyChannelsParam.ElapsedTimeSinceStartUp = nextChanParams->ElapsedTimeSinceStartUp;
979+
identifyChannelsParam.ElapsedTimeSinceTxBackoffRefTime = nextChanParams->ElapsedTimeSinceTxBackoffRefTime;
980980
identifyChannelsParam.LastTxIsJoinRequest = nextChanParams->LastTxIsJoinRequest;
981981
identifyChannelsParam.ExpectedTimeOnAir = GetTimeOnAir( nextChanParams->Datarate, nextChanParams->PktLen );
982982

src/STM32CubeWL/LoRaWAN/Mac/Region/RegionCN470.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,10 +663,10 @@ void RegionCN470SetBandTxDone( SetBandTxDoneParams_t* txDone )
663663
#if defined( REGION_CN470 )
664664
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x01010003 ))
665665
RegionCommonSetBandTxDone( &RegionNvmGroup1->Bands[RegionNvmGroup2->Channels[txDone->Channel].Band],
666-
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceStartUp );
666+
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceTxBackoffRefTime );
667667
#elif (defined( REGION_VERSION ) && (( REGION_VERSION == 0x02010001 ) || ( REGION_VERSION == 0x02010003 )))
668668
RegionCommonSetBandTxDone( &RegionBands[RegionNvmGroup2->Channels[txDone->Channel].Band],
669-
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceStartUp );
669+
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceTxBackoffRefTime );
670670
#endif /* REGION_VERSION */
671671
#endif /* REGION_CN470 */
672672
}
@@ -1321,7 +1321,7 @@ LoRaMacStatus_t RegionCN470NextChannel( NextChanParams_t* nextChanParams, uint8_
13211321
identifyChannelsParam.DutyCycleEnabled = nextChanParams->DutyCycleEnabled;
13221322
identifyChannelsParam.MaxBands = CN470_MAX_NB_BANDS;
13231323

1324-
identifyChannelsParam.ElapsedTimeSinceStartUp = nextChanParams->ElapsedTimeSinceStartUp;
1324+
identifyChannelsParam.ElapsedTimeSinceTxBackoffRefTime = nextChanParams->ElapsedTimeSinceTxBackoffRefTime;
13251325
identifyChannelsParam.LastTxIsJoinRequest = nextChanParams->LastTxIsJoinRequest;
13261326
identifyChannelsParam.ExpectedTimeOnAir = GetTimeOnAir( nextChanParams->Datarate, nextChanParams->PktLen );
13271327

src/STM32CubeWL/LoRaWAN/Mac/Region/RegionCN779.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ void RegionCN779SetBandTxDone( SetBandTxDoneParams_t* txDone )
315315
#if defined( REGION_CN779 )
316316
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x01010003 ))
317317
RegionCommonSetBandTxDone( &RegionNvmGroup1->Bands[RegionNvmGroup2->Channels[txDone->Channel].Band],
318-
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceStartUp );
318+
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceTxBackoffRefTime );
319319
#elif (defined( REGION_VERSION ) && (( REGION_VERSION == 0x02010001 ) || ( REGION_VERSION == 0x02010003 )))
320320
RegionCommonSetBandTxDone( &RegionBands[RegionNvmGroup2->Channels[txDone->Channel].Band],
321-
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceStartUp );
321+
txDone->LastTxAirTime, txDone->Joined, txDone->ElapsedTimeSinceTxBackoffRefTime );
322322
#endif /* REGION_VERSION */
323323
#endif /* REGION_CN779 */
324324
}
@@ -905,7 +905,7 @@ LoRaMacStatus_t RegionCN779NextChannel( NextChanParams_t* nextChanParams, uint8_
905905
identifyChannelsParam.DutyCycleEnabled = nextChanParams->DutyCycleEnabled;
906906
identifyChannelsParam.MaxBands = CN779_MAX_NB_BANDS;
907907

908-
identifyChannelsParam.ElapsedTimeSinceStartUp = nextChanParams->ElapsedTimeSinceStartUp;
908+
identifyChannelsParam.ElapsedTimeSinceTxBackoffRefTime = nextChanParams->ElapsedTimeSinceTxBackoffRefTime;
909909
identifyChannelsParam.LastTxIsJoinRequest = nextChanParams->LastTxIsJoinRequest;
910910
identifyChannelsParam.ExpectedTimeOnAir = GetTimeOnAir( nextChanParams->Datarate, nextChanParams->PktLen );
911911

src/STM32CubeWL/LoRaWAN/Mac/Region/RegionCommon.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
* defined duty-cycle restrictions. In order to ensure that these restrictions never get violated we changed the
6666
* default duty cycle observation time period to 1/2 hour (1800000 ms).
6767
*/
68-
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
68+
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
6969
#define DUTY_CYCLE_TIME_PERIOD 3600000
7070
#else
7171
#define DUTY_CYCLE_TIME_PERIOD 1800000
@@ -107,7 +107,7 @@ static uint16_t GetDutyCycle( Band_t* band, bool joined, SysTime_t elapsedTimeSi
107107

108108
if( joined == false )
109109
{
110-
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
110+
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
111111
uint16_t joinDutyCycle = BACKOFF_DC_1_HOUR;
112112
#else
113113
uint16_t joinDutyCycle = BACKOFF_DC_24_HOURS;
@@ -151,7 +151,7 @@ static uint16_t SetMaxTimeCredits( Band_t* band, bool joined, SysTime_t elapsedT
151151
if( joined == false )
152152
{
153153
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
154-
if( elapsedTimeSinceStartup.Seconds < BACKOFF_DUTY_CYCLE_1_HOUR_IN_S )
154+
if( elapsedTimeSinceStartup.Seconds < BACKOFF_DUTY_CYCLE_1_HOUR_IN_S )
155155
{
156156
maxCredits = DUTY_CYCLE_TIME_PERIOD;
157157
}
@@ -164,8 +164,8 @@ static uint16_t SetMaxTimeCredits( Band_t* band, bool joined, SysTime_t elapsedT
164164
maxCredits = DUTY_CYCLE_TIME_PERIOD_JOIN_BACKOFF_24H;
165165
}
166166
#else
167-
TimerTime_t elapsedTime = SysTimeToMs( elapsedTimeSinceStartup );
168-
SysTime_t timeDiff = { 0 };
167+
TimerTime_t elapsedTime = SysTimeToMs( elapsedTimeSinceStartup );
168+
SysTime_t timeDiff = { 0 };
169169
if( dutyCycle == BACKOFF_DC_1_HOUR )
170170
{
171171
maxCredits = DUTY_CYCLE_TIME_PERIOD;
@@ -218,7 +218,7 @@ static uint16_t SetMaxTimeCredits( Band_t* band, bool joined, SysTime_t elapsedT
218218
{
219219
band->TimeCredits = maxCredits;
220220
}
221-
#endif
221+
#endif
222222

223223
// Setup the maximum allowed credits. We can assign them
224224
// safely all the time.
@@ -228,7 +228,7 @@ static uint16_t SetMaxTimeCredits( Band_t* band, bool joined, SysTime_t elapsedT
228228
}
229229

230230

231-
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
231+
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
232232
static uint16_t UpdateTimeCredits( Band_t* band, bool joined, bool dutyCycleEnabled,
233233
bool lastTxIsJoinRequest, SysTime_t elapsedTimeSinceStartup,
234234
TimerTime_t currentTime, TimerTime_t lastBandUpdateTime )
@@ -456,7 +456,7 @@ TimerTime_t RegionCommonUpdateBandTimeOff( bool joined, Band_t* bands,
456456
// We calculate the minTimeToWait among the bands which are not
457457
// ready for transmission and which are potentially available
458458
// for a transmission in the future.
459-
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
459+
#if (defined( REGION_VERSION ) && ( REGION_VERSION == 0x02010003 ))
460460
TimerTime_t observationTimeDiff = 0;
461461
if( bands[i].LastMaxCreditAssignTime >= elapsedTime )
462462
{
@@ -727,7 +727,7 @@ LoRaMacStatus_t RegionCommonIdentifyChannels( RegionCommonIdentifyChannelsParam_
727727
identifyChannelsParam->MaxBands,
728728
identifyChannelsParam->DutyCycleEnabled,
729729
identifyChannelsParam->LastTxIsJoinRequest,
730-
identifyChannelsParam->ElapsedTimeSinceStartUp,
730+
identifyChannelsParam->ElapsedTimeSinceTxBackoffRefTime,
731731
identifyChannelsParam->ExpectedTimeOnAir );
732732

733733
RegionCommonCountNbOfEnabledChannels( identifyChannelsParam->CountNbOfEnabledChannelsParam, enabledChannels,

src/STM32CubeWL/LoRaWAN/Mac/Region/RegionCommon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ typedef struct sRegionCommonIdentifyChannelsParam
307307
/*!
308308
* Elapsed time since the start of the node.
309309
*/
310-
SysTime_t ElapsedTimeSinceStartUp;
310+
SysTime_t ElapsedTimeSinceTxBackoffRefTime;
311311
/*!
312312
* Joined Set to true, if the last uplink was a join request
313313
*/

0 commit comments

Comments
 (0)