Skip to content
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

Split the rendering of the display from the model objects #32

Open
cgreening opened this issue Oct 9, 2021 · 1 comment
Open

Split the rendering of the display from the model objects #32

cgreening opened this issue Oct 9, 2021 · 1 comment
Labels
prio: high High priority refactoring Involves a big update in many parts

Comments

@cgreening
Copy link
Collaborator

cgreening commented Oct 9, 2021

It would be good to move towards the MVC (Model View Controller) pattern for the UI to make the code a bit cleaner. At the moment classes like the EpubList and EpubReader have everything in them with some of the controller code in the main.cpp as well.

Ideally, we'd have a model class that contains the state, a controller class that responds to user events and updates the model and then a view class that renders the current state of the model.

User Event (touch, button_press) -> Controller -> Model Update -> View Rendered

This will be a fairly chunky refactor.

@martinberlin
Copy link
Collaborator

martinberlin commented Oct 9, 2021

A though about this idea, there is also LVGL that is a library that can help with this concept:
https://github.com/martinberlin/lv_port_esp32-epaper/
That is my fork that works with EPDiy to render and detect touch in this epaper.

The thing is that of course to use that will add a lot of code and reduce our own space to code. But the benefit is that it has that what you describe, kind of Model-View with ready made UX elements and also allows you to make Buttons that are directly attached to callback functions (With much more events, like onPress, onRelease, etc)
This is just a pointer and idea so you try it out and maybe just get some ideas from Lvgl.

This is an article I wrote about it with some video demos.

@martinberlin martinberlin added the refactoring Involves a big update in many parts label Oct 17, 2021
@martinberlin martinberlin added the prio: high High priority label Oct 25, 2021
@martinberlin martinberlin pinned this issue Oct 25, 2021
@martinberlin martinberlin unpinned this issue Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: high High priority refactoring Involves a big update in many parts
Projects
None yet
Development

No branches or pull requests

2 participants