set/get iso - LUA Scripting - CHDK Forum

set/get iso

  • 3 Replies
  • 2855 Views
set/get iso
« on: 13 / October / 2015, 23:18:11 »
Advertisements
Code: (lua) [Select]
for x=0,9,1 do
print("trying ",x)
set_iso_mode(x)
print(get_iso_market())
print(get_iso_real())
print(get_sv96())
end
Code: [Select]
=== START =============================
21:user:'trying  0'
21:user:'0'
21:user:'0'
21:user:'0'
21:user:'trying  1'
21:user:'0'
21:user:'0'
21:user:'0'
I tried in play, rec, with Program mode, nothing is working.
sd1200is

any ideas?

See also
http://chdk.setepontos.com/index.php?topic=12606.0

questions of setting camera parameters.  I have the same question; this was an attempt to see what would happen if I set an index that wasn't valid.  Really, I want to find the range of indexes possible.  I have looked up the table in shooting.c but I'm writing this for both of my CHDK cameras.
« Last Edit: 14 / October / 2015, 03:28:59 by jmac698 »

Re: set/get iso
« Reply #1 on: 14 / October / 2015, 00:47:53 »
Looks like you are iterating through the first n values used by the ISO_MODE propcase.   Of these,  only 0 & 1 are defined,  and they are used for ISO auto and ISO-HI respectively.    You have to get above 80 for this to actually start setting ISO values from what I can tell.  It's an archaic function call - nobody uses it these days AFAIK.

Having said that,  I expect you will have to do a "half press" to get values for there resulting get_xxx() calls.

Why are you looking for table indexes though?   Just use the sv96 value you want - the firmware will do the rest.





« Last Edit: 14 / October / 2015, 00:49:30 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: set/get iso
« Reply #2 on: 14 / October / 2015, 02:54:42 »
Thanks for the quick reply.  I'm now trying to set ISO by key presses, and it's not working either.

Code: (lua) [Select]

--set ISO values by keypresses and read CHDK ISO values
iso_temp=0
click_delay_short=1000

function click_with_delay(btn)
click(btn)
sleep(click_delay_short)
end

function next_iso()
click_with_delay("set")--ISO settings
click_with_delay("right")--next ISO value
click_with_delay("set")--exit settings
end

function change_iso()
--sd1200is
--the only known state is first turning it on, in rec, P mode
if iso_temp==0 then
click_with_delay("set")--mode menu
click_with_delay("down")-ISO settings
click_with_delay("set")-select first value, AUTO
end
next_iso()
end

function get_iso()
--print(get_iso())
print(get_iso_market())
print(get_iso_mode())--the only function that doesn't return 0. gives index.
print(get_iso_real())
print(get_sv96())
end

print "first ISO"
change_iso()
sleep(1000)
press("shoot_half")
sleep(1000)
release("shoot_half")
get_iso()
print "second ISO"
change_iso()
get_iso()
Code: [Select]
0
3
0
0
In this case, I set the ISO to the the 4th value (#3 if zero-based counting).  So reading the index works, but none of the keypresses are working.  So I tried just click("right") in playback mode, it should scroll through some existing pictures, but nothing happened.

Could this be a problem with the port or my script?

To answer your question, I wanted to make a universal camera script to move through the usual market ISO values, so I want to go by index.  I don't know what would happen if I tried to set an ISO that didn't normally exist, and if I tried, I'd have to take pictures and prove that there's higher usable ISO's.  To avoid that, I want to stick to the usual values.

« Last Edit: 14 / October / 2015, 02:57:46 by jmac698 »

Re: set/get iso
« Reply #3 on: 14 / October / 2015, 03:31:50 »
Update:  The key was to set record mode from script, even though the camera was started in record mode.  Something about my test environment moved it to play mode before the script started.

Here is code which can set ISO by keypresses on sd1200is:
Code: (lua) [Select]
--set ISO values by keypresses and read CHDK ISO values
iso_temp=0
click_delay_short=1000

function click_with_delay(btn)
click(btn)
sleep(click_delay_short)
end

function next_iso()
click_with_delay("set")--ISO settings
click_with_delay("right")--next ISO value
click_with_delay("set")--exit settings
end

function change_iso()
--sd1200is
--the only known state is first turning it on, in rec, P mode
if iso_temp==0 then
click_with_delay("set")--mode menu
click_with_delay("down")--ISO settings
click_with_delay("set")--select first value, AUTO
end
iso_temp=1
next_iso()
end

function get_iso()
--print(get_iso())
print(get_iso_market())
print(get_iso_mode())--the only function that doesn't return 0. gives index.
print(get_iso_real())
print(get_sv96())
end

function record_mode()
set_record(true)
local rec,vid,mode
repeat
rec,vid,mode=get_mode()
sleep(10)
until rec
end

record_mode()
print "first ISO"
change_iso()
sleep(1000)
press("shoot_half")
sleep(1000)
release("shoot_half")
get_iso()
print "second ISO"
change_iso()
sleep(1000)
press("shoot_half")
sleep(1000)
release("shoot_half")
get_iso()
and the results (didn't start from the beginning though):
Code: [Select]
=== START =============================
6:user:'first ISO'
6:user:'400'
6:user:'4'
6:user:'243'
6:user:'603'
6:user:'second ISO'
6:user:'800'
6:user:'5'
6:user:'486'
6:user:'699'

 

Related Topics


SimplePortal © 2008-2014, SimplePortal