Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - grnbrg

Pages: [1]
Apologies if this is an obvious answer.  :)

I'd like to be able to toggle image quality in my script, going from RAW to Fine JPG and back again.  However, this functionality doesn't appear to be exposed in the API.

Is there something I am missing, or even an ugly hack that can be suggested?



Scripting Corner / Eclipse exposure sequence generator.
« on: June 20, 2017, 07:54:07 PM »
If you haven't heard of it yet, you will soon.  There will be a total solar eclipse visible to most of North America on August 21st this year.  I am making the road trip to the path of totality, and have written a script to take a series of exposures over the ~3 hours of the eclipse, with heavy coverage during the 2 and a half minutes of totality.

Notable features:

  • Calculates the intervals to take an arbitrary number of partial phase images, both in the C1-C2 and C3-C4 periods.
  • Includes a configurable "margin" time, so that the first and last interval images are "interesting".
  • Allows for exposure bracketing of the partial phase images.  Configurable number of brackets and f-stops.
  • Fires a configurable "burst" of images at C2 and C3.  Depending on your camera's buffer, you can adjust how far before C2 and C3 this burst starts, so that you can be sure of coverage.
  • During totality, will run through a configurable range of exposures as many times as possible.  Minimum and maximum shutter speed, as well as the f-stop step size can be specified.
  • Image times are calculated based on clock time, not by intervals between shots, which means that if you need to restart the camera (to change a battery, late setup, or other issue) the sequence will begin to execute at whatever image is appropriate for the current time.
  • Has a test mode, which will run through a given sequence (starting at 00:00:00 when the camera powers on) without activating the shutter.

Download (from pastebin, as I can't be bothered to put it into git):

Comments are welcome.  (My first lua script, although I have been hacking in various languages for years.)

Two questions:

Code: [Select]

tick_time = 0 -- global
tick_offset = 0 -- global

event.seconds_clock = function (ignore)
    local cur_time =
    local cur_secs = (cur_time.hour * 3600 + cur_time.min * 60 + cur_time.sec)

    tick_time = cur_secs
    tick_offset = dryos.ms_clock
    return true

function wait_until (done_waiting) -- done_waiting is a future time, in seconds.
    local counter = tick_time
    local next_sec = 0
        task.yield (1000) -- Let the camera do other tasks for a second.
        counter = tick_time
    until (counter >= (done_waiting - 1))
    if ( counter < done_waiting)   

        next_sec = (1000 - (dryos.ms_clock - tick_offset))     
        msleep (next_sec)

The script spends a lot of time waiting for the appropriate time to take the next image, and these two functions should (I think) pause until the target time arrives, and exit as close as possible to the beginning of the target clock time second.  Any suggested improvements? 


Code: [Select]
function take_shot(iso, speed, dobkt, bktstep, bktcount)

   camera.iso.value = iso

   for bktnum = PartialBktCount,(-1 * PartialBktCount),-1 do
        bktspeed = PartialShutterSpeed * (2.0^(bktnum * PartialBktStep))
        camera.shutter.value = bktspeed

        task.yield(10) -- Give other stuff a chance to run


This is takes a bracketed exposure, with $bkcount brackets, and an f-stop change of $bktstep per bracket.  Is there a more sensible way to do this?



PS:  If a lua build for the 70D that supports camera.burst() were to show up before August 21st, I'd be really pleased.  :)

Pages: [1]