Yet Another Sunset Script (yass) v2 - page 7 - Completed and Working Scripts - CHDK Forum  

Yet Another Sunset Script (yass) v2

  • 63 Replies
  • 39362 Views
Re: Yet Another Sunset Script (yass) v2
« Reply #60 on: 21 / July / 2013, 15:51:43 »
Advertisements
Here you go - compensation added.
Code: [Select]
--[[
Yet Another Sunset Script v3.4
@title yass_3.4
  rem Based on scripts by Fbonomi and Soulf2
  rem Released under GPL
@param o Compensation (1/2 stop)
  @default o 0
  @range o -8 8
@param t Delay (sec)
  @default t 10
@param b Limit Tv
  @default b -320
  rem (-414=20 sec; -384=15 sec; -320=10 sec; -224=5 sec.)
@param c Default Sv
  @default c 450
  rem (450=ISO100 500=ISO200)
@param d Limit Sv
  @default d 776
  rem (776=ISO1250 960=ISO5000)
@param e Guess mode limit
  @default e -200
@param f Slope in guess mode
  @default f 5
@param h Free Disk MB Shut down
  @default h 15
@param r RAW enable
  @default r 0
  @range r 0 1
@param g Backlight Disable
  @default g 0
  @range g 0 1
@param m 1st Shot Delay (min)
  @default m 0
  @range m 0 240
--]]

function restore()
    set_aflock(0)
    set_backlight(1)
    set_raw(original_raw)
end

  props=require("propcase")

  -- use descriptive variable names
  tv96_rate = f
  tv96_low_limit = b
  tv96_normal_limit = e
  sv96_default = c
  sv96_max = d
  min_disk_space = h*1024
  interval = t*1000
  if (g==0) then bloff=1 else bloff=0 end
  compensation = o*48

  -- setup
  set_console_layout(1, 0, 40, 14)
  print_screen(1)
  print("Yet Another Sunset Script V3.3")
  original_raw = get_raw()
  set_raw(r)

  -- startup delay ?
  if ( m>0 ) then
     print("Delaying startup for",m,"minutes")
     sleep(m*60000)
  end

  -- switch to shooting mode if necessary
  if ( get_mode() == false ) then
    set_record(1)
    while ( get_mode() == false ) do sleep(100) end
  end

  -- camera configuration
  set_prop(props.FLASH_MODE, 2)     -- flash off
  set_prop(props.IS_MODE, 3)        -- IS_MODE off
  if ( get_propset() > 1 and get_propset() < 5  )  then
     set_prop(5,0)                  -- AF assist off if supported for this camera
  end

  -- start shooting
  shot=1
  done=0

  press("shoot_half")
  repeat  sleep(50)  until get_shooting() == true
  set_aflock(1)
  release("shoot_half")
  tv96=get_tv96()
  av96=get_av96()
repeat
    if ( get_free_disk_space() < min_disk_space) then
        print("SD card full")
        done = 1
    else
        timestamp=get_tick_count()
        bv96=get_bv96()                             -- get current exposure readings
        bv96c=bv96-compensation                     -- calulate compensated exposure needed
        tv96needed=sv96_default+bv96c-av96          -- calculate desired shutter speed at default ISO
        print("shot",shot,"bv:", bv96, "comp:",compensation,"tv needed:",tv96needed)
        if(tv96needed>tv96_normal_limit) then
            tv96=(tv96+tv96needed)/2                -- use that shutter speed if above Tv low limit
            sv96=sv96_default                       -- use default ISO
        else
            if( tv96 > tv96needed) then
                tv96=tv96-tv96_rate                 -- lower the shutter speed
            else
                if( tv96 < tv96needed-tv96_rate) then
                    tv96=tv96+tv96_rate             -- increase the shutter speed slowly
                end
            end
            if (tv96>tv96_low_limit) then
                sv96=sv96_default                   -- use default ISO value while Tv above lower limit
            else
                tv96=tv96_low_limit                 -- Tv at low limit - recalculate ISO value
                sv96=(sv96+(tv96+av96-bv96c))/2
                if (sv96>sv96_max) then
                    sv96=sv96_max                   -- clamp ISO at high limit
                end
            end
        end
        print("  tv:",tv96,"sv:",sv96,"av:",av96)
        set_sv96(sv96)
        set_av96(av96)
        set_tv96_direct(tv96)
        shoot()
        shot=shot+1
        while  ( get_tick_count() < timestamp + interval ) do
           sleep(100)
           set_backlight(bloff)   
        end
    end
until done==1
restore()

I guess I should really clean this up so the UI works in real world units and not APEX96 ones.  I can steal the code from one of my other scripts pretty easily and release as yass4 !
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Yet Another Sunset Script (yass) v2
« Reply #61 on: 21 / July / 2013, 16:45:56 »
Thanks, you're great!!
I needed a constant compensation value, that is set before starting the script.
I don't think changing it on the fly is an option, because pushing buttons would introduce shake and could change framing a little. I never touch the camera, once the script starts.

If the script could use real world values, that would be even better!

Re: Yet Another Sunset Script (yass) v2
« Reply #62 on: 21 / July / 2013, 17:15:22 »
Thanks, you're great!!
I needed a constant compensation value, that is set before starting the script.
I don't think changing it on the fly is an option, because pushing buttons would introduce shake and could change framing a little. I never touch the camera, once the script starts.
Ah,  but that's where having the ability to read from a USB remote in the script comes in handy.

Quote
If the script could use real world values, that would be even better!
Stay tuned.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Yet Another Sunset Script (yass) v2
« Reply #63 on: 04 / August / 2013, 18:38:53 »
New version posted here :

http://chdk.setepontos.com/index.php?topic=10493

as promised.
Ported :   A1200    SD940   G10    Powershot N    G16


 

Related Topics