Okay! I’m finally tackling the encoders. I’m planning on having multiple banks of encoders for different functions within Hachi, but I don’t want to use your system of banks, because of the storage overhead.
I plan on storing the current value of each controller, and then when I get an update from EncoderInputs::SendRotaryMessage() I’ll update the controller that’s currently active.
However, the encoder code is pretty complicated, I think because you’re tracking direction of movement and acceleration etc. I’d like to reuse your code for that stuff but with use it with my own controller tracking.
I’m looking at the code in encoders.ino, starting about line 1079:
// GET NEW ENCODER VALUE based on speed, direction and speed multiplier (14 bits config)
If I just have one bank, will there only be one set of eBankData? It looks like the amount to update the value is determined either by normalDirection or nextJump*speedMultiplier. So if I pull out the value after that block of code, I’ll be reusing your acceleration logic. Is that right?
And if I just want to use one of your banks but have my own values, can I just insert my values into eBankData[eHwData[encNo].thisEncoderBank][encNo].encoderValue when I change my “banks” and let the rest of your logic just update those values?
I think the other option would be for me to just tap in earlier and grab normalDirection and create my own acceleration logic? I’m not sure yet what makes more sense – I just started trying to figure this out. Any suggestions are welcome!