Skip to content

Commit 8df888e

Browse files
committed
prevent recursive display refresh
1 parent ac9e846 commit 8df888e

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

shared-module/busdisplay/BusDisplay.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,14 @@ static bool _refresh_area(busdisplay_busdisplay_obj_t *self, const displayio_are
309309
}
310310

311311
static void _refresh_display(busdisplay_busdisplay_obj_t *self) {
312+
if (!displayio_display_core_start_refresh(&self->core)) {
313+
// Refresh for this display already in progress.
314+
return;
315+
}
312316
if (!displayio_display_bus_is_free(&self->bus)) {
313317
// A refresh on this bus is already in progress. Try next display.
314318
return;
315319
}
316-
displayio_display_core_start_refresh(&self->core);
317320
const displayio_area_t *current_area = _get_refresh_areas(self);
318321
while (current_area != NULL) {
319322
_refresh_area(self, current_area);

shared-module/epaperdisplay/EPaperDisplay.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ void epaperdisplay_epaperdisplay_change_refresh_mode_parameters(epaperdisplay_ep
187187
}
188188

189189
static void epaperdisplay_epaperdisplay_start_refresh(epaperdisplay_epaperdisplay_obj_t *self) {
190+
if (!displayio_display_core_start_refresh(&self->core)) {
191+
// Refresh on this display already in progress.
192+
return;
193+
}
194+
190195
if (!displayio_display_bus_is_free(&self->bus)) {
191196
// Can't acquire display bus; skip updating this display. Try next display.
192197
return;
@@ -201,7 +206,6 @@ static void epaperdisplay_epaperdisplay_start_refresh(epaperdisplay_epaperdispla
201206
if (mp_hal_is_interrupted()) {
202207
return;
203208
}
204-
displayio_display_core_start_refresh(&self->core);
205209
}
206210

207211
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)