Menu

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.

Show posts Menu

Messages - garry23

#1501
Scripting API suggestions / Re: Lua Request/Idea
July 01, 2016, 02:52:40 PM
A1ex

Yes. The script runs in LV.

Cheers

Garry
#1502
Scripting API suggestions / Re: Lua Request/Idea
June 30, 2016, 10:33:21 PM
I hope David or A1ex read this as I've worked out what is causing my script to fail. Here is the test script:

soft_err = true
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance


function move(direction)
local a1 = 0
local b1 = 0
if direction == -1 then -- focus stack ti infinity soft stop
repeat
a1 = a2
b1 = b2
repeat
soft_err = lens.focus(-1,1,false)
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance
until a2> b1 or soft_err == false
msleep(1000)
until soft_err == false
else  -- focus stack to macro soft stop
repeat
a1 = a2
b1 = b2
repeat
soft_err = lens.focus(1,1,false)
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance
until b2 < a1 or soft_err == false
camera.shoot(64, false)
until soft_err == false
end
end

function start() -- test out focus stacking works through the soft stop error return
move(-1)
move(1)
move(-1)
end

scrnshot_menu = menu.new
{
    name = "Test",
select = function(this)
task.create(start)
end
}


If I don't use camera.shoot(64, false), ie dummy it out with a msleep(1000), say, as in the block of code above the camera.shoot(64, false) call, all is well.

As soon as camera.shoot(64, false) is called in the above, the script stops, ie camera.shoot(64, false) seems to cause lens.focus to return a false.

Does anyone have any insight as to the logic here?
#1503
Scripting API suggestions / Re: Lua Request/Idea
June 30, 2016, 05:36:21 PM
@BBA

BTW in the test code I left out handling focus overlaps, eg in the 'real' code I do something like this:

if direction == -1 then -- focus stack ti infinity soft stop
repeat
a1 = a2
b1 = b2
repeat
soft_err = lens.focus(-1,1,false)
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance
until a2> b1 or soft_err == false
                                lens.focus(1,1,false) -- move back to ensure focus overlap
msleep(1000)
until soft_err == false
#1504
Scripting API suggestions / Re: Lua Request/Idea
June 30, 2016, 08:44:16 AM
@BBA (A1ex/David)

I have convinced myself my original script is corrupting things, but I don't know why.

The following test script works as expected, ie detects the soft limit reached:

soft_err = true
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance


function move(direction)
local a1 = 0
local b1 = 0
if direction == -1 then -- focus stack ti infinity soft stop
repeat
a1 = a2
b1 = b2
repeat
soft_err = lens.focus(-1,1,false)
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance
until a2> b1 or soft_err == false
msleep(1000)
until soft_err == false
else  -- focus stack to macro soft stop
repeat
a1 = a2
b1 = b2
repeat
soft_err = lens.focus(1,1,false)
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance
until b2 < a1 or soft_err == false
msleep(1000)
until soft_err == false
end
end

function start() -- test out focus stacking works through the soft stop error return
move(-1)
move(1)
move(-1)
end

scrnshot_menu = menu.new
{
    name = "Test",
select = function(this)
task.create(start)
end
}



The only 'problem' I see is that if lens.focus generates another error, my script will detect that but assume the soft limit has been reached. That is I can't differentiate lens.focus error code returns.

For this reason I had to use false in lens.focus, as it could generate a focus error if I use true.

I think I will redo my focus & exposure bracketing script, starting from the above test script.

Cheers

Garry
#1505
General Help Q&A / Re: Dual Iso on 50d
June 29, 2016, 06:49:08 PM
@visiono

I don't understand your post, as the 50D has a base Canon ISO of 100.

I have a 50D and use 100/800 all the time I use Dual-ISO.
#1506
Scripting API suggestions / Re: Lua Request/Idea
June 28, 2016, 10:21:04 AM
I'll do some checking tonight and report back.

Cheers
#1507
Scripting API suggestions / Re: Lua Request/Idea
June 28, 2016, 09:43:30 AM
A1ex

Post crossed. API script runs ok if Expo Override OFF.

Here is the relevant piece of my script that is not 'working'.


soft_err = true
repeat
soft_err = lens.focus(1,1,true)
until soft_err == false


It stops straight away, implying lens.focus is returning false.

