I'd like a function, among others,
others?
to manage releasing the synch hook, for a multi-camera setup, in script, simplified e.g.
function cmds.usb_sync_wait()
press('shoot_half')
sleep(2000)
usb_sync_wait(1)
press('shoot_full')
sleep(9000) --usb transistion from +5v -> 0V in this period
release('shoot_full')
end
When this function has finished (as part of a long running script similar to multicam.lua but without choosing which function to run as a result of a received ptp message) i'd then like to choose another function (e.g. to set Canon AV/TV/ISO) utilising "get_usb_power(3)" (pulses from a ucontroller pulse generator) but note the wiki page states "USB remote must be enabled for this function to work"
Is there a scheme whereby, following the +5v -> 0V transistion in my example "function cmds.usb_sync_wait()" the next usb transistion (0V->+5V) can be ignored in respect of activating a "Shoot Half" so the script can merely continue with it's monitoring of pulses (similarly to the way multicam.lua "function mc.run(opts)" monitors for ptp messages and chooses which function to execute)?
ummm .. wow. Let me see if I can restate what I think you want to do.
First of all, it looks like you are
not actually using chdkptp (multicam.lua) for anything here. You are trying to do
all of this by toggling the USB +5V pin to either trigger a sync'd shot or to communicate (i.e.
bit banging) some other information to the script.
Correct so far?
You want to trigger a sync'd shooting process using your script rather than the built-in CHDK USB Remote code. But you also want the built-in code to do pulse counting for you so you don't want it disabled. So your concern is how to enable the built-in code without having it also trigger a shot when the USB 5V line changes state.
Am I still correct?
If so, the simple answer is to set the
Enable Remote [ * ] option in the CHDK Remote Parameters menu but to leave
Switch Type [ None ] and
Control Mode [ None ]If I've missed something here, or you are also trying to use chdkptp, then please elaborate here and I'll give it another try.
Incidentally, if you use the
Script Shooting Hooks you can eliminate the
sleep(9000) statement and have your function return right after the actual shot takes place.
Further to above, noting msl's advice here https://chdk.setepontos.com/index.php?topic=12772.msg126824#msg126824,
is there any difference (in the proposed scenario) between using
usb_sync_wait(1)
to set the usb_sync_wait_flag rather than
set_config_value(core.synch_enable, 1)
in my simplified example functon above?
Yes - there is a big difference. Using
usb_sync_wait(1) works as you have describe. However, using
set_config_value(core.synch_enable, 1) will only cause the shot to sync if the shot is originated from the built-in USB remote code. Triggering the shot from a script will not cause a sync wait when the core.synch_enable parameter is set.