Commit graph

226 commits

Author SHA1 Message Date
Mikael Degerfält
5d333432ce Removed switch statement for curves, use array lookup instead 2019-06-25 23:00:45 +02:00
John Stäck
a0a3718b85
Merge pull request #18 from Trasselfrisyr/jstck/smallthings
Various small cleanup things
2019-06-25 14:30:10 +02:00
John Stäck
4df0bf068c More stale code removal 2019-06-25 13:42:41 +02:00
John Stäck
cc86c357a0 Move defines elsewhere as they're used in multiple places 2019-06-25 13:42:22 +02:00
John Stäck
416b2a1730 Restructure and clarify defined constants 2019-06-25 13:42:22 +02:00
John Stäck
bc31cb9eef Remove stale commented-out code 2019-06-25 13:42:22 +02:00
John Stäck
549c2797b0 Use pin names rather than hardcoding 2019-06-25 13:42:22 +02:00
John Stäck
7342de4d82 Annotate "fingering math" for readability 2019-06-25 13:41:34 +02:00
John Stäck
34a3dd0613
Merge pull request #17 from Trasselfrisyr/numenu
Full Menu Refactoring
2019-06-25 13:06:02 +02:00
Mikael Degerfält
7505cd21c2
Merge pull request #16 from Trasselfrisyr/compilerthings
Clever compiler tricks
2019-06-24 18:38:27 +02:00
Mikael Degerfält
9074f56ae5
Merge pull request #15 from Trasselfrisyr/eepromfile
Eepromfile storage support
2019-06-24 18:34:53 +02:00
Mikael Degerfält
b061084f1f Fixed som redraw issues 2019-06-24 17:55:37 +02:00
John Stäck
f5fc086177 Only write to file if value has actually changed. 2019-06-24 16:01:27 +02:00
John Stäck
b0ad504761 Fake some useful compiler flags 2019-06-24 15:39:36 +02:00
John Stäck
6c1c5e0344 More explicit version checking 2019-06-24 15:39:13 +02:00
John Stäck
b6ed8126b7 Allow midi+serial usb type too (useful for "console debugging") 2019-06-24 15:38:29 +02:00
John Stäck
0bbfdda241 No need for user to set NEWTEENSYDUINO 2019-06-24 15:03:02 +02:00
John Stäck
d04c0f92f8 Use TEENSYDUINO to determine version rather than making our own 2019-06-24 15:00:42 +02:00
John Stäck
50b1fe9eb3 Check for correct target platform and USB type 2019-06-24 15:00:00 +02:00
John Stäck
2c3df24fc1 Use default eeprom file if none is provided 2019-06-24 14:11:58 +02:00
John Stäck
829c08c031 EEPROM file storage, and argparsing that actually works 2019-06-24 11:56:57 +02:00
Mikael Degerfält
91b2a69d21 Fixed text alignment for sub values with units 2019-06-24 00:17:27 +02:00
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
7a2b70c38d Moved code from a function into where it was called
and some minor cleanup
2019-06-23 21:02:08 +02:00
John Stäck
3b2f0fa4cf Add argument parsing for eeprom stuff 2019-06-23 20:44:10 +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
9a595c0ffc WIP on making menues even more generic in handling 2019-06-23 17:14:18 +02:00
Mikael Degerfält
be0d08d8d6 Renamed some stuff for clarity 2019-06-23 17:14:18 +02:00
Mikael Degerfält
f2e2b7d33f Tiny adjust menu redraw bug fix
Had forgotten to redraw adjust menu after normal update, it was only redrawn when the sensor pixels were to be updated.
As a bonus I cleaned up some code.
2019-06-23 17:14:18 +02:00
Mikael Degerfält
bddbffd51d Moved over the rotation menu to new system
Had to change how the values where stored in RAM from singed to unsigned to be able to use the generic menu features. Also had to add the MenuEntrySub as a parameter to the menu callback functions to be able fo display and store the correct values.

Did some major cleanup now that the special case of rotator menu is gone together with all uses of the old version of the sub menu struct.
2019-06-23 17:14:18 +02:00
Mikael Degerfält
6c721e8b65 Removed code duplication
Also fixed bug were I reset the active sub menu when then sleep timer kicks in.
2019-06-23 17:14:18 +02:00
Mikael Degerfält
65aa0f4dab Converted more of the sub menus to the new sub definitions
Found out that it’s the lambda functions used for pointer that forces the structs to be in ram instead or rom.
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
Mikael Degerfält
ca5b2b9484 Removed unnecessary display.display() call 2019-06-23 17:14:17 +02:00
Mikael Degerfält
3df78f6598 Same as before 2019-06-23 17:14:17 +02:00
Mikael Degerfält
3de5dd2b37 Even more places to use helper functions 2019-06-23 17:14:17 +02:00
Mikael Degerfält
aec3ef9fc7 Use helper function to plot velocity 2019-06-23 17:14:17 +02:00
Mikael Degerfält
b156a5935d Moved status led blink to function 2019-06-23 17:14:17 +02:00
Mikael Degerfält
f2eabd7d37 Minor cleanups 2019-06-23 17:14:17 +02:00
Mikael Degerfält
1ac1b67732 Small bug fix 2019-06-23 17:14:17 +02:00
Mikael Degerfält
6e0786bccb Missed a few spots for sub menu redraw 2019-06-23 17:14:17 +02:00
Mikael Degerfält
8087f93677 Use helper function for midi channel as well 2019-06-23 17:14:17 +02:00
Mikael Degerfält
8772e28907 Pass button state instead of accessing global variable 2019-06-23 17:14:17 +02:00
Mikael Degerfält
2ed201ed04 Helper function to draw centered number in sub box 2019-06-23 17:14:17 +02:00
Mikael Degerfält
0c7bb7cc13 Pass *currentPage to functions instead of the original page data
This way it will be easier to break out even more functionality into more general functions.
2019-06-23 17:14:17 +02:00
Mikael Degerfält
5aafab684e Unified sub menu redraw 2019-06-23 17:14:17 +02:00
Mikael Degerfält
2ea76d96d3 Unified sub menu cursor blink 2019-06-23 17:14:17 +02:00
Mikael Degerfält
bd84f16b1a Removed an unused function 2019-06-23 17:14:17 +02:00