I can't work it out :(
#1508
Scripting API suggestions / Re: Lua Request/Idea
June 28, 2016, 09:21:16 AM
OK worked it out: Expo Override was ON.

All tests worked.

BTW Your lens.focus works, ie doesn't generate a soft focus error: but mine does  >:(

I use lens.focus(1,1,false) as I thought setting false meant the lens wouldn't wait for focus: is that correct?
#1509
Scripting API suggestions / Re: Lua Request/Idea
June 28, 2016, 09:03:21 AM
Script fails at Lua 213 "shutter"

BTW Auto Power is OFF
#1510
Scripting API suggestions / Re: Lua Request/Idea
June 27, 2016, 11:27:49 PM
Just ran the API test several times and it failed each time on a 5D3 + 24-105 F4/L in manual  mode.


===============================================================================
ML/SCRIPTS/TEST.LUA - 2016-6-27 22:18:55
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 115
    apex = 7.375
    ms = 6
    value = 0.006024
  aperture = table:
    raw = 67
    apex = 7.375
    value = 12.8
    min = table:
      raw = 40
      apex = 4
      value = 4
    max = table:
      raw = 80
      apex = 9
      value = 22.6
  iso = table:
    raw = 72
    apex = 5
    value = 100
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = -5
    value = -0.624999
  kelvin = 2500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 5D Mark III"
  model_short = "5D3"
  firmware = "1.1.3"
  temperature = 151
  state = 0
  reboot = function: p
  shoot = function: p
  bulb = function: p
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  write = function: p
  show = function: p
  clear = function: p
  hide = function: p
lv = table:
  enabled = true
  paused = false
  running = true
  zoom = 1
  start = function: p
  resume = function: p
  info = function: p
  stop = function: p
  pause = function: p
  wait = function: p
lens = table:
  name = "EF24-105mm f/4L IS USM"
  focal_length = 24
  focus_distance = 1820
  hyperfocal = 5649
  dof_near = 1383
  dof_far = 2659
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  screenshot = function: p
  rect = function: p
  pixel = function: p
  on = function: p
  load = function: p
  line = function: p
  off = function: p
  notify_box = function: p
  print = function: p
  draw = function: p
  clear = function: p
  circle = function: p
key = table:
  last = 0
  press = function: p
  wait = function: p
menu = table:
  visible = false
  close = function: p
  get = function: p
  block = function: p
  set = function: p
  new = function: p
  open = function: p
testmenu = userdata:
  value = 0
  name = "Script API tests"
  help = "Various tests for the Lua scripting API."
  help2 = "When adding new Lua APIs, tests for them should go here."
  advanced = 0
  depends_on = 0
  edit_mode = 0
  hidden = false
  icon_type = 5
  jhidden = false
  max = 0
  min = 0
  selected = true
  shidden = false
  starred = false
  submenu_height = 0
  submenu_width = 0
  unit = 0
  works_best_in = 0
  run_in_separate_task = 0
  select = function: p
  update = nil
  info = nil
  rinfo = nil
  warning = nil
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 29
  ms_clock = 29777
  prefix = "2P6A"
  dcim_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "B:/"
      path = "B:/DCIM/"
    path = "B:/DCIM/100EOS5D/"
  config_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "A"
    file_number = 2459
    folder_number = 100
    free_space = 27909408
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 131072
    drive_letter = "B"
    file_number = 2459
    folder_number = 100
    free_space = 51559424
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  date = table:
    month = 6
    min = 18
    yday = 179
    isdst = false
    sec = 57
    year = 2016
    day = 27
    hour = 22
    wday = 2
  directory = function: p
  call = function: p
  remove = function: p
interval = table:
  time = 0
  count = 0
  running = 0
  stop = function: p
battery = table:
  level = 51
  id = 3
  performance = 3
  time = 3519
  drain_rate = 52
task = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Testing exposure settings, module 'camera'...
Camera    : Canon EOS 5D Mark III (5D3) 1.1.3
Lens      : EF24-105mm f/4L IS USM
Shoot mode: 3
Shutter   : ,160 (raw 115, 0.006024s, 6ms, apex 7.375)
Aperture  : 12 (raw 67, f/12.8, apex 7.375)
Av range  : 4.0..22 (raw 40..80, f/4..f/22.6, apex 4..9)
ISO       : 100 (raw 72, 100, apex 5)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : -0.6 (raw -5, -0.624999 EV)
Setting shutter to random values...

