Change timeout time for usb_sync_wait - General Help and Assistance on using CHDK stable releases - CHDK Forum

Change timeout time for usb_sync_wait

  • 20 Replies
  • 7869 Views
*

R.Blickle

Change timeout time for usb_sync_wait
« on: 27 / March / 2019, 05:46:22 »
Advertisements
Hello everybody,

in my Project I want to take a photo after a digital signal over the USB-Remote. To download, etc. I use the chdkptp - console with the multicam.lua.
Is there a way to edit the timeout of the "usb_sync_wait" function to prevent a automatically timout shoot after 10 seconds?

I wish to start usb_sync_wait and take a photo after the signal. Also if the signal is >10 sec. after call the sync_wait function.

Thanks!


Re: Change timeout time for usb_sync_wait
« Reply #1 on: 27 / March / 2019, 06:02:56 »
Is there a way to edit the timeout of the "usb_sync_wait" function to prevent a automatically timout shoot after 10 seconds?

I wish to start usb_sync_wait and take a photo after the signal. Also if the signal is >10 sec. after call the sync_wait function.
If I understand your question correctly , the "usb_sync_wait" you refer to is the time that CHDK will wait, after the USB remote +5V signal goes active, for the release of that signal?  If the signal does not release in that interval, CHDK treats that as a timeout and proceeds with taking the shot.

As you have observed, that timeout is currently fixed at 10 seconds in the CHDK code.  The only way to make it longer is to edit the CHDK source code and produce a custom version for your camera.

Please note that if you extend the delay too much, you could cause camera watchdog resets as CHDK is essentially hogging most (all?) of the camera processor time in a tight loop as it waits for the USB signal to release.
Ported :   A1200    SD940   G10    Powershot N    G16

*

R.Blickle

Re: Change timeout time for usb_sync_wait
« Reply #2 on: 27 / March / 2019, 06:14:10 »
If I understand your question correctly , the "usb_sync_wait" you refer to is the time that CHDK will wait, after the USB remote +5V signal goes active, for the release of that signal?  If the signal does not release in that interval, CHDK treats that as a timeout and proceeds with taking the shot.

As you have observed, that timeout is currently fixed at 10 seconds in the CHDK code.  The only way to make it longer is to edit the CHDK source code and produce a custom version for your camera.

Yes, you understood it right :)

Which ist the file, I have to edit to set the timeout time by myself?

Quote
Please note that if you extend the delay too much, you could cause camera watchdog resets as CHDK is essentially hogging most (all?) of the camera processor time in a tight loop as it waits for the USB signal to release.

Do you have an idea for another solution, without usb_sync_wait?
Or to interrupt usb_sync_wait() function after 8 sec. and call it again and again, if no signal released in this time?

« Last Edit: 27 / March / 2019, 06:25:30 by R.Blickle »

Re: Change timeout time for usb_sync_wait
« Reply #3 on: 27 / March / 2019, 06:34:45 »
Which ist the file, I have to edit to set the timeout time by myself?
It's a little more than just editing a file - you need to be able to recompile and build a custom CHDK release for your camera.   

If you have that figured out, you need to change this line :

Code: [Select]
#define DELAY_TIMEOUT 10000in usb_remote.h

Quote
Do you have an idea for another solution, without usb_sync_wait?
E.g. to interrupt usb_sync_wait() function after 8 sec. and call it again and again, if no signal released in this time?
The whole point of the usb_sync_wait() period is to lock all your cameras in the same tight loop so that they will take a photo in exactly the same amount of time after the USB +5V signal is released.  Getting around the wait would defeat the purpose of using the wait in the first place.  But if you wanted to do so, you can try reworking this code :

Code: [Select]
do { }  while( get_remote_state() &&  ((int)get_tick_count()-tick < DELAY_TIMEOUT));
in the file usb_sync.c to periodically call msleep( ) like this :

