sqfmi / Watchy

Watchy - An Open Source E-Ink Smartwatch
http://www.sqfmi.com
MIT License
1.85k stars 322 forks source link

Refactor main menu functionality and state handling #205

Open kolemikko opened 1 year ago

kolemikko commented 1 year ago

This PR is my proposal how to refactor/reimplement the main menu functionality and state handling.

The aim is to simplify the code structure, avoid duplicate code and allow better extensibility. But also, to make menu flows easier to follow and isolate state handling within certain menu rather than handling all possible states at handleButtonPress().

Main changes:

This is fairly big change but I haven't noticed anything being broken, any feedback is welcome! :)

DarkZeros commented 1 year ago

I have been experimenting with multiple ways to simplify menus, I have nothing nearly "done" but I think this is a step forward. There are multiple ways to improve it for the future also to take into account that I have experimented with: