Add basic support for Disting Ex dual mode commands#434
Add basic support for Disting Ex dual mode commands#434trentgill merged 4 commits intomonome:mainfrom
Conversation
* Allow getters to use separate arguments for side and parameter, instead of forcing the caller to pack them each time.
|
looks good--- don't have a disting so can't test but figure you have :) @trentgill checking if you have opinions on name lengths |
lua/ii/disting.lua
Outdated
| , cmd = 0x57 | ||
| } | ||
| -- dual mode algorithms | ||
| , { name = 'set_dual_parameter' |
There was a problem hiding this comment.
i think we can drop set_ as this is implicit in usage: ii.disting.dual_parameter(2, 23).
below, getting is already implicit in the call (not the fn name): ii.disting.get('dual_parameter', 2)
same comment for set_dual_scale_parameter
lua/ii/disting.lua
Outdated
| , { 'value', u16 } | ||
| } | ||
| } | ||
| , { name = 'load_dual_algorithm' |
There was a problem hiding this comment.
consider if we can drop load in this case? there is no save_dual_algorithm, so it seems unnecessary.
same for load_dual_algorithms.
lua/ii/disting.lua
Outdated
| data[1] = (data[1] & 0xF0) | (data[2] & 0xF); | ||
| data[1] = (data[1] & 0x0F) | ((side & 0xF) << 4); |
There was a problem hiding this comment.
i'm out of bit-manipulation practice, but couldn't this just be:
data[1] = ((data[1] & 0xF) << 4) | (data[2] & 0xF);then you could delete the side variable.
if there's something trickier going on, perhaps a short inline comment?
There was a problem hiding this comment.
I'm rusty on manipulation as well... hence a step based approach, but this is much more concise.
|
All the comments are good/helpful. I'll clean everything up when I have time in the next day or or two. Thanks @trentgill |
* Use pickle to pack side/param for dual_parameter commands. * Remove set_ from function names.
|
@trentgill I've cleaned this up a bit and am now handling all commands that use the packed side/param in pickle(). I removed all @discohead this works for me in some quick tests, but maybe you have time to try it out to confirm or offer any suggestions? |
Finally had a chance to connect disting to crow, so I went ahead and added these commands from the 1.9 firmware.
Not sure if the names for dual mode should be abbreviated-- they are getting a bit long.