Commit graph

5 commits

Author SHA1 Message Date
Mikael Degerfält
d2f3bba544 Reduced code duplication and fixed adjust cursor bug 2019-06-23 22:02:23 +02:00
Mikael Degerfält
e08a3a5291 Converted lambdas to normal functions to save RAM 2019-06-23 22:01:17 +02:00
Mikael Degerfält
9561556302 No need to set text color all the time
Since the cursor blinking is handled a bit differently now, there is no need to set text color all the time since we know it should always be white. But just to be certain, lets set it to WHITE first thing in the updatePage function.
Also moved the code from plotMIDI into a custom render function for midi sub menu.
2019-06-23 21:28:35 +02:00
Mikael Degerfält
5b59b4cd0f Final push to unify all menu states
All states are now handled by the new menu system, although some are flagged to have a custom handler that does everything by itself.

I replaced most reference parameters to pointers to be able to typecast in a nicer way.

Key input is not passed as a parameter to the menu functions instead of having global variables they all access. I think I broke one thing by doing this, since there is no way to propagate key input changes to the next frame.
2019-06-23 17:14:18 +02:00
Mikael Degerfält
699546df8c Handle sub menus in a generic way and moved adjust menu logic to separate file
This is a big one where I can finally reap what I sown. Sub menu entries now provide two functions, one to get the text for the current value and one to apply changes aka save to EEPROM. With this I can replace so much code in the menu() function that handles input, but was _almost_ identical. The process of converting the old menus are not completed, and I can probably remove about 200 lines more code.

The question is still what to do with less general menus like the rotator and fast patch menu.

One problem with the current implementation is that it is RAM heavy. It seems the const MenuEntry structs are placed in ram, because there is a pointer to RAM that I assume is allocated during execution and therefore the address cannot be stored in ROM.

My plan has been to put all the configuration fields (that are stored in EEPROM) into a struct or an array. When that is implemented, I can instead store the offset into the array in the const struct, which should be available at compile time and therefore can reside completely in ROM.
2019-06-23 17:14:17 +02:00