===============================================================================
ML/SCRIPTS/TEST.LUA - 2016-6-27 22:22:03
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 125
    apex = 8.624999
    ms = 3
    value = 0.002532
  aperture = table:
    raw = 67
    apex = 7.375
    value = 12.8
    min = table:
      raw = 40
      apex = 4
      value = 4
    max = table:
      raw = 80
      apex = 9
      value = 22.6
  iso = table:
    raw = 72
    apex = 5
    value = 100
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = -5
    value = -0.624999
  kelvin = 2500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 5D Mark III"
  model_short = "5D3"
  firmware = "1.1.3"
  temperature = 152
  state = 0
  shoot = function: p
  bulb = function: p
  reboot = function: p
event = table:
  pre_shoot = nil
  post_shoot = nil
  shoot_task = nil
  seconds_clock = nil
  keypress = nil
  custom_picture_taking = nil
  intervalometer = nil
  config_save = nil
console = table:
  write = function: p
  clear = function: p
  hide = function: p
  show = function: p
lv = table:
  enabled = true
  paused = false
  running = true
  zoom = 1
  stop = function: p
  resume = function: p
  pause = function: p
  start = function: p
  info = function: p
  wait = function: p
lens = table:
  name = "EF24-105mm f/4L IS USM"
  focal_length = 24
  focus_distance = 1060
  hyperfocal = 5649
  dof_near = 895
  dof_far = 1298
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  rect = function: p
  notify_box = function: p
  on = function: p
  draw = function: p
  off = function: p
  pixel = function: p
  load = function: p
  print = function: p
  circle = function: p
  screenshot = function: p
  line = function: p
  clear = function: p
key = table:
  last = 0
  press = function: p
  wait = function: p
menu = table:
  visible = false
  new = function: p
  get = function: p
  open = function: p
  set = function: p
  block = function: p
  close = function: p
testmenu = userdata:
  value = 0
  name = "Script API tests"
  help = "Various tests for the Lua scripting API."
  help2 = "When adding new Lua APIs, tests for them should go here."
  advanced = 0
  depends_on = 0
  edit_mode = 0
  hidden = false
  icon_type = 5
  jhidden = false
  max = 0
  min = 0
  selected = true
  shidden = false
  starred = false
  submenu_height = 0
  submenu_width = 0
  unit = 0
  works_best_in = 0
  run_in_separate_task = 0
  select = function: p
  update = nil
  info = nil
  rinfo = nil
  warning = nil
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 23
  ms_clock = 23938
  prefix = "2P6A"
  dcim_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "B:/"
      path = "B:/DCIM/"
    path = "B:/DCIM/100EOS5D/"
  config_dir = table:
    exists = true
    create = function: p
    children = function: p
    files = function: p
    parent = table:
      exists = true
      create = function: p
      children = function: p
      files = function: p
      parent = table:
        exists = true
        create = function: p
        children = function: p
        files = function: p
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "A"
    file_number = 2459
    folder_number = 100
    free_space = 27909408
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    cluster_size = 131072
    drive_letter = "B"
    file_number = 2459
    folder_number = 100
    free_space = 51559424
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    wday = 2
    yday = 179
    isdst = false
    min = 22
    sec = 4
    month = 6
    hour = 22
    day = 27
    year = 2016
  remove = function: p
  call = function: p
  directory = function: p
interval = table:
  time = 0
  count = 0
  running = 0
  stop = function: p
battery = table:
  level = 50
  id = 3
  performance = 3
  time = 3450
  drain_rate = 52
task = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Testing exposure settings, module 'camera'...
Camera    : Canon EOS 5D Mark III (5D3) 1.1.3
Lens      : EF24-105mm f/4L IS USM
Shoot mode: 3
Shutter   : ,400 (raw 125, 0.002532s, 3ms, apex 8.624999)
Aperture  : 12 (raw 67, f/12.8, apex 7.375)
Av range  : 4.0..22 (raw 40..80, f/4..f/22.6, apex 4..9)
ISO       : 100 (raw 72, 100, apex 5)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : -0.6 (raw -5, -0.624999 EV)
Setting shutter to random values...
#1511
Scripting Q&A / Re: Lua and the use of xpcall
June 26, 2016, 02:05:48 PM
damn  >:(
#1512
Scripting Q&A / Lua and the use of xpcall
June 26, 2016, 12:44:07 PM
I hope some kind expert will be able to point me in the right direction.

I'm still trying to detect the 'soft limit reached' in a Lua script and thought I would try pcall and xpcall.

I'm using this test script:

err_state = true

function move()
lens.focus(1,1,true)
end

function erf()
err_state = false
end

function focus()
err_state = true
repeat
xpcall(move,erf)
until err_state == false
-- now move the other way having detected an error
lens.focus(-10,1,true)
end

scrnshot_menu = menu.new
{
    name = "Test",
select = function(this)
task.create(focus)
end
}


The lens moves as instructed and a 0 gets displayed but the (soft limit) error doesn't get intercepted and I get the ML error message and the script stops.

Anyone got any ideas?
#1513
Scripting API suggestions / Re: Lua Request/Idea
June 19, 2016, 06:00:58 PM
@BBA

Sorry, I don't know how to attach a spreadsheet to a post  :-[

I tend to write up my work and photography on my blog at http://photography.grayheron.net/

The 'registering' idea was my simple way of getting round not being able to solve the soft limit error.

All you need to do, when you go into the focus bracketing submenu is to rotate the lens to the macro end and tell the script this is the macro stop, ie all you do is press SET. This macro stop remains good whilst the camera is on.

I still haven't worked out how to store my own variables, ie when the camera switches off: next job  ;)
#1514
Scripting API suggestions / Re: Lua Request/Idea
June 19, 2016, 04:48:28 PM
@BBA

My all in one bracketing script is now working in two focus modes: from the FP to infinity and from the FP to the macro end.

I got it running through 'hard linking' in the macro minimum FP.

BTW here is the full script: https://gist.github.com/pigeonhill/b67462aec370495fdef8de74f303c734

Cheers

Garry
#1515
Scripting API suggestions / Re: Lua Request/Idea
June 19, 2016, 11:17:19 AM
A1ex

You are thinking how I've been thinking, ie ways to work around it using 'state logic'.

BTW the problem is not at the ends.

That is, if the focus is, say, in the middle, then lens.focus seems to return a false, then a true, even if (AF) wait is false.

I'll carry on testing, but I'm moving to another 'solution' now, which I know works, ie use lens.dof_near as my 'macro stop'.
#1516
Scripting API suggestions / Re: Lua Request/Idea
June 19, 2016, 10:27:04 AM
@BBA (David/A1ex)

I've worked out what is going on in my script and it pivots around this code:

repeat
if lens.focus(1,1,true) then stop = false else stop = true end
until stop


lens.focus seems to return a false when it is first called. It then returns true.

As I'm looking for a false return, and 'only' associating that with a soft limit.

I tried this, ie not waiting for focus, but still have problems as lens.focus seems to return true and false even if it is functioning, ie it must reporting other 'errors'

[code]repeat
if lens.focus(1,1,false) then stop = false else stop = true end
until stop
[/code]

#1517
Scripting API suggestions / Re: Lua Request/Idea
June 19, 2016, 09:37:06 AM
@BBA

BTW your observation is not quite right, as repeat always runs through the loop once, ie it checks at the end, not the beginning  ;)
#1518
Scripting API suggestions / Re: Lua Request/Idea
June 19, 2016, 09:34:48 AM
@BBA

It is.

I'll just keep playing with the script until I find my (sic) error.

Cheers

Garry
#1519
Scripting API suggestions / Re: Lua Request/Idea
June 19, 2016, 08:36:45 AM
@BBA

First, thanks for continuing to try and help me.

Here is a test script that works:

function focus()
local stop = false
repeat
if lens.focus(1,1,true) then stop = false else stop = true end
until stop
-- now move the other way having detected the soft limit
lens.focus(-10,1,true)
end

scrnshot_menu = menu.new
{
    name = "Test",
select = function(this)
task.create(focus)
end
}


All this does is drive the lens to the macro end and stop when lens.focus return a false.

However, if i use the same approach in my full script, the above simple coding doesn't work, which implies something else is wrong, but I can't work out what.

