In the current version of chdkptp in svn (not in the packages yet) you can skip this entirely and run a file directly from your pc like.<myfile.lua
> lua f,err=loadfile('A/CHDK/SCRIPTS/LEVMAIN.LUA') if not f then error(err) end f()
@hokiespurs : I have your script setup so it works now with a sync'd shot rate of 1.75 seconds per shot (on my A1200 - an elcheapo Powershot) ! And no special builds or changes to CHDK were needed.The script turns on an LED each time it is ready to shoot and turns it off when the shot starts. By watching the LED and manually toggling my USB remote switch each time it lit up, I took 34 shots in 60 seconds. I would think that your uController has better reaction time than I do so you might even be able to go faster. Or you could simply set the uController to fire every 1.8 seconds with no feedback from the LED.Each shot is "sync'd" to the falling edge of the USB pulse so if you had multiple cameras, they would have all been within a few milliseconds of each other.Code: [Select]--[[@title USB Sync @chdk_version 1.3 @param l LED? @default l 1 @range l 0 7--]]function restore() set_config_value(cnf.remote_enable,0) -- disable USB remote set_config_value(cnf.synch_enable, 0) -- disable syncend-- setup AF_led = l cnf=require("gen/cnf_core") set_console_layout(10, 0, 40, 14) print("USB Sync test started...") set_config_value(cnf.remote_enable,1) -- enable USB remote set_config_value(cnf.synch_enable, 1) -- enable sync-- switch to shooting mode if ( get_mode() == false ) then set_record(1) while ( get_mode() == false ) do sleep(100) end end-- set focus & exposure and lock them in press("shoot_half") repeat sleep(50) until get_shooting() == true-- fire away as fast as possible repeat ecnt=get_exp_count() set_led(AF_led,1) repeat sleep(20) until get_usb_power(1) == 1 press("shoot_full") set_led(AF_led,0) tic = get_tick_count() repeat sleep(20) until get_usb_power(1) == 0 pwidth = get_tick_count() - tic i=0 repeat sleep(20) i=i+1 until( get_exp_count()~=ecnt ) or ( i>100 ) release("shoot_full_only") until ( pwidth > 2000) -- done release("shoot_half") restore() print("done")Edit : forgot to mention that the script will stop if you give it a pulse of more than 2 seconds. Otherwise it will shoot forever.
--[[@title USB Sync @chdk_version 1.3 @param l LED? @default l 1 @range l 0 7--]]function restore() set_config_value(cnf.remote_enable,0) -- disable USB remote set_config_value(cnf.synch_enable, 0) -- disable syncend-- setup AF_led = l cnf=require("gen/cnf_core") set_console_layout(10, 0, 40, 14) print("USB Sync test started...") set_config_value(cnf.remote_enable,1) -- enable USB remote set_config_value(cnf.synch_enable, 1) -- enable sync-- switch to shooting mode if ( get_mode() == false ) then set_record(1) while ( get_mode() == false ) do sleep(100) end end-- set focus & exposure and lock them in press("shoot_half") repeat sleep(50) until get_shooting() == true-- fire away as fast as possible repeat ecnt=get_exp_count() set_led(AF_led,1) repeat sleep(20) until get_usb_power(1) == 1 press("shoot_full") set_led(AF_led,0) tic = get_tick_count() repeat sleep(20) until get_usb_power(1) == 0 pwidth = get_tick_count() - tic i=0 repeat sleep(20) i=i+1 until( get_exp_count()~=ecnt ) or ( i>100 ) release("shoot_full_only") until ( pwidth > 2000) -- done release("shoot_half") restore() print("done")
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?
So if you wanted to do it all under software control, you could have a command that did something like...return status
If you wanted to know when the shot was finished, you'd have to make an additional multicam command for that.
function cmds.status_check() wait_timeout_write_status(get_shooting,false,100,mc.shoot_complete_timeout,'get_shooting timeout')end
On 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.
It's safe to initiate the +5V -> 0V transition as soon as you detect the AF LED turning off.
Thanks, I should probably have described my idea in more detail!
wait_timeout_write_status(get_shooting,true,100,mc.shoot_complete_timeout,'get_shooting timeout') ?
In your pseudo function, can I place:usb_sync_wait(1)anywhere prior:hook_shoot.continue
You mean:Code: [Select]function cmds.status_check() wait_timeout_write_status(get_shooting,false,100,mc.shoot_complete_timeout,'get_shooting timeout')end
I currently redirect multicam.lua status to text file and process that in an external application (AutoIt). I currently plan to control the Windows PC / Arduino serial comms by way of Putty/Plink and the AutoIt wrapper described here, in case it could be useful for someone:
No, you wouldn't want to wait on get_shooting there, or any wait.
In that case, in my example you could just make chdkptp output some recognizable string to the autoit code and have that trigger the arduino. Or if you can a stand along executable which can talk to the serial port, you could invoke it directly from chdkptp lua code.
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