esp32: Add a small delay before leaving wlan.active().

The delay is 1 ms. It avoids the crashes reported by the
issues #8289, #8792 and #9236 with esp-idf versions >= 4.2, but does
not solve an underlying problem in the esp-idf.
diff --git a/ports/esp32/network_wlan.c b/ports/esp32/network_wlan.c
index f0b458e..e4b34b2 100644
--- a/ports/esp32/network_wlan.c
+++ b/ports/esp32/network_wlan.c
@@ -35,6 +35,7 @@
 
 #include "py/objlist.h"
 #include "py/runtime.h"
+#include "py/mphal.h"
 #include "modnetwork.h"
 
 #include "esp_wifi.h"
@@ -210,6 +211,12 @@
                 wifi_started = true;
             }
         }
+        // This delay is a band-aid patch for issues #8289, #8792 and #9236,
+        // allowing the esp data structures to settle. It looks like some
+        // kind of race condition, which is not yet found. But at least
+        // this small delay seems not hurt much, since wlan.active() is
+        // usually not called in a time critical part of the code.
+        mp_hal_delay_ms(1);
     }
 
     return (mode & bit) ? mp_const_true : mp_const_false;