Focus bracketing scripts sometimes stops at "shoot" command - Script Writing - CHDK Forum

Focus bracketing scripts sometimes stops at "shoot" command

  • 76 Replies
  • 26632 Views
Focus bracketing scripts sometimes stops at "shoot" command
« on: 15 / December / 2012, 03:34:19 »
Advertisements
I have tried several focus bracketing scripts on my S2 IS camera.
When used with the built-in flash, they randomly(?) stops at the shoot command.
Script example:
-----------------------
rem Leif Karlsson
@title Focus bracketing
@param n Max number of steps
@default n 200

sleep 2000

  for s=1 to n
   shoot
   get_focus f
   get_dof d
   g=f+d*2/3
   set_focus g
   print g,d
   if g>50000 then s=n
   if d<0 then s=n
  next s

end
-----------------------
It can randomly(?) stop at the first "shoot" or any other. Sometimes it works until the end.

If it stops and I finish the script with the button, and start it again, it makes 2 loops for every shoot-command.
I have "CHDK-DE_s2is-100f-1.1.0_rev_2228" installed.

Any explanation for this behaviour and a remedy ?

By the way, I have tried "sleep" in the script, but didn´t help.

*

Offline srsa_4c

  • ******
  • 4451
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #1 on: 15 / December / 2012, 10:05:45 »
I hope you'll receive a more detailed answer, but until that happens:
Some (earlier?) cameras have problems with the shoot command. You can try to replace it with keypress commands and delays. See the shoot, press, release, click, sleep, get_shooting commands here: http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #2 on: 15 / December / 2012, 11:39:28 »
By the way, I have tried "sleep" in the script, but didn´t help.
I don't have a better answer either but where did you put the sleep command and how long was it ?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #3 on: 15 / December / 2012, 12:33:13 »
I tried with sleep 50 between each line in the loop and a sleep 1000 before "next s".
Had an idea about using "get_flash_ready" to check if the flash is ready, but that command give me an error "uBasis Unk stmt".

Will try to replace shoot ...

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #4 on: 15 / December / 2012, 13:19:10 »
I tried with sleep 50 between each line in the loop and a sleep 1000 before "next s".
Sounds about right.

Quote
Had an idea about using "get_flash_ready" to check if the flash is ready, but that command give me an error "uBasis Unk stmt".

Hmmmm ... did a little testing and this works on my G10 :
Code: [Select]
@title Flash Ready Test 3
press "shoot_half"
    sleep 1000
    x = get_flash_ready
    if x=0 then
      print "flash is not ready"
    else
       print "flash is ready"
    endif
release "shoot_half"
print "done"
end
If I enable / disable the flash in the Canon menus,  this script reports the changes correctly.

Quote
Will try to replace shoot ...

Probably a good suggestion .. something like :
Code: [Select]
press "shoot_half"
do
    sleep 50
until get_shooting = 1
click "shoot_full_only"
release "shoot_half"
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #5 on: 15 / December / 2012, 14:02:55 »
Is there any text displayed in the console when script is interrupted? Something like "PRESS SHUTTER TO END" or something?

There's some strange problem with random script breaking which is still unsolved. Check out the thread:

http://chdk.setepontos.com/index.php?topic=8273.0

Maybe you observe the same thing...
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #6 on: 15 / December / 2012, 16:57:48 »
There's some strange problem with random script breaking which is still unsolved.
So far that has only been reported on the sx130.

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14126
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #7 on: 15 / December / 2012, 19:47:24 »
There's some strange problem with random script breaking which is still unsolved.
So far that has only been reported on the sx130.
Hard to be sure, but I think the same problem has been encountered on others. See the thread by mattkime I linked from in that discussion.

edit:
I very much doubt this is related to skrylten's original problem though
« Last Edit: 15 / December / 2012, 20:17:44 by reyalp »
Don't forget what the H stands for.

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #8 on: 16 / December / 2012, 08:29:41 »
I don´t get any error messages. To me it looks like "shoot" and "get_shooting=1" doesn´t detect all the necessary conditions to trigger a shot.
The script seems to work with two added "sleep", but really don´t know why ...

---------------------------
rem Leif Karlsson
@title Focus bracketing
@param n Max number of steps
@default n 200

sleep 2000

  for s=1 to n
   press "shoot_half"
   do
      sleep 50
   until get_shooting = 1
   sleep 1500   
   click "shoot_full_only"
   release "shoot_half"
   get_focus f
   get_dof d
   g=f+d*2/3
   set_focus g
   sleep 1500   
   print g,d
   if g>50000 then s=n
   if d<0 then s=n
  next s

end
-----------------------------------

*

Offline lapser

  • *****
  • 1093
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #9 on: 16 / December / 2012, 10:42:38 »
I think you need to wait for get_shooting() to be false after the shot:

Code: (lua) [Select]
press("shoot_half")
repeat sleep(50) until get_shooting()
click("shoot_full") -- also does release("shoot_half")
while(get_shooting()) do sleep(50) end
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics


SimplePortal © 2008-2014, SimplePortal