Skip to content

Commit cdd0cdd

Browse files
authored
Merge pull request adafruit#10806 from dhalbert/prevent-recursive-display-refresh
prevent recursive display refresh
2 parents 32bfcdb + bcb9cd1 commit cdd0cdd

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

shared-module/busdisplay/BusDisplay.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,11 @@ static void _refresh_display(busdisplay_busdisplay_obj_t *self) {
313313
// A refresh on this bus is already in progress. Try next display.
314314
return;
315315
}
316-
displayio_display_core_start_refresh(&self->core);
316+
if (!displayio_display_core_start_refresh(&self->core)) {
317+
// Refresh for this display already in progress.
318+
return;
319+
}
320+
317321
const displayio_area_t *current_area = _get_refresh_areas(self);
318322
while (current_area != NULL) {
319323
_refresh_area(self, current_area);

shared-module/epaperdisplay/EPaperDisplay.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ static void epaperdisplay_epaperdisplay_start_refresh(epaperdisplay_epaperdispla
191191
// Can't acquire display bus; skip updating this display. Try next display.
192192
return;
193193
}
194+
if (!displayio_display_core_start_refresh(&self->core)) {
195+
// Refresh on this display already in progress.
196+
return;
197+
}
194198

195199
// run start sequence
196200
self->bus.bus_reset(self->bus.bus);
@@ -201,7 +205,6 @@ static void epaperdisplay_epaperdisplay_start_refresh(epaperdisplay_epaperdispla
201205
if (mp_hal_is_interrupted()) {
202206
return;
203207
}
204-
displayio_display_core_start_refresh(&self->core);
205208
}
206209

207210
uint32_t common_hal_epaperdisplay_epaperdisplay_get_time_to_refresh(epaperdisplay_epaperdisplay_obj_t *self) {

shared-module/framebufferio/FramebufferDisplay.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ static void _refresh_display(framebufferio_framebufferdisplay_obj_t *self) {
217217
if (!self->bufinfo.buf) {
218218
return;
219219
}
220-
displayio_display_core_start_refresh(&self->core);
220+
if (!displayio_display_core_start_refresh(&self->core)) {
221+
// Refresh on this display already in progress.
222+
return;
223+
}
221224
const displayio_area_t *current_area = _get_refresh_areas(self);
222225
if (current_area) {
223226
bool transposed = (self->core.rotation == 90 || self->core.rotation == 270);

0 commit comments

Comments
 (0)