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

Sdcard odb fix #3449

merged 4 commits into from
Oct 1, 2020

Conversation

FoamyGuy
Copy link
Collaborator

Resolves #3309

Tested successfully with PyPortal.

@jepler helped create this fix for me. It was mentioned that there may need to be a similar solution added for framebuff APIs perhaps, that would be needed for the neopixels matrices if I understood correctly.

I think I have the appropriate hardware to try to tackle that now but I will need a bit more guidance into where that fix is it within the code and whether the same strategy used here is applicable for it.

@jepler jepler requested a review from tannewt September 22, 2020 00:19
@jepler
Copy link

jepler commented Sep 22, 2020

What I'm thinking--but haven't tested:

STATIC void _refresh_display(framebufferio_framebufferdisplay_obj_t* self) {
    self->framebuffer_protocol->get_bufinfo(self->framebuffer, &self->bufinfo);
    if(!self->bufinfo.buf) {
        return;
    }
    displayio_display_core_start_refresh(&self->core);
    const displayio_area_t* current_area = _get_refresh_areas(self);

This code in shared-modules/framebufferio/FramebufferDisplay.c needs to be changed so that it checks the return value of displayio_display_core_start_refresh.

The use in shared-module/displayio/EPaperDisplay.c should be corrected too.

I simply used git grep to list up all the files where the string _refresh_display appeared.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jepler
Copy link

jepler commented Sep 23, 2020

No, it's not.

We aren't entering background tasks recursively. We're entering refresh recursively: first from a foreground refresh() call, then from background tasks run during SD card accesses by OnDiskBitmap.

@jepler jepler requested a review from tannewt September 23, 2020 13:56
@tannewt
Copy link
Member

tannewt commented Sep 23, 2020

Do we need the top level test then? Could we remove it?

@jepler
Copy link

jepler commented Sep 29, 2020

I think the test at https://github.com/adafruit/circuitpython/blob/main/shared-module/displayio/__init__.c#L43-L44 can be removed with or without this, because of background_callback_run_all()s checks for !in_background_callback -- https://github.com/adafruit/circuitpython/blob/main/supervisor/shared/background_callback.c#L71-L75

@tannewt
Copy link
Member

tannewt commented Sep 29, 2020

Ok, @FoamyGuy please remove that outer display check. If you don't have time, let us know and we can finish it. Thanks!

@FoamyGuy
Copy link
Collaborator Author

@tannewt I think the latest commit removes the check you were referring to. Let me know if I've misunderstood and removed something different, or if I missed something else that needs to go with it.

I did not build this or test on a device after the latest commit. I can try that out later tonight.

@tannewt
Copy link
Member

tannewt commented Sep 30, 2020

Yup! Thank you. That is what I was thinking.

@FoamyGuy
Copy link
Collaborator Author

FoamyGuy commented Oct 1, 2020

I had missed one instance of that boolean variable being used. The latest commit takes care of that.

I did also build this version tonight and run it on a PyPortal and verify that the adafruit_sdcard and ondiskbitmap are still working properly.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you!

@tannewt tannewt merged commit be6e6ea into adafruit:main Oct 1, 2020
jepler added a commit to jepler/circuitpython that referenced this pull request Oct 2, 2020
An RGBMatrix has no bus and no bus_free method.  It is always possible
to refresh the display.

This was not a problem before, but the fix I suggested (adafruit#3449) added
a call to core_bus_free when a FramebufferDisplay was being refreshed.
This was not caught during testing.

This is a band-aid fix and it brings to light a second problem in which
a SharpDisplay + FrameBuffer will not have a 'bus' object, and yet does
operate using a shared SPI bus.  This kind of display will need a
"bus-free" like function to be added, or it can have problems like
adafruit#3309.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

adafruit_sdcard causes device to lock up on versions newer than 4.1.2 when used with OnDiskBitmap
3 participants