From 70366bdac1f5e51345558d46992bac6c69090653 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 13 Feb 2021 01:20:02 +0200 Subject: [PATCH] Fix CYW43/LWIP and soft-reset bugs. --- src/omv/ports/stm32/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/omv/ports/stm32/main.c b/src/omv/ports/stm32/main.c index a436671c2..e9dfe603a 100644 --- a/src/omv/ports/stm32/main.c +++ b/src/omv/ports/stm32/main.c @@ -523,8 +523,8 @@ soft_reset: #if LWIP_MDNS_RESPONDER mdns_resp_init(); #endif - systick_enable_dispatch(SYSTICK_DISPATCH_LWIP, mod_network_lwip_poll_wrapper); } + systick_enable_dispatch(SYSTICK_DISPATCH_LWIP, mod_network_lwip_poll_wrapper); #endif #if MICROPY_PY_NETWORK_CYW43 @@ -722,6 +722,12 @@ soft_reset: } } while (openmv_config.wifidbg == true); + #if MICROPY_PY_LWIP + // Must call GC sweep here to close open sockets. + gc_sweep_all(); + systick_disable_dispatch(SYSTICK_DISPATCH_LWIP); + #endif + // Disable all other IRQs except Systick and Flash IRQs // Note: FS IRQ is disable, since we're going for a soft-reset. irq_set_base_priority(IRQ_PRI_FLASH+1); @@ -745,9 +751,6 @@ soft_reset: #ifdef IMLIB_ENABLE_DMA2D imlib_draw_row_deinit_all(); #endif - #if MICROPY_PY_LWIP - gc_sweep_all(); - #endif first_soft_reset = false; goto soft_reset; }