Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Scripting Q&A => Topic started by: garry23 on January 17, 2021, 12:11:21 PM

Title: ISO strangeness
Post by: garry23 on January 17, 2021, 12:11:21 PM
I've convinced myself that setting ISO values via Lua 'may' be broken.

I can use camera.iso.apex or camera.iso.value etc to read, eg x = camera.iso.apex; but if I use something like camera.iso.apex = 10 I get 'failed stack traceback' error.

Has anyone else come across this?
Title: Re: ISO strangeness
Post by: a1ex on January 17, 2021, 12:22:07 PM
Last time I've checked, it used to work:

https://foss.heptapod.net/magic-lantern/magic-lantern/-/blob/branch/lua_fix/scripts/api_test.lua#L785

            local apex = math.random(5*100,10*100)/100
            camera.iso.apex = apex


https://codingkilledthecat.wordpress.com/2012/06/26/how-to-ask-for-programming-help/
https://en.wikipedia.org/wiki/Minimal_working_example
http://sscce.org/
Title: Re: ISO strangeness
Post by: garry23 on January 17, 2021, 12:28:30 PM
@a1ex

Using latest Lua fix on 5D3 123.

Shutter and aperture all OK.

Reading ISO is OK.

Just tried running the API test script and got error "Not enough memory" ???????
Title: Re: ISO strangeness
Post by: garry23 on January 17, 2021, 12:32:23 PM
Looks like one of my scripts is creating the problem :-(

If I only run API test all looks OK :-(

But which script I wonder?

Time to test!!!!
Title: Re: ISO strangeness
Post by: garry23 on January 17, 2021, 12:37:36 PM
@a1ex

API test fails here:

Testing picture taking functions...
Snap simulation test...
Single picture...
A:/DCIM/103EOS5D/2P6A0508.CR2 not found.
A:/DCIM/103EOS5D/2P6A0508.JPG not found.

ML/SCRIPTS/API_TEST.LUA:1062: assertion failed!
stack traceback:
   [C]: in function 'assert'
   ML/SCRIPTS/API_TEST.LUA:1062: in function 'test_camera_take_pics'
   ML/SCRIPTS/API_TEST.LUA:1574: in function <ML/SCRIPTS/API_TEST.LUA:1564>
   [C]: in function 'xpcall'
   ML/SCRIPTS/API_TEST.LUA:1564: in function 'api_tests'
   ML/SCRIPTS/API_TEST.LUA:1603: in main chunk
Title: Re: ISO strangeness
Post by: garry23 on January 17, 2021, 12:59:05 PM
Well I'm mystified, but that's easy :-)

Here is the point of failure, that generates the traceback error:

local iso_b = camera.iso.apex
local temp = camera.shutter.ms
local stop = MUSIC_menu.submenu["Number of images?"].value
if MUSIC_menu.submenu["Bookends?"].value == "yes" then stop = stop + 2 end
for i = 1,stop do
if (i == 1 or i == stop) and MUSIC_menu.submenu["Bookends?"].value == "yes" then -- tweak shutter and ISO for first and last images in bracket set
camera.shutter.ms = 1
camera.iso.apex = 10 --FAILS HERE!!!!!!!!
else
camera.iso.apex = iso_b
camera.shutter.ms = temp
end
my_shoot()
msleep(MUSIC_menu.submenu["I2I Delay"].value * 1000)
if MUSIC_menu.submenu["Focus shift mode"].value ~= "None"  then
check_lens_ready() -- just in case
lens.focus(dir,step,true) -- move lens
check_lens_ready() -- just in case
lens.focus(-dir,step,true) -- move back
end
end
camera.shutter.ms = temp
camera.iso.apex = iso_b
display.notify_box("Script Finished Running", 3000)
else -- something is wrong
display.notify_box("Switch on LV", 3000)
end


Title: Re: ISO strangeness
Post by: garry23 on January 17, 2021, 01:51:15 PM
In the end I 'just' did a complete reinstall of the latest Lua_fix and all now seems OK.

As I say, strange.
Title: Re: ISO strangeness
Post by: garry23 on January 18, 2021, 10:53:59 PM
@a1ex

I'm still nowhere with this ISO strangeness.

I have the latest Lua running on my 5D3 in M mode.

I have deleted all scripts bar this test script:

--ISO Test
t = camera.iso.value
menu.close()
sleep(1)
camera.iso.value = 800
display.notify_box("iso="..t, 3000)
sleep(3)
camera.iso.value = t


The script fails with this message:

(https://i.ibb.co/zsN1X0N/image0.jpg) (https://imgbb.com/)

Can you see the error of my ways?

Cheers

Garry

Title: Re: ISO strangeness
Post by: garry23 on January 18, 2021, 10:55:10 PM
Bugger: why doesn't the image show!!!!!!

Here is the link: https://ibb.co/G7FXWbF

Fixed  :)
Title: Re: ISO strangeness
Post by: garry23 on January 19, 2021, 08:43:13 AM
@a1ex

I had a thought and just tested it out and now can trigger the error.

If only ExpSim is enabled all is OK.

If I also enable Expo Override, then the error occurs, ie I can't control ISO via Lua.

I don't under why this is occurring, but at least I can circumvent it by not playing around with ISO if I also need Expo Override!
Title: Re: ISO strangeness
Post by: a1ex on January 19, 2021, 10:31:42 AM
Confirmed - that's a valid bug report.
Title: Re: ISO strangeness
Post by: garry23 on January 19, 2021, 10:34:56 AM
@a1ex

Thanks for confirming. For a while I thought I was going mad, then, last night, as I was in bed thinking about it, I wondered if the exposim or expo override was the issue.

May I assume the bug is registered now?

Cheers

Garry