Skip to content

Conversation

@tannewt
Copy link
Member

@tannewt tannewt commented Aug 23, 2019

This PR reworks the display refresh mechanics by replacing wait_for_refresh and refresh_soon with refresh. refresh is required for ePaper and not required for regular displays when auto_refresh is True. auto_refresh can be set during execution to prevent intermediate screen updates. This fixes #1691. 4.x code that calls wait_for_refresh and refresh_soon can have it removed for nearly identical behavior. (wait_for_refresh may have caused a slight delay that could be replaced by self-timing using time.monotonic)

This also adds support for ePaper displays through a sister class to Display. It can handle two color and three color displays.

Lastly, Monster M4SK support was added to test the new refresh code. It also parameterizes the filesystem label so that it can be changed from the default CIRCUITPY.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Thanks for this massive amount of work!

@tannewt
Copy link
Member Author

tannewt commented Aug 23, 2019

Ok, changes are pushed. I'm still thinking over the ePaper refresh API. I kinda think the return of True/False is too silent because it's not obvious something is wrong.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Still also thinking about the refresh() calls, especially for ePaper. For a really long refresh cycle like ePaper, maybe the old refresh_soon() makes sense. But could call it schedule_refresh(), or refresh_needed(), or similar. There could also be a call seconds_until_refresh() that would return how much more time there is, and maybe even a 'refresh_done` property after that.

I'm thinking about some kind of use case where you might, say, light up an LED to indicate a refresh is on the way, an then turn it off when it's done. But maybe that's not real.

}
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_reset);
Copy link

@deshipu deshipu Aug 24, 2019

Choose a reason for hiding this comment

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

What is the reasoning here behind rising an exception rather than just doing nothing? It forces us to repeat that check for pin everywhere (or catch the exception). Is there a use case where that exception is useful?

Copy link
Member Author

Choose a reason for hiding this comment

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

An ePaper display driver may need to detect whether a reset worked because the only way to exit a power down is to reset. Without it, the drivers must leave it on. (The monochrome featherwing needs it.)

@tannewt
Copy link
Member Author

tannewt commented Aug 26, 2019

@dhalbert The danger of a refresh_soon or similar is that you may change what is on the screen after the call but before the refresh occurs.

I already added a time_to_refresh property to access how much longer to wait in the cycle. With it, someone can either sleep or do a loop while waiting.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

This is OK by me now. Thanks!

@tannewt
Copy link
Member Author

tannewt commented Aug 27, 2019

I'm going to merge this. @deshipu let me know if you'd like me to follow up with any more changes.

@tannewt tannewt merged commit 42956a6 into adafruit:master Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

displayio - pause display refresh (for setting up a bunch of items)

4 participants