18
18
#include < stdio.h>
19
19
#include < stdlib.h>
20
20
#include < string.h>
21
- #include < icd/server/ICDServerConfig.h>
21
+ #include < app/ icd/server/ICDServerConfig.h>
22
22
#include " AppConfig.h"
23
23
#include " BaseApplication.h"
24
24
@@ -38,7 +38,10 @@ using namespace ::chip;
38
38
using namespace ::chip::DeviceLayer;
39
39
40
40
namespace {
41
- uint16_t retryInterval = WLAN_MIN_RETRY_TIMER_MS;
41
+ constexpr uint8_t kWlanMinRetryIntervalsInSec = 1 ;
42
+ constexpr uint8_t kWlanMaxRetryIntervalsInSec = 60 ;
43
+ constexpr uint8_t kWlanRetryIntervalInSec = 5 ;
44
+ uint8_t retryInterval = kWlanMinRetryIntervalsInSec ;
42
45
osTimerId_t sRetryTimer ;
43
46
}
44
47
/*
@@ -70,7 +73,7 @@ void wfx_started_notify()
70
73
71
74
// Creating a timer which will be used to retry connection with AP
72
75
sRetryTimer = osTimerNew (RetryConnectionTimerHandler, osTimerOnce, NULL , NULL );
73
- VerifyOrReturnError (sRetryTimer != NULL , SL_STATUS_ALLOCATION_FAILED );
76
+ VerifyOrReturn (sRetryTimer != NULL );
74
77
75
78
memset (&evt, 0 , sizeof (evt));
76
79
evt.header .id = SL_WFX_STARTUP_IND_ID;
@@ -182,8 +185,8 @@ void wfx_retry_connection(uint16_t retryAttempt)
182
185
if (retryAttempt < MAX_JOIN_RETRIES_COUNT)
183
186
{
184
187
ChipLogProgress (DeviceLayer, " wfx_retry_connection : Next attempt after %d Seconds" ,
185
- CONVERT_MS_TO_SEC (WLAN_RETRY_TIMER_MS) );
186
- if (osTimerStart (sRetryTimer , pdMS_TO_TICKS (WLAN_RETRY_TIMER_MS )) != osOK)
188
+ kWlanRetryIntervalInSec );
189
+ if (osTimerStart (sRetryTimer , pdMS_TO_TICKS (CONVERT_SEC_TO_MS ( kWlanRetryIntervalInSec ) )) != osOK)
187
190
{
188
191
ChipLogProgress (DeviceLayer, " Failed to start retry timer" );
189
192
// Sending the join command if retry timer failed to start
@@ -205,11 +208,11 @@ void wfx_retry_connection(uint16_t retryAttempt)
205
208
* are telescopic. If interval exceed WLAN_MAX_RETRY_TIMER_MS then it will try to reconnect at
206
209
* WLAN_MAX_RETRY_TIMER_MS intervals.
207
210
*/
208
- if (retryInterval > WLAN_MAX_RETRY_TIMER_MS )
211
+ if (retryInterval > kWlanMaxRetryIntervalsInSec )
209
212
{
210
- retryInterval = WLAN_MAX_RETRY_TIMER_MS ;
213
+ retryInterval = kWlanMaxRetryIntervalsInSec ;
211
214
}
212
- if (osTimerStart (sRetryTimer , pdMS_TO_TICKS (retryInterval)) != osOK)
215
+ if (osTimerStart (sRetryTimer , pdMS_TO_TICKS (CONVERT_SEC_TO_MS ( retryInterval) )) != osOK)
213
216
{
214
217
ChipLogProgress (DeviceLayer, " Failed to start retry timer" );
215
218
// Sending the join command if retry timer failed to start
@@ -221,7 +224,7 @@ void wfx_retry_connection(uint16_t retryAttempt)
221
224
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE
222
225
wfx_rsi_power_save (RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION);
223
226
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE
224
- ChipLogProgress (DeviceLayer, " wfx_retry_connection : Next attempt after %d Seconds" , CONVERT_MS_TO_SEC ( retryInterval) );
227
+ ChipLogProgress (DeviceLayer, " wfx_retry_connection : Next attempt after %d Seconds" , retryInterval);
225
228
retryInterval += retryInterval;
226
229
return ;
227
230
}
0 commit comments