Skip to content

Commit

Permalink
extmod/network_ninaw10: Disable active connections before connecting.
Browse files Browse the repository at this point in the history
  • Loading branch information
iabdalkader authored and dpgeorge committed Jan 6, 2022
1 parent c6d26bc commit 0f25e03
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extmod/network_ninaw10.c
Expand Up @@ -173,6 +173,11 @@ STATIC mp_obj_t network_ninaw10_connect(mp_uint_t n_args, const mp_obj_t *pos_ar
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Key can't be empty!"));
}

// Disconnect active connections first.
if (nina_isconnected()) {
nina_disconnect();
}

if (self->itf == MOD_NETWORK_STA_IF) {
// Initialize WiFi in Station mode.
if (nina_connect(ssid, security, key, 0) != 0) {
Expand Down

0 comments on commit 0f25e03

Please sign in to comment.