Code: [Select]
do { msleep(10) ; }  while( get_remote_state() &&  ((int)get_tick_count()-tick < DELAY_TIMEOUT*100)) ;
As before, you need to be capable of recompiling CHDK to make this work.
Ported :   A1200    SD940   G10    Powershot N    G16

*

R.Blickle

Re: Change timeout time for usb_sync_wait
« Reply #4 on: 27 / March / 2019, 06:50:41 »
Thanks a lot for this idea. I will try it.

What would be the "normal" way to do this? Without recompile an edit the CHDK?
I hope there is a easy way to react on an external signal without the information of its release-time, shoot a foto and get back in ptpcam mode with pc-connection

Re: Change timeout time for usb_sync_wait
« Reply #5 on: 27 / March / 2019, 06:54:17 »
What would be the "normal" way to do this? Without recompile an edit the CHDK?
I hope there is a easy way to react on an external signal without the information of its release-time, shoot a foto and get back in ptpcam mode with pc-connection
Are you trying to synchronize the shot across multiple cameras or is this a single camera project?
Ported :   A1200    SD940   G10    Powershot N    G16

*

R.Blickle

Re: Change timeout time for usb_sync_wait
« Reply #6 on: 27 / March / 2019, 07:58:15 »
Are you trying to synchronize the shot across multiple cameras or is this a single camera project?

It is with the multicam.lua

Re: Change timeout time for usb_sync_wait
« Reply #7 on: 27 / March / 2019, 08:59:32 »
It is with the multicam.lua
So you have an external signal (like a motion sensor) that goes active (+5V -> USB plug) and tells the cameras to get ready to shoot? When something else happens some time later ( > 10seconds), the signal to goes inactive ( 0V -> USB plug ) and all cameras shoot at the same time.  You then use chdkptp to upload all of the resulting images.

Do I have that correct? 

Do you have a sense of how closely the camera's need to be sync'd?
Ported :   A1200    SD940   G10    Powershot N    G16

*

R.Blickle

Re: Change timeout time for usb_sync_wait
« Reply #8 on: 27 / March / 2019, 09:12:21 »

So you have an external signal (like a motion sensor) that goes active (+5V -> USB plug) and tells the cameras to get ready to shoot? When something else happens some time later ( > 10seconds), the signal to goes inactive ( 0V -> USB plug ) and all cameras shoot at the same time.  You then use chdkptp to upload all of the resulting images.

Do I have that correct? 

Do you have a sense of how closely the camera's need to be sync'd?

Yes, right. The external signal should trigger all cameras and directly after the shoot I download all images to pc and delete them on the camera. I can use a signal that is constant 0V and goes up to 5V or the other way around. I will use the way which is better for work with CHDK.

The cameras don´t have to be synced in exactly the same time. The photo object isn´t in move. So the goal is to shoot a image as fast as possible after the external signal goes activ but not in a millisecond-range. It is enaught to take the picture within 1/2 seconds.
For download and delete I have more time afterwards.
« Last Edit: 27 / March / 2019, 09:14:12 by R.Blickle »

Re: Change timeout time for usb_sync_wait
« Reply #9 on: 27 / March / 2019, 11:13:24 »
Yes, right. The external signal should trigger all cameras and directly after the shoot I download all images to pc and delete them on the camera. I can use a signal that is constant 0V and goes up to 5V or the other way around. I will use the way which is better for work with CHDK.

The cameras don´t have to be synced in exactly the same time. The photo object isn´t in move. So the goal is to shoot a image as fast as possible after the external signal goes activ but not in a millisecond-range. It is enaught to take the picture within 1/2 seconds. For download and delete I have more time afterwards.
From your description, it sounds like the easiest way to do this would be to have your PC monitor the trigger signal, issue commands over a USB connection for all cameras to shoot, and then upload the images from each camera.  No USB remote hardware cables required - simply enough USB hub connections to provide one cable per camera.  All you need then is some I/O device for your PC to accept the signal.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal