How to handle encoder data

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!

Related question: I’d like to experiment with letting the encoders go faster – can I just increase ENCODER_MAX_SPEED?

Never mind that last question I updated the accel speed values:

uint8_t encoderAccelSpeed[][ENCODER_MAX_SPEED] = {{1, 2, 3, 3, 4, 5},
{1, 2, 3, 4, 6, 7},
{1, 2, 4, 8, 12, 16}};

Increasing the acceleration makes the encoders feel kind of unpredictable. I might go to fixed speed but have fast and slow modes, but where fast is pretty fast, like a jump value of 8-12. Encoder click could switch between modes. The other thing I was thinking was use the encoder click to jump between zero and the current value, for very quick changes.

We’ll see what works! I’m thinking I maybe should have made Hachi with faders instead, but I do love the LED rings.