UI properties (PTM functions) - page 5 - General Discussion and Assistance - CHDK Forum

UI properties (PTM functions)

  • 49 Replies
  • 26013 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: UI properties (PTM functions)
« Reply #40 on: 04 / November / 2015, 13:09:57 »
Advertisements
Can I try to expand that range in order to identify the relevant CurrentItem for shutter period / zoom (or is it likely they just don't exist for this camera)?
No need to expand the search. To quote myself:
Quote
Not all UI elements have properties (examples of these: zoom, focus, Av, Tv values)
Oh, and setting unknown properties blindly can lead to camera crash due to asserts.

Re: UI properties (PTM functions)
« Reply #41 on: 04 / November / 2015, 13:44:53 »
Useful link.

Thanks.

Re: UI properties (PTM functions)
« Reply #42 on: 06 / November / 2015, 06:25:18 »
srsa_4c,

have you ever tried setting continuous mode on a VxWorks?

Just tried id 0x8007 on an A620 and it crashes the cam.


Edit: However, the IXUS850is does work.
« Last Edit: 06 / November / 2015, 17:00:13 by andrew.stephens.754365 »

*

Offline srsa_4c

  • ******
  • 4451
Re: UI properties (PTM functions)
« Reply #43 on: 06 / November / 2015, 18:12:03 »
srsa_4c,

have you ever tried setting continuous mode on a VxWorks?

Just tried id 0x8007 on an A620 and it crashes the cam.


Edit: However, the IXUS850is does work.
Tried 3 Vx cameras, works on all 3 (and the ID is 0x8007 on all 3).

Did you make sure it's the correct ID on the a620? Can you get a romlog?


Re: UI properties (PTM functions)
« Reply #44 on: 08 / November / 2015, 16:53:11 »
The problem seems to have been caused by temporarily not having the usual amount of memory available. Once that was fixed, everything works fine.

Thanks.


Re: UI properties (PTM functions)
« Reply #45 on: 09 / November / 2015, 13:54:43 »
srsa_4C,

registering procedures seems to consume a large amount of memory - have you any idea what could be involved?

*

Offline reyalp

  • ******
  • 14082
Re: UI properties (PTM functions)
« Reply #46 on: 09 / November / 2015, 16:02:28 »
registering procedures seems to consume a large amount of memory - have you any idea what could be involved?
It's normal for some of the registration calls to consume a significant amount of memory. You can make your script call get_meminfo('system') after each registration call to see how much.

You may be able to call the ones you want directly by address instead, using call_func_ptr(). However, in some cases the arguments need to be passed differently, because the eventproc system does some auto-magic translation.
Don't forget what the H stands for.

Re: UI properties (PTM functions)
« Reply #47 on: 10 / November / 2015, 04:13:59 »
Ok...thanks for that.


Re: UI properties (PTM functions)
« Reply #48 on: 12 / November / 2016, 11:25:23 »
For years I've been using set_prop to configure the aspect ratio in my scripts like this:

    --SX60 Props 304 & 399 Aspect Ratio (0=4:3, 1=16:9, 2=3:2, 3=1:1, 4=4:5)
    set_prop(require("propcase").ASPECT_RATIO, 0)


Unfortunately the camera's UI does not reflect this change, so the viewfinder crops the display differently to the images captured. Worse, switching to Play and back to Record loses the change completely. Looking for a better way I tried your excellent CmpUIP feature, which uncovered this UIProp:

    --SX60 UIProp 26 Aspect Ratio (0=16:9, 1=3:2, 2=4:3, 3=1:1, 4=4:5)

Interestingly those values do not match the Prop values but they do align with their order in the Canon menu. So I thought great, I'll just set that in my script:

    set_uiprop(26, 2)

But the function does not exist! I couldn't understand why the Debug menu let me discover UIProps that I can't get or set. Searching for this obvious function name lead me to this thread, where after reading all 5 pages and digging through several more wiki articles, I finally got it working like this:

    --register PTM_* functions
    call_event_proc("UI.Create")
    --set UIProp 26 to 2
    call_event_proc("PTM_SetCurrentItem", 0x8000 + 26, 2)


Upon running that code, the camera's UI instantly updates to 4:3 and sets Props 304 & 399 to 0. Better yet, it survives switching modes and even restarting the camera, which I guess is the reason you guys are scared to implement it. To that end, I tried passing an invalid value of 5 and the camera crashed immediately. It came back up fine though, so I believe such fears are exaggerated.

About abstraction: due to differences between camera generations, these properties should probably be manipulated by separate script functions. For camera-specific use, we could introduce generic functions like set_uiprop() and get_uiprop().

So my question is, can you guys please introduce the scripting functions get_uiprop and set_uiprop that srsa_4c suggested over 1 year and 4 months ago? You've already done all the hard work, it's time to make it official. This technology will eliminate the need for all sorts of slow and unreliable button-pushing scripts, as well as allowing scripts to read UIProps that do not have a corresponding Prop (eg AF Frame Size) :D
« Last Edit: 12 / November / 2016, 13:32:06 by fossil »

Re: UI properties (PTM functions)
« Reply #49 on: 12 / November / 2016, 13:54:50 »
To that end, I tried passing an invalid value of 5 and the camera crashed immediately. It came back up fine though, so I believe such fears are exaggerated.
Interesting test.  Although it's hardly exhaustive.  Different values than 5 or different function codes could still cause permanent problems?

Quote
So my question is, can you guys please introduce the scripting functions get_uiprop and set_uiprop that srsa_4c suggested over 1 year and 4 months ago? You've already done all the hard work, it's time to make it official. This technology will eliminate the need for all sorts of slow and unreliable button-pushing scripts, as well as allowing scripts to read UIProps that do not have a corresponding Prop (eg AF Frame Size) :D
I guess the short answer might be that you already have the ability to use this functionality - as your post shows.  Making it a built-in function really thus just provides a typing convenience. But maybe it also opens the door for a naive person learning to script getting themselves into trouble?
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics