Skip to content

Commit 0f25e03

Browse files
iabdalkaderdpgeorge
authored andcommitted
extmod/network_ninaw10: Disable active connections before connecting.
1 parent c6d26bc commit 0f25e03

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

extmod/network_ninaw10.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ STATIC mp_obj_t network_ninaw10_connect(mp_uint_t n_args, const mp_obj_t *pos_ar
173173
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Key can't be empty!"));
174174
}
175175

176+
// Disconnect active connections first.
177+
if (nina_isconnected()) {
178+
nina_disconnect();
179+
}
180+
176181
if (self->itf == MOD_NETWORK_STA_IF) {
177182
// Initialize WiFi in Station mode.
178183
if (nina_connect(ssid, security, key, 0) != 0) {

0 commit comments

Comments
 (0)