Merge pull request #1359 from kwagyeman/kwabena/add_missing_check

Add missing framesize init check
This commit is contained in:
Ibrahim Abd Elkader 2021-06-09 14:42:47 +02:00 committed by GitHub
commit f0f5c8cf79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,6 +347,10 @@ static mp_obj_t py_sensor_set_windowing(uint n_args, const mp_obj_t *args)
static mp_obj_t py_sensor_get_windowing()
{
if (sensor.framesize == FRAMESIZE_INVALID) {
mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("Frame size not set yet!"));
}
return mp_obj_new_tuple(4, (mp_obj_t []) {mp_obj_new_int(framebuffer_get_x()),
mp_obj_new_int(framebuffer_get_y()),
mp_obj_new_int(framebuffer_get_u()),