diff --git a/nrf5/modules/ubluepy/modubluepy.h b/nrf5/modules/ubluepy/modubluepy.h index 1d2c15469f..fc8aca5b8f 100644 --- a/nrf5/modules/ubluepy/modubluepy.h +++ b/nrf5/modules/ubluepy/modubluepy.h @@ -40,8 +40,8 @@ DB setup: from ubluepy import Service, Characteristic, UUID, Peripheral, constants from pyb import LED -def event_handler(id, conn_handle, length, data): - print("BLE event:", id, "conn_handle:", conn_handle, "length:", length) +def event_handler(id, length, data): + print("BLE event:", id, "length:", length) if id == constants.EVT_GAP_CONNECTED: # connected diff --git a/nrf5/modules/ubluepy/ubluepy_peripheral.c b/nrf5/modules/ubluepy/ubluepy_peripheral.c index 267a87a0f3..9e8372dd6a 100644 --- a/nrf5/modules/ubluepy/ubluepy_peripheral.c +++ b/nrf5/modules/ubluepy/ubluepy_peripheral.c @@ -49,15 +49,14 @@ STATIC void gap_event_handler(mp_obj_t self_in, uint16_t event_id, uint16_t conn } if (self->conn_handler != mp_const_none) { - mp_obj_t args[4]; - mp_uint_t num_of_args = 4; + mp_obj_t args[3]; + mp_uint_t num_of_args = 3; args[0] = MP_OBJ_NEW_SMALL_INT(event_id); - args[1] = MP_OBJ_NEW_SMALL_INT(conn_handle); - args[2] = MP_OBJ_NEW_SMALL_INT(length); + args[1] = MP_OBJ_NEW_SMALL_INT(length); if (data != NULL) { - args[3] = mp_obj_new_bytearray_by_ref(length, data); + args[2] = mp_obj_new_bytearray_by_ref(length, data); } else { - args[3] = mp_const_none; + args[2] = mp_const_none; } // for now hard-code all events to conn_handler