extmod/network_ninaw10: Disable active connections before connecting.

This commit is contained in:
iabdalkader 2022-01-04 19:20:38 +02:00 committed by Damien George
parent c6d26bc524
commit 0f25e0387c

View File

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