Here is the snippet of the full script. One part of the code runs from the focus point to infinity (and works ok), the other runs from the focus point to the macro (and doesn't run: no errors just the lens.focus doesn't run).

it's a mystery.

if lens.focus_distance < inf and no_tv_error then
if keymenu.submenu["Focus bracketing?"].value == "FP2INF" then
repeat
a1=a2
b1=b2
repeat
lens.focus(-1,1,true)
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance
until a2 > b1 or fp >= inf
lens.focus(1,1,true) -- move back one step for focus bracket overlap
take_brackets()
until fp >= inf
else
repeat
a1=a2
b1=b2
repeat
if lens.focus(1,1,true) then stop = false else stop = true end
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance
until b2 < a1 or stop
if not stop then lens.focus(-1,1,true) end -- move forward one step for focus bracket overlap
take_brackets()
until stop == true
end
end


BTW I have tried removing all the a1 a2 b1 b2 checks, ie just using the stop and it still doesn't run :(
#1520
Scripting API suggestions / Re: Lua Request/Idea
June 18, 2016, 08:44:32 PM
Sorry A1ex

This test script works as I would 'hope', ie the soft limit error is displayed in LV, but the script carries on working.

function focus()
local lens_error
repeat
lens_error = lens.focus(1,1,true)
until lens_error == false
-- now move the other way having detected the soft limit
lens_error = lens.focus(-10,1,true)
end

scrnshot_menu = menu.new
{
    name = "Test",
select = function(this)
task.create(focus)
end
}


My code, below, simply refuses to work through the soft limit error :(
#1521
Scripting API suggestions / Re: Lua Request/Idea
June 18, 2016, 08:22:12 PM
@BBA

I think I'll have to give up as I'm getting a headache!

This code simply will not work, ie detect the soft limit error

elseif keymenu.submenu["Focus bracketing?"].value == "FP2MAC" then
repeat
a1=a2
b1=b2
repeat
lens_error = lens.focus(1,1,true)
b2 = lens.dof_far
a2 = lens.dof_near
if a2 == a1 then -- move lens a bit more
lens_error = lens.focus(1,1,true)
b2 = lens.dof_far
a2 = lens.dof_near
end
fp = lens.focus_distance
until b2 < a1 or lens_error == false
lens_error = lens.focus(-1,1,true) -- move forward one step for focus bracket overlap
take_brackets()
until lens_error == false
end
#1522
Scripting API suggestions / Re: Lua Request/Idea
June 18, 2016, 07:42:10 PM
@BBA

Thanks for sharing :)

Do you assume the lens.focus return bol value is TRUE if the lens.focus functioned correctly or incorrectly?
#1523
Scripting API suggestions / Re: Lua Request/Idea
June 18, 2016, 07:22:51 PM
@BBA

Many thanks for trying to help.

I think I'm getting confused over what wait is doing, ie it's a bol.

'All' my script does is 'look' for lens.focus to return a false, which I'm interpreting as a soft limit reached, ie an error, however, lens.focus seems to return a false even if the lens is no where near the soft limit.

Once again, thanks for trying to help me.
#1524
Scripting API suggestions / Re: Lua Request/Idea
June 18, 2016, 07:12:44 PM
A1ex

I looked at the api_test and I thought I got it, but when I use the following code snippet, I can't get it to run.

As I say, 'all' I'm trying to do is detect the soft limit error.

Any help/hints would be gratefully received :)

elseif keymenu.submenu["Focus bracketing?"].value == "FP2MAC" then
repeat
a1=a2
b1=b2
repeat
lens_error = lens.focus(1,1,true)
b2 = lens.dof_far
a2 = lens.dof_near
if a2 == a1 then -- move lens a bit more just to be sure
lens_error = lens.focus(1,1,true)
b2 = lens.dof_far
a2 = lens.dof_near
end
fp = lens.focus_distance
until b2 < a1 or lens_error == false
lens_error = lens.focus(-1,1,true) -- move forward one step for focus bracket overlap
take_brackets()
until lens_error == false
end
#1525
Scripting API suggestions / Re: Lua Request/Idea
June 18, 2016, 06:47:39 PM
Alex

Thanks: I'll look through those.

What I'm trying to do is intercept the soft focus limit reached, before it stops Lua working, and take appropriate action.

Cheers

Garry