Update JPEG frame buffer after loading/creating images.

* With this fix the frame buffer will be updated instantly after loading or creating
new images with the copy_to_fb flag set to true.
* There's no need to flush the framebuffer after loading or creating images anymore,
however the sensor (or image) flush() still needs to be called after drawing to see the updates.
This commit is contained in:
iabdalkader 2020-11-16 00:47:07 +02:00
parent 11d7cde25b
commit b46ba79557
2 changed files with 6 additions and 12 deletions

View File

@ -17,11 +17,5 @@ sensor.set_pixformat(sensor.GRAYSCALE)
# Load image
img = image.Image("/example.bmp", copy_to_fb=True)
# Add drawing code here.
# img.draw_line(...)
# Flush FB
sensor.flush()
# Add a small delay to allow the IDE to read the flushed image.
time.sleep(100)
# Add a small delay to allow the IDE to read the loaded image.
time.sleep(500)

View File

@ -7128,10 +7128,6 @@ mp_obj_t py_image_load_image(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
}
}
if (copy_to_fb) {
fb_update_jpeg_buffer();
}
image_t image = {0};
if (mode) {
@ -7190,6 +7186,10 @@ mp_obj_t py_image_load_image(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
arg_other->bpp = image.bpp;
}
if (copy_to_fb) {
fb_update_jpeg_buffer();
}
return py_image_from_struct(&image);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_image_obj, 1, py_image_load_image);