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

Yet Another Sunset Script (yass) v2

  • 63 Replies
  • 39083 Views
Re: Yet Another Sunset Script (yass.lua) v3 - now coded in Lua
« Reply #40 on: 20 / April / 2013, 17:58:54 »
Advertisements
As promised,  an updated Lua version of yass that should work with all cameras.  I removed some of the camera setup stuff that could not be made generic - I don't really think anybody will miss it.   Replacing the single character variable used in uBASIC with more descriptive names made it easy to see a couple of logic bugs in yass2 so there are some improvements in how this version works.  I also changed the loop timing logic so that the loop length stays the same as the exposure time gets longer (at least while exposure time is less than loop time).  The documentation in first post of this thread is still valid.

Code: [Select]
--[[
Yet Another Sunset Script v3.2
@title yass3
  rem based on scripts by Fbonomi and Soulf2
  rem Released under GPL
@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
--]]

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

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

  -- 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
        tv96needed=sv96_default+bv96-av96           -- calculate desired shutter speed at default ISO
        print( "shot",shot,"  bv:", bv96, "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-bv96))/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()

With the loop delay set to zero, I get a shot about once every 2.5 seconds with my A1200.

EDIT : updated to v3.2 to make backlight off work better
« Last Edit: 20 / April / 2013, 22:15:05 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Yet Another Sunset Script (yass) v2
« Reply #41 on: 22 / April / 2013, 05:06:25 »
I'm trying to run new version of the script on Powershot G12, CHDK version g12-100c-1.1.0-2654-full.
The following message shows at the start:
"A/CHDK/LUALIB/propcase.LUA:16: Unsupported propset 4"

Re: Yet Another Sunset Script (yass) v2
« Reply #42 on: 22 / April / 2013, 09:08:26 »
I'm trying to run new version of the script on Powershot G12, CHDK version g12-100c-1.1.0-2654-full.
The following message shows at the start:
"A/CHDK/LUALIB/propcase.LUA:16: Unsupported propset 4"
I tested on my A1200 - a propset 4 camera.

Did you install the full CHDK release on your SD card ? 

Is there a propset4.lua in the /CHDK/LUALIB/GEN directory on your SD card?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14079
Re: Yet Another Sunset Script (yass) v2
« Reply #43 on: 22 / April / 2013, 12:54:11 »
I'm trying to run new version of the script on Powershot G12, CHDK version g12-100c-1.1.0-2654-full.
The following message shows at the start:
"A/CHDK/LUALIB/propcase.LUA:16: Unsupported propset 4"
this probably means that you have a very old copy of propcase.lua installed on your sd card.
Don't forget what the H stands for.


Re: Yet Another Sunset Script (yass) v2
« Reply #44 on: 22 / April / 2013, 12:59:28 »
this probably means that you have a very old copy of propcase.lua installed on your sd card.

hence my question :

Did you install the full CHDK release on your SD card ? 
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14079
Re: Yet Another Sunset Script (yass) v2
« Reply #45 on: 22 / April / 2013, 13:11:52 »
hence my question :
Yes, I thought it was worthwhile being more explicit: this error message is generated in the propcase script itself,  it's not a lua error. This error would not be generated if gen/propset4.lua was missing, or any error in the yass script. The only reasonable explanation is an old version of the script... or 4 ~= 4 ;)

Code: [Select]
if get_propset()==1 then
....
elseif get_propset()==4 then
  return require("gen/propset4")
elseif get_propset()==5 then
  return require("gen/propset5")
else
  error('Unsupported propset ' .. get_propset(), 1)
end

If poweredjj is using a multi-partition card, installing the scripts to the wrong partition could be a factor. The diskboot.bin needs to go on the small boot partition, while the scripts and other CHDK files need to go on the large partition.
Don't forget what the H stands for.

Re: Yet Another Sunset Script (yass) v2
« Reply #46 on: 24 / April / 2013, 01:18:26 »
I've installed a fresh copy of CHDK on my sd card and the script works fine now.
Maybe previously I have replaced some files on my card and forgot about it later.
In the next few days I will try to test the script in the field.

Re: Yet Another Sunset Script (yass) v2
« Reply #47 on: 10 / June / 2013, 21:51:57 »
Thanks for a great script. I've used it a few times now, but I am a bit of a newbie.
Camera I have been using it on is an IXUS 860IS.

Just a few questions.
My first usage of the script is with version 3 of YASS. I've noticed that the defaults for this script are different to the defaults mentioned in the YASS02 Read me file. Is this due to a gradual evolution of finding out which settings are best, or are they suited for particular camera types?

Also can you tell me if the default settings are best suited for Sunset or for night sky and stars.
And, can the script be used for sunRISE?

I tried to take some more shots last night, but clouds got in the way.
I also might have to change the default Limit SV, as ISO1250 seems to cause quite a bit of noise.

This is a link to me very first try ever of taking timelapse stars
Not a valid vimeo URL
I'm afraid there isn't much to see apart from the stars going around though.
Perhaps I need some foreground object?


Re: Yet Another Sunset Script (yass) v2
« Reply #48 on: 10 / June / 2013, 23:47:09 »
I've noticed that the defaults for this script are different to the defaults mentioned in the YASS02 Read me file. Is this due to a gradual evolution of finding out which settings are best, or are they suited for particular camera types?
I was not aware of that.  When I coded v3 I just used what I found in V2 - I didn't look at the readme file for default values.  So its up to you to decide if those values work for you - this is not a precise science.

Quote
Also can you tell me if the default settings are best suited for Sunset or for night sky and stars.
Sorry - no idea.  But if you experiment and find some good option,  please return and post them here.

Quote
And, can the script be used for sunRISE?
I think so.  The script really only does two things - it limits the range of the shutter speed and ISO settings and it smooths the rate at which the shutter speed can change.  It should work fine regardless of whether it goes from light to dark  or  from dark to light.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Yet Another Sunset Script (yass) v2
« Reply #49 on: 11 / June / 2013, 01:21:05 »
Quote
Sorry - no idea.  But if you experiment and find some good option,  please return and post them here.

But as far as the ND Filter - you mention that "In" is for Sunset, and "Out" is for night sky and stars.
Which should I use for sunrise?

Thanks!

 

Related Topics