Replies: 2 comments 1 reply
-
|
Sounds promising! |
Beta Was this translation helpful? Give feedback.
-
|
While thinking about a key matrix and setting this up I also realized that a "central" storage of all inputs would be helpfull. In the end I came also up with a "bit array" where all inputs are representd by one bit. As far as I remember a class was always presented by Edwardz(?) in the development channel from discord (unfortenutelly I lost the link). An easy and fast! solution should be set up w/o high effort. But this would mean that the button and encoder routine must be split up. The values must be read in the required time frame (10ms buttons, 1ms encoders) from the bit array, within the main loop() the digital I/O's must be read and stored into the array. Same for the shifters, they must be read "continously" there values into the array, and the button routine can also read these "vituell" pin numbers. There must be only once a definition which input device writes into which bit in the array. Special care has to be taken on the max. size of the configuration, espacially at the promicro. This will limit the number of inputs. Assuming 20 bytes are required for each button (name, pin and overhead) and increasing the config size to 512 Byte (promicro) the max number of buttons are 25 unless "other" inputs (shift register, MPX, keymatrix) transfer only a "general" name (shifter xyz) and the pin number. But this would make the requirement for a "bit array" obsolete ;) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Looking at the current firmware code (also including coming input shifter management), I noticed that every source for digital inputs (buttons, encoders, input shifters...) has the very same mechanisms in place after the actual data is read:
Callbacks seem very redundant:
Besides, every input "block" type has its own buffer with its management functions, mostly all very similar (if not the same).
Proposal:
For consistency, all (digital) inputs from any source could be written to a common buffer (let's call it a "flag" buffer to distinguish them from physical inputs); the change detection and reporting could be run just once, by a single function, on this buffer.
This way the information about the source of the flags is lost, but I see no reason why an input coming from a button should be treated differently from one coming from a shifter or e.g. a multiplexer.
Some sensitive inputs (encoders) could still be read/scanned more frequently.
I have more details figured out (and tested classes ready to use), but they can be discussed later.
I believe there are several merits to this changes in implementation:
On a related note, this would also benefit the implementation of Multiplex support.
As correctly pointed out on Discord, of course this should wait until after support for input shifters is finally merged.
Beta Was this translation helpful? Give feedback.
All reactions