Skip to content

Commit fd38630

Browse files
Matthieu Antoinemluis1
authored andcommitted
Pull-request #885 - Fixed SX126xSetLoRaSymbNumTimeout to call the workaround only if the number of symbols is equal to or higher than 64.
1 parent ba17382 commit fd38630

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/radio/sx126x/sx126x.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -353,22 +353,25 @@ void SX126xSetStopRxTimerOnPreambleDetect( bool enable )
353353
SX126xWriteCommand( RADIO_SET_STOPRXTIMERONPREAMBLE, ( uint8_t* )&enable, 1 );
354354
}
355355

356-
void SX126xSetLoRaSymbNumTimeout( uint8_t SymbNum )
356+
void SX126xSetLoRaSymbNumTimeout( uint8_t symbNum )
357357
{
358-
SX126xWriteCommand( RADIO_SET_LORASYMBTIMEOUT, &SymbNum, 1 );
358+
SX126xWriteCommand( RADIO_SET_LORASYMBTIMEOUT, &symbNum, 1 );
359359

360-
uint8_t mant = SymbNum >> 1;
361-
uint8_t exp = 0;
362-
uint8_t reg = 0;
363-
364-
while( mant > 31 )
360+
if( symbNum >= 64 )
365361
{
366-
mant >>= 2;
367-
exp++;
368-
}
362+
uint8_t mant = symbNum >> 1;
363+
uint8_t exp = 0;
364+
uint8_t reg = 0;
365+
366+
while( mant > 31 )
367+
{
368+
mant >>= 2;
369+
exp++;
370+
}
369371

370-
reg = exp + ( mant << 3 );
371-
SX126xWriteRegister( REG_LR_SYNCH_TIMEOUT, reg );
372+
reg = exp + ( mant << 3 );
373+
SX126xWriteRegister( REG_LR_SYNCH_TIMEOUT, reg );
374+
}
372375
}
373376

374377
void SX126xSetRegulatorMode( RadioRegulatorMode_t mode )

0 commit comments

Comments
 (0)