10000 Merge pull request #3449 from FoamyGuy/sdcard_odb_fix · joric/circuitpython@be6e6ea · GitHub
[go: up one dir, main page]

Skip to content

Commit be6e6ea

Browse files
authored
Merge pull request adafruit#3449 from FoamyGuy/sdcard_odb_fix
Sdcard odb fix
2 parents 36bd405 + 422a7d4 commit be6e6ea

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

shared-module/displayio/Display.c

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

330330
STATIC void _refresh_display(displayio_display_obj_t* self) {
331-
if (!displayio_display_core_bus_free(&self->core)) {
332-
// Can't acquire display bus; skip updating this display. Try next display.
331+
if (!displayio_display_core_start_refresh(&self->core)) {
332+
// A refresh on this bus is already in progress. Try next display.
333333
return;
334334
}
335-
displayio_display_core_start_refresh(&self->core);
336335
const displayio_area_t* current_area = _get_refresh_areas(self);
337336
while (current_area != NULL) {
338337
_refresh_area(self, current_area);

shared-module/displayio/__init__.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ STATIC bool any_display_uses_this_framebuffer(mp_obj_base_t *obj) {
4040
}
4141
#endif
4242

43-
// Check for recursive calls to displayio_background.
44-
bool displayio_background_in_progress = false;
4543

4644
void displayio_background(void) {
4745
if (mp_hal_is_interrupted()) {
@@ -52,12 +50,6 @@ void displayio_background(void) {
5250
return;
5351
}
5452

55-
if (displayio_background_in_progress) {
56-
// Don't allow recursive calls to this routine.
57-
return;
58-
}
59-
60-
displayio_background_in_progress = true;
6153

6254
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
6355
if (displays[i].display.base.type == NULL || displays[i].display.base.type == &mp_type_NoneType) {
@@ -75,8 +67,6 @@ void displayio_background(void) {
7567
}
7668
}
7769

78-
// All done.
79-
displayio_background_in_progress = false;
8070
}
8171

8272
void common_hal_displayio_release_displays(void) {

shared-module/displayio/display_core.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,17 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
316316
}
317317
}
318318

319-
void displayio_display_core_start_refresh(displayio_display_core_t* self) {
319+
bool displayio_display_core_start_refresh(displayio_display_core_t* self) {
320+
if (!displayio_display_core_bus_free(self)) {
321+
// Can't acquire display bus; skip updating this display. Try next display.
322+
return false;
323+
}
324+
if (self->refresh_in_progress) {
325+
return false;
326+
}
327+
self->refresh_in_progress = true;
320328
self->last_refresh = supervisor_ticks_ms64();
329+
return true;
321330
}
322331

323332
void displayio_display_core_finish_refresh(displayio_display_core_t* self) {
@@ -326,6 +335,7 @@ void displayio_display_core_finish_refresh(displayio_display_core_t* self) {
326335
displayio_group_finish_refresh(self->current_group);
327336
}
328337
self->full_refresh = false;
338+
self->refresh_in_progress = false;
329339
self->last_refresh = supervisor_ticks_ms64();
330340
}
331341

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,
@@ -81,7 +82,7 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
8182

8283
void release_display_core(displayio_display_core_t* self);
8384

84-
void displayio_display_core_start_refresh(displayio_display_core_t* self);
85+
bool displayio_display_core_start_refresh(displayio_display_core_t* self);
8586
void displayio_display_core_finish_refresh(displayio_display_core_t* self);
8687

8788
void displayio_display_core_collect_ptrs(displayio_display_core_t* self);

0 commit comments

Comments
 (0)
0