Support for rotary "scroll" trim wheels
Support for rotary "scroll" trim wheels
Hey folks.
I would like to replace the clicky toggle trim switch assemblies with scroll/navigation wheels of the variety found on early blackberry handsets. The operation of these wheels is identical to that of a mouse scroll wheel - rotates infinitely in either direction with detents at regular intervals, clicks when pressed (though I don't intend to use the click function). The wheels can be found on digikey for about $5.50 each: link. I ordered 5 (1 to play with, 4 for the installation) which should be waiting for me when I get home from work. The wheels are smaller than a mouse scroll wheel, but I'll post pics when i can actually lay one on the 9X to get a better idea of what i'm getting myself into.
Electrically, the wheel's scroll function uses two contacts and outputs grey code: 00 01 11 10 00 as the wheel is turned. Since the 9X already has 2 uC inputs for each trim rocker switch, it should just be a matter physically installing the wheels and wiring them up in place of each trim switch PCB.
The software code on the other hand is where I'm hoping someone can help out. I could probably write some code to get the effect I'm after, but I know nothing about the existing er9X code and what it expects from any new trim adjusting code.
I expect the current system checks the trim switch inputs at regular intervals and takes action when one is pressed. To support the wheels, it would need to take action when the inputs change (store the previous state to compare with the present one at each input check). When a change is detected, determine which input pair the changed bit is associated with, and figure out which direction the wheel has moved based on the grey code sequence.
One of the more elegant ways I've seen the 'figuring' done is with a 4x4 array. One dimension is the two bits of the stored (old) input value, the other dimension is the two bits of the current value. Stored in each array element is a signed value representing how far the wheel has moved. Not to say this is the only, most efficient or fastest way of accomplishing the task, just one that I saw and appreciated.
So anyway, if someone could add a dozen or two lines of code to support grey code wheels, I think trim wheels will make an awesome hardware mod.
I would like to replace the clicky toggle trim switch assemblies with scroll/navigation wheels of the variety found on early blackberry handsets. The operation of these wheels is identical to that of a mouse scroll wheel - rotates infinitely in either direction with detents at regular intervals, clicks when pressed (though I don't intend to use the click function). The wheels can be found on digikey for about $5.50 each: link. I ordered 5 (1 to play with, 4 for the installation) which should be waiting for me when I get home from work. The wheels are smaller than a mouse scroll wheel, but I'll post pics when i can actually lay one on the 9X to get a better idea of what i'm getting myself into.
Electrically, the wheel's scroll function uses two contacts and outputs grey code: 00 01 11 10 00 as the wheel is turned. Since the 9X already has 2 uC inputs for each trim rocker switch, it should just be a matter physically installing the wheels and wiring them up in place of each trim switch PCB.
The software code on the other hand is where I'm hoping someone can help out. I could probably write some code to get the effect I'm after, but I know nothing about the existing er9X code and what it expects from any new trim adjusting code.
I expect the current system checks the trim switch inputs at regular intervals and takes action when one is pressed. To support the wheels, it would need to take action when the inputs change (store the previous state to compare with the present one at each input check). When a change is detected, determine which input pair the changed bit is associated with, and figure out which direction the wheel has moved based on the grey code sequence.
One of the more elegant ways I've seen the 'figuring' done is with a 4x4 array. One dimension is the two bits of the stored (old) input value, the other dimension is the two bits of the current value. Stored in each array element is a signed value representing how far the wheel has moved. Not to say this is the only, most efficient or fastest way of accomplishing the task, just one that I saw and appreciated.
So anyway, if someone could add a dozen or two lines of code to support grey code wheels, I think trim wheels will make an awesome hardware mod.
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Support for rotary "scroll" trim wheels
We have a rotary encoder in ersky9x, so grey code is no problem:
Mike.
Code: Select all
x = Rotary_inputs ; // Read new position, bits 0 and 1
if ( ( Rotary_position & 0x01 ) ^ ( ( x & 0x02) >> 1 ) )
{
Rotary_count -= 1 ;
}
else
{
Rotary_count += 1 ;
}
Rotary_position = x ; // Update current position
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Support for rotary "scroll" trim wheels
Does that mean we could have a rotary encoder on er9x??
I don't miss one do I??
I don't miss one do I??
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
- cre8tiveleo
- Posts: 1434
- Joined: Tue Dec 27, 2011 6:13 pm
- Country: -
- Location: Ontario,(GTA North)
- Contact:
Re: Support for rotary "scroll" trim wheels
Ooooo.rotary encoder and a grey wheel thingy ma jigger... nice... where the heck am I gonna put that.. along with the 7" daylight touch screen, raspberry pi, 2 rotary encoders... c**p... no room... :mrgrren:
Re: Support for rotary "scroll" trim wheels
Interesting. So it's [oldFirstBit] XOR [newSecondBit] = -1, assuming you already know the inputs have changed. Time to break out the K-maps. ^_^MikeB wrote:Code: Select all
x = Rotary_inputs ; // Read new position, bits 0 and 1 if((Rotary_position & 0x01)^((x & 0x02) >>1 )) Rotary_count -= 1 ; else Rotary_count += 1; Rotary_position = x ; // Update current position
[edit]
Yeah, that works if you treat the 0 and +/-2 values as "don't care"s, meaning they should be weeded out before hand. Since you can't tell which way the wheel was moved on increments of 2 steps or more, it would makes sense to me to just count them as 0. If an XOR of the old pair of bits against the new pair results in 0 (no change) or 3 (both changed), that should be a 0-increment case.
[/edit]
Re: Support for rotary "scroll" trim wheels
They're about the size I expected... If anything, maybe a little too small diameter-wise.
The wheel is just a hair thinner than the stock trim tab.
The wheel is just a hair thinner than the stock trim tab.
Re: Support for rotary "scroll" trim wheels
Ok, I got sidetracked by other projects, but remembered a related idea I had while rummaging through a bin of parts:
4-way navigation buttons + wheel and center select. $6.42 on mouser.
It requires clipping out the plastic X and sanding the hole ever so slightly (~.2 mm). Letting it sit against the back of the '9X front panel makes it stand out slightly from the face. If the existing screw hole/standoff posts were used to brace a PCB, the raised lip of the directional switches would be almost flush with the panel, making the whole thing a slight bowl in the panel (good for using the wheel).
Is 5 wheels too much? ^_^;
4-way navigation buttons + wheel and center select. $6.42 on mouser.
It requires clipping out the plastic X and sanding the hole ever so slightly (~.2 mm). Letting it sit against the back of the '9X front panel makes it stand out slightly from the face. If the existing screw hole/standoff posts were used to brace a PCB, the raised lip of the directional switches would be almost flush with the panel, making the whole thing a slight bowl in the panel (good for using the wheel).
Is 5 wheels too much? ^_^;
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: Support for rotary "scroll" trim wheels
Now that look nice, for ersky9x as well. I think I might get 1 (or three!). 5 wheels may be a bit much, but since I'm looking at the TelemetrEZ board, this might support some rotary encoders. That will be a follow up to getting it's basic operation going though.
Mike.
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: Support for rotary "scroll" trim wheels
for er9x?? hhmmm, nice..
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9
Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW