Quote from: waterwingz on 08 / April / 2017, 13:01:38Nope - set_config_value(191,1) has no effect on ptp connectivity.So, doing that in script has zero impact on the .cfg, correct?
Nope - set_config_value(191,1) has no effect on ptp connectivity.
Not correct. The value is saved in the CCHDK.CFG file and reloaded at startup. But what that value is set to has no effect on ptp connectivity.
Something weird about this is in my memory. Will try to test/remember what and report back.
function cmds.lock_ptp_comms() --e.g. to run !return mc:cmdwait('lock_ptp_comms')usb_force_active(1) --lock ptp comms ON (+5V line changes do not disconnect)write_status(true) end function cmds.enable_remote() --e.g. to run !return mc:cmdwait('enable_remote')set_config_value(121,1) --enable USB switch operationswrite_status(true) end
___> !mc:connect({list='C:/CHDKPTP/listfile'})+ 1:Canon PowerShot SX150 IS b=\\.\libusb0-0001--0x04a9-0x3234 d=bus-0 s=9A952438E0A647E9AC0179DDC30582D5___> !mc:start() [ensure switch initially at +5V] ___> !return mc:cmdwait('lock_ptp_comms')lock_ptp_comms [subsequently, turn switch to 0V]___> !return mc:cmdwait('rec')rec___> !return mc:cmdwait('enable_remote')enable_remote___> !mc:cmd('exit')exit [subsequently, turn switch to +5V]___> !mc:start()___> !return mc:cmdwait('lock_ptp_comms')lock_ptp_comms___> !return mc:cmdwait('set_mode',{args=61})set_mode 61 [movie mode, in this example, was selected on the camera]___>
Quote from: andrew.stephens.754365 on 09 / January / 2017, 15:43:35Is there a way to know/estimate a minimum safe period between press("shoot_full") in above (i.e sensing +5V) and when the tight loop hook should have been reached (in order that the +5V -> 0V transistion can occur)...or should this period be negligible while "shoot_half" is active? On the camera, you could use the hook_shoot hook http://chdk.wikia.com/wiki/Script_Shooting_Hooks#hook_shoot to measure, or do something to signal that the camera is ready.The hook becomes "ready" immediately before the hardware remote stuff is called.So if you wanted to do it all under software control, you could have a command that did something likehook_shoot.setpress shoot_fullhook_shoot.wait_readyrelease shoot_fullhook_shoot.continue (allowing it to continue into the hardware remote wait loop)return statusOn the pc side, you'd wait for this command to complete with cmdwait, and then do whatever is required to trigger the hardware remote, e.g. using system.execute() to run a command that controls a GPIO.If you wanted to know when the shot was finished, you'd have to make an additional multicam command for that.
Is there a way to know/estimate a minimum safe period between press("shoot_full") in above (i.e sensing +5V) and when the tight loop hook should have been reached (in order that the +5V -> 0V transistion can occur)...or should this period be negligible while "shoot_half" is active?
I hadn't really thought about this before, but it is expected behavior, because the only way to get status messages from the camera is by polling, and the USB hardware remote code uses a tight loop that doesn't allow the camera PTP code to run. Getting high precision sync requires the tight loop, so this is not easily fixable in CHDK code.If it spends too long in this sate (~seconds in my experience), attempting to communicate via USB results in errors likeERROR: call failed:Protocol error: data expectedThe exact behavior may be camera and host OS dependent. A short waits for the remote seem OK, probably because the underlying USB layer allows some wiggle room.The simplest way to avoid this is for your shoot command to use mc:cmd() instead of mc:cmdwait()
It seems safe to assume there is no easy way to minimize the time difference originally envisioned!?
I'm not clear what "originally envisioned" is.
the mc:cmd won't return until the command has been to the last camera
Your mention of the hook_shoot continue -> status message back to pc for switch control seemed to fit the bill (if 250ms polling had been acceptable).
From a a practical perspective, even with a considerable "bit more" safety margin, this should be much faster than the previous method (now understood as unworkable) which included polling.
Could be combined with pre shoot
function cmds.preshoot_hook_times() local tick_prior_preshoot = get_tick_count() press('shoot_half') local status=wait_timeout_write_status(get_shooting,true,10,mc.preshoot_timeout) if not status then release('shoot_half') end local tick_post_preshoot = get_tick_count() local total_preshoot_period = tick_post_preshoot - tick_prior_preshoot write_status(total_preshoot_period, 'total_preshoot_period (ms)') if type(hook_shoot) ~= 'table' then write_status(false, 'build does not support shoot hook') return end if status then hook_shoot.set(mc.shoot_hook_timeout) press('shoot_full') --https://chdk.setepontos.com/index.php?topic=12219.msg134738#msg134738 --script execution time up through the point press'shoot_full' happens could also be a factor. --press itself has some built in delay, and there's some hand-off time between the usb code and the script seeing it (~10s of ms). local wait_time = 0 while not hook_shoot.is_ready() do if wait_time > mc.shoot_hook_ready_timeout then hook_shoot.set(0) release('shoot_full') write_status(false, 'hook_shoot ready timeout') -- write_usb_msg only when hook fails & prior get_shooting is true return end sleep(10) wait_time = wait_time + 10 end local tick_post_hook_shoot_ready = get_tick_count() local total_hook_shoot_is_ready_period = tick_post_hook_shoot_ready - tick_post_preshoot write_status(total_hook_shoot_is_ready_period, 'total_hook_shoot_is_ready_period(ms)')-- write_usb_msg only when hook reached&prior get_shooting is true release('shoot_full') else write_status(false, 'shoot_half was released - no hook_shoot_is_ready_period calculated')-- write_usb_msg only when hook not reached because prior get_shooting failed end end
___> !mc=require('multicam')___> !mc:connect({list='C:/CHDKPTP/listfile'})+ 1:Canon PowerShot SX150 IS b=\\.\libusb0-0001--0x04a9-0x3234 d=bus-0 s=9A95243etc etc+ 8:Canon PowerShot SX150 IS b=\\.\libusb0-0008--0x04a9-0x3234 d=bus-0 s=52358FA70E8940F9B145A6C7053BB251___> !mc:start()___> !return mc:cmdwait('rec')rec=true,{ [1]={ done=true, status={ status=true, cmd="rec", }, failed=false, }, [2]={ done=true, status={ status=true, cmd="rec", }, failed=false, }, [3]={ done=true, status={ status=true, cmd="rec", }, failed=false, }, [4]={ done=true, status={ status=true, cmd="rec", }, failed=false, }, [5]={ done=true, status={ status=true, cmd="rec", }, failed=false, }, [6]={ done=true, status={ status=true, cmd="rec", }, failed=false, }, [7]={ done=true, status={ status=true, cmd="rec", }, failed=false, }, [8]={ done=true, status={ status=true, cmd="rec", }, failed=false, },}___> !return mc:cmd('preshoot_hook_times')preshoot_hook_times=true___> !mc:print_cmd_status(mc:wait_status_msg())ok1: { done=true, status={ status=true, cmd="preshoot_hook_times", }, failed=false,}2: { done=true, status={ status=true, cmd="preshoot_hook_times", }, failed=false,}3: { done=true, status={ status=true, cmd="preshoot_hook_times", }, failed=false,}4: { done=true, status={ status=true, cmd="preshoot_hook_times", }, failed=false,}5: { done=true, status={ status=true, cmd="preshoot_hook_times", }, failed=false,}6: { done=true, status={ status=true, cmd="preshoot_hook_times", }, failed=false,}7: { done=true, status={ status=true, cmd="preshoot_hook_times", }, failed=false,}8: { done=true, status={ status=true, cmd="preshoot_hook_times", }, failed=false,}___> !mc:print_cmd_status(mc:wait_status_msg())ok1: { done=true, status={ msg="total_preshoot_period (ms)", status=770, cmd="preshoot_hook_times", }, failed=false,}2: { done=true, status={ msg="total_preshoot_period (ms)", status=690, cmd="preshoot_hook_times", }, failed=false,}3: { done=true, status={ msg="total_preshoot_period (ms)", status=680, cmd="preshoot_hook_times", }, failed=false,}4: { done=true, status={ msg="total_preshoot_period (ms)", status=690, cmd="preshoot_hook_times", }, failed=false,}5: { done=true, status={ msg="total_preshoot_period (ms)", status=750, cmd="preshoot_hook_times", }, failed=false,}6: { done=true, status={ msg="total_preshoot_period (ms)", status=680, cmd="preshoot_hook_times", }, failed=false,}7: { done=true, status={ msg="total_preshoot_period (ms)", status=710, cmd="preshoot_hook_times", }, failed=false,}8: { done=true, status={ msg="total_preshoot_period (ms)", status=700, cmd="preshoot_hook_times", }, failed=false,}___> !mc:print_cmd_status(mc:wait_status_msg())ok1: { done=true, status={ msg="total_hook_shoot_is_ready_period(ms)", status=140, cmd="preshoot_hook_times", }, failed=false,}2: { done=true, status={ msg="total_hook_shoot_is_ready_period(ms)", status=140, cmd="preshoot_hook_times", }, failed=false,}3: { done=true, status={ msg="total_hook_shoot_is_ready_period(ms)", status=140, cmd="preshoot_hook_times", }, failed=false,}4: { done=true, status={ msg="total_hook_shoot_is_ready_period(ms)", status=140, cmd="preshoot_hook_times", }, failed=false,}5: { done=true, status={ msg="total_hook_shoot_is_ready_period(ms)", status=140, cmd="preshoot_hook_times", }, failed=false,}6: { done=true, status={ msg="total_hook_shoot_is_ready_period(ms)", status=140, cmd="preshoot_hook_times", }, failed=false,}7: { done=true, status={ msg="total_hook_shoot_is_ready_period(ms)", status=140, cmd="preshoot_hook_times", }, failed=false,}8: { done=true, status={ msg="total_hook_shoot_is_ready_period(ms)", status=140, cmd="preshoot_hook_times", }, failed=false,}___> !mc:print_cmd_status(mc:wait_status_msg())
and there's some hand-off time between the usb code and the script seeing it (~10s of ms).
Started by Anaglyphic Hotwire! Hardware Mods, Accessories and Insights
Started by Blooper « 1 2 » Creative Uses of CHDK
Started by Alarik « 1 2 ... 12 13 » General Discussion and Assistance
Started by David Ripple « 1 2 ... 6 7 » General Discussion and Assistance
Started by colombo11 « 1 2 3 4 » General Discussion and Assistance