get jogdial in ubasic and lua? - Script Writing - CHDK Forum supplierdeeply

get jogdial in ubasic and lua?

  • 2 Replies
  • 1615 Views
*

Offline funnel

  • ****
  • 349
get jogdial in ubasic and lua?
« on: 07 / August / 2011, 09:15:37 »
Advertisements
I see there's no get function for jogdial in ubasic and lua. I want to make a simple script to override the subject distance and use the wheel to change the values.

Is there any way to call get_jogdial_direction() from lua?

Thanks.

Re: get jogdial in ubasic and lua?
« Reply #1 on: 22 / August / 2011, 12:03:35 »
You have to know jog_dial adresses in RAM for your camera. Then you can peek() them and compare. I did it for SX130IS. It follows:

Code: [Select]
function get_jogdial()
    u=v
    v=peek(0xC0240104,4)
    
    if v>u then
     jogdial_change=1
    end
    
    if v<u then
     jogdial_change=-1
    end
    
    if u==v then
     jogdial_change=0
    end
end

However, you need to find your own adresses for your camera. It's to be done by reading some files of the source code, I don't remember which. Probably a kind of patch for the specific camera or something.

Function returns -1 if jogdial was turned left, +1 if turned right and 0 if it was not turned since last check. Note, that wait_click() will not work for jogdial.

It would be nice to have get_jogdial() function built in CHDK...

EDIT:

As I'm reading this code I'm sure, that u and v must be initialized somewhere before (otherwise v would be a nil value at start and v>u would return an error).
« Last Edit: 22 / August / 2011, 12:16:24 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline funnel

  • ****
  • 349
Re: get jogdial in ubasic and lua?
« Reply #2 on: 22 / August / 2011, 15:09:20 »
Thanks. That helped. I knew that the code would look something like that. You saved me from figuring it out myself. :)

 

Related Topics