@@ -371,6 +371,9 @@ modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ss
371371 // if the device is in AP mode, we need to wait for this event
372372 // before doing anything
373373 while (!IS_IP_ACQUIRED (wlan_obj .status )) {
374+ #ifndef SL_PLATFORM_MULTI_THREADED
375+ _SlTaskEntry ();
376+ #endif
374377 HAL_Delay (5 );
375378 }
376379 }
@@ -386,6 +389,9 @@ modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ss
386389 // other return-codes
387390 if (0 == sl_WlanDisconnect ()) {
388391 while (IS_CONNECTED (wlan_obj .status )) {
392+ #ifndef SL_PLATFORM_MULTI_THREADED
393+ _SlTaskEntry ();
394+ #endif
389395 HAL_Delay (5 );
390396 }
391397 }
@@ -516,7 +522,7 @@ void wlan_set_pm_policy (uint8_t policy) {
516522void wlan_servers_stop (void ) {
517523 servers_disable ();
518524 do {
519- HAL_Delay (2 );
525+ HAL_Delay (5 );
520526 } while (servers_are_enabled ());
521527}
522528
@@ -553,9 +559,12 @@ STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, co
553559
554560 if (0 == sl_WlanConnect ((_i8 * )ssid , ssid_len , (_u8 * )bssid , & secParams , NULL )) {
555561
556- // Wait for WLAN Event
562+ // Wait for the WLAN Event
557563 uint32_t waitForConnectionMs = 0 ;
558564 while (!IS_CONNECTED (wlan_obj .status )) {
565+ #ifndef SL_PLATFORM_MULTI_THREADED
566+ _SlTaskEntry ();
567+ #endif
559568 HAL_Delay (5 );
560569 if (++ waitForConnectionMs >= MODWLAN_TIMEOUT_MS ) {
561570 return MODWLAN_ERROR_TIMEOUT ;
@@ -777,6 +786,9 @@ STATIC mp_obj_t wlan_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
777786 if (GET_STATUS_BIT (wlan_obj .status , STATUS_BIT_CONNECTION )) {
778787 if (0 == sl_WlanDisconnect ()) {
779788 while (IS_CONNECTED (wlan_obj .status )) {
789+ #ifndef SL_PLATFORM_MULTI_THREADED
790+ _SlTaskEntry ();
791+ #endif
780792 HAL_Delay (5 );
781793 }
782794 }
0 commit comments