Skip to content

Commit e114b5a

Browse files
committed
fixes showing OnDiskBitmap with adafruit_sdcard
1 parent 7611e71 commit e114b5a

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

shared-module/displayio/Display.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,10 @@ STATIC bool _refresh_area(displayio_display_obj_t* self, const displayio_area_t*
317317
}
318318

319319
STATIC void _refresh_display(displayio_display_obj_t* self) {
320-
if (!displayio_display_core_bus_free(&self->core)) {
321-
// Can't acquire display bus; skip updating this display. Try next display.
320+
if (!displayio_display_core_start_refresh(&self->core)) {
321+
// A refresh on this bus is already in progress. Try next display.
322322
return;
323323
}
324-
displayio_display_core_start_refresh(&self->core);
325324
const displayio_area_t* current_area = _get_refresh_areas(self);
326325
while (current_area != NULL) {
327326
_refresh_area(self, current_area);

shared-module/displayio/display_core.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,17 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
295295
}
296296
}
297297

298-
void displayio_display_core_start_refresh(displayio_display_core_t* self) {
298+
bool displayio_display_core_start_refresh(displayio_display_core_t* self) {
299+
if (!displayio_display_core_bus_free(self)) {
300+
// Can't acquire display bus; skip updating this display. Try next display.
301+
return false;
302+
}
303+
if (self->refresh_in_progress) {
304+
return false;
305+
}
306+
self->refresh_in_progress = true;
299307
self->last_refresh = supervisor_ticks_ms64();
308+
return true;
300309
}
301310

302311
void displayio_display_core_finish_refresh(displayio_display_core_t* self) {
@@ -305,6 +314,7 @@ void displayio_display_core_finish_refresh(displayio_display_core_t* self) {
305314
displayio_group_finish_refresh(self->current_group);
306315
}
307316
self->full_refresh = false;
317+
self->refresh_in_progress = false;
308318
self->last_refresh = supervisor_ticks_ms64();
309319
}
310320

shared-module/displayio/display_core.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ typedef struct {
5454
int16_t colstart;
5555
int16_t rowstart;
5656
bool full_refresh; // New group means we need to refresh the whole display.
57+
bool refresh_in_progress;
5758
} displayio_display_core_t;
5859

5960
void displayio_display_core_construct(displayio_display_core_t* self,
@@ -78,7 +79,7 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
7879

7980
void release_display_core(displayio_display_core_t* self);
8081

81-
void displayio_display_core_start_refresh(displayio_display_core_t* self);
82+
bool displayio_display_core_start_refresh(displayio_display_core_t* self);
8283
void displayio_display_core_finish_refresh(displayio_display_core_t* self);
8384

8485
void displayio_display_core_collect_ptrs(displayio_display_core_t* self);

0 commit comments

Comments
 (0)