Handle None for BLE name; fix ScanEntry bug; compile issue

This commit is contained in:
Dan Halbert 2019-06-17 23:16:40 -04:00
parent cfa8b4b5a9
commit 1356819de1
4 changed files with 4 additions and 6 deletions

View File

@ -91,7 +91,7 @@ INC += -I../../supervisor/shared/usb
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb
# You may want to enable these flags to make setting breakpoints easier.
CFLAGS += -fno-inline -fno-ipa-sra
# CFLAGS += -fno-inline -fno-ipa-sra
else
CFLAGS += -Os -DNDEBUG
# TODO: Test with -flto

View File

@ -117,11 +117,8 @@ STATIC mp_obj_t bleio_peripheral_make_new(const mp_obj_type_t *type, size_t n_ar
}
const mp_obj_t name = args[ARG_name].u_obj;
if (name == MP_OBJ_NULL) {
if (name == MP_OBJ_NULL || name == mp_const_none) {
self->name = mp_obj_new_str(default_name, strlen(default_name));
} else if (name == mp_const_none) {
// Make None be the empty string.
self->name = MP_OBJ_NEW_QSTR(MP_QSTR_);
} else if (MP_OBJ_IS_STR(name)) {
self->name = name;
} else {

View File

@ -55,6 +55,7 @@ STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) {
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
bleio_address_obj_t *address = m_new_obj(bleio_address_obj_t);
address->base.type = &bleio_address_type;
memcpy(address->bytes, self->address.bytes, NUM_BLEIO_ADDRESS_BYTES);
address->type = self->address.type;
return MP_OBJ_TO_PTR(address);

View File

@ -440,7 +440,7 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) {
displayio_area_t* displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *self, displayio_area_t* tail) {
if (self->moved && !self->first_draw) {
displayio_area_union(&self->previous_area, &self->current_area, &self->dirty_area);
if (displayio_area_size(&self->dirty_area) <= 2 * self->pixel_width * self->pixel_height) {
if (displayio_area_size(&self->dirty_area) <= 2U * self->pixel_width * self->pixel_height) {
self->dirty_area.next = tail;
return &self->dirty_area;
}