Is there a way to detect when picture is done being taken? - Script Writing - CHDK Forum

Is there a way to detect when picture is done being taken?

  • 7 Replies
  • 2666 Views
Is there a way to detect when picture is done being taken?
« on: 01 / August / 2011, 12:43:46 »
Advertisements
Currently in my scripts I have a "shoot" followed by some amount of sleep. The problem is that sleeping longer than necessary is inefficient and not sleeping long enough forces the script to be out of sync. I'm hoping there's an elegant way to stall the script until an image is done being taken and/or the review of the image is complete.

*

Offline msl

  • *****
  • 1274
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Is there a way to detect when picture is done being taken?
« Reply #1 on: 01 / August / 2011, 13:12:59 »
get_shooting is the command you need. If the shooting is in progress get_shooting returns 1 else 0. When using scripts I would switch off the image review.

msl
CHDK-DE:  CHDK-DE links

Re: Is there a way to detect when picture is done being taken?
« Reply #2 on: 01 / August / 2011, 13:16:34 »
get_shooting is the command you need. If the shooting is in progress get_shooting returns 1 else 0. When using scripts I would switch off the image review.

msl

I do switch off image review for scripts, I just wasn't sure if it would change the answer to my question. Thanks!

Re: Is there a way to detect when picture is done being taken?
« Reply #3 on: 01 / August / 2011, 13:43:10 »
If I run the following:

      shoot
      :wait
      if get_shooting then
         goto "wait"
      endif
      click "button"

The 'click "button" ' does not seem to register. Any thoughts?


*

Offline fe50

  • ******
  • 3127
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: Is there a way to detect when picture is done being taken?
« Reply #4 on: 02 / August / 2011, 01:10:20 »
The 'click "button" ' does not seem to register. Any thoughts?
What "button" do you use in your script ?  ;)
--> http://chdk.wikia.com/wiki/UBASIC/TutorialScratchpad#Camera_Operation_Commands

*

Offline reyalp

  • ******
  • 13058
Re: Is there a way to detect when picture is done being taken?
« Reply #5 on: 02 / August / 2011, 01:20:06 »
If I run the following:

      shoot
      :wait
      if get_shooting then
         goto "wait"
      endif
      click "button"

The 'click "button" ' does not seem to register. Any thoughts?
shoot actually takes care of waiting on get_shooting for you already, you only need a get_shooting loop if you are doing the key presses yourself. If some additional delay is needed, you'll have to have a fixed sleep for that.

What camera are you using ?
Don't forget what the H stands for.

Re: Is there a way to detect when picture is done being taken?
« Reply #6 on: 02 / August / 2011, 08:31:39 »
The 'click "button" ' does not seem to register. Any thoughts?
What "button" do you use in your script ?  ;)
--> http://chdk.wikia.com/wiki/UBASIC/TutorialScratchpad#Camera_Operation_Commands

I just wrote "button" to make it generic. It's in fact the 'erase' button.

If I run the following:

      shoot
      :wait
      if get_shooting then
         goto "wait"
      endif
      click "button"

The 'click "button" ' does not seem to register. Any thoughts?
shoot actually takes care of waiting on get_shooting for you already, you only need a get_shooting loop if you are doing the key presses yourself. If some additional delay is needed, you'll have to have a fixed sleep for that.

What camera are you using ?


SX20 IS.

I don't want more delay than is necessary, but I've found that the operation time for shooting an image can vary with the camera. Sometimes if the conditions change right before an image is taken, shooting will take much longer, and subsequent button presses will not occur. Dropping in a 'sleep 3000' may guarantee that the picture will be taken, but it's an unnecessary delay in other cases.

*

Offline funnel

  • ****
  • 349
Re: Is there a way to detect when picture is done being taken?
« Reply #7 on: 02 / August / 2011, 12:48:12 »
I was interested if this would work with the combination of shoot_half and shoot_full_only discussed here http://chdk.setepontos.com/index.php?topic=1444.0. Get_shooting returns 1 when "shoot_half" is pressed so it doesn't work.

This one is ok:
Code: [Select]
:loop
a=get_shooting
if a=0 then
click "shoot_full"
endif
goto "loop"

end


 

Related Topics