From 7740cbac97a312f5932ad0731b46ad5ad8398a23 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 4 Mar 2023 13:13:59 -0600 Subject: [PATCH 1/2] do background tasks and handle interrupt during boundary fill --- shared-module/bitmaptools/__init__.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index dbf5a9ef96..6354dd508a 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "shared/runtime/interrupt_char.h" #include "shared-bindings/bitmaptools/__init__.h" #include "shared-bindings/displayio/Bitmap.h" #include "shared-bindings/displayio/Palette.h" @@ -376,6 +377,10 @@ void common_hal_bitmaptools_boundary_fill(displayio_bitmap_t *destination, } mp_obj_list_get(fill_area, &list_length, &fill_points); + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + return; + } } // set dirty the area so displayio will draw From f2931dec7aed790e26c8ce1136e097cce0fff7c6 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 14 Mar 2023 18:26:23 -0500 Subject: [PATCH 2/2] empty RUN_BACKGROUND_TASKS for unix port --- ports/unix/mpconfigport.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index c94845229c..237b99bfe8 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -194,6 +194,8 @@ extern const struct _mp_print_t mp_stderr_print; +#define RUN_BACKGROUND_TASKS + #if !(defined(MICROPY_GCREGS_SETJMP) || defined(__x86_64__) || defined(__i386__) || defined(__thumb2__) || defined(__thumb__) || defined(__arm__)) // Fall back to setjmp() implementation for discovery of GC pointers in registers. #define MICROPY_GCREGS_SETJMP (1)