diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-12-05 08:35:02 -0500 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-12-05 08:40:53 -0500 |
| commit | e30dde0afc71bbd0e01bfa9454589ef2b553d75a (patch) | |
| tree | d2934a9c879402b2210eba2442b9ec669a2b85b3 | |
| parent | 19dc219ff76ed448a80921cf407c9312277147d7 (diff) | |
Make _bleio.Connection.disconnect() idempotent
| -rw-r--r-- | shared-bindings/_bleio/Connection.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index da2fbff28..e1e458c22 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -80,14 +80,12 @@ STATIC void ensure_connected(bleio_connection_obj_t *self) { //| //| .. method:: disconnect() //| -//| Disconnects from the remote peripheral. +//| Disconnects from the remote peripheral. Does nothing if already disconnected. //| STATIC mp_obj_t bleio_connection_disconnect(mp_obj_t self_in) { bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in); - ensure_connected(self); - + // common_hal_bleio_connection_disconnect() does nothing if already disconnected. common_hal_bleio_connection_disconnect(self->connection); - return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_disconnect_obj, bleio_connection_disconnect); |
