Compare commits

...

3 Commits

Author SHA1 Message Date
wdfk-prog fe8d7fe99f
Merge bd990f7bd8 into 139e8d28bc 2025-03-12 02:30:51 +01:00
Rania JMAI 139e8d28bc [HAL] Upload new fixes 2025-03-10 13:28:25 +01:00
huangly bd990f7bd8 [LORA MAC] Prevent 32-bit data from overflowing and winding to cause RX receive window exception 2024-05-31 13:55:39 +08:00
2 changed files with 8 additions and 4 deletions

@ -1 +1 @@
Subproject commit 8188d40505f5f77cb6ff9cea404b661d445acbd2
Subproject commit a496d1eebd7394fb880ebfdd56fdcb5f2cce687b

View File

@ -1017,12 +1017,16 @@ static void ProcessRadioTxDone( void )
Radio.Sleep( );
}
#if ( !defined(DISABLE_LORAWAN_RX_WINDOW) || (DISABLE_LORAWAN_RX_WINDOW == 0) )
// Setup timers
// Setup timers
CRITICAL_SECTION_BEGIN( );
uint32_t offset = TimerGetCurrentTime( ) - TxDoneParams.CurTime;
TimerSetValue( &MacCtx.RxWindowTimer1, MacCtx.RxWindow1Delay - offset );
uint32_t cur_time = TimerGetCurrentTime( );
uint32_t offset = (cur_time >= TxDoneParams.CurTime) ? (cur_time - TxDoneParams.CurTime) : (cur_time+ (0XFFFFFFFF - TxDoneParams.CurTime + 1));
uint32_t value1 = (MacCtx.RxWindow1Delay > offset) ? (MacCtx.RxWindow1Delay - offset) : MacCtx.RxWindow1Delay;
TimerSetValue( &MacCtx.RxWindowTimer1, value1 );
TimerStart( &MacCtx.RxWindowTimer1 );
TimerSetValue( &MacCtx.RxWindowTimer2, MacCtx.RxWindow2Delay - offset );
uint32_t value2 = (MacCtx.RxWindow2Delay > offset) ? (MacCtx.RxWindow2Delay - offset) : MacCtx.RxWindow2Delay;
TimerSetValue( &MacCtx.RxWindowTimer2, value2 );
TimerStart( &MacCtx.RxWindowTimer2 );
CRITICAL_SECTION_END( );
#else