Skip to content

Commit cf645ab

Browse files
Zhang Jun Haodonghengqaz
Zhang Jun Hao
authored andcommitted
feat(lwip): make lwip timeouts to 3000ms in light sleep
1 parent e0a3a60 commit cf645ab

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

components/lwip/lwip/src/core/timeouts.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ const struct lwip_cyclic_timer lwip_cyclic_timers[] = {
112112
static struct sys_timeo *next_timeout;
113113
static u32_t timeouts_last_time;
114114

115+
/** For light sleep. time out. limit is 3000ms */
116+
u32_t LwipTimOutLim = 0;
117+
115118
#if LWIP_TCP
116119
/** global variable that shows if the tcp timer is currently scheduled or not */
117120
static int tcpip_tcp_timer_active;
@@ -196,6 +199,7 @@ void sys_timeouts_init(void)
196199
* @param handler callback function to call when msecs have elapsed
197200
* @param arg argument to pass to the callback function
198201
*/
202+
199203
#if LWIP_DEBUG_TIMERNAMES
200204
void
201205
sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name)
@@ -224,7 +228,18 @@ sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg)
224228
timeout->next = NULL;
225229
timeout->h = handler;
226230
timeout->arg = arg;
231+
232+
#ifdef ESP_LWIP
233+
if ((msecs + diff) < LwipTimOutLim) {
234+
timeout->time = LwipTimOutLim;
235+
msecs = LwipTimOutLim;
236+
} else {
237+
timeout->time = msecs + diff;
238+
}
239+
#else
227240
timeout->time = msecs + diff;
241+
#endif
242+
228243
#if LWIP_DEBUG_TIMERNAMES
229244
timeout->handler_name = handler_name;
230245
LWIP_DEBUGF(TIMERS_DEBUG, ("sys_timeout: %p msecs=%"U32_F" handler=%s arg=%p\n",

components/tcpip_adapter/tcpip_adapter_lwip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ static bool tcpip_inited = false;
7373

7474
static const char* TAG = "tcpip_adapter";
7575

76-
u32_t LwipTimOutLim = 0; // For light sleep. time out. limit is 3000ms
77-
7876
/* Avoid warning. No header file has include these function */
7977
err_t ethernetif_init(struct netif* netif);
8078
void system_station_got_ip_set();

0 commit comments

Comments
 (0)