Recently I decided to rebuild my streamer and add a volume knob and a screen.
I finished with the hardware part, and when it came to software, turned out it doesn't work that well. The volume control is super unresponsive.
Here's how it looks. I disabled encoder acceleration for testing purposes. The screen updates constantly and uses MPDClient Status() function to get the volume. It took 19 rotations to go from 0 to 100:
click to play
I wanted to see if this can be fixed and ended up modifying the rotenc.py.
Basically, the main change is that I update the UI (volume wheel) in a separate thread, while the MPDClient is updated instantly.
Here's the result, acceleration disabled. It took 5 turns to go from 0 to 100 and the encoder is 20 clicks per turn - checks out. You can even use the inertia of the knob to do a big jump in volume:
click to play
It'd be nice if out of the box performance was improved.
upd. I updated the modified rotenc.py with the one I ended up using, should work without issues now.
Here's the default one, just in case.
Notice that the arguments here are a bit different: <poll_interval in ms> <volume_step> <accel_interval> <accel_step> <pin_a> <pin_b> <print_debug>
If interval between two clicks is less than accel_interval, accel_step is used instead of volume_step, which is used normally. The lower the accel_interval, the faster you need to turn the knob to toggle acceleration.
Default values are 20 1 15 4 23 24
I finished with the hardware part, and when it came to software, turned out it doesn't work that well. The volume control is super unresponsive.
Here's how it looks. I disabled encoder acceleration for testing purposes. The screen updates constantly and uses MPDClient Status() function to get the volume. It took 19 rotations to go from 0 to 100:
click to play
I wanted to see if this can be fixed and ended up modifying the rotenc.py.
Basically, the main change is that I update the UI (volume wheel) in a separate thread, while the MPDClient is updated instantly.
Here's the result, acceleration disabled. It took 5 turns to go from 0 to 100 and the encoder is 20 clicks per turn - checks out. You can even use the inertia of the knob to do a big jump in volume:
click to play
It'd be nice if out of the box performance was improved.
upd. I updated the modified rotenc.py with the one I ended up using, should work without issues now.
Here's the default one, just in case.
Notice that the arguments here are a bit different: <poll_interval in ms> <volume_step> <accel_interval> <accel_step> <pin_a> <pin_b> <print_debug>
If interval between two clicks is less than accel_interval, accel_step is used instead of volume_step, which is used normally. The lower the accel_interval, the faster you need to turn the knob to toggle acceleration.
Default values are 20 1 15 4 23 24