Open cgreening opened 2 years ago
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.
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.