parent
a1a4959071
commit
b13adfc228
@ -76,7 +76,7 @@ STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type,
|
|||||||
|
|
||||||
const int buffer_size = args[ARG_buffer_size].u_int;
|
const int buffer_size = args[ARG_buffer_size].u_int;
|
||||||
if (buffer_size < 1) {
|
if (buffer_size < 1) {
|
||||||
mp_raise_ValueError(translate("buffer_size must be >= 1"));
|
mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_buffer_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MP_OBJ_IS_TYPE(characteristic, &bleio_characteristic_type)) {
|
if (!MP_OBJ_IS_TYPE(characteristic, &bleio_characteristic_type)) {
|
||||||
|
@ -64,11 +64,20 @@ STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_arg
|
|||||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||||
|
|
||||||
|
mp_int_t width = args[ARG_width].u_int;
|
||||||
|
if (width < 1) {
|
||||||
|
mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_width);
|
||||||
|
}
|
||||||
|
mp_int_t height = args[ARG_height].u_int;
|
||||||
|
if (height < 1) {
|
||||||
|
mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_height);
|
||||||
|
}
|
||||||
|
|
||||||
displayio_shape_t *self = m_new_obj(displayio_shape_t);
|
displayio_shape_t *self = m_new_obj(displayio_shape_t);
|
||||||
self->base.type = &displayio_shape_type;
|
self->base.type = &displayio_shape_type;
|
||||||
common_hal_displayio_shape_construct(self,
|
common_hal_displayio_shape_construct(self,
|
||||||
args[ARG_width].u_int,
|
width,
|
||||||
args[ARG_height].u_int,
|
height,
|
||||||
args[ARG_mirror_x].u_bool,
|
args[ARG_mirror_x].u_bool,
|
||||||
args[ARG_mirror_y].u_bool);
|
args[ARG_mirror_y].u_bool);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user