Please tell me if script have redundant lines. (proper use of shoot_half/full) - General Discussion and Assistance - CHDK Forum supplierdeeply

Please tell me if script have redundant lines. (proper use of shoot_half/full)

  • 3 Replies
  • 1237 Views
Advertisements
for years, I've been using a script with this code:  (on a Powershot S100)

Code: [Select]
    press("shoot_half")
    repeat sleep(50) until get_shooting() == true
    press("shoot_full")
    sleep(500)
    release("shoot_full")
    repeat sleep(50) until get_shooting() == false
    release("shoot_half")

Just recently, I reduced the sleep from 50 to 10ms to reduce latency (automated task)

I wonder whatever there is any reason to     "repeat sleep(50) until get_shooting() == false"  ?
what good does it do ? , can't I just release shoot_full then shoot_half ?
Also:  the sleep(500),   would it just if it was reduced to 200ms ? I don't remember the exact reason for why I set it to 500ms years ago.

I wonder whatever there is any reason to     "repeat sleep(50) until get_shooting() == false"  ? what good does it do ?
That's only there so that your script knows that the shot has actually completed.  If you did not do that test and looped back around to the initial press("shoot_half") you could go right through to the shoot_full without the camera having set focus and exposure for the next shot.


Quote
, can't I just release shoot_full then shoot_half ?what good does it do ?
When you release("shoot_full") it actually releases the "shoot_half" button press at the same time.  You have to do a release("shoot_full_only") if you want to prevent that.

Quote
Also:  the sleep(500),   would it just if it was reduced to 200ms ? I don't remember the exact reason for why I set it to 500ms years ago.
It's almost certainly picked because it is a fairly short value that seems to work on most cameras and in most shooting circumstances.   Your best bet is to test 200mS and see what happens.
Ported :   A1200    SD940   G10    Powershot N    G16

Thank you, your first comment was actually about the first wait, between press_half and press_full.
That I understand.
The second one, between release_half and release_full  is pointless - right ?

I guess this will work just as fine.
Code: [Select]
press("shoot_half")
    repeat sleep(50) until get_shooting() == true
    press("shoot_full")
    sleep(200)
    release("shoot_half")

Thank you, your first comment was actually about the first wait, between press_half and press_full.
That I understand.
The second one, between release_half and release_full  is pointless - right ?

I guess this will work just as fine.
Code: [Select]
press("shoot_half")
  repeat sleep(50) until get_shooting() == true 
  press("shoot_full")
  sleep(200)
  release("shoot_half")

Note change in last line :
Code: [Select]
press("shoot_half")
repeat sleep(50) until get_shooting() == true
press("shoot_full")
sleep(200)
release("shoot_full")
should work unless you do something like this :


Code: [Select]
repeat
    press("shoot_half")
    repeat sleep(50) until get_shooting() == true
    press("shoot_full")
    sleep(200)
    release("shoot_full")
until false
Then you need the sleep / get_shooting() == false after the release("shoot_full")


Ported :   A1200    SD940   G10    Powershot N    G16


 

Related Topics