Browse Source

extmod/network_ninaw10: Disable active connections before connecting.

pull/8141/head
iabdalkader 3 years ago
committed by Damien George
parent
commit
0f25e0387c
  1. 5
      extmod/network_ninaw10.c

5
extmod/network_ninaw10.c

@ -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) {

Loading…
Cancel
Save