rp2/mpnetworkport: Fix lwip alarm callback timing to use microseconds.

The callback passed to add_alarm_in_ms must return microseconds, even
though the initial delay is in milliseconds.  Fix this use, and to avoid
further confusion use the add_alarm_in_us function instead.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-06-07 14:19:22 +10:00
parent c58dc7f091
commit a446a7bdef
1 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ STATIC int64_t alarm_callback(alarm_id_t id, void *user_data) {
#if MICROPY_PY_WIZNET5K
wiznet5k_try_poll();
#endif
return lwip_try_poll();
return (int64_t)lwip_try_poll() * 1000;
}
void mod_network_lwip_init(void) {
@ -116,7 +116,7 @@ void mod_network_lwip_init(void) {
if (lwip_alarm_id != -1) {
cancel_alarm(lwip_alarm_id);
}
lwip_alarm_id = add_alarm_in_ms(LWIP_TICK_RATE_MS, alarm_callback, mp_const_true, true);
lwip_alarm_id = add_alarm_in_us(LWIP_TICK_RATE_MS * 1000, alarm_callback, mp_const_true, true);
}
#endif // MICROPY_PY_LWIP