- Script Writing - CHDK Forum  

  • 7 Replies
  • 2666 Views
« on: 18 / March / 2009, 21:52:59 »
Advertisements
i have a much larger script that inexplicably exits in the code below. the code will run fine through anywhere from 40 to 250 executions of the script. it exits between the last two log functions, apparently on setting the focus, pressing shoot_full or  releasing shoot_full and releasing shoot_half.

the code below is lua but it should be understood by ubasic users.

does anyone know why this problem happens or....better yet....how it can be fixed?

Code: [Select]
log.print("cam.smartShoot - start")
-- Shoot: Half press and wait until camera is ready
  press("shoot_half")
  repeat
    sleep(1)
  until get_shooting() == true
  log.print("cam.smartShoot - confirm shooting")
  --not sure what good this does
  local bv=get_bv96()
   log.print("cam.smartShoot - get bv")
  local av=get_av96()
  log.print("cam.smartShoot - get av")
 
  --init aperture and exposure
  if(tv ~= nil)then set_prop(propcase.TV,tv) end
  if(sv ~= nil)then set_prop(propcase.SV,sv) end
   log.print("cam.smartShoot - init aperture and exposure")
 
  set_focus(subjdist)
  press("shoot_full")
  release("shoot_full")
  release("shoot_half")
  repeat
    sleep(1)
  until get_shooting() ~= true
  log.print("cam.smartShoot - end shoot")

*

Offline fudgey

  • *****
  • 1705
  • a570is
« Reply #1 on: 22 / March / 2009, 05:21:26 »
My guess is it's setting focus that is causing your problem. There's been so many threads about it and its behavior differs for different cameras so I don't remember it all, but have you tried for instance adding sleep after set_focus()?

« Reply #2 on: 22 / March / 2009, 16:03:18 »
that seems to have made a big difference although its not a complete fix. previously the script would error out every 200 pics or so. this time i stopped one camera at 873 and another exited at 566 with the last log note at release("shoot_half").

if the script continues to run this reliably then i may consider it stable enough. i'm transferring pics over eye-fi so there's no point in being more stable than that.

BIG THANKS!

« Reply #3 on: 23 / March / 2009, 17:59:33 »
ug, i think i'm back were i started.

trying to shrink my goals as small as possible.

how long can a canon camera take pics, deleting the oldest when the card gets full? it doesn't have to be forever, but a couple of days would be plenty.


*

Offline fudgey

  • *****
  • 1705
  • a570is
« Reply #4 on: 28 / March / 2009, 07:32:17 »
I've had my a570 powered on about 3 days straight before crashing (running sunsetF15). Card space was not a problem for me, I believe it crashed due to excessive number of shots (several thousands) being all registered in a huge RAM file table by Canon firmware.

Deletion via CHDK io doesn't cure this problem, deletion via play mode possibly would but that's not an option for me.

« Reply #5 on: 28 / March / 2009, 10:47:06 »
>>I've had my a570 powered on about 3 days straight before crashing (running sunsetF15). Card space was not a problem for me, I believe it crashed due to excessive number of shots (several thousands)

that does sound like a successful run. however i think thats a vxworks camera and i'm having trouble with a dryos camera. that might be the difference.

anyway, i'm pursuing the problem in this thread here - http://chdk.setepontos.com/index.php/topic,3370.0.html

i'm currently trying to get the shoot() function to allow the variable getting and setting that is possible with the longer and failure prone method.

« Reply #6 on: 30 / March / 2009, 13:20:20 »
i'm optimistic that i've found a solution to the problem. need to do more testing before my results are ready for release.  :lol  :lol

« Reply #7 on: 02 / April / 2009, 17:58:59 »
just following up to report that shoot() is much more stable compared to press("shoot_full")

Code: [Select]
function cam.smartShoot(tv,sv,focusDistance)
  if(tv ~= nil)then set_prop(propcase.TV,tv) end
  if(sv ~= nil)then set_prop(propcase.SV,sv) end

shoot()

local bv=get_bv96()
local av=get_av96()

  return bv, av
end


 

Related Topics