Skip to content

Commit 2cac96e

Browse files
committed
TimerGetElapsedTime: made aware of t==0 situation, removed ternaries
1 parent 99c388c commit 2cac96e

File tree

13 files changed

+19
-13
lines changed

13 files changed

+19
-13
lines changed

src/mac/region/RegionAS923.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ LoRaMacStatus_t RegionAS923NextChannel( NextChanParams_t* nextChanParams, uint8_
917917
NvmCtx.ChannelsMask[0] |= LC( 1 ) + LC( 2 );
918918
}
919919

920-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
920+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
921921
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
922922
{
923923
// Reset Aggregated time off

src/mac/region/RegionAU915.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ LoRaMacStatus_t RegionAU915NextChannel( NextChanParams_t* nextChanParams, uint8_
917917
}
918918
}
919919

920-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
920+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
921921
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
922922
{
923923
// Reset Aggregated time off

src/mac/region/RegionCN470.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ LoRaMacStatus_t RegionCN470NextChannel( NextChanParams_t* nextChanParams, uint8_
734734
NvmCtx.ChannelsMask[5] = 0xFFFF;
735735
}
736736

737-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
737+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
738738
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
739739
{
740740
// Reset Aggregated time off

src/mac/region/RegionCN779.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ LoRaMacStatus_t RegionCN779NextChannel( NextChanParams_t* nextChanParams, uint8_
860860
NvmCtx.ChannelsMask[0] |= LC( 1 ) + LC( 2 ) + LC( 3 );
861861
}
862862

863-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
863+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
864864
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
865865
{
866866
// Reset Aggregated time off

src/mac/region/RegionCommon.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ TimerTime_t RegionCommonUpdateBandTimeOff( bool joined, bool dutyCycle, Band_t*
169169
{
170170
if( joined == false )
171171
{
172-
TimerTime_t elapsedJoin = ( bands[i].LastJoinTxDoneTime == 0 ) ? 0 : TimerGetElapsedTime( bands[i].LastJoinTxDoneTime );
173-
TimerTime_t elapsedTx = ( bands[i].LastTxDoneTime == 0 ) ? 0 : TimerGetElapsedTime( bands[i].LastTxDoneTime );
172+
TimerTime_t elapsedJoin = TimerGetElapsedTime( bands[i].LastJoinTxDoneTime );
173+
TimerTime_t elapsedTx = TimerGetElapsedTime( bands[i].LastTxDoneTime );
174174
TimerTime_t txDoneTime = MAX( elapsedJoin,
175175
( dutyCycle == true ) ? elapsedTx : 0 );
176176

@@ -187,7 +187,7 @@ TimerTime_t RegionCommonUpdateBandTimeOff( bool joined, bool dutyCycle, Band_t*
187187
{
188188
if( dutyCycle == true )
189189
{
190-
TimerTime_t elapsed = ( bands[i].LastTxDoneTime == 0 ) ? 0 : TimerGetElapsedTime( bands[i].LastTxDoneTime );
190+
TimerTime_t elapsed = TimerGetElapsedTime( bands[i].LastTxDoneTime );
191191
if( bands[i].TimeOff <= elapsed )
192192
{
193193
bands[i].TimeOff = 0;

src/mac/region/RegionEU433.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ LoRaMacStatus_t RegionEU433NextChannel( NextChanParams_t* nextChanParams, uint8_
860860
NvmCtx.ChannelsMask[0] |= LC( 1 ) + LC( 2 ) + LC( 3 );
861861
}
862862

863-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
863+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
864864
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
865865
{
866866
// Reset Aggregated time off

src/mac/region/RegionEU868.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ LoRaMacStatus_t RegionEU868NextChannel( NextChanParams_t* nextChanParams, uint8_
892892
NvmCtx.ChannelsMask[0] |= LC( 1 ) + LC( 2 ) + LC( 3 );
893893
}
894894

895-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
895+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
896896
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
897897
{
898898
// Reset Aggregated time off

src/mac/region/RegionIN865.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ LoRaMacStatus_t RegionIN865NextChannel( NextChanParams_t* nextChanParams, uint8_
885885
NvmCtx.ChannelsMask[0] |= LC( 1 ) + LC( 2 ) + LC( 3 );
886886
}
887887

888-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
888+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
889889
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
890890
{
891891
// Reset Aggregated time off

src/mac/region/RegionKR920.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ LoRaMacStatus_t RegionKR920NextChannel( NextChanParams_t* nextChanParams, uint8_
854854
NvmCtx.ChannelsMask[0] |= LC( 1 ) + LC( 2 ) + LC( 3 );
855855
}
856856

857-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
857+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
858858
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
859859
{
860860
// Reset Aggregated time off

src/mac/region/RegionRU864.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ LoRaMacStatus_t RegionRU864NextChannel( NextChanParams_t* nextChanParams, uint8_
851851
NvmCtx.ChannelsMask[0] |= LC( 1 ) + LC( 2 );
852852
}
853853

854-
TimerTime_t elapsed = ( ( nextChanParams->LastAggrTx == 0 ) ) ? 0 : TimerGetElapsedTime( nextChanParams->LastAggrTx );
854+
TimerTime_t elapsed = TimerGetElapsedTime( nextChanParams->LastAggrTx );
855855
if( ( nextChanParams->LastAggrTx == 0 ) || ( nextChanParams->AggrTimeOff <= elapsed ) )
856856
{
857857
// Reset Aggregated time off

0 commit comments

Comments
 (0)