Skip to content

Commit 3d55ebb

Browse files
committed
optimize property size
1 parent 3ff272a commit 3d55ebb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/modcamera_api.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,13 @@ static void camera_obj_property(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
289289
switch (attr) {
290290
// Read-only properties
291291
case MP_QSTR_pixel_format:
292-
dest[0] = mp_obj_new_int(mp_camera_hal_get_pixel_format(self));
292+
dest[0] = MP_OBJ_NEW_SMALL_INT(mp_camera_hal_get_pixel_format(self));
293293
break;
294294
case MP_QSTR_grab_mode:
295-
dest[0] = mp_obj_new_int(mp_camera_hal_get_grab_mode(self));
295+
dest[0] = MP_OBJ_NEW_SMALL_INT(mp_camera_hal_get_grab_mode(self));
296296
break;
297297
case MP_QSTR_fb_count:
298-
dest[0] = mp_obj_new_int(mp_camera_hal_get_fb_count(self));
298+
dest[0] = MP_OBJ_NEW_SMALL_INT(mp_camera_hal_get_fb_count(self));
299299
break;
300300
case MP_QSTR_pixel_width:
301301
dest[0] = mp_obj_new_int(mp_camera_hal_get_pixel_width(self));
@@ -304,7 +304,7 @@ static void camera_obj_property(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
304304
dest[0] = mp_obj_new_int(mp_camera_hal_get_pixel_height(self));
305305
break;
306306
case MP_QSTR_max_frame_size:
307-
dest[0] = mp_obj_new_int(mp_camera_hal_get_max_frame_size(self));
307+
dest[0] = MP_OBJ_NEW_SMALL_INT(mp_camera_hal_get_max_frame_size(self));
308308
break;
309309
case MP_QSTR_sensor_name:
310310
dest[0] = mp_obj_new_str_from_cstr(mp_camera_hal_get_sensor_name(self));
@@ -524,12 +524,12 @@ static void camera_obj_property(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
524524
{ MP_ROM_QSTR(MP_QSTR_set_##property), MP_ROM_PTR(&camera_set_##property##_obj) }
525525

526526
CREATE_GETSET_FUNCTIONS(frame_size, MP_OBJ_NEW_SMALL_INT, mp_obj_get_int);
527-
CREATE_GETTER(pixel_format, mp_obj_new_int);
528-
CREATE_GETTER(grab_mode, mp_obj_new_int);
529-
CREATE_GETTER(fb_count, mp_obj_new_int);
527+
CREATE_GETTER(pixel_format, MP_OBJ_NEW_SMALL_INT);
528+
CREATE_GETTER(grab_mode, MP_OBJ_NEW_SMALL_INT);
529+
CREATE_GETTER(fb_count, MP_OBJ_NEW_SMALL_INT);
530530
CREATE_GETTER(pixel_width, mp_obj_new_int);
531531
CREATE_GETTER(pixel_height, mp_obj_new_int);
532-
CREATE_GETTER(max_frame_size, mp_obj_new_int);
532+
CREATE_GETTER(max_frame_size, MP_OBJ_NEW_SMALL_INT);
533533
CREATE_GETTER(sensor_name, mp_obj_new_str_from_cstr);
534534
CREATE_GETSET_FUNCTIONS(contrast, MP_OBJ_NEW_SMALL_INT, mp_obj_get_int);
535535
CREATE_GETSET_FUNCTIONS(brightness, MP_OBJ_NEW_SMALL_INT, mp_obj_get_int);

0 commit comments

Comments
 (0)