Aspect Ratio Button - Script Writing - CHDK Forum

Aspect Ratio Button

  • 4 Replies
  • 4577 Views
Aspect Ratio Button
« on: 02 / September / 2011, 05:51:50 »
Advertisements
Hi folks! This is my camera:



Does anyone know how can I press the Aspect Ratio Button in ubasic or lua? I've tried:
  click "aspect"
  click "ratio"
  click "wide"
but none of them work :(

*

Offline reyalp

  • ******
  • 14126
Re: Aspect Ratio Button
« Reply #1 on: 03 / September / 2011, 19:12:07 »
This key doesn't appear to be included in the kbd code. If you can find the physw_status bit for this button, we might be able to add it.

In lua, you could probably simulate a press by with
post_levent_to_ui("PressAspectButton")
post_levent_to_ui("UnpressAspectButton")

These functions are not available in ubasic
Don't forget what the H stands for.

Re: Aspect Ratio Button
« Reply #2 on: 05 / September / 2011, 11:07:08 »
reyalp you are a genius - it worked exactly as you said! :D

    post_levent_to_ui("PressAspectButton")
    post_levent_to_ui("UnpressAspectButton")

Then I just needed to wait for the camera to finish changing aspect ratio (takes anywhere from 100ms to 800ms):

    repeat
        sleep(50)
    until get_prop(294) == 1

And the problem was solved - thanks a million for your help!

So how can I find the physw_status bit?

*

Offline reyalp

  • ******
  • 14126
Re: Aspect Ratio Button
« Reply #3 on: 05 / September / 2011, 15:31:31 »
So how can I find the physw_status bit?
You need to watch the values of physw_status while pressing the button and figure out which bit changes.

physw_status is an array of 3 words. Some of the bits change continuously. Others correspond the various buttons/switches on the camera. Generally pressing a button makes the corresponding bit go to zero.

If you are comfortable modifying C code and building your own CHDK, the simplest way to do this is probably to modify gui.c  gui_draw_debug_vals_osd to show all 3 words of physw_status. One of the commented out sections does this.

If you don't want to modify CHDK, you can use the memory browser in the debug menu. The start of physw_status is 0x12DA4 both 200h and 201a firmwares. The bit for this button is likely be in the second word ( 0x12DA8 ) like most of the other buttons.

Don't forget what the H stands for.

Re: Aspect Ratio Button
« Reply #4 on: 06 / September / 2011, 11:06:08 »
More pure genius - it was exactly where you said! I used the memory browser and enabled show misc values:

* 0x12DA8 is normally 0xffffff but becomes 0xdfffff when I hold the aspect button
* I guess that means the aspect button's physw_status bit is 0x00200000!

Thanks for your help again reyalp - I sure hope you can add it in a later build :xmas

 

Related Topics


SimplePortal © 2008-2014, SimplePortal