Propcases - Script Writing - CHDK Forum

Propcases

  • 8 Replies
  • 2752 Views
Propcases
« on: 27 / January / 2013, 22:43:58 »
Advertisements
Hope someone can point me in the right direction. I am trying to find the latest info on propcases. In reading the relevant CHDK page it looks as if the info is a little out date.

Also it is not clear is, say, the S95 propcase table is in addition to the 'older' tables, or does the S95 propcases only hold a subset of what is possible? That is does each camera have a full set of propcase ids?

Any help gratefully received.

Re: Propcases
« Reply #1 on: 27 / January / 2013, 22:46:50 »
Hope someone can point me in the right direction. I am trying to find the latest info on propcases. In reading the relevant CHDK page it looks as if the info is a little out date.
propset1.h to propset5.h as defined here is as good as it gets : http://trac.assembla.com/chdk/browser/trunk/include

other than that,   its here :  http://chdk.wikia.com/wiki/PropertyCase

Quote
Also it is not clear is, say, the S95 propcase table is in addition to the 'older' tables, or does the S95 propcases only hold a subset of what is possible? That is does each camera have a full set of propcase ids?
This makes no sense.   The propcase tables list the know values stored in memory for each of the camera firmware releases they reference.  Its not an additive thing or a subset thing.  For each camera,  there is a propcase table, usually shared with other cameras released about the same time.


« Last Edit: 27 / January / 2013, 22:51:25 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Propcases
« Reply #2 on: 27 / January / 2013, 22:52:56 »
Waterwingz

Thanks, but how do you know what propset goes with what camera?

Re: Propcases
« Reply #3 on: 27 / January / 2013, 22:54:58 »
Thanks, but how do you know what propset goes with what camera?
Well, its in the platform_camera.h source file for each camera as
Code: [Select]
#define CAM_PROPSET   nnLets see if I can find a better source - I was thinking here ( http://chdk.wikia.com/wiki/P-ID_(Table) ) but I guess not.
« Last Edit: 27 / January / 2013, 23:04:17 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline lapser

  • *****
  • 1093
Re: Propcases
« Reply #4 on: 28 / January / 2013, 02:12:13 »
For lua scripting, take a look at the files in the folder CHDK/LUALIB/GEN on the SD card.

Basically, you start your script with:

props=require("propcase")

That loads the correct table for the camera the script is running on. Then, you can just refer to:

props.TV
props.TV2

I've attached a script I wrote awhile back that uses the propcases to set Tv and Sv that should give you the idea of how this works:
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline msl

  • *****
  • 1276
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Propcases
« Reply #5 on: 28 / January / 2013, 04:01:07 »
but how do you know what propset goes with what camera?

get_propset()

But as lapser wrote, for Lua scripts the better way is to use props=require("propcase"). This variant is independent of the propset number.

msl
CHDK-DE:  CHDK-DE links

Re: Propcases
« Reply #6 on: 28 / January / 2013, 10:24:14 »
Waterwingz, Lapser & Msl

Many thanks to all three of you for taking the time to try and help me better understand propcases etc.

It was not my intention to waste your time, so I appreciate your inputs.

I now understand that propcases are not always a definitive science, but more an evolving art, ie the CHDK community doesn’t fully understand every case.

If I take my S95, propset 4, and look in the Lualib, it seems to correlate with http://chdk.wikia.com/wiki/PropertyCase, where I see that the CHDK community is still not sure regarding R/W status in all cases.

Where I continue to get ‘confused, is when I read lapsers posts and see reference to require("propcase") and props.Tv etc, which I can’t seem to reconcile with what I see in the LuaLib and on the Forum.

Bottom line: I am getting there, but I must admit to still being slightly confused by the available info. Finally, please don’t waste any more of your time precious time on me, you truly have helped a lot so far. My task is to work it out myself!

Cheers

Garry


*

Offline lapser

  • *****
  • 1093
Re: Propcases
« Reply #7 on: 28 / January / 2013, 11:35:46 »
props=require("propcase") loads and executes the code in the file "lualib/propcase.lua"

Look at the file "lualib/propcase.lua" and you'll see that it then loads and runs one of 5 files:

gen/propcase1.lua  to gen/propcase5.lua

The code in these files creates a table that is specific for each camera and returns the table location to your code. So props now is a table of propcases specific to each camera.

Look at the code in some of the other files in CHDK/LUALIB and you'll see some other things you can do, like adding functions. To add the drawing functions to your program, for example, you would do this:

require("drawings")

Note there is no return value from drawings. It just adds a set of drawing functions that you can then call from your program.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


Re: Propcases
« Reply #8 on: 28 / January / 2013, 13:35:17 »
lapser

Got it now!

I now appreciate the Lua extension capability, for instance I could put all my common Lua functions in a Lua file called, say, CHDK/LUALIB/pigeonhill.lua.

If I then call require("pigeonhill") at the beginning of any script I write, this would load those functions, thus making the individual script smaller.

As I am writing scripts for myself at this time, and for known propset cameras, eg S95 & G11, I can make specific propcase calls, if I need to. Of course, if I publish any script, I would put a test in to ensure the correct propcase was returned.

Once again. many thanks for your mentoring! I move on to the next scripting phase of my education!

Cheers

Garry

 

Related Topics