diff options
| author | Damien George <damien@micropython.org> | 2022-06-07 14:19:22 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-06-07 16:55:18 +1000 |
| commit | a446a7bdef86c2e4fef673e0d1f07e5a35672831 (patch) | |
| tree | 69a7bed920140e192f2850b328a5cd917e855d20 | |
| parent | c58dc7f091b6809de83064e8c2444757ad7c962a (diff) | |
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>
| -rw-r--r-- | ports/rp2/mpnetworkport.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/rp2/mpnetworkport.c b/ports/rp2/mpnetworkport.c index 7ee10bb03..b481abba2 100644 --- a/ports/rp2/mpnetworkport.c +++ b/ports/rp2/mpnetworkport.c @@ -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 |
