Skip to content

Sdcard odb fix #3449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions shared-module/displayio/Display.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,10 @@ STATIC bool _refresh_area(displayio_display_obj_t* self, const displayio_area_t*
}

STATIC void _refresh_display(displayio_display_obj_t* self) {
if (!displayio_display_core_bus_free(&self->core)) {
// Can't acquire display bus; skip updating this display. Try next display.
if (!displayio_display_core_start_refresh(&self->core)) {
// A refresh on this bus is already in progress. Try next display.
return;
}
displayio_display_core_start_refresh(&self->core);
const displayio_area_t* current_area = _get_refresh_areas(self);
while (current_area != NULL) {
_refresh_area(self, current_area);
Expand Down
10 changes: 0 additions & 10 deletions shared-module/displayio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ STATIC bool any_display_uses_this_framebuffer(mp_obj_base_t *obj) {
}
#endif

// Check for recursive calls to displayio_background.
bool displayio_background_in_progress = false;

void displayio_background(void) {
if (mp_hal_is_interrupted()) {
Expand All @@ -52,12 +50,6 @@ void displayio_background(void) {
return;
}

if (displayio_background_in_progress) {
// Don't allow recursive calls to this routine.
return;
}

displayio_background_in_progress = true;

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

// All done.
displayio_background_in_progress = false;
}

void common_hal_displayio_release_displays(void) {
Expand Down
12 changes: 11 additions & 1 deletion shared-module/displayio/display_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,17 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,
}
}

void displayio_display_core_start_refresh(displayio_display_core_t* self) {
bool displayio_display_core_start_refresh(displayio_display_core_t* self) {
if (!displayio_display_core_bus_free(self)) {
// Can't acquire display bus; skip updating this display. Try next display.
return false;
}
if (self->refresh_in_progress) {
return false;
}
self->refresh_in_progress = true;
self->last_refresh = supervisor_ticks_ms64();
return true;
}

void displayio_display_core_finish_refresh(displayio_display_core_t* self) {
Expand All @@ -305,6 +314,7 @@ void displayio_display_core_finish_refresh(displayio_display_core_t* self) {
displayio_group_finish_refresh(self->current_group);
}
self->full_refresh = false;
self->refresh_in_progress = false;
self->last_refresh = supervisor_ticks_ms64();
}

Expand Down
3 changes: 2 additions & 1 deletion shared-module/displayio/display_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ typedef struct {
int16_t colstart;
int16_t rowstart;
bool full_refresh; // New group means we need to refresh the whole display.
bool refresh_in_progress;
} displayio_display_core_t;

void displayio_display_core_construct(displayio_display_core_t* self,
Expand All @@ -78,7 +79,7 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self,

void release_display_core(displayio_display_core_t* self);

void displayio_display_core_start_refresh(displayio_display_core_t* self);
bool displayio_display_core_start_refresh(displayio_display_core_t* self);
void displayio_display_core_finish_refresh(displayio_display_core_t* self);

void displayio_display_core_collect_ptrs(displayio_display_core_t* self);
Expand Down