Skip to content

Commit 1019e91

Browse files
committed
espressif/common-hal/_bleio: int Characteristic observer properly; restore descriptor pre-check code
1 parent ea9a8df commit 1019e91

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ports/espressif/common-hal/_bleio/Characteristic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self,
6161
self->props = props;
6262
self->read_perm = read_perm;
6363
self->write_perm = write_perm;
64-
self->observer = NULL;
64+
self->observer = mp_const_none;
6565

6666
// Map CP's property values to Nimble's flag values.
6767
self->flags = 0;

ports/espressif/common-hal/_bleio/Connection.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ static void discover_remote_services(bleio_connection_internal_t *self, mp_obj_t
425425
? service->end_handle
426426
: next_characteristic->handle - 1;
427427

428+
// Pre-check if there are no descriptors to discover so descriptor discovery doesn't fail
429+
if (end_handle <= characteristic->handle) {
430+
continue;
431+
}
432+
428433
// Reset discovery status before starting callbacks
429434
_set_discovery_step_status(0);
430435

0 commit comments

Comments
 (0)