Jogdial functions - General Discussion and Assistance - CHDK Forum

Jogdial functions

  • 5 Replies
  • 3238 Views
*

Offline reyalp

  • ******
  • 14080
Jogdial functions
« on: 15 / February / 2015, 23:41:33 »
Advertisements
On sx160, I noticed wheel_left() and wheel_right() didn't work from chdkptp.

The wheel buttons in the chdkptp GUI did work.

For reasons I don't remember, the chdkptp GUI buttons use PostLogicalEventToUI directly instead of the wheel functions. The wheel functions on this camera and many others use PostLogicalEventForNotPowerType rather than *ToUI.

Switching to ToUI fixed the wheel functions. It seems likely that other cameras suffer from the same problem.

The difference between these functions has never been clear to me, but we've seen cases before where some events only work with one or the other.

waterwingz found that the wheel_* functions on G10 also did not work, but in that case it turned out the levent IDs were wrong. With the correct IDs, both *ToUI and *ForNotPowerType appear to work.
Don't forget what the H stands for.

Re: Jogdial functions
« Reply #1 on: 15 / February / 2015, 23:52:52 »
FWIW,  I've sometimes wished there was a way to interface with the jogdial as an input device from a script.  To be able to sense activity rather than generate it.

Maybe a counter value that goes up & down when the jogdial changes?

Code: [Select]
oldcount = get_jogdial_count()
sleep(100)
newcount = get_jogdial_count()
if (newcount > oldcount ) then direction = 1
if (newcount< oldcount ) then direction = -1
-- etc ....
No need for a "zero" function - the script could note the current value when started and just watch for changes.  Mind you,  if somebody spins the dial enough to wrap a 32 bit number I guess the code would need to handle the wrap.

Hmmm .. something to add to my project list I guess.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14080
Re: Jogdial functions
« Reply #2 on: 16 / February / 2015, 01:06:47 »
Yes, right now the jogdial passes through to the canon firmware in when a script is running, on most ports anyway.

This is something that would be easier if there was more unified keyboard code :P


On the original topic:
I've attached test script for the jogdial and various levent functions.

Clicking the left / right keys in the script generate jogdial left/right, using the method specified by the mode option:
func: wheel_left/wheel_right
4npt: post_levent_for_npt
2ui: post_levent_to_ui

Half shoot cycles the mode. Other keys are passed through to the canon firmware.
Don't forget what the H stands for.

*

Offline dvip

  • ****
  • 451
Re: Jogdial functions
« Reply #3 on: 17 / February / 2015, 22:29:18 »
Cool lua script, reyalp.
Could even be used to interact and adjust EV while a script is running.
Ran it on the SX160IS trunk4017 without problems. I didn't test it with chdkptp.


Re: Jogdial functions
« Reply #4 on: 17 / February / 2015, 22:39:25 »
Could even be used to interact and adjust EV while a script is running.
My exact thoughts when I posted earlier ... a nice addition to CHDKplus.lua.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Jogdial functions
« Reply #5 on: 19 / February / 2015, 20:00:45 »
sx100, ixus110_sd960, ixus870_sd880, s80 all pass the test now.
Interestingly, the old IDs used by the s80 port did work as left and right 'clicks' on the directional buttons - but neither of them is listed in the firmware levent table...  :blink:

 

Related Topics