Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Topic started by: dmilligan on March 29, 2015, 04:44:07 AM

Title: Lua Scripting (lua.mo)
Post by: dmilligan on March 29, 2015, 04:44:07 AM
Lua Scripting Module



Run lua scripts in your camera!

(https://bitbucket.org/dmilligan/magic-lantern/downloads/lua_editor.png)

Source: https://bitbucket.org/hudson/magic-lantern/branch/lua
Documentation: http://davidmilligan.github.io/ml-lua/
Current State: Merged!

Download:
Lua is now part of nightly builds!

Looking for an IDE? http://code.visualstudio.com/ + Lua extensions

NOTE: ML uses Lua version 5.3 (which is rather new and not widely adopted yet). It is very similar to 5.2 (the currently widely adopted version), the key difference has to do with integer division support. Older versions of Lua always use floating point division and always promote integers to floating point when doing division, 5.3 allows keeping integers as integers and doing integer division. I decided to go with 5.3 because of this fact. For our resource constrained devices, the ability to use integer division is very helpful (floating point division is much slower). Use a double slash (e.g. "2//3") to indicate integer division.

Can I help?
Perhaps you've been wanting to help with ML development, but writing low-level C code or digging through all the ML code to figure out how to do stuff is a little over your head? Well, I could use some help writing unit test scripts to test the scripting engine and API, and this should be a very easy task (just need basic (http://www.lua.org/manual/5.3/) knowledge (http://www.lua.org/pil/contents.html) of lua, a simple high-level scripting language). You don't even need to compile this branch, just write your test script and post it in this thread and I'll run it (though if you want to run yourself, feel free, request a build here (http://www.magiclantern.fm/forum/index.php?topic=12608.0), or compile in the cloud (http://www.magiclantern.fm/forum/index.php?topic=14725.0), just be aware things are very unstable at this point). I usually just barely have enough spare time here and there to simply implement a few API functions, and not really enough time to actually test that they work, so you may find that portions of API not working, this is why I really need your help. Thanks!

What to test and how?
I would prefer automated scripts that are like unit tests that I can just run and they spit out errors if something is not working as expected (hint: use the assert() function). For example to test file IO, try to write some data to a file, then read it back, if it's not the same data, throw an error.  Though, this is not always possible, so a script that simply exercises some particular API function is also still helpful. Things that need testing: any API function, menu stuff (make sure all the fields work as expected, see menu example), events stuff, file IO (use the builtin lua io library for this, note that stdin/out/err do not work, I know this), make sure all the constants are correctly defined, performance and resource utilization, etc.



Original Message:

Well I just managed to get lua running as module. Right now it's just "hello world", but I thought I'd share my progress.

https://bitbucket.org/dmilligan/magic-lantern/branch/lua

I'm quite familiar with lua as I implemented it inside a project at work, even wrote a fancy IDE/debugger. So now that I have the library compiled and running, creating an API should be fairly easy and straight forward.
Title: Re: LUA Scripting (lua.mo)
Post by: DeafEyeJedi on March 29, 2015, 04:53:02 AM
Amazing work, David!

Looking forward to its progress...

[emoji106]
Title: Re: LUA Scripting (lua.mo)
Post by: ItsMeLenny on March 29, 2015, 09:33:01 AM
Oh as a module! Took a few seconds for me to get it. lol.
Very good job! Now all I gotta learn is lua :P (unless you're doing a python one next)
Title: Re: LUA Scripting (lua.mo)
Post by: a1ex on March 29, 2015, 12:53:41 PM
Great stuff!

Btw, @dmilligan, you have commit access on branches on the main repo, so you can just push things there.

You can reuse script.mo as a front-end GUI.

Here's my very old attempt at Lua scripting (it even has the API documented as PDF):
http://magiclantern.wikia.com/wiki/MagicLUA

PDF here (http://a1ex.magiclantern.fm/bleeding-edge/LUA.pdf).

Title: Re: LUA Scripting (lua.mo)
Post by: jpaana on March 30, 2015, 09:40:28 AM
Don't know if it's feasible as it's probably a bit more work to integrate, but LuaJIT 2 is quite a bit faster even with JIT off than the standard Lua interpreter so it might also be a good alternative for these fairly performance constrained devices :) Also it has integrated FFI interface (http://luajit.org/ext_ffi.html (http://luajit.org/ext_ffi.html)), which makes working with C even easier.
Title: Re: LUA Scripting (lua.mo)
Post by: surami on March 30, 2015, 04:17:02 PM
Is that correct, that this will be the replacement of the old script.mo?
Title: Re: LUA Scripting (lua.mo)
Post by: wolf on April 04, 2015, 12:05:54 PM
@ dmilligan
Thanks for bringing back a script module.

I compiled it with your "Compiling Magic Lantern in the Cloud" tutorial. Works great btw.
How do I start a script or is it too soon to test? (550D)
(http://i.imgur.com/pvvNi4l.png?1)

My test script:
print("hello, world");
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 04, 2015, 02:33:23 PM
It's working, but I have not documented the API yet, so it's not clear how a script should be setup. I plan on doing this, once more stuff is implemented. I can give you a quick example:

menu.new
{
    name = "Run my script!",
    help = "Press SET to run the script",
    select = function()
        console.show()
        print("Hello World!")
    end
}


here's a more advanced example:

mymenu = menu.new
{
    parent = "LUA",
    name = "Run Test Script",
    help = "Run the test script.",
    submenu =
    {
        {
            name = "Run",
            help = "Run this script.",
            icon_type = 5,
            update = "",
        },
        {
            name = "param1",
            help = "help for param1",
            min = 0,
            max = 100,
            warning = function() return "this param doesn't work right :P" end,
        },
        {
            name = "param2",
            help = "help for param2",
            min = 0,
            max = 10,
            value = 5,
            info = function() return "click it baby!" end,
        },
        {
            name = "dec test",
            min = 0,
            max = 10000,
            unit = 7,
        },
        {
            name = "choices test",
            choices = { "choice1", "choice2", "choice3" },
        }
    },
    update = function() return mymenu.submenu["choices test"].value end,
}

mymenu.submenu["Run"].select = function()
    console.show()
    print("param1= "..mymenu.submenu["param1"].value)
    print("param2= "..mymenu.submenu["param2"].value)
    print("dec test= "..mymenu.submenu["dec test"].value)
    print("choices test= "..mymenu.submenu["choices test"].value)
    print("script run finished!")
end
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 05, 2015, 04:50:34 AM
Got a few APIs implemented and documented (https://bitbucket.org/hudson/magic-lantern/src/e7444838c5fe92c190f236b347ad67a28752ae75/modules/lua/LuaAPI.rst?at=lua). I'm open to comments /suggestions for the API, and what else should be added?
Title: Re: LUA Scripting (lua.mo)
Post by: wolf on April 05, 2015, 10:48:47 AM
Cool.
I remember the PicoC API which was perfect for me.

http://www.magiclantern.fm/forum/index.php?topic=4362.0

I think power saving options i.e. display off/on are very useful.
Also key events, key press emulation and a text output like
"void bmp_printf(int fnt, int x, int y, char* fmt, ...); "    


Title: Re: LUA Scripting (lua.mo)
Post by: g3gg0 on April 05, 2015, 12:49:43 PM
hooray! nice to see progress there.
good work, dmilligan!

can modules register some functions, variables and constants to your lua module?
i am sure people would like to see some functions to call from lua. e.g. setting MLV options,
setting FRSP parameters or dual iso settings.

in this case i would prefer to not "directly" call lua module register function, but having a generic structure
that explains which functions, constants and variables my module has and call a "generic" script_register() function
to make those descriptor known.
in case there will be another scripting module, or some revival of the old ones, all of them can make use of that.

e.g.:
struct script_interface_descriptor mlv_desc =
{
    .funcs = { { .name = "mlv_start_rec", .func = &mlv_start }, { .... }},
    .vars = { { .name = "mlv_take_number", .type = VAR_TYPE_UINT32, .var = &mlv_.... }},
    .callouts = { { .name = "mlv_recording_started" }, { .name = "mlv_new_chunk" }}
}

this could be used by any script - or even PTP functions.
Title: Re: LUA Scripting (lua.mo)
Post by: Walter Schulz on April 05, 2015, 12:54:04 PM
Will it be even remotely possible to access/manipulate ML options remote via USB connection? Sorry for the lame pun ...
EDIT: Just seen g3gg0's remark about PTP ...

Already answered. Damn, not to be a programmer sucks at times.
Title: Re: LUA Scripting (lua.mo)
Post by: surami on April 05, 2015, 03:09:23 PM
I would like to run a script, which would be enabled when the picture is taken with the intervalometer and the AutoETTR module (+advanced intervalometer module) are also in use. The idea is to force a delay (4 seconds) between the shots independently from interval time.

I'm not familiar with LUA scripting and compiling the LUA module, but as I read on the API page, I should use the event "intervalometer" and the global function "msleep". The modules wouldn't do any confusion? I would like to learn and understand, that how I could do this.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 05, 2015, 07:05:29 PM
something like this should work:

force_delay_menu = menu.new
{
parent = "Intervalometer",
name = "Force Delay",
help = "Add an extra delay to each interval",
min = 0,
max = 300,
unit = UNIT.TIME,
}

events =
{
intervalometer = function() msleep(force_delay_menu.value * 1000) return true end
}
Title: Re: LUA Scripting (lua.mo)
Post by: themichael on April 07, 2015, 03:00:33 AM
Would it be possible to play back a short audio file? 

Something useless like -

script_name = "Shutter Tones";
script_help = "Avoid talking to models";
events =
{
post_shoot = function() play("shutrton.wav") return true end
}


Or to say a wake up message, show a screen looking for a certain keypress sequence before playing "help help I am being camera napped!"

Of course it could play more useful stuff like focus distance (if reported) when focused or exposure settings, counting down long exposures, or the "number of number" when using auto bracketing.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 07, 2015, 01:16:25 PM
Pretty much anything is possible to do in a script that is possible from ML. The question is, is it worth while doing all the work to add whatever particular thing to the scripting API. Audio stuff is sort of a low priority, since there's a new audio backend in development, that is not finished (would be best to wait for it to be finished).



magic_button = KEY.SET

events =
{
    shoot_task = function()
        display.clear()
        display.rect(0,0,720,480,COLOR.BLACK,COLOR.BLACK)
        display.print("Please press the magic button...",20,80,FONT.LARGE)
        return true
    end
    keypress = function(key)
        if(key == magic_button) then
            events.shoot_task = nil
            events.keypress = nil
            display.clear()
        else
            beep(100)
        end
        return false
    end
}
Title: Re: LUA Scripting (lua.mo)
Post by: surami on April 07, 2015, 03:01:14 PM
Thanks for the example David. Could you please send me a LUA.mo download link in private for testing purpose or should I wait for a more stable version?
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 07, 2015, 03:16:42 PM
Just updated the OP, for builds you need a full build, not just the lua.mo: request a build here (http://www.magiclantern.fm/forum/index.php?topic=12608.0), or compile in the cloud (http://www.magiclantern.fm/forum/index.php?topic=14725.0).

If someone will provide the full builds, I will keep the lua.mo up to date in the OP.

See the OP for info about how and what to test.
Title: Re: LUA Scripting (lua.mo)
Post by: surami on April 07, 2015, 09:45:24 PM
Thanks for the links. I could compile a build + LUA scripting module (http://www.magiclantern.fm/forum/index.php?topic=12608.msg144514#msg144514) for my camera with Codio. It was my first try to compile something and it took some hours to figure everything out, but it seems so, that the "Force Delay" script works perfectly. I hadn't tested yet in the field outside with AutoETTR always ON or with Advanced Intervalometer module, but as I have more time I will make it and report back again.

OFF topic: Now I'm waiting for this Flash Hot Shoe Sync Adapter (http://www.ebay.de/itm/Flash-Hot-Shoe-PC-Sync-Adapter-NEW-/280827673533?pt=LH_DefaultDomain_77&hash=item4162a23bbd), I would like to use this as triggering the MX2 controller by DP. If it works, we can make nice day -> night/night -> day timelapses with some motion. (The Pixel TF-321 hot shoe sync adapter didn't worked for me, don't know what was the problem.) In theory there will be enough time (independently from interval time) during the shooting between the exposures for calculating the right ETTR picture and trigger the MX2 to move the cart on the slider and move the Merlin head.

Update: I got my simple hot shoe PC sync adapter and it works perfectly, solved (http://www.magiclantern.fm/forum/index.php?topic=12533.msg144614#msg144614).
Title: Re: LUA Scripting (lua.mo)
Post by: themichael on April 10, 2015, 05:35:02 AM
I went to try out my cloud compiled version (http://www.magiclantern.fm/forum/index.php?topic=12608.msg144582#msg144582) and I don't have a Lua tab like Wolf does (post #6 above).

(https://farm8.staticflickr.com/7628/17068798636_1c8b9c6f70_n.jpg) (https://flic.kr/p/s1j4aE)screen (https://flic.kr/p/s1j4aE) by memoirs-in-digital (https://www.flickr.com/people/8064667@N05/), on Flickr
Title: Re: LUA Scripting (lua.mo)
Post by: wolf on April 10, 2015, 08:50:11 AM
@themichael
you need to fetch the lua-repository.

Delete your ML folder on codio.com.
cd to workspace.
hg clone -r lua https://bitbucket.org/hudson/magic-lantern
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 10, 2015, 12:42:21 PM
You won't necessarily have a LUA tab. Scripts can specify what menu they appear under "LUA" is simply the default if a script doesn't specify this. If you don't have any scripts, or if all your scripts put themselves in other menus, then you won't have a LUA tab.
Title: Re: LUA Scripting (lua.mo)
Post by: themichael on April 11, 2015, 03:35:11 AM
I still cannot find any Lua scripts.

Removed all the *.lua scripts in the directory.
Used the menu script in LuaAPI.rst saved as menu.lua
Cannot see it under any menu (no lua tab either) but can see it with file manager.

Compiled 15 hours ago, last change on bitbucket was 23 hours ago.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 11, 2015, 06:11:40 AM
I made some changes to the menu API and revamped the documentation. Please refer to the new documentation location linked to in the OP.
Title: Re: LUA Scripting (lua.mo)
Post by: themichael on April 11, 2015, 09:36:42 PM
Now the test script is there and works. Trying my own.

Two questions -
A. (off topic) Can I save the scripts over USB so I don't risk damaging the CF pins on the camera?

2. Something is wrong with this script below, it doesn't show up. Is the mistake is in the menu.new part? Or am I completely off the rails?
mykeys = menu.new
{
    parent = "LUA",
    name = "Key Test Script",
    help = "Key code script.",
    submenu =
    {
            name = "Test",
            help = "Run my script.",
            icon_type = 5,
            update = "",
    },
    update = "key?",
}

mykeys.submenu["Test"].select = function()
    console.show()
    print("Waiting 10 sec for key")
    key.wait(,10000)
    if (key.last <> 0) then print("key "..key.last) else print("no key")
    print("donesies!!")
end
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 12, 2015, 02:40:34 AM
A. There's currently no way to do this.

2. Hint: If a script doesn't load, check the console for errors. (I might also suggest a script editor that does syntax checking, such as: http://www.eclipse.org/ldt )
Title: Re: LUA Scripting (lua.mo)
Post by: surami on April 18, 2015, 09:49:25 PM
@dmilligan: Could you please help me out, that how could I update the Force Delay script (http://www.magiclantern.fm/forum/index.php?topic=14828.msg144324#msg144324) for working well with the updated LUA module?

Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 18, 2015, 10:33:19 PM
Ah, yes, I changed the event API slightly:


force_delay_menu = menu.new
{
parent = "Intervalometer",
name = "Force Delay",
help = "Add an extra delay to each interval",
min = 0,
max = 300,
unit = UNIT.TIME,
}

event.intervalometer = function(count) msleep(force_delay_menu.value * 1000) return true end


Title: Re: LUA Scripting (lua.mo)
Post by: surami on April 19, 2015, 12:40:50 AM
Thanks, I will try as soon as I can compile a new build from the LUA repository.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 25, 2015, 05:34:14 AM
Just an update:

The API is really coming together, and is more or less complete and working. So I've started working on an in camera text editor written in lua: https://bitbucket.org/hudson/magic-lantern/commits/9c47101480ce7a1e64152a40666c3373d37c8e87 It's very preliminary at this point, you can select files and view them, but it shouldn't be too much longer until it's a fully functioning editor with the ability to insert text and save files. Thanks to lua's regex like capabilities, cool things like syntax coloring and basic auto-complete shouldn't be too hard either, and with lua's built-in debugging capabilities, things like setting breakpoints, stepping through code and an "immediate console" are also possibilities.
Title: Re: LUA Scripting (lua.mo)
Post by: Audionut on April 25, 2015, 09:09:43 AM
In camera editing with some stupidity debugging sounds great.

Looking forward to trying this out.
Title: Re: LUA Scripting (lua.mo)
Post by: nikfreak on April 25, 2015, 10:10:42 AM
you have been definitely been on a run getting LUA to work on ML. Chapeau! Checking how chdk people use lua for scripting this will definitely help lots of people.
Title: Re: LUA Scripting (lua.mo)
Post by: DeafEyeJedi on April 25, 2015, 10:23:01 AM
Run, David, Run!  8)
Title: Re: LUA Scripting (lua.mo)
Post by: EBurke on April 30, 2015, 12:22:11 PM
I am new to ML and have little background in Lua. I am excited that I am going to learn both soon.

I have installed ML on a 5D2 camera through standard build. Reading the posts here I assume I have to replace it with a Lua compatible build. Is there a link to an already existing build or I must build it from the source, is it sufficient to try and build lua branch?
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on April 30, 2015, 04:36:18 PM
@EBurke,
correct, see the OP




Updates:

Yesterday, I managed to write a script and then debug/step through it entirely in camera! (and all of this from a program that is itself just a lua script!) This is very cool and exciting (and quite meta!), there are many possibilities...

Title: Re: LUA Scripting (lua.mo)
Post by: garry23 on April 30, 2015, 04:48:08 PM
@dmilligan

As you say, this is really exciting.

Like others, I'm sure, I'm waiting for the sign (from the coders/gurus above) that things are stable enough to begin 'playing'.

Thanks for all your efforts (and those others that are adding value here).

:)

Title: Re: LUA Scripting (lua.mo)
Post by: g3gg0 on May 01, 2015, 08:54:30 PM
@dmilligan:

do you need some changes to IME for integrating it into your editor?
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on May 02, 2015, 08:41:36 PM
no, I think I prefer just doing my own input in lua, I already have stuff like copy and paste, and I'll probably be working on things like autocomplete. Eventually a lot of the code from the editor could become a high-level, object-oriented UI API for lua.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on May 09, 2015, 09:39:55 PM
Updates:

Most floating point stuff seems to be working now (previously, parsing and printing floats would crash the interpreter due to some non-standards-compliant libc functions).

Keep in mind that doing floating point math can be quite slow. Fortunately for us, new in lua 5.3 is a lot of stuff for doing integer only math. For example // will do integer division (a normal single / will automatically promote to floating point).

I have improved the API for basic exposure settings with various units (some floating point, some integer).
So now instead of camera.shutter you have the following:

camera.shutter.raw
camera.shutter.apex
camera.shutter.apexf
camera.shutter.ms
camera.shutter.value
camera.shutter:tostring()

aperture, iso, and ec also follow the same basic pattern. See the updated docs (http://davidmilligan.github.io/ml-lua/modules/camera.html) for more info.
Title: Re: LUA Scripting (lua.mo)
Post by: DeafEyeJedi on May 09, 2015, 11:35:09 PM
All this is looking positive so far... Keep up the great work everyone!
Title: Re: LUA Scripting (lua.mo)
Post by: Totte on May 10, 2015, 11:03:32 AM
How is the program control in modules in general and in this LUA implementation in particular? Is the LUA script in full control when it is running or are there system tasks that can mess up the timing of simple LUA while loops and/or timer interrupts? I can see this replacing the advanced intervalometer module completely for my kind of use, if timing can be trusted.
Title: Re: LUA Scripting (lua.mo)
Post by: chris_overseas on May 10, 2015, 11:18:24 AM
There's a minor bug in the docs I think: The docs for ec.raw and ec.apex both refer to aperture rather than exposure compensation.

This module is looking impressive dmilligan, I'm looking forward to trying it out properly.
Title: Re: LUA Scripting (lua.mo)
Post by: pholler on May 10, 2015, 04:46:57 PM
Hi David,

i am still working on my intervalometer-script. At the moment i want to manipulate the shutter speed that is determined by AETTR. The idea is that small changes in shutter speed are ignored.
The thing is that i cannot manage to do operations directly after a shooting-task. The following code is not started after pressing the shutter or using the intervalometer. I don't know why. Could you give me hint?
function event.post_shoot()
print("post_shoot()")
end
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on May 11, 2015, 03:56:37 AM
@chris_overseas,
yes, thanks, there are probably lots of typos in the docs (lots of copy/pasting). Every time I go back and read them it seems I find another typo.

@pholler,
it appears that cbr (as well as pre_shoot) is not actually implemented in the ML core, it's a simple fix, I will probably submit a patch to the main branch

@Totte,
It would certainly be possible to to implement the advanced intervalometer as script (in fact that was one of my goals when working on the API: what would I need to completely re-implement it in lua). Actually doing the re-implementation may take some time (it's sort of a low priority, but it's a good test case for the lua engine). Unless you're doing some really heavy processing (i.e. image analysis), I don't think "timing" is going to be an issue. Lua performance is actually pretty good. The text editor I wrote in lua does a lot of drawing and it works pretty smoothly.
Title: Re: LUA Scripting (lua.mo)
Post by: Totte on May 11, 2015, 02:26:19 PM
Just to clarify, I'm not asking for a re-implementation of the advanced intervalometer in LUA just because it can be done (although that is usually reason good enough ;)). For me, writing a script will be much simpler than to generate a complex exposure sequence in the AI. And the scripts can also easily be saved and loaded again from the camera.

I'm looking at taking pictures with sub-second timing resolution. What worries me is whether the length of while-loops or msleep(ms) could possibly be unpredictable because other system tasks have priority when scripts are running? No processing involved for me, just set new exposure values, wait and fire again.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on May 11, 2015, 04:02:03 PM
For simple things, I doubt you would be able to notice much difference between doing something in lua or doing it in native C. Also, most of the time spent for simple stuff is likely going to be in the API call itself, not your script code. You also have access to the vast majority of the ML core API calls, and if there's something in particular you need that's missing, it's pretty easy to add.

I see no reason you couldn't achieve pretty accurate timing in a script, but depending on exactly how precise you want it to be, it may be more a little more complicated than simply calling msleep in a while loop (which is what it sounds like you are asking). The issue there wouldn't really be the fact that it's a script, but simply the naïve approach to timing. However, the timing should be halfway decent even with a naïve approach like this, you're just probably going to see "drift" over time. More robust scenarios are certainly possible, and creating simple constructs for them in the API is also a possibility.

Alternatively, you can piggyback the existing ML intervalometer (http://davidmilligan.github.io/ml-lua/modules/event.html#intervalometer) and modify it's behavior (http://davidmilligan.github.io/ml-lua/modules/interval.html), or you have event.seconds_clock (http://davidmilligan.github.io/ml-lua/modules/event.html#seconds_clock) cbr, or you also have access to a milliseconds clock (http://davidmilligan.github.io/ml-lua/modules/dryos.html#ms_clock).
Title: Re: LUA Scripting (lua.mo)
Post by: pholler on May 20, 2015, 09:39:04 PM
Hi David,

i read all your docu and alle the menu-samples but i still can't get the following thing working. I want a menu whos parent is "Intervalometer". When you press that menu it activates or deactivates the function. In the submenu i need decimal values to choose the minimal interval and to choose the minimal processing time between two shots. This can either be a decimal number or a time value. I tried it several times but i fail implementing such a menu structure. Could you give me a sample how to do that?

Best regards

Peter
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on May 21, 2015, 05:42:28 PM
It's not possible for items in a submenu to exhibit this behavior. Submenus can have submenus but if they do, they can't toggle their own values too (because SET goes into the submenu and Q goes back out). You have to make a submenu item for enabling/disabling the feature.


mymenu = menu.new
{
    parent = "Intervalometer",
    name = "Whatever",
    update = function(self) return self.submenu["Enabled"].value end
    submenu =
    {
        {
            name = "Enabled",
            choices = {"Off","On"},
        },
        {
             name = "Dec. Value",
             min = 0, max = 500,
             unit = UNIT.DEC,
         },
        {
             name = "Time Value",
             min = 0, max = 500,
             unit = UNIT.TIME,
         }
    }
}
Title: Re: LUA Scripting (lua.mo)
Post by: pholler on May 21, 2015, 07:08:24 PM
Thanx david! With your input i just finished my intervalometer-script:
http://www.magiclantern.fm/forum/index.php?topic=15119.0
Title: Re: LUA Scripting (lua.mo)
Post by: garry23 on May 25, 2015, 03:59:52 PM
@dmilligan

Can you point me to the source where you code the various Lua functions and fields.

I tried looking in your bitbucket link but could find the source.

I'm trying to educate myself as to how you created the Lua to ML links, eg lens control.

Cheers
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on May 25, 2015, 04:53:44 PM
the Lua bindings are in these files:
modules/lua/lua.c
modules/lua/lua_battery.c
modules/lua/lua_camera.c
modules/lua/lua_common.h
modules/lua/lua_console.c
modules/lua/lua_constants.c
modules/lua/lua_display.c
modules/lua/lua_dryos.c
modules/lua/lua_globals.c
modules/lua/lua_interval.c
modules/lua/lua_key.c
modules/lua/lua_lens.c
modules/lua/lua_lv.c
modules/lua/lua_menu.c
modules/lua/lua_movie.c
modules/lua/lua_property.c
modules/lua/lua_task.c

You can also use bitbucket to look at a diff of the branch:
https://bitbucket.org/hudson/magic-lantern/branch/lua#diff
Title: Re: LUA Scripting (lua.mo)
Post by: garry23 on May 25, 2015, 05:21:56 PM
Sorry, I still can't find the source.

I've looked everywhere.

For example, I can't find this file: modules/lua/lua_lens.c

Sorry to be a pain and thick, but can you give me an explicit link to: modules/lua/lua_lens.c

Cheers
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on May 25, 2015, 08:06:39 PM
Checkout the lua branch of the main ML repository.

https://bitbucket.org/hudson/magic-lantern/src/636fa3e718d1c1351193baf480e8a7736559600b/modules/lua/?at=lua
Title: Re: LUA Scripting (lua.mo)
Post by: garry23 on May 25, 2015, 08:24:17 PM
 :)
Title: Re: LUA Scripting (lua.mo)
Post by: [email protected] on June 01, 2015, 12:09:37 PM
Hi

Is it possible to trigger video on the 5D mark2 for time lapse purposes using lua scripting?

Thanks
Katrina
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on June 01, 2015, 12:49:11 PM
Yes! (http://davidmilligan.github.io/ml-lua/modules/movie.html)
Title: Re: LUA Scripting (lua.mo)
Post by: [email protected] on June 02, 2015, 12:15:25 AM
Thanks for your reply Dave

I had a look at the link

What is meant to go between the brackets in the lines

Start () and stop ()

Is that a video duration or a time interval?

I have not installed, reviewed, scripted or done anything before with Magic Lantern and I'm a bit uncertain that I can write a script

Is there a script already written which will trigger record for 20 seconds every day - with an interval of 24 hours?

Thanks again
Katrina
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on June 02, 2015, 01:53:14 AM
movie.start() and movie.stop() don't take any parameters. To record a 20s movie you can do something like this:


movie.start()
msleep(20000)
movie.stop()


For more info see this example: http://davidmilligan.github.io/ml-lua/examples/recdelay.lua.html

Taking a video once a day may be some trouble, as you can't really keep LiveView on that long (even if you could it probably wouldn't be a good idea).
Title: Re: LUA Scripting (lua.mo)
Post by: [email protected] on June 02, 2015, 10:46:32 AM
Thanks again

if LiveView needs to be on for the script to run, this solution probably won't work for me then.

Can Live view not be switched on by the script?

Sorrry, as I said, I have no experience in this?

I believe that there is a light sensor interveralometer available - which might work better

Thanks again
Katrina
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on June 02, 2015, 01:00:52 PM
You can turn on and off photo LV, but there's no way to switch to movie mode/LV. Programmatically switching Canon modes is possible (there was an old feature called movie mode remap), but it is dangerous and has caused cameras to be temporarily bricked, so all such capability has been removed from ML.

You can pause LV though. I suppose this works in movie LV. I don't know if this will prevent the camera from shutting off LV after 30 mins or not (there is a way that's been implemented for raw recording, but it is not currently exposed for scripts).
Title: Re: LUA Scripting (lua.mo)
Post by: [email protected] on June 02, 2015, 06:06:03 PM
Thanks again for letting me know the limitations and functions...

However, I'm sorry but I am still not sure if I should proceed in getting ML and trying to create this script - perhaps there is somebody else who is doing this or has tried it?

If not - what's your advice - do you think I should try the script or not?

Thanks
Katrina
Title: Re: LUA Scripting (lua.mo)
Post by: Walter Schulz on June 02, 2015, 06:16:21 PM
What are your requirements?

As far as I could find out right now:
- You have a cam, 5D2. Unattended. No one is looking after it for quite some days/weeks/months ...
- All 24 hours there is a 20 second video shot to be taken.

Corrections and more details, if necessary, please.
Do you have an external power supply?
Title: Re: LUA Scripting (lua.mo)
Post by: [email protected] on June 02, 2015, 11:33:37 PM
Hi

All the above mentioned is correct, the camera is locked in place and powered by the AC adapter, the scene is an old house in ruin which is slowly being taken over by vegetation.

I have a series of these type of shoots to perform for a film, which is still in development. (lots of ruin, decay and renewal)

I have never used ML, but I met an Italian in the Azores last week who was very certain ML would work 8)...

I tried firstly doing time lapse photos with an intervalometer - taking a pic every 5 minutes for several weeks and trying to bracket and select only the pics in similar light  - but the light here in Ireland is way too sporadic... no two days are ever the same and with natural shadows changing on the door frames etc - it just didn't work.

Currently I am visiting the house frequently and shooting video myself, which is then taken into the adobe premiere and dissolves into each other to see the transition - but this is not a good long term solution.

I have no other information - only if you think it will work and can support me I would love to try it.

Thank you again
Katrina
Title: Re: LUA Scripting (lua.mo)
Post by: Walter Schulz on June 03, 2015, 09:50:35 AM
Tried to find another solution but failed. Problem with 5D2 is - as dmilligan pointed out - you have to enable Liveview in movie mode. There are cams not having this problem. 7D for instance has a movie mode switch and with switch set will startup in movie mode.

You tried Auto-ETTR to solve exposure problem using stills?
Title: Re: LUA Scripting (lua.mo)
Post by: [email protected] on June 03, 2015, 10:40:20 AM
Thanks Walter

NO, I didn't try  Auto-ETTR - I have never used ML at all.

I will look into it - but, from a quick scan I don;t know if that will even work... bearing in mind the sun's position, height, cloud cover etc - I used can't see photo solution working - even though it would be nice... maybe if I get the correct funding decision this month I might buy the 7D and keep it for time lapse - are you confident it will work with the 7D? - is there a cheaper camera that it would work on?

Thanks again for your help
Katrina
Title: Re: LUA Scripting (lua.mo)
Post by: a1ex on June 03, 2015, 11:36:31 AM
The easiest - and portable - way to shut down LiveView in movie mode is to go to play mode (and then turn the display off).

On 5D2, there's no dedicated hardware switch for movie mode. So, on the contrary - on this camera, enabling and disabling movie mode can be done without problems, since the only way to do it is from the menus. The 50D is very similar. All the other cameras have a hardware switch, so you can't safely switch between photo and movie mode from ML (that switch is handled by a secondary processor, which we don't fully understand yet - the MPU - so faking the mode dial position on the main CPU is not enough, though it seems to work at first sight).
Title: Re: LUA Scripting (lua.mo)
Post by: Walter Schulz on June 03, 2015, 06:14:29 PM
Thanks, a1ex, for correction!

Setup in mind:
----
Timer for AC adapter, cam switched to ON. Timer will startup cam. ML + modules will run (Debug tab -> Modules debug -> Load modules after crash ON). Loading script
- Wait short time
- Start movie recording
- After 20 seconds stop movie recording

Wait some minute and timer will cut power.

----
Any errors within this concept?

Title: Re: LUA Scripting (lua.mo)
Post by: rambler on June 03, 2015, 06:17:37 PM
@Katrina
It seems you intend to run a very long timelapse. I doubt anyone has tested this with a DSLR. Note that cameras are not designed to run for months on end, so it is probable, or almost certain, that it will fail after some days or weeks. And since it is possible to damage a DSLR programmatically, you may not want to try. It may be possible to use a trick long since known for P&S Canons in the CHDK (http://chdk.wikia.com/wiki/CHDK) community: if the power switch is set to "on" and power is applied, the camera will go "on". Thus, with a programmable power supply, the camera can be switched on for only the duration required to take a couple of shots or a short video. This works on 550D, but I have no idea if it works on the others. And I have a gut feeling that it a dangerous practice with a DSLR.

May I suggest you consider another, far cheaper alternative: rather than use a Canon DSLR with ML, think of a Canon P&S with CHDK (http://chdk.wikia.com/wiki/CHDK), where long timelapses is a proven and well tested concept. For the price of a DSLR you can get half a dozen of decent P&S. Video quality will probably be not as good, unless you pick one of the high-end models, which are expensive though. But then, are you sure you need video, 20s every day? Why not a still shot, or a few of them, which can then be combined into a nice hi-res timelapse video? If you need further advice on this, ask nicely at the CHDK forum (http://chdk.setepontos.com/index.php?action=forum), explaining your project and needs, and a few nice people out there will surely be more than happy to provide you with any general or practical advice.
Title: Re: LUA Scripting (lua.mo)
Post by: garry23 on June 03, 2015, 07:04:13 PM
Just to add my input to rambler's; having used CHDK with scripting (S95 and G11), I have to agree that it a very serious option for those doing 'unusual' things, ie away from 'normal' timelapse sequences. Especially if money is an issue ;-)

I found the CHDK scripting environment very accessible.

As I say: just my humble view.

Cheers

Garry
Title: Re: LUA Scripting (lua.mo)
Post by: Totte on June 09, 2015, 01:52:01 PM
OK, finally time to play with this: I've checked out the LUA branch and compiled it for the 5D2 on my Linux machine. I end up with an empty doc folder but I've assumed that I can ignore that for now.

I copy everything from the zip file to my ML card and after enabling the LUA module I find the LUA Menu Test under Debug, but I don't see a separate LUA menu. After copying the scripts/lib folder from the source to the CF card I also see the Sokoban game with its own menu. I guess the make file will eventually be updated to include this folder in the zip target?

So where am I supposed to select which of the other scripts in the scripts folder to run, like how to invoke editor.lua? Is it just me being stupid, or am I still missing some vital LUA component on the CF card, or should I be investigating my build environment and make output?

Thanks for any help!
Title: Re: LUA Scripting (lua.mo)
Post by: Licaon_Kter on June 09, 2015, 05:28:04 PM
See my reply to dmilligan here ( modify your ML and rerun make ): https://bitbucket.org/hudson/magic-lantern/issue/2297/shoot-mode-ca-and-hdr-backlight-control#comment-18586259


I guess you are missing the /scripts/LIB folder maybe?
Title: Re: LUA Scripting (lua.mo)
Post by: Totte on June 09, 2015, 06:11:32 PM
Yes I was missing the /scripts/lib folder but like I said I copied it manually and then got to the point where I can play Sokoban ;D

Now trying to figure out where/how to run the rest of the LUA scripts in the scripts folder. Being all new to LUA I wouldn't be able to tell how this is supposed to work.
Title: Re: LUA Scripting (lua.mo)
Post by: Licaon_Kter on June 09, 2015, 07:27:08 PM
Those scripts that make a menu are visible ( sokoban, copy2m ).
I actually cloned copy2m and use it's framework to do something else, but a word of warning, if you do that either remove the original script from the card/folder or rename the menu/functions if not it will loop and eventually freeze/crash ( it did on my M so your results may vary ).
Title: Re: LUA Scripting (lua.mo)
Post by: Totte on June 09, 2015, 08:48:43 PM
That makes sense, except that I don't see any trace of copy2m. Only Games is added to the top menu, with Sokoban as a sub-item. I guess I can make a copy of Sokoban and see how that goes. Thanks for the warning about the naming!

Does anyone have another precompiled LUA-compatible binary for the 5D2 that behaves better? If so I would gladly jump to learning and running LUA scripts ASAP.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on June 10, 2015, 02:53:07 AM
All scripts are run immediately on startup. They may or may not have menu items, and their menus can show up anywhere. copy2m shows up in the 'Prefs' menu, several of the other scripts show up in the Debug menu, some scripts may not even have a menu item

I would suggest turning the 'console' on (Debug >Modules debug > Show Console), any errors are going to be logged there. There should also be messages about scripts being loaded and other informational things.

I've also greatly expanded the general lua documentation so see http://davidmilligan.github.io/ml-lua/
Title: Re: LUA Scripting (lua.mo)
Post by: Licaon_Kter on June 10, 2015, 08:44:44 AM

Quote from: Totte on June 09, 2015, 08:48:43 PMThat makes sense, except that I don't see any trace of copy2m.
Read the source and it says were the menu item should appear.


copy2m_menu = menu.new{
parent = "Prefs",
name = "Copy To M",
...
}
Title: Re: LUA Scripting (lua.mo)
Post by: Totte on June 10, 2015, 12:42:22 PM
Thanks to both of you, I can confirm that I see the other scripts now.

In the console I get a bunch of 404's at startup before "Modules loaded":
auto_ettr_intervalometer_wait
dual_iso_get_dr_improvement
dual_iso_get_recovery_iso

There could be more, I just see it slowly printing auto_ettr_intervalometer_wait, then quickly overwriting it with the next two function names. Any idea where this comes from?

In the editor I am simply stuck as the Picture style button (which is supposed to be Q on the 5D2) does not open the menu. Key translation missing?
Title: Re: LUA Scripting (lua.mo)
Post by: pholler on July 29, 2015, 09:58:38 AM
Hi David,

do you think it's possible use a LUA-script to use focus-trap onlny when the shutter-button ist clicked and AF-assist when you press the AF-on-button. I described it in more detail here: http://www.magiclantern.fm/forum/index.php?topic=14914.msg145552#msg145552 (http://www.magiclantern.fm/forum/index.php?topic=14914.msg145552#msg145552).
Title: Re: LUA Scripting (lua.mo)
Post by: dfort on August 03, 2015, 07:23:32 PM
I'm trying to track down properties that trigger the shutter-bug on the EOS-M. There's a tool for that (property spy) but it is not working on the EOS-M so I'm looking into trying to do it in a lua script. No problem getting the lua branch working though I did have problems writing scripts with various text editors, I kept getting errors on start up:
Loading script: propspy.lua
ML/SCRIPTS/propspy.lua:11: unexpected symbol near '<\226>'
Loading script: ._propspy.lua
ML/SCRIPTS/._propspy.lua:1: unexpected symbol

Switching over to the nano text editor solved that problem. Yeah, I know, real programmers use vi or emacs.

Anyway, the script is very simple, basically a modified "Hello, World!" script.
-- Spy on a Property

function property.LENS_SOMETHING:handler(value)
    print("Lens Something: "..value)
end

function main()
    menu.close()
    console.show()
    print "Property Spy"
    print(property.LENS_SOMETHING)
    print "Half-press shutter to exit."
    key.wait()
    console.hide()
end

keymenu = menu.new
{
    name = "Property Spy",
    select = function(this) task.create(main) end,
}



The output printed on the console is:
Save configs...
Property Spy
table: p
Half-press shutter to exit.

This is my first attempt at writing a script. I checked the online tutorials but haven't been able to figure it out. Any clues to what I'm doing wrong?
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on August 03, 2015, 10:18:49 PM
You can't retrieve the value of a property with Lua like this. All you can really do is set a property change handler (you can request a change if you enable this functionality, see the warning in the docs).
Title: Re: LUA Scripting (lua.mo)
Post by: dfort on August 04, 2015, 03:29:36 AM
You mean this warning?

// !!!DANGER WILL ROBINSON!!!
//#define LUA_PROP_REQUEST_CHANGE


Yeah, I'm a little hesitant turning that on. So in your example:

function property.SHUTTER:handler(value)
     print("shutter: "..value)
end


You need to have #define LUA_PROP_REQUEST_CHANGE enabled for it to work?

Calling the function like this would then print to the console when there's a change in the shutter, like when firing off a shot or doing a shutter half-press?

function property.SHUTTER:handler(value)
     print("shutter: "..value)
end

function main()
    menu.close()
    console.show()
    property.SHUTTER
end


Just checking before I try it. I've got 3 EOS-M's so I've got 3 chances to get this right.
Title: Re: LUA Scripting (lua.mo)
Post by: Licaon_Kter on August 04, 2015, 10:09:11 AM
My script used to detect shooting mode changes for this bug: https://bitbucket.org/hudson/magic-lantern/issues/2297/shoot-mode-ca-and-hdr-backlight-control (https://bitbucket.org/hudson/magic-lantern/issues/2297/shoot-mode-ca-and-hdr-backlight-control)


--copies the shutter, aperture, and iso of the current mode when switching to M mode
require("config")


--class to keep track of property values using prophandlers
prop_value = {}
prop_value.__index = prop_value


function prop_value.create(...)
    local pv =
    {
        value = 0,
        previous = 0,
        time = dryos.ms_clock,
        props = {...}
    }
    setmetatable(pv,prop_value)
    return pv
end


function prop_value:enable()
    for i,v in ipairs(self.props) do
        function v.handler(prop,value) self:set(value) end
    end
end


function prop_value:disable()
    for i,v in ipairs(self.props) do
        v.handler = nil
    end
end


function prop_value:set(value)
    if camera.mode ~= MODE.M and value ~= 0 then
        self.previous = self.value
        self.value = value
    end
end


function prop_value:get()
    --ignore value if we've been in the current mode for less than 1 sec
    if dryos.ms_clock - self.time < 1000 then
        return self.previous
    else
        return self.value
    end
end


--will be set as the prop handler for property.SHOOTING_MODE, when enabled
function shooting_mode_handler(self,value)
      print("shutter: "..value)
end


modedisplay_menu = menu.new
{
    parent = "Prefs",
    name = "Mode display",
    help = "Switch mode and print",
    choices = {"Off","On"},
    value = "Off"
}


function modedisplay_menu:select(delta)
    if self.value == "Off" then self.value = "On" else self.value = "Off" end
    modedisplay_update(self.value)
end


--start/stop the prop handlers to enable/disable this script's functionality
function modedisplay_update(value)
    if value == "On" then
        property.SHOOTING_MODE.handler = shooting_mode_handler
    else
        property.SHOOTING_MODE.handler = nil
    end
end


config.create_from_menu(modedisplay_menu)
modedisplay_update(modedisplay_menu.value)



It's a modified script from here: https://davidmilligan.github.io/ml-lua/examples/copy2m.lua.html (https://davidmilligan.github.io/ml-lua/examples/copy2m.lua.html) with lots of cruft.
What you should change is SHOOTING_MODE to whatever property you desire: https://davidmilligan.github.io/ml-lua/modules/property.html (https://davidmilligan.github.io/ml-lua/modules/property.html)
Two tips, never use two scripts with the same menu/function names, it will crash LUA & ML, and second you need /ML/scripts/LIB/config.lua present too.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on August 04, 2015, 01:05:47 PM
Quote from: dfort on August 04, 2015, 03:29:36 AM
You need to have #define LUA_PROP_REQUEST_CHANGE enabled for it to work?
No. That is only for if you want to set the value of a property.

You can add a handler that gets called when the property changes without enabling this macro. Using a handler is the only way to get a property value (except for select properties which are exposed other ways like in the 'camera' class). What I meant in my post is that there is no method to retrieve the value of a property on demand. The only way is to set a handler and wait until the property changes.
Title: Re: LUA Scripting (lua.mo)
Post by: dfort on August 04, 2015, 09:02:27 PM
Thanks dmilligan and Licaon_Kter, now I get it. Well, sort of. It will be questionable whether the shutter-bug can be tracked down by waiting until a property changes. What's important is finding what state a property is in when the camera is first powered on and compare it to when the shutter-bug is active and inactive. In any case, it is worth looking at what properties change when un-mounting and re-mounting the lens--one of the shutter-bug workarounds.

I must admit that I didn't understand what the copy2m.lua script was doing. It doesn't seem to display anything on the screen or write a log to the card. With Licaon_Kter's modified version it prints to the console so it is clear what is going on and how he was able to find the shooting_mode he was looking for.

Anyway, this is tricky stuff for a beginner like me. Any little change I make to Licaon_Kter's script seems to blow it up. This is going to take me a while--but first I'm going on a vacation so I should have a fresh start on this in a couple of weeks.

By the way--is this the right place to mention bugs or peculiar behavior of lua scripts or should that be done on bitbucket under the "Modules (other module)" component? There isn't one for lua.
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on August 04, 2015, 09:51:31 PM
Best place to comment is on the current pull request for it on bitbucket.
Title: Re: LUA Scripting (lua.mo)
Post by: garry23 on October 19, 2015, 07:53:47 PM
Just a quick inquiry regarding progress.

Like many I'm eager to experiment with scripting, but I'm not adept enough at compiling my own (5D3-113 and 50D).

Could I politely ask if there will be any chance of seeing Lua scripting in the nightlies any time soon?

Cheers

Garry
Title: Re: LUA Scripting (lua.mo)
Post by: f.javi.pz on January 11, 2016, 08:29:58 AM
Hi,

I'm also eager to experiment with scripting, and as garry23, compiling can be too complicated for me.

I've tried the "codio way" at

http://www.magiclantern.fm/forum/index.php?topic=14725.msg142351#msg142351

but I'm afraid that web has now restrictions (no Terminal tool if you don't have a paid account).

I have access to a linux computer (ubuntu) so...

can anybody please tell me how to compile lua.mo on it's terminal?

I'm afraid I could need a "dummy" approach: "download all the files from this link" and so on.

This is a community project. Although my skills are quite basic, I will contribute with probably World's simplest scrip!  :)

Thank you anyway, your work has been jus amazing (and your patience with newbies like me),

Javi.
Title: Re: LUA Scripting (lua.mo)
Post by: Licaon_Kter on January 11, 2016, 09:21:50 AM
This: http://www.magiclantern.fm/forum/index.php?topic=991.0 (http://www.magiclantern.fm/forum/index.php?topic=991.0)

And the Pull Request patch is this: https://bitbucket.org/api/2.0/repositories/hudson/magic-lantern/pullrequests/642/patch (https://bitbucket.org/api/2.0/repositories/hudson/magic-lantern/pullrequests/642/patch)


cd magiclanternfoldername
patch -p0 -i bitbucket-hudson-magic-lantern-pullrequest-642.patch

(or was that p1 ?)

See my notes here too as they might help you if you encounter any errors: https://bitbucket.org/hudson/magic-lantern/issues/2297/shoot-mode-ca-and-hdr-backlight-control#comment-18586259

Then see this: http://www.magiclantern.fm/forum/index.php?topic=14725.msg150244#msg150244 (http://www.magiclantern.fm/forum/index.php?topic=14725.msg150244#msg150244)

If the dual_iso module fails you need multiarch or just edit line 12 in magiclantern/modules/dual_iso/Makefile like this:
# include Makefile.cr2hdr # means comment out
Title: Re: LUA Scripting (lua.mo)
Post by: Walter Schulz on January 11, 2016, 11:57:00 PM
Fireworks, please!
https://bitbucket.org/hudson/magic-lantern/pull-requests/642/lua-scripting/activity#
[Sound]Black Eyed Peas: I Gotta Feeling[/Sound]

Finally! Thanks to all involved!
Title: Re: LUA Scripting (lua.mo)
Post by: g3gg0 on January 12, 2016, 01:09:06 AM
okay i merged LUA into mainline.

but do me one favor:
integrate IME module (ime_base) for quicker text editing, both in edit view and save box etc.
it is meant to be an ML module so people do not always reimplement the wheel on their own...
you can of course make it optional via menu a la "Insert Text via IME" or an IME button.

description: http://www.magiclantern.fm/forum/index.php?topic=6899.0
code: https://bitbucket.org/hudson/magic-lantern/src/524b2bc791d786bab42d1ec094134613db773b23/modules/ime_base/ime_base.c?at=unified
see ime_base_test_* functions
Title: Re: LUA Scripting (lua.mo)
Post by: dmilligan on January 12, 2016, 01:23:51 AM
Hooray!

I had been thinking about integrating IME, but it was less work to just do it in pure Lua than expose the IME API :P But I agree there should be a unified text input method, so I will work on it.
Title: Re: LUA Scripting (lua.mo)
Post by: g3gg0 on January 12, 2016, 01:26:42 AM
thanks a lot.

as said, i am sure they can co-exist (e.g. longpress-Q can open a popup "insert text via IME" or "copy" "paste" stuff etc)
Title: Re: LUA Scripting (lua.mo)
Post by: f.javi.pz on January 12, 2016, 08:00:52 AM
So...

I've got all the code ready (thanks Licaon_Kter!), Black Eyed Peas are waiting at the living room with lots of fireworks, a lighter and a dangerous look...

I think I have everything, I can compile it. Wait!, it's already done at the mainline!

Thanks Walter, g3gg0, dmilligan!
Title: Re: LUA Scripting (lua.mo)
Post by: Licaon_Kter on January 12, 2016, 10:08:54 AM
This fails on my EOS-M with GCC 5.2.1: https://bitbucket.org/snippets/Licaon_Kter/Mdzey (https://bitbucket.org/snippets/Licaon_Kter/Mdzey)

EOSM (localeconv, strspn, memchr)

But it works with GCC 4.8.4 and GCC 4.9.3.


/LE: Reported: https://bitbucket.org/hudson/magic-lantern/issues/2449/lua-module-build-fails-with-gcc-521
Title: Re: Lua Scripting (lua.mo)
Post by: axelcine on January 20, 2016, 11:04:54 PM
LUA is a tremendously fine piece of software. I envision - and hope -, that in the near future skilled photographers are going to provide us with libraries of LUA scripts, performing all kinds of tasks like HDR or RAW filming. dmilligan has given us a fine tool.
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on January 24, 2016, 02:52:20 AM
Dang! It's not the first time I mentioned to suck as a programmer.
Help, please: How to place a new menu item in an existing submenu?
Location should be Prefs tab -> Config files
I learned how to create a new menu item in Prefs tab by
parent = "Prefs";

Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 24, 2016, 05:23:09 AM
Try
parent = "Config files"
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on January 24, 2016, 08:30:40 AM
I could swear I tried this tonight but failed. I retried and it works.
Thanks!
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on January 24, 2016, 09:09:54 AM
Always missed the option to reboot from menu in Modules and Prefs -> Config files ...

Reb_Conf.lua
-- Unsophisticated reboot (Prefs -> Config files)

function main()
    camera.reboot()
end

keymenu = menu.new
{
    parent = "Config files",
    name = "Reboot",
    help = "Reboots cam. Will not ask for confirmation!",
    select = function(this) task.create(main) end,
}


Reb_Modu.lua
-- Unsophisticated reboot (Modules)

function main()
    camera.reboot()
end

keymenu = menu.new
{
    parent = "Modules",
    name = "Reboot",
    help = "Reboots cam. Will not ask for confirmation!",
    select = function(this) task.create(main) end,
}

(http://picload.org/image/wdwprdl/vram1.png)
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 24, 2016, 09:50:50 AM
Walter

Thanks for posting this as it helps people like me, who are keen to start scripting, but, bluntly not programmers and don't know Lua syntax etc.

The more people like me can see others' scripts, the quicker we will be able to write our own scripts.

It truly would be fantastic is someone could write a simple (couple of pages) ML-focused intro to Lua scripting, ie showing how to do all the 'common' things we will be looking to do, eg: set up menu, get focus position, change exposure, move lens focus, take an image, drive other ML functionality from within a script, eg set ETTR etc etc.

Once again: thanks for posting and I hope others do as well.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 24, 2016, 01:04:55 PM
Ok, I jumped in and tried adapting Walter's script. The function of the script is simply to take an image. But I can't seem to get it to work.

I hope some kind expert can nudge me in the right direction, as once I get this core script running, I feel I can make progress on more complex scripting.

-- Test Script

require('keys')

function main()
    keys:start()
menu.block(true)
  while menu.visible do
local key = keys:getkey()
if key == KEY.RATE then camera.shoot() end
  end

-- quit script
    menu.block(false)
    keys:stop()
end

keymenu = menu.new
{
    parent = "Audio",
    name = "Shoot",
    help = "Simply operates shutter",
    select = function(this) task.create(main) end,
}
Title: Re: Lua Scripting (lua.mo)
Post by: Licaon_Kter on January 24, 2016, 01:33:19 PM

Quote from: garry23 on January 24, 2016, 09:50:50 AM
It truly would be fantastic is someone could write a simple (couple of pages) ML-focused intro to Lua scripting, ie showing how to do all the 'common' things we will be looking to do, eg: set up menu, get focus position, change exposure, move lens focus, take an image, drive other ML functionality from within a script, eg set ETTR etc etc.
You read some examples on the right here: https://davidmilligan.github.io/ml-lua/ too, right?

Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 24, 2016, 01:41:15 PM
Yes...of course :-)

I've read and reread then many times.

I feel my weakest understanding is the basic syntax, ie how do you get DoF or move the lens etc.

I'll get there :-)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 24, 2016, 02:10:44 PM
When using keys:getkey(), you need to yield execution inside your loop (otherwise keys won't be able to process events). So inside your while loop add the line:

task.yield(100)
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 24, 2016, 02:41:53 PM
@dmilligan

Thanks for the hint and I've tried it two ways: but no luck :-(

-- Test Script

require('keys')


function main()
    keys:start()
menu.block(true)
  while menu.visible do
task.yield(100)
local key = keys:getkey()
-- task.yield(100) - tried it here as well
if key == KEY.RATE then camera.shoot() end
  end

-- quit script
    menu.block(false)
    keys:stop()
end

keymenu = menu.new
{
    parent = "Audio",
    name = "Shoot",
    help = "Simply operates shutter",
    select = function(this) task.create(main) end,
}


BTW this is why it would be helpful for someone in the know, to help kickstart the rest of us in the art of scripting.

I had looked at the Pong example and it didn't have the task.yield(100) business.

I truly am not looking for personal help as I know everyone is busy.

As I said, I'll just wait until a few more post their scripts and adapt anything I see useful to my project.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on January 24, 2016, 03:35:48 PM
I replaced .RATE with .INFO and it is working fine on 650D. Only one "yield" entry needed.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 24, 2016, 04:03:48 PM
Walter

Does that imply you can't 'access' the rate button on the 5D3?
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on January 24, 2016, 04:08:38 PM
That would be wonderful because I don't own a 5D3.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 24, 2016, 04:23:28 PM
Ok I just found out what has been happening.

With the script loaded (in the Audio parent menu) iy shows up OK.

If I toggle to the script submenu and press RATE nothing happens.

If I first press SET then RATE the script appears to function OK.

It's nuances like this that will mean that 'idiots' like me will meander towards scripts that work, ie our only way forward is to adapt others' scripts and experiment (and hope we don't brick our cameras :-))

Bottom line: now I can trigger a script I can focus on my task, ie an auto landscape bracketing script.

Thanks for your help.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: Totte on January 25, 2016, 02:11:44 PM
It's nice to finally have an official build with LUA included. Now I no longer have to wonder if the errors I encounter are from my own sketchy build and can instead concentrate on the LUA part.

I've experimented with camera.bulb(duration). The documentation says that duration is in seconds, but I soon discovered that it must indeed be in ms.

Even if I put a single camera.bulb(5000) statement inside a while loop there's still about 3 seconds before the next pic is taken with my 5D2. It is possible to fire off manual bulb exposures with at least 2s less delay between exposures with the same camera settings. Is this something that can be optimized in the camera.bulb() implementation or does the problem run deeper?

Thanks!
Totte
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 25, 2016, 11:07:56 PM
I hope one of the Lua experts can help with this simple script I am using to try and understand Lua.

-- Test Script

require('keys')


function main()
-- Close ML menu
menu.close()
    console.show()
print "move to macro end"
    key.wait()
-- Move lens to macro end
lens.focus(-10,3)
print "take picture"
    key.wait()
camera.shoot()
    print (lens.focal_length)
    print (lens.focal_distance)
print (lens.dof_near)
print (lens.dof_far)
print "Press any key to exit"
    key.wait()
    console.hide()
-- quit script
end

keymenu = menu.new
{
    parent = "Audio",
    name = "Shoot",
    help = "Simply operates shutter",
    select = function(this) task.create(main) end,
}


All the script does is first move the lens to the macro end, following a key press; then take a picture, following a key press; then display some info; then finish after a key press.

But I get strange results and when in the console I get 'loads' of other Lua reporting, eg about other scripts running.

What am I doing wrong?

Hope some kind person can 'educate me'  :)
Title: Re: Lua Scripting (lua.mo)
Post by: Totte on January 25, 2016, 11:46:24 PM
Here's another script that is oh-so close. The idea is to switch between two series of settings while shooting and toggle this 'mode' with the joystick. The logic seems sound and it all works perfectly when the camera.shoot() statements are commented out and I just watch the camera settings change. When the camera.shoot() statements are included, it still works in principle but several shots are fired off before the key event is handled. This is very frustrating, as I would guess that the ability to handle key inputs would increase with longer task.yield() periods, yet this is not what I see for reasonable values of task.yield(). Any ideas?

For those of you who are LUA experts: Apologies for my mistreatment of the LUA language :P

Quoterequire('keys')

menu.new
{
  name = "MultiSeq",
  select = function() task.create(multiseq) end,
  depends_on = DEPENDS_ON.M_MODE,
}

multiseq = function()

  shutters0  = {   1/4 ,    1/8,   1/16 }
  apertures0 = {   8.0 ,    5.6,    4.0 }
  isos0      = {   100 ,    100,    100 }

  shutters1  = {  1/32 ,   1/64,  1/128 }
  apertures1 = {  16.0 ,   11.0,    8.0 }
  isos1      = {   200 ,    200,    200 }

  elementsin0 = 3
  elementsin1 = 3

  seq = 0
  k = nil
  i = 1

  keys:start()
  beep(1,500)

  while true do
    if seq == 0 then
      camera.shutter.value  = shutters0
      camera.aperture.value = apertures0
      --camera.iso.value      = isos0
      camera.shoot() 
      i = i+1
      if i>elementsin0 then
        i = 1
      end
    elseif seq == 1 then
      camera.shutter.value  = shutters1
      camera.aperture.value = apertures1
      --camera.iso.value      = isos1
      camera.shoot()
      i = i+1
      if i>elementsin1 then
        i = 1
      end
    else
      keys:stop()
      return
    end
   
   
    task.yield(1000)
    k = keys:getkey()

    if k==KEY.LEFT or k==KEY.RIGHT then
      if (seq == 0) then
        seq = 1
        beep(2)
      else
        seq = 0
        beep(1)
      end
      i = 1
    elseif k==KEY.SET or k==KEY.UP or k==KEY.DOWN then
      seq = 2
      beep(1, 1000)
    end

  end
end
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 26, 2016, 01:19:41 PM
Quote from: Totte on January 25, 2016, 02:11:44 PM
Is this something that can be optimized in the camera.bulb() implementation or does the problem run deeper?
All the Lua function does is simply call the underlying function in ML core.

Quote from: garry23 on January 25, 2016, 11:07:56 PM
But I get strange results and when in the console I get 'loads' of other Lua reporting, eg about other scripts running.
There is only one console, you do not have exclusive access to it. So anything else that is running: ML core, modules, and other scripts, might be writing there (at any given time there may be as many as a dozen or more ML tasks running).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 26, 2016, 08:48:37 PM
@dmilligan

Thanks for clarifying the console.

May I ask one more question of you: If you look at my simple code, can you see why it wouldn't work.

For example, rather than go to the macro end, when the code runs it seems to go the macro end and then return to where the lens started.

An image isn't taken and the shutter picks up a half press focus, when I have back button set.

As I said: I don't understand as the code seems 'simple' to me.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 26, 2016, 08:59:12 PM
You probably need to call camera.shoot (http://davidmilligan.github.io/ml-lua/modules/camera.html#shoot) with the should_af parameter to false (it defaults to true).

camera.shoot(64, false)
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 26, 2016, 09:28:09 PM
I'm afraid that didn't change anything.

Here is the function I call:

function main()
-- Close ML menu
menu.close()
    console.show()
print "move to macro end"
    key.wait()
-- Move lens to macro end
lens.focus(-10,3)
print "take picture"
    key.wait()
camera.shoot(64, false)
    print (lens.focal_length)
    print (lens.focal_distance)
print (lens.dof_near)
print (lens.dof_far)
print "Press any key to exit"
    key.wait()
    console.hide()
-- quit script
end


After the first key.wait, the lens doesn't move.

After the second key.wait an image is taken and the lens moves to the macro end then back to where it was.

Also the half press becomes active.

I'm mystified as the above code can't get much simpler.

Hope someone can divine what I'm doing wrong :-)
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 26, 2016, 09:41:02 PM
You are in LV, right?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 26, 2016, 09:51:17 PM
!!!!!!! I am now !!!!!!!!!!!!!!!!!!

But I still have a non-predicted response.

After the first wait, the lens correctly moves to the macro end.

After the next wait a picture is not taken and the lens moves backwards and forwards between the macro and infinity end.

I'm baffled.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 26, 2016, 10:19:09 PM
The lens is moving because the camera is still trying to auto focus.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 26, 2016, 10:28:46 PM
I think I found a bug.

Try

camera.shoot(64, 0)


In C there is no boolean data type, it's just zero (false) and non-zero (true) integers. In Lua there's a difference. In the Lua API function for camera.shoot I mixed these up:

static int luaCB_camera_shoot(lua_State * L)
{
    LUA_PARAM_INT_OPTIONAL(wait, 1, 64);
    LUA_PARAM_INT_OPTIONAL(should_af, 2, 1);
    int result = lens_take_picture(wait, should_af);
    lua_pushinteger(L, result);
    return 1;
}


should be:

static int luaCB_camera_shoot(lua_State * L)
{
    LUA_PARAM_INT_OPTIONAL(wait, 1, 64);
    LUA_PARAM_BOOL_OPTIONAL(should_af, 2, 1);
    int result = lens_take_picture(wait, should_af);
    lua_pushinteger(L, result);
    return 1;
}


the definition of those macros just for reference:

#define LUA_PARAM_INT_OPTIONAL(name, index, default) int name = (index <= lua_gettop(L) && (lua_isinteger(L, index) || lua_isnumber(L,index))) ? (lua_isinteger(L, index) ? lua_tointeger(L, index) : (int)lua_tonumber(L, index)) : default

#define LUA_PARAM_BOOL_OPTIONAL(name, index, default) int name = (index <= lua_gettop(L) && lua_isboolean(L, index)) ? lua_toboolean(L, index) : default
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 26, 2016, 11:10:59 PM
@dmilligan

:)

That fixed it: thank you.

I'm now confident to move to the coding the conditional logic in my script.

Once again thanks for your help.

BTW I hadn't read anywhere that Lua requires you to be in LV.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on January 27, 2016, 12:30:48 AM
Quote from: garry23 on January 26, 2016, 11:10:59 PMBTW I hadn't read anywhere that Lua requires you to be in LV.

That's mainly because it doesn't. There are functions/procedures only working in LV or in non-LV or in movie mode or ... See http://davidmilligan.github.io/ml-lua/modules/constants.html#DEPENDS_ON and http://davidmilligan.github.io/ml-lua/modules/constants.html#MODE
Example in recdelay.lua
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 27, 2016, 12:49:10 AM
It's a long standing ML limitation that we can only control focus in LV, and that control that we do have is very limited.

There's a note in the documentation for lens.focus: http://davidmilligan.github.io/ml-lua/modules/lens.html#focus
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 27, 2016, 08:07:09 AM
David/Walter

Once again, thanks for the prompt and to the point feedback.

It was my incompetence that I hadn't picked up on the LV 'sensitivity' to some ML functionality. I'll look at the documentation more carefully next time  ;)

I will also build some simple 'error' handling into the script, eg to ensure it doesn't run if not in LV.

BTW I assume if I call lv.start() it will switch on LV if LV is not enabled?

Once again, many thanks, and, because of your help, I hope to be publishing my first script very soon  :)

Finally, can someone explain the need for task.yield and when to use it.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 27, 2016, 12:57:17 PM
Quote from: garry23 on January 27, 2016, 08:07:09 AM
Finally, can someone explain the need for task.yield and when to use it.
In a long running loop where you are polling or waiting for something to change and need to allow other things to execute rather than hogging the CPU and blocking event handlers.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 27, 2016, 06:55:54 PM
David

Can you give idiots like me any addition hints as to when we should consider using task.yield?

I've looked at the Lua examples, but it's difficult to see why task.yield has been inserted, ie good practice or essential at certain times.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 27, 2016, 08:38:39 PM
David/Walter

I hope you can help, as I'm so enthused about being able to script.

To me the following is simple and, I believed, coded 'correctly.

It behaves as expected initially, ie move the lens to the macro end and takes a picture.

I then get the LV message repeatedly flashed, ie looks as if it is in an infinite loop, that I'm at the soft end limit. Which I don't understand as I'm driving the lens the other way.

Can you see where I'm going wrong?

-- Simple landscape bracketing script

function main()
-- Close ML menu
menu.close()
-- Move lens to macro end
lens.focus(-10,3)
-- Get DoF info & take first bracket
a1 = lens.dof_near
b1 = lens.dof_far
camera.shoot(64, 0)
-- take remaining brackets to infinity
repeat
repeat
task.yield(100)
lens.focus(1,1)
a2 = lens.dof_near
b2 = lens.dof_far
until a2 > b1
-- move lens back to overlap last capture
lens.focus(-1,1)
a1 = lens.dof_near
b1 = lens.dof_far
camera.shoot(64,0)
until b2 >= 1000000
-- Infinity reached
beep(2, 100, 330)
end

keymenu = menu.new
{
    parent = "Audio",
    name = "Press SET",
    help = "Simple landscape bracket script",
    select = function(this) task.create(main) end,
}
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 27, 2016, 10:54:03 PM
I think the problem is that you are assuming lens.dof_near and far are immediately updated. They are probably not, esp since you aren't "waiting" until the focus move is complete (see the wait parameter to the lens.focus() function). Even if you wait, IDK if they will get updated. They come from Canon properties which can behave in finicky ways at times. You may have to use a prop handler to wait for them to change.

Another thing to keep in minds is that focus step sizes and total number of steps from macro to infinity can vary greatly from lens to lens.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 27, 2016, 11:10:52 PM
David

Thanks for the pointer, I do some experimenting and educating  :)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 27, 2016, 11:30:41 PM
David

I may have found a bug in lens.focus.

No matter if you put positive or negative values of num_steps or step_size, the lens only moves one way, ie towards the macro end.

If this is a bug, I hope you can fix it   ;)
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 29, 2016, 08:06:22 AM
David

Have you found time to confirm my testing, that lens.focus has a bug, i.e. Only moves the lens one way?

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 29, 2016, 01:00:58 PM
yes
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 29, 2016, 01:42:19 PM
David

Thanks. For a while I thought it was me, until I tested every option  :)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on February 24, 2016, 10:35:04 PM
Feature request:
Autostart Lua script at powerup.

If Lua.mo is activated and cam is started it will lookup for scripts in subdir "Autostrt" and execute them. And/or look for files with a dedicated prefix (for example "AS_xxxx.lua") and execute them.
Title: Re: Lua Scripting (lua.mo)
Post by: Licaon_Kter on February 25, 2016, 12:15:43 AM
Any script in mind?
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on February 25, 2016, 02:17:48 AM
All scripts get executed at startup. First paragraph: http://davidmilligan.github.io/ml-lua/index.html
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on February 25, 2016, 07:30:03 AM
David

BTW I see the nightlies were updated the other day, but I couldn't see any Lua tweaks.

Do you know when your Lua fixes will be incorporated ?

I'm particularly keen to see the lens move function working in both directions ;-)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on February 25, 2016, 08:07:56 AM
Thanks, Dan! <Note to self: RTFM!>

Quote from: Licaon_Kter on February 25, 2016, 12:15:43 AM
Any script in mind?

Sure: Rivaling "The most useless machine EVER" by running Reboot script at startup.

No, seriously, there are applications for running scripts at startup. Unattended cams for instance.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on February 25, 2016, 08:24:41 AM
Walter

I can confirm that the scripts run on start-up.

For example, my script to provide a focus and exposure bracketing helper is by default switched off in the menu, but by changing the default to "On" in the script, it will be running, ready for use when the camera is switch on.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 26, 2016, 06:44:35 PM
I have an issue with a very simple script.


function printf(s,...)
    print(s:format(...))
end

printf("abc%d", 5)


On PC:

lua test.lua
abc5


On camera (60D, lua_fix branch):

ML/SCRIPTS/TEST.LUA:2: attempt to index a string value (local 's')
stack traceback:
   ML/SCRIPTS/TEST.LUA:2: in function 'prin_


That's right - it can't even display an error message...

Tried formatting the card, copying everything from scratch to make sure it isn't some filesystem error... all I could get was different names for the "printf" function in that incomplete error message (for example, once it printed "'glob_" instead of "'prin_")

No other scripts were changed or added - just the default scripts from the repository.

I suspect some memory corruption issues.

(no, it wasn't me who merged it into nightly builds, if you are wondering)

Update: I've reproduced the issue in QEMU as well (with semi-random names on the last word on the error line):

(http://a1ex.magiclantern.fm/bleeding-edge/lua/qemu-lua-bug.png) (http://a1ex.magiclantern.fm/bleeding-edge/lua/qemu-lua-bug-scriptsource.png)
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on February 26, 2016, 08:21:18 PM
So basically what is happening is that you are trying to call a function in a library that isn't loaded. This is the one situation where the deferred automatic loading of the lua libraries does not work (I did this to try and save every last drop of RAM).

Almost always you have to do say:

local f = io.open

To get an instance. In other words to get an instance of a 'file' you have to reference a global "io" first. After that it's safe to do f:read() or whatever. When you reference a global that is a built-in lua library name, then the Lua backend loads that library at that time (it doesn't load them initially, only 'on demand'). This works pretty well for most situations because it's impossible to create an instance of some particular type without calling the 'constructor' by using the global reference. Strings are the one exception to that. They are the only "type" that you can instantiate without calling "string.<something>()".

So either:

require("string")
function printf(s,...)
    print(s:format(...))
end

printf("abc%d", 5)

or

function printf(s,...)
    print(string.format(s,...))
end

printf("abc%d", 5)





The truncated stack traceback is a separate problem. I've noticed that myself and I'm not sure what's going on. I remember in the past it's given the whole thing just fine, so I'll have to investigate that.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on February 26, 2016, 11:20:20 PM
So the stacktrace issue I've narrowed down to this changeset:
https://bitbucket.org/hudson/magic-lantern/commits/2279fb4bd843d32969f63827f5f17142a84d0faf

So it appears to be a problem with ML's 'printf'
This does not work:

#define err_printf(fmt,...) console_show(), printf(fmt, ## __VA_ARGS__)


This works fine:

#define err_printf(fmt,...) console_printf(fmt, ## __VA_ARGS__)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 26, 2016, 11:47:43 PM
Fixed it locally.

Still, wondering why I've got random names for the last word, both in QEMU and on the camera. Could be a bug in Canon's vsnprintf as well.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on February 27, 2016, 01:51:37 AM
so I'm wondering if we should load string lib by default for this reason, thoughts?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 27, 2016, 07:44:50 AM
Sounds good to me.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 26, 2016, 09:51:30 PM
Getting close to a major bugfix update for the Lua scripting engine, including an API testing script (which already revealed a few bugs in the ML core). I'd like to ask everyone interested to take a look at this pull request:

https://bitbucket.org/hudson/magic-lantern/pull-requests/683/lua-scripting-lots-of-fixes-plus-api/commits

I'm tempted to include this one as well (C stdio routines from dietlibc, which give a major speedup on text file I/O because of buffering), so I'd like some review and/or testing here as well:

https://bitbucket.org/hudson/magic-lantern/pull-requests/689/lua-stdio-routines-from-dietlibc-with/commits

After merging those two, the next big thing on the Lua side will be lua_touch, where dmilligan is working on some really nice stuff for touch-screen cameras (interactive console, touch keyboard, gestures, IME integration...)
Title: Re: Lua Scripting (lua.mo)
Post by: lumenmikie on April 12, 2016, 06:44:15 AM
I've been trying my hand with Lua and trying to write a script that would allow me to record a series of video clips at particular intervals. I used recdelay as a template. I did get something working but then wanted to apply it to RAW video recording. So I'm looking for a way to dynamically select the correct function to call, depending on whether raw_rec or mlv_rec or neither is loaded. Currently I've just hot wired the 2 functions in lua_movie.c to call raw_start_stop(0,0) unconditionally, e.g.

static int luaCB_movie_start(lua_State* L)
{
    if (shooting_type != 3 && shooting_mode != SHOOTMODE_MOVIE)
    {
        return luaL_error(L, "Not in movie mode");
    }
    else if (RECORDING)
    {
        return luaL_error(L, "Already recording");
    }
    else
    {
    raw_start_stop(0,0);
        //movie_start();
    }
    return 0;
}


Is there a way to determine which modules are loaded when the lua module is loaded? If someone can point me towards an area of the code that does this sort of thing, I'll try to make a more reliable patch to these functions.

Magic Lantern and now Lua are fantastic tools. I've used it for HDR and astro imaging with my 500D for over a year and really find it allows me to do things I otherwise couldn't possible do.

Thanks for the help,

Mike Hayford

PS: here's an example time lapse of Jupiter that I made from data acquired by the time lapse video script.
https://goo.gl/photos/2TzkUxBGMEisTjVH9 (https://goo.gl/photos/2TzkUxBGMEisTjVH9)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 20, 2016, 12:12:52 AM
Here's a code snippet that may help you, from this script (https://bitbucket.org/hudson/magic-lantern/src/raw_benchmark/scripts/extra/rawbench.lua):


    if menu.get("Movie", "RAW video") ~= 1 then
       print("Please enable RAW video recording (raw_rec).")
       return
    end


menu.get returns 0 or 1 for boolean menu items (on/off), or nil if the menu was not found (in other words, the module was not loaded).

BTW, movie.start() applies to RAW/MLV as well, with no other changes needed (the same script I've linked above uses this feature).
Title: Re: Lua Scripting (lua.mo)
Post by: lumenmikie on April 20, 2016, 05:52:20 PM
Thanks for the clue.
Mike
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 20, 2016, 11:40:47 PM
Just merged lua_fix. What's interesting:

- strict.lua (https://bitbucket.org/hudson/magic-lantern/src/tip/scripts/lib/strict.lua) (this may break your scripts, but should be easy to fix)
- api_test.lua: this is intended to test the entire functionality; feel free to add tests for any API that is not yet covered, or for new APIs
- example scripts now working (tested on 5D3)
- exposure setters now working (with pretty harsh tests passing in api_test.lua); max roundoff error is 1/8 EV for integer raw requests, and 1.5/8 EV for arbitrary requests
- focus backend: fixed a crash when Step Delay was disabled (fix also applies to core functionality, e.g. follow focus, raw focus)
- stdio routines (io.write, io.stderr:write, placeholder for implementing io.read)
- file I/O API more or less functional (append, seek, buffering, delete)
- logger: module that prints to console and also saves to a log file (dmilligan)
- a handy macro for integer reversible scaling: RSCALE(RSCALE(x,num,den),den,num) = x for any num > den > 0 (except overflows); tested for 1 <= den <= num < 1000, -1000 < x < 1000
- running "make" in the modules/lua directory will also check all the scripts for syntax errors
- complete list at https://bitbucket.org/hudson/magic-lantern/pull-requests/683/lua-scripting-lots-of-fixes-plus-api/commits

Sorry for the rushed merge from 3 months ago (when I actually got time to try it, I found it unusable*), but it wasn't something I could fix quickly...)


*) the best example is this changeset (https://bitbucket.org/hudson/magic-lantern/commits/c0acfcdb94226e1aa9c379f3a7ba598f0f90e8ec?at=unified), which shows the ISO setter was never tested (I'm not talking about model-specific differences; it simply did not work from the beginning). To me, that's really basic functionality that should be tested before merging pull requests...


Anyway, I'm sure there are still rough edges, but at least the basics should be working now.
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on April 21, 2016, 02:44:30 AM
7D with Canon EF 50/1.8 II, EF 100/2.8 Macro USM, EF 100/2.8 L Macro USM.
Focus stacking:

Num. pics in front > 0
->"Focus: Unknown error (2400)"
No pics taken. Abort.

Num. pics in front = 0
Num. pics behind > 1
-> Takes one pic. "Focus: Unknown error (2400)"

Not happening mounting Sigma 18-125. Not happening with 650D.
7D with EF-S 55-250/4-5.6 IS II gives "Focus: Unkown error (402400)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 21, 2016, 08:09:57 AM
Fixed.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 21, 2016, 07:05:51 PM
a1ex

Sorry to bother you so soon, but I've just tried the latest nightly to see if how the new Lua modules works.

Here is the script I used, which worked fine before on my 5D3. The only change I made below is to account for the focus_distance change you made.

--[[
Still photography toggler script
Version 1.0 (should work on all ML enabled cameras with the Lua module)
Garry George March 2016
http://photography.grayheron.net/
Workflow toggler script to help with focus and exposure setting.
Toggle through your workflow using the selected option ie a button or the top of the main dial or toggle switch.
For focus feedback yellow means move more towards the infinity end, Red means move more towards macro end,
Green means at the sweet spot. If Green not seen, move to just being in the yellow from being in the Red.
--]]
factor = 0.2
b1 = lens.dof_far
fp = lens.focus_distance
c1 = b1 - (b1 - fp)*factor
inf = 1000000
started = false
current_tv = 0
play = 0
toggler = 0
-- Change toggler value to your choice of button, eg KEY.RATE, KEY.UP, KEY.INFO or KEY.PLAY.
-- See http://davidmilligan.github.io/ml-lua/modules/constants.html for key constants
-- Default is KEY.RATE for non-EOSM cameras. EOSM self selects upper toggle on main dial as the EOSM doesn't have many buttons!
if camera.model_short == "EOSM" then toggler = KEY.UP else toggler = KEY.RATE end

event.keypress = function(key)
if keymenu.submenu["Turn On/Off"].value == "Off" then
started = false
return true
elseif key == toggler 
then
play = play + 1
if play == 7 then play = 0 end
return false
elseif key == KEY.FULLSHUTTER and play ~= 6
then
b1 = lens.dof_far -- in mm
fp = lens.focus_distance -- in mm
c1 = b1 - (b1 - fp)*factor
started = true
return true
elseif key == KEY.HALFSHUTTER and play == 6
then
b1 = lens.dof_far -- in mm
fp = lens.focus_distance -- in mm
c1 = b1 - (b1 - fp)*factor
started = true
return true
end
end

lv.info
{
    name = "Info 1",
    value = "",
    priority = 100,
    update = function(this)
    this.value = ""
    if keymenu.submenu["Turn On/Off"].value == "On" and started and fp ~= 0
    then
this.foreground = COLOR.BLACK
a2 = lens.dof_near
if a2 > b1 then
this.background = COLOR.RED
elseif a2 < c1 then
this.background = COLOR.YELLOW
else
this.background = COLOR.GREEN1
end
if lens.dof_far >= inf then
this.value = "INF"
else
this.value = "   "
end
else
this.value = ""
end
end
}

lv.info
{
    name = "Info 2",
    priority = 100,
    value = "",
    update = function(this)
    if keymenu.submenu["Turn On/Off"].value == "On" then
    i = menu.set("Shoot","Advanced Bracket",0)
i = menu.set("Expo","Auto ETTR",0)
i = menu.set("Expo","Dual ISO",0)
i = menu.set("Shoot","Silent Picture",0)
this.foreground = COLOR.YELLOW
this.background = COLOR.BLUE
if play == 0 then
current_tv = camera.shutter.ms
this.value = " Off"
elseif play == 1 then
this.value = " BE "
camera.shutter.ms = 1
i = menu.set("Shoot","Advanced Bracket",0)
elseif play == 2 then
this.value = " Off"
camera.shutter.ms = current_tv
elseif play == 3 then
this.value = "ETTR"
i = menu.set("Expo","Auto ETTR",1)
i = menu.set("Auto ETTR","Trigger mode",3)
elseif play == 4 then
this.value = "Auto"
i = menu.set("Shoot","Advanced Bracket",1)
elseif play == 5 then
this.value = "Dual"
i = menu.set("Expo","Dual ISO",1)
elseif play == 6 then
this.value = "FRSP"
i = menu.set("Shoot","Silent Picture",1)
else
this.value = ""
end
end
end
}

keymenu = menu.new
{
parent = "Shoot",
name = "Landscape Helper",
help = "Toggle through workflow",
help2 = "Grab exposure or take picture as required",
submenu =
{
{
name = "Turn On/Off",
help = "Switches the script on/off",
help2 = "Provides access to ML functionality",
choices = {"On","Off"},
},
{
name = "Bracket to bracket overlap",
help = "Amount to overlap each bracket",
help2 = "% of FP-2-DoF(far) distance",
choices = {"20","10", "5"},
update = function(this)
factor = tonumber(keymenu.submenu["Bracket to bracket overlap"].value)/100
end,
}
}
}


The first issue I'm having is that the script does appear to load, ie it doesn't register on the console screen, as does the ony other script I have in the scripts folder, ie CALC.lua.

The script above should just load into the Shoot menu.

Do I need to do anything differently now?

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 21, 2016, 07:21:42 PM
What's the file name of the script? Can you see it in the file manager module?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 21, 2016, 07:32:48 PM
File is TOGGLER.LUA and it shows up in the ML File Manager.

Strange.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 21, 2016, 07:38:18 PM
The script loads fine here, and appears in the Shoot menu.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 21, 2016, 07:41:31 PM
Well that's good news. but a mystery for me. ???
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 21, 2016, 08:14:45 PM
OK it looks like the new lua module is going to require me to rewrite my script.

I get lots of errors regarding undeclared variables, that I never got before :-(

I try and get my toggler script running before moving on to other projects.

BTW will some kind person me tweaking the lua help pages to flag up the changes in functionality and syntax etc?

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on April 21, 2016, 08:48:12 PM
Quote from: garry23 on April 21, 2016, 08:14:45 PM
OK it looks like the new lua module is going to require me to rewrite my script.

I get lots of errors regarding undeclared variables, that I never got before :-(
This is just the strict.lua (https://bitbucket.org/hudson/magic-lantern/src/tip/scripts/lib/strict.lua) stuff (first thing a1ex mentions in this post (http://www.magiclantern.fm/forum/index.php?topic=14828.msg166022#msg166022)). It's a little checker script that requires that you declare global variables in the global scope before using them (It's actually nothing specific to ML or the ML API). This is good b/c you might not have realized that a variable you were only using locally was getting promoted to the global scope, which can have unintended consequences if you reuse the same variable names. For the most part all you need to do is add a local declaration if it's intended to be a local variable, or initialize it to something at the beginning of your script if its intended to be a global variable.

The only one I see in your script is the variable "i" in the "Info 2" update function. It looks like you don't even use "i", you only set it (a lot of compilers now-a-days actually issue warnings for this sort of thing), so you can just get rid of it altogether (just get rid of all the "i = "). Or you can just declare i as a local variable before you start using it (however, I would recommend the former for "correctness").
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 21, 2016, 09:09:13 PM
@dmilligan

Many, many thanks. I really appreciate your help.

I'll review the script and get it running :-)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 23, 2016, 11:39:25 AM
@A1ex/@dmilligan/@all

First of all, thanks to those of you that have supported the latest Lua nightly update.

For those of you that are still photographers you may be interested in the attached script, which is a fully auto landscape focus bracketing script.

I have tried it on my 5D3 and I'm pleased with it. YOU MUST HAVE THE LATEST NIGHTLY FROM AT LEAST 22 APRIL 2016.

Please read the text at the start of the script :-)

As usual I welcome feedback (on the coding or enhancements) to make the script better...and my programming skills ;-)

BTW I use Helicon Focus to merge the focus brackets directly from within LR, but you can use any post processing software you like.

Cheers

Garry

--[[
Simple landscape auto bracketing script
This version has no error detection so the user must be aware of certain things:
* Check the correct DoF diffraction options are set in ML, eg diffraction aware is on
* Must use a lens that reports focus distance and DoF can be calculated
* Lens must be in AF mode
* Switch stabalisation off as you will not be hand holding ;-)
* Must be in LV mode
* Assumes lens is focused at nearest point to start, ie script moves to infinity
* Script takes last bracket with focus point at infinity
--]]

function albs()
-- Get DoF info, delay as requested & take first bracket
menu.close()
-- Declare a few variables for the script
local a1 = 0
local b1 = 0
local a2 = 0
local b2 = 0
local fp = 0
local inf = 100000
local delay = 0
local base_tv = 0
local delay = tonumber(keymenu.submenu["Delay"].value)*1000
msleep(delay)
a2 = lens.dof_near
b2 = lens.dof_far
-- Add start dark frame bookend if requested
if keymenu.submenu["Bookends?"].value == "yes"
then
base_tv = camera.shutter.apex
camera.shutter.apex = 100
camera.shoot(64, false)
camera.shutter.apex = base_tv
end
camera.shoot(64, false)
-- take remaining brackets to macro end
repeat
a1=a2
b1=b2
repeat
lens.focus(-1,1)
b2 = lens.dof_far
a2 = lens.dof_near
fp = lens.focus_distance
until a2 > b1 or fp >= inf
lens.focus(1,1)
msleep(50)
camera.shoot(64,false)
until fp >= inf
-- Adds end dark frame bookend if requested
if keymenu.submenu["Bookends?"].value == "yes"
then
base_tv = camera.shutter.apex
camera.shutter.apex = 100
camera.shoot(64, false)
camera.shutter.apex = base_tv
end
end

keymenu = menu.new
{
    parent = "Shoot",
    name = "Auto Focus Bracketing",
    help = "Remember: LV, DoF & AF on + focus at nearest point",
depends_on = DEPENDS_ON.LIVEVIEW,
    submenu =
{
{
name = "Run Script",
help = "Does what it says after pressing SET",
select = function(this) task.create(albs) end,
},
{
name = "Delay",
help = "Delays script start by stated number of secs",
choices = {"2","5","0"},
},
{
name = "Bookends?",
help = "Places a dark frame at start and end of focus bracket set",
choices = {"no","yes"},
}
}
}
Title: Could be a Lua Menu bug?
Post by: garry23 on April 30, 2016, 10:15:50 AM
David/A1ex

Just noted some Lua 'strangeness' that I can't understand, but as it occurs in several sub menu calls in my script, I think it could be a bug?

Here is the part of the script that is 'playing up'

{
name = "Shadow Ev",
help = "As measured by shadow Ev from ML RAW (Ev) Spotmeter",
help2 = "only  integer value in (Ev)stops from 100% highlights", -- simply the ML spotmeter reading
min = -4,
           max = -20,
value = -5,
},


In the above, and another submenu that uses negatives, when I toggle through the values the max that is allowed is always the max I request less 2. In other words in the above I can only access between -4 and -18.

This does not occur if min and max are positive.

I've just noticed this as I've always used positive min and max until now.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on April 30, 2016, 12:11:02 PM
Does it work correctly if you make max larger than min?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 30, 2016, 01:16:55 PM
 :) Yes!

Thank you.

Is it still a bug or now a feature  ;)
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on April 30, 2016, 08:10:27 PM
I'd say it's probably a bug that it doesn't generate an error. Having max < min should probably technically be invalid.
Title: Re: Lua Scripting (lua.mo)
Post by: Licaon_Kter on May 08, 2016, 11:48:35 PM
dm-spy-experiments branch says it can't load LUA on EOS-M:
Will NOT load on:
    EOSM (console_clear)
Title: Re: Lua Scripting (lua.mo)
Post by: BBA on June 10, 2016, 01:01:32 PM
I have been trying to write some lua scripts. I worked on lens focusing to test "best focus infinity setting" and "focus stacking" scripts (cf. garry23's work in Lua).
I hope I will be able to share but first, I need advices of more experimented people.

As newb, I want to thank you very much for the hard but rewarding work that has been done and fully support the ML team way of thinking about this project http://www.magiclantern.fm/forum/index.php?topic=13335.0
Please forgive my english; always think I don't want to harm anyone!

1) the event message "software limit reached" appears on the Lv screen when moving lens, at some point, in both directions,
As said in this forum : to command the stepping motor for fast, accurate lens positioning can be a bit tricky/impossible b/c things change from one experiment to the other (there is always the temperature effect, but not alone; it can become very slow to get the infos/feedback from the lens).
Could someone tell me more about how this event message is generated and if it can be thought of as more "accurate" ?
Would it be difficult to be able to handle it in Lua scripting ?

2) are there "dummy libraries" to work with on a Lua sdk ? Not for timings nor multithreading questions, but to avoid syntax errors detected when script is running and to debug as many cases as possible (tree of possibilities).


Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 11, 2016, 08:07:09 AM
@BBA

I experienced the soft limit 'problem' and worked around it in my scripts. The problem occurs if you drive the lens to the lens soft limits, ie at infinity or 'macro' end.

The way I worked around this is that I drive the lens, in my script towards the infinity end, and stop when the lens.focus_distance has reached a defined infinity, ie a large number, which happens before the infinity soft limit is reached.

Another way to achieve this would be to stop when lens.dof_far is reached at the infinity end or lens.dof_near at the macro end.

If you look at my landscape stacking code photography.grayheron.net (http://photography.grayheron.net) (latest version is in the top right link on the home page), you will see that is how I handle the soft limit reached issue.

As to debugging and error detection, I'm afraid my experience is limited. My development approach is slow, as 'all' I can do is code things up, transfer to my 5D3 and read any errors that are reported and correct them.

As you will see in my code, I do try and account for user errors, but as I'm developing scripts for myself and sharing on that basis, I'm fairly relaxed regarding 'error detection'. Having said this, I do try and place comments in my scripts to help others.

I hope the above is of some help to you.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 11, 2016, 08:24:51 AM
@BBA

Another thing I thought about, and would love to see, is a Lua error module, ie some way we can detect an 'error event' and take action, eg the soft limit error.

But for this we are in the hands of others who know how to do such things: 'all' I can do is basic Lua scripting, ie not C-based ML coding.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: BBA on June 11, 2016, 01:29:08 PM
@garry23

Thank you for your messages !

QuoteAnother thing I thought about, and would love to see, is a Lua error module, ie some way we can detect an 'error event' and take action, eg the soft limit error.
I would love too. You have understood what I meant in my first question. Forgive my "clumsy" english... I think too it would be useful to be able to "trap" this error message in Lua. I "cross my fingers" and hope others will be interested too. Maybe I can help...but I have to learn too !

I have followed your work in Lua as I wasn't member of the community. I think you have made a lot of progress. I wondered why you did things like that: the test with a big number,... So I tried to study from scratch how things work with stepping motor and lens focusing. I will share what I did. I am not so experienced in photography, so I have to be careful because things can change a lot with other body/lens systems (I have a 5DmIII; I tested with EF 35mm f/2 IS II and EF 24mm f/1.4 L which both report distance). Imho, the algorithm is quite effective : not too many shots, rather well spaced. As you probably think too, the "infinity end" and the "macro end" can be improved with some work. That's why I asked for the error messages.
I would like to do a timelapse of the milky way in July. I will have to focus on "infinity". So, I have worked on scripts to help with that and I will share. Others have already done that in C. dmilligan and you have helped me a lot : thank you for that too !

QuoteAs to debugging and error detection, I'm afraid my experience is limited. My development approach is slow, as 'all' I can do is code things up, transfer to my 5D3 and read any errors that are reported and correct them.
As you will see in my code, I do try and account for user errors, but as I'm developing scripts for myself and sharing on that basis, I'm fairly relaxed regarding 'error detection'. Having said this, I do try and place comments in my scripts to help others.
Like you; the "cards" door of the 5D3 is rather "durable".
I have found the "Zerobrane" lua "sdk" on the internet (not Eclipse; I have to learn more about it) (no kidding, Zerobrane means zero brained - then, it's good for me to start learning...) . It can help to test algorithms and logic snippets more easily. I think it is possible to redefine the Lua functions (those that are used in the script) in "dummy" modules. For exemple, you can "emulate" the step by step focus motor with a file (the results of a complete scan of the lens from macro end to infinity end with storage of the values of "fp"...) . I wonder if others have already made more powerful things.

I wonder : the "editor.lua" can be used to make simple typo corrections while testing on camera.
By the way, I think it is possible to fix it by analogy:
Quote-- fixme: neither global width nor sb.w appear to be used anywhere
    -- if width == nil then sb.w = 2 end
I propose to replace the last line with
Quoteif w == nil then sb.width = 2 end

Have you already tried "big jumps" with  "step_size" of more than one step, like lens.focus(1,100) for instance ?
Quote
focus (num_steps[, step_size=2[, wait=true[, extra_delay=0]]])
I'll try as soon as possible.

A+
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 12, 2016, 03:48:13 PM
@BBA

The infinity 'large number' approach is already in ML's C coding as 1000 * 1000 (mm): I just adopted that protocol.

As to changing/editing on camera: I personally wouldn't bother - too fiddly.

Regarding moving the lens, I did look into that, but on my 5D3, the lens zips along even if I move one step at a time. However, on my 50D the same script runs at a snail's pace.

So I'm going to look at a more efficient algorithm to home in one the next focus point, eg jump past the point and quickly collapse to the 'optimum' position.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 12, 2016, 06:51:01 PM
@BBA

Forgot to say, thanks for pointing me towards Zerobrane lua. I'm hopeful this will help me with my debugging  :)

I wonder if it can be enhanced with some ML 'Lua stuff'?

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on June 12, 2016, 06:59:30 PM
lens.focus returns true or false for whether or not the call sucedded, it's just not documented.

If you have a touchscreen camera, the version of the editor in the lua_touch branch is quite usable (on screen touch keyboard). Without the touch keyboard, I agree that trying to use the editor is a bit too tedious to be practical.

You can use luac or an editor that supports syntax checking (like LDT, mentioned in the OP), make sure you use Lua 5.3 version, for a very basic check on the computer. A stub version of the ML Lua API for the computer would be really nice, but very time consuming to make, so no such thing exists yet, but it's on the long term wish/todo list. HINT: modifying ldoc, the tool that generates the API docs, to output a stubbed version of the API in Lua code, might be one potential avenue.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 12, 2016, 07:28:13 PM
David

I really want to help push the 'Lua environment' along, ie more tools to help debug code etc, but I fear my skills let me down. For instance I wouldn't have a clue how to 'modify Idoc'.

But I am keen to learn, but I will need help/pointers.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on June 12, 2016, 10:13:01 PM
https://github.com/stevedonovan/LDoc

It's a program written in Lua that converts source code comments in C or Lua to the HTML pages you see here: http://davidmilligan.github.io/ml-lua/index.html

You can reuse it's parsing capabilities, you just need to change the output code and templates that generates HTML to create some Lua source code instead. I've not looked at ldoc source so I have no idea how much work this would be.

You would probably want to start with simply manually writing some stub functions. A stub is an implementation of an API function that typically simply doesn't do anything, except perhaps validate the input to the function, and return some fake/synthetic/random data if the function is supposed to return a value (this will quickly become monotonous doing it for the entire API, which is why you eventually want to automate it with ldoc or whatever).

The stubs will give you the ability to "run" your script directly on the computer and do some basic validation, the quality of this validation depends on the complexity of your stub layer. The more work and complexity you put in your stubs the closer it will be to actually running your script on the camera and the more stuff about your script you can test.
Title: Re: Lua Scripting (lua.mo)
Post by: BBA on June 14, 2016, 03:11:48 PM
To more experienced people.

I want to take a timelapse of the milky way in Switzerland (Alps, > 3000 meters) in a not so light pollution free area (according to light pollution map of darksitefinder), new moon. I would like to be able to best focus on stars. In the field, I'll focus manually and take test shots to be sure (till now, I've never done that).
I wonder: with such star pictures in low light with some (I don't know how much) light/other noise, am I realistic of thinking of a Lua script that could help compare the blurriness of a few pictures (lets say x10 screen shots) taken one step (lens stepper motor) away from each other and could help me decide which one is the best focused one (Living dream ?)
Any answer is much appreciated!
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on June 14, 2016, 03:36:49 PM
There is currently no Lua API for image analysis. It's one area that's probably impractical for Lua. Image processing is typically very demanding in terms of both memory and processor due to the huge sizes of images, and Lua is already a heavy memory hog.

The best way I've found to do focusing for AP (and the method I always use) is to use LiveView 10x zoom with FPS override. FPS override of about 2-4 fps ("low-light" mode) is usually enough to clearly see bright stars, and focus "live" manually. This is significantly faster and easier than the test shot trial and error method. Its also a method that will work with manual optics that lack autofocus, such as my telescope.
Title: Re: Lua Scripting (lua.mo)
Post by: Audionut on June 15, 2016, 02:41:16 AM
Some display gain helps too if the stars are fainter.
Title: Re: Lua Scripting (lua.mo)
Post by: BBA on June 20, 2016, 10:12:38 AM
I thank you very much for your messages.

I am very grateful to this community because you, high level people, with all the work you have, having to work in such uncertain environment (it's Canon software), help the members, even the low level ones.

Respect (in french) !.

It makes me want to help in one way or another, but my technical background tells me I first have to learn, learn and learn.
Title: Re: Lua Scripting (lua.mo)
Post by: dhepguler on July 15, 2016, 07:29:16 PM
It is nice to have aLUA scripting module in ML.. I am not familiar with LUA but can program in C... I want to know if I can write a script to keep the mirror locked up as long as intervalometer takes a definite number of shots... It would be great for astrophotography with a telescope... as you know, MLU activates but never keeps locked up with intervalomater... I want it to be locked up to dampen vibrations...  Many thanks in advance for replies...

Dincer
http://borsaci06.com
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on July 16, 2016, 03:03:56 AM
You don't even need a script. Powersave in LiveView -> Always ;)
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 18, 2016, 06:06:47 AM
How about something to keep the LCD active indefinitely? A user posted on the EOS-M topic that he wants to set up a wildlife camera trap but the camera won't fire with Audio RemoteShot when the LCD turns off. Maximum setting on the Canon menu is 30 minutes for the LCD to remain active.

http://www.magiclantern.fm/forum/index.php?topic=9741.msg173367#msg173367

Is there something that can be scripted to keep the LCD from going to sleep? Any hints where to start?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on October 18, 2016, 09:12:15 AM
Quote from: dmilligan on July 16, 2016, 03:03:56 AM
Powersave in LiveView -> Always ;)

Not sure what this has to do with MLU, and there's no "Always" setting at the time of writing.

I guess @dhepguler is looking for full-res silent pictures. Some cameras also keep the mirror locked if you take pictures in LiveView (I guess you were referring to that), but the shutter is still actuated.

Quote from: dfort on October 18, 2016, 06:06:47 AM
How about something to keep the LCD active indefinitely?

powersave_prohibit() or powersave_prolong(), but these aren't exposed to Lua or menus (yet). They are currently used for raw recording, for full-res silent pics, and for various test routines (e.g. card benchmarks) that may take longer than default auto power off setting.

Faking half-shutter from a script every now and then will also reset the powersave timer.
Title: Re: Lua Scripting (lua.mo)
Post by: DeafEyeJedi on October 18, 2016, 09:30:03 AM
Quote from: a1ex on October 18, 2016, 09:12:15 AM
Faking half-shutter from a script every now and then will also reset the powersave timer.

Excellent suggestion!
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 18, 2016, 06:39:26 PM
I don't see anything in the ML Lua API (http://davidmilligan.github.io/ml-lua/) that could be used to trigger a half-shutter. The only thing related to half-shutter that I could find is a constant--DEPENDS_ON (Dependency for a menu item) Fields: CFN_AF_HALFSHUTTER: which I have no idea what it means or if this is even relevant to faking a half-shutter.

Any hints on how to script this?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on October 18, 2016, 07:14:47 PM
In the lua_fix branch, api_test.lua:


key.press(KEY.HALFSHUTTER)


(I know, I should merge it, but since I'm not really using it, it's very easy to forget...)
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 18, 2016, 07:31:29 PM
Thanks, I'll get started with this.

So if someone wants to use the module I create they will need the lua module from the lua_fix branch too, right? Anything else?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on October 18, 2016, 08:24:33 PM
Well, the fix for half-shutter pressing is in ML core, so you would need a custom build.

Anyway, if you help me with some testing feedback and some reminders of the current issues (in particular, those from garry23), I hope to be able to look at it this weekend (or, at least, I'll increase its priority).
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 18, 2016, 08:37:58 PM
I'll give it a try.

You know what my other issues are  :D
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on October 18, 2016, 09:31:16 PM
Although I'm busy with work at moment, I'll throw in as much support as I can to get the Lua module to the next release point. 

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 19, 2016, 08:22:15 AM
@a1ex I'm getting a feeling we've been here before.

https://bitbucket.org/hudson/magic-lantern/pull-requests/748/focus-backend-updates-precise-focus/diff

Should I be testing with the unified branch, lua_fix or focus? I assume that the half-shutter press script needs at least the commits that are in lua_fix but there are a lot of tweaks in the focus branch. Maybe I need to merge the branches before testing?

For starters I'm running the api_test.lua script on both an EOSM and 700D with the lua_test branch. No surprises on the 700D, here's the log (https://gist.github.com/digiola/680fc603b8462544a530c5033746a40e). The EOSM is causing some issues. The test hangs on the lv test so that had to go (déjà vu) but the lens test is taking a very long time, probably because we haven't figured out how to focus the EOSM yet. It is taking so long that I had to hook up the AC adapter and will try running it overnight to try and get through the lens focus test. I ran a test without the lens focus test and it looks good. Here's the log (https://gist.github.com/digiola/2a32b28b97cbf2c50b5f63834fed3166). Well at least half-shutter is working!
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 19, 2016, 02:00:08 PM
Figured out what was taking so long for the lens focus test to complete on the EOSM. It was because the camera was set to autofocus mode--more déjà vu. It got through the focus test but crashed on the take pics test. Here's that log (https://gist.github.com/digiola/d6a3f7bd2fef048e745da67fa9207b93). [EDIT--the camera needs to be set to autofocus mode but with continuous autofocus disabled to complete the test successfully.]

Set the EOSM on automatic focus and did another run. This time the console showed a message to put the lens on auto focus mode or remove the lens to skip test. Not wanting to wait hours for what will certainly end in a crash I twisted the lens on and off (like the shutter bug "fix") and the test completed successfully. For the record here is the entire log (https://gist.github.com/digiola/cb32adc08bacc2e13e606886f1ea2b51) but the pertinent section is:

Testing lens focus functionality...
Please enable autofocus.
(or, remove the lens from the camera to skip this test)
Focus test skipped.


Of course all of this is expected behavior until a way to control the lens on the EOSM is figured out.

What would be an enhancement to api_test.lua is to determine what camera is being tested and skip test_lv if it is an EOSM.
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 20, 2016, 01:44:44 AM
Picking up where we left off, I wrote a patch for api_test.lua that skips test_lv when run on an EOSM. I submitted a pull request on the lua_fix branch (https://bitbucket.org/hudson/magic-lantern/pull-requests/759/skips-test_lv-on-eosm/diff). Hope that's the right procedure.

I did manage to get a successful api_test.lua run on the EOSM with the camera in "Focus Mode AF" mode and "Continuous AF Disable" set on the Canon menu. Here is the log to that test (https://gist.github.com/digiola/1d30908b296a1b22aa0c330dcdb962c6).

It takes a long time for the EOSM to complete the test and it will crash if the camera is not set to "Continuous shooting" on the Canon menu.

(https://c7.staticflickr.com/6/5822/29804890974_cea967a4a2_z.jpg)

It looks like the main issues that I've found so far on the lua module have to do with focus. garry23 pointed this out:

QuoteOne of the issues was that moving the lens had to be managed and I did it this way, my a loop delay:

function check_lens_ready()
   if scriptmenu.submenu["Focus bracketing?"].value ~= "no" then -- hang around until lens is ready to be moved
      repeat
      msleep(200)
      until lens.focus(0,1,false)
   end
end

That is a zero movement move!

There was also a recent discussion in the Programmatic focus control and absolute/relative focus position (http://www.magiclantern.fm/forum/index.php?topic=4997.msg173575#msg173575) topic.

This pointed to the focus branch so I turned my attention to the Focus backend updates - precise focus position and other tweaks (https://bitbucket.org/hudson/magic-lantern/pull-requests/748/focus-backend-updates-precise-focus/diff) pull request. I tried to help find the missing property handler address for the EOSM a while ago but didn't quite get it. There is an issue compiling the EOSM platform and I think that the reason is because the lens data is missing prop_lv_lens.focus_pos information in the lens.h file causing a build error on that platform. The EOSM is handled differently than the other platforms so as a test I commented out the following block of code from lens.h and ran a test of the focus branch on the EOSM. Running api_test.lua completed successfully on it and created this log (https://gist.github.com/digiola/0e0bdb00032ca9614a33aeb36cc6bbfd) which looks to me pretty much like the lua_test branch.

#elif defined(CONFIG_EOSM)
struct prop_lv_lens
{
        uint32_t                lens_rotation; //
        uint32_t                lens_step; //
        uint32_t                off_0x08;  //
        uint32_t                off_0x0c;  //
        uint32_t                off_0x10;  //
        uint32_t                off_0x14;  //
        uint32_t                off_0x18;  //
        uint32_t                off_0x1c;  //
        uint32_t                off_0x20;  //
        uint32_t                off_0x24;  //
        uint32_t                off_0x28;  // L10  - names not accurate
        uint16_t                off_0x30;  //     
        uint16_t                focal_len; //
        uint16_t                focus_dist; // One FD
        uint16_t                focus_dist2;//       
        uint16_t                off_0x38;  //
        uint32_t                off_0x3c;  //
        uint8_t                 off_0x3D;  //
       
} __attribute__((packed));

SIZE_CHECK_STRUCT( prop_lv_lens, 59 );


There was another issue compiling the focus branch--the dual_iso module failed to build on all the platforms. The error seems to be this:

error:

cr2hdr.c:2574:21: error: function definition is not allowed here
                    {
                    ^


As if all this wasn't enough to chew on for a while I started thinking if the EOSM lens issue has to do with the camera or the EF-M lens so I put on the EF-EOS M adapter and an EF-S 17-55mm 2.8 lens on the camera and re-ran the tests. This time it didn't take nearly as long as with the EF-M lens and I could hear the focus mechanism churning during the tests. The logs show more activity on the EF-S lens than on the EF-M lens. Here's the log for the hacked focus branch (https://gist.github.com/digiola/0a3c3fbeb6ed5cdd4d38ddde72cf64af) and here's the log from the lua_fix branch (https://gist.github.com/digiola/c5cce10e18fb7be00cd32ef287055c49). If I'm reading it right it appears that the lua_fix branch test may be communicating with the EF-S lens properly. Of course this brings up the question--why isn't it working with the EF-M lens?
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on October 20, 2016, 02:34:34 AM
The dual ISO issue is because cr2hdr won't compile, probably because you are using clang rather than gcc (clang doesn't support anonymous functions, which is the error you're seeing).
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 20, 2016, 03:16:11 AM
Quote from: dmilligan on October 20, 2016, 02:34:34 AM
...probably because you are using clang rather than gcc...

You're right again. I made a new copy of the repository because I couldn't figure out how to bring in the new branches and forgot to copy over my Makefile.user. Yeah, I know, I should learn this stuff if I want to play with the big boys.
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 20, 2016, 06:32:36 AM
A few days ago a newcomer to the forum had an interesting problem. He wanted to use an EOSM as a wildlife trap camera using Audio RemoteShot to fire the camera. Problem was that this camera only works while the live view is active and the longest setting in the Canon Power saving menu is 30 min. A simple solution would be to keep the live view from going to sleep. This seemed like an ideal task for a lua script.

Quote from: a1ex on October 18, 2016, 07:14:47 PM
In the lua_fix branch, api_test.lua:


key.press(KEY.HALFSHUTTER)


(I know, I should merge it, but since I'm not really using it, it's very easy to forget...)

So at the risk of posting possibly the worst example of a lua script ever, here is what I came up with:

-- LV Alive
-- Don't let Live View go to sleep

while true do
    msleep(10000)
    key.press(KEY.HALFSHUTTER)
    key.press(KEY.UNPRESS_HALFSHUTTER)
end


As a1ex mentioned this only runs on the lua_fix branch. For the test I set the LCD auto off to 15 sec. and the script to trigger a half-shutter press and unpress (very important) every 10 sec. I'm sure it can be greatly improved but hey, it works.

At first I struggled with the menu, the examples wouldn't work for me. I kept stripping it down until I got to the bare essentials to appear in the Scripts menu. I'm not proud of the infinite loop but this is my first lua script so it is bound to have some rough edges.

Of course having a half-shutter press every 10 seconds is annoying when setting up the camera but I'll change that to every 20 minutes and instruct the user to set LCD auto off to 30 min. That should keep the LCD active as long as the battery has juice. Any suggestions?
Title: Re: Lua Scripting (lua.mo)
Post by: DeafEyeJedi on October 20, 2016, 09:33:23 AM
Wonderful scripting even if it goes through an infinite loop -- to me I find this another giant step towards a small little EOSM and yet it feels so magnesium. Very exciting news!

The best hasn't even come yet and that's just scary good!

I've always wondered if we can trick the EOSM thinking the LiveView is active and keep the LCD display in dim or sleep mode similar to how the other DSLR's running ML can do via through advance settings -- wouldn't this help prolong the battery's juice especially for Audio RemoteShot type of work?
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on October 20, 2016, 03:31:38 PM
Quote from: DeafEyeJedi on October 20, 2016, 09:33:23 AM
I've always wondered if we can trick the EOSM thinking the LiveView is active and keep the LCD display in dim or sleep mode similar to how the other DSLR's running ML can do via through advance settings -- wouldn't this help prolong the battery's juice especially for Audio RemoteShot type of work?

Yes, the best solution would be to have Audio RemoteShot trigger the EOSM even while the LCD off just like it can on the DSLR's. That would require taking a deep dive into the ML code. My hypothesis is that we'll run into a hardware limitation because when the LCD turns off it also shuts off the microphone input. Of course elaborating on this would take us off the lua topic.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on October 20, 2016, 04:48:10 PM
Right - playing with the functions called by mlv_snd might help. The audio side shouldn't depend on the display operation, but most likely, Canon's powersaving turns off both of them.

Another workaround would be to let audio remote shot work on top of Canon menu. That would reduce the power consumption a lot.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on October 30, 2016, 09:55:03 PM
I've abandoned using LDT as an editor for Lua scripts. It has a lot of shortcoming and annoyances and appears to not be very well supported anymore. I started using http://code.visualstudio.com/ with the Lua extensions and it's a lot better (also cross platform and open source).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on October 30, 2016, 10:20:00 PM
David

Thanks for the pointer: just downloaded visualstudio and will report any 'strangeness'.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: warnotte on December 02, 2016, 03:05:09 PM
Damn, that looks a pretty cool stuff.

One question (perhaps already asked, I'm sorry if it's the case) :

So I can code my LUA file, then put it directly on the card without have to compile something and the LUA module will interpret it ? (I shorten the description a little bit).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 02, 2016, 04:01:26 PM
@warrnotte

Yes. Just code lua in a text file and ensure file extension is .lua  :)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: warnotte on December 02, 2016, 04:18:29 PM
Perfect, I'll have to try this weekend or as soon as possible :)

Thanks Garry.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 02, 2016, 04:29:58 PM
...and of course you need ML loaded  ;)
Title: Re: Lua Scripting (lua.mo)
Post by: eraizgn on December 03, 2016, 09:30:05 AM
what is exactly the Lua doing with ML? I didnt get it..
just a program for scripting?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 03, 2016, 10:16:41 AM
@eraizgn

The ML Lua module is 'simply' a Lua interpreter that the ML environment provides. With Lua you can code Lua scripts  ;)
Title: Re: Lua Scripting (lua.mo)
Post by: eraizgn on December 10, 2016, 09:15:00 PM
thank you man!
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 13, 2017, 12:45:39 AM
Added builds from the lua_fix branch to https://builds.magiclantern.fm/experiments.html

The current state looks pretty good to me; if there are no obvious issues, I think it's ready to be merged into nightly.

Updated API docs here (http://builds.magiclantern.fm/jenkins/view/Experiments/job/lua_fix/ML_Lua_API_Documentation/) (though it won't be the final location).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 13, 2017, 08:20:22 AM
A1ex

Fantastic. I'll do testing/evaluation this weekend and report back.

Once again, thanks to everyone involved, for all the hard work on Lua.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 13, 2017, 08:44:17 AM
A1ex

Just noticed that 5D.123 is not there.

If it is not too much trouble, when you get a chance, could you throw in a Lua experimental build for the 5D.123 as well?

I currently use .123 as I need the F/8 focus for my 70-200 F/4L x2 ;)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 13, 2017, 08:57:11 AM
...also

As I've tried to use each update of Lua, I've looked at the Lua .c files to try and work out the changes. I say tried, as I'm not a C programmer.

I have done this as David warned me that not all Lua functions are enabled, eg some of the event.x calls.

One thing that confuses me is that I can't find event.c to look for these calls, ie to see what is implemented.

The manual doesn't say "Not Implemented Yet".

As I'm not the developer, I, of course, don't know what is developed or switched on, without looking. Which, as I say, I try to do, but event.c evades me  ;)

Any hints/help would be great, as I try and evaluate the latest Lua_fix experimental build, eg what is not yet enable but is in the manual.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 13, 2017, 09:40:49 AM
The events are defined as LUA_CBR_FUNC.

The ones that are not available are:

LUA_CBR_FUNC(pre_shoot, ctx, 500)
LUA_CBR_FUNC(post_shoot, ctx, 500)

#ifdef CONFIG_VSYNC_EVENTS
LUA_CBR_FUNC(vsync)
LUA_CBR_FUNC(display_filter)
LUA_CBR_FUNC(vsync_setparam)
#endif


The first two are not yet available from ML core. For pre_shoot, we don't know yet where to place a hook in order to do something useful from it (such as update exposure settings, or prevent the picture from being taken), so it requires reverse engineering. The post_shoot hook is a bit ill-defined, as it's a bit hard to tell when exactly a picture is finished, especially in burst mode. Currently, most ML code uses the QuickReview screen to tell whether a picture was taken; the recent Burst module looks at the file number property from Canon, which appears to work fine.

The last 3 are from LiveView vsync hook, which must be fast; otherwise it can interfere with image capture, possibly resulting in corrupted frames. Since the pink frames still appear during raw recording, it's probably best to keep those disabled, unless there's a good reason to use them.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 13, 2017, 09:53:04 AM
@A1ex

Many thanks: this info will help me as I try and do Lua experiments/exploration  :)
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 13, 2017, 11:35:07 AM
@A1ex

Before I 'waste' time, I'm guessing the experimental Lua_fix hasn't fixed lens move on the EOSM?

Just tried this simple test script and all I get in the no movement and rapid yellow blinking shutter button.


function event.keypress(k)
    if k == KEY.INFO then
        repeat
lens.focus(-1,1,false)
until lens.focus_distance >= lens.hyperfocal
    return false
    else
        return true
    end
end
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 13, 2017, 11:46:14 AM
You confirmed it's working here (http://www.magiclantern.fm/forum/index.php?topic=18083.msg177751#msg177751). There should be no difference between the two branches, regarding focus backend.

BTW, focus commands should not be sent from GUI task.

Sorry, can't help much more than that...
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 13, 2017, 12:59:23 PM
@A1ex

I'm testing things on a 5D3 and an EOSM, with Canon Lens and Sigma Lens, and with Canon adapter and non-canon adapter on the EOSM  ::)

I'm now using this test script:

function test_lens()
        repeat
           lens.focus(-1,1,false)
        until lens.focus_distance >= lens.hyperfocal
end

test_menu = menu.new
{
    parent = "Shoot",
    name = "Test Lens Move",
depends_on = DEPENDS_ON.LIVEVIEW,
    submenu =
{
{
name = "Run Script",
help = "Does what it says after pressing SET",
depends_on = DEPENDS_ON.LIVEVIEW,
select = function(this) task.create(test_lens) end,
}
    }
}


The above runs OK on the 5D3 with all AF lenses.

I doesn't seem to run on the EOSM with any AF lens. But it's flaky. For example, it did run once, but with incredibly small focus steps.

Also, and I'm sure it's my programming again, on the above script I get 0 or 1 sometimes returned on the menu, when the lens is being moved.

I've tried using lens focus this way, but still get the menu feedback (to the right of the menu).

local ok = lens.focus(-1,1,false)

I'll carry on playing in my own incompetent way ;)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 13, 2017, 03:01:52 PM
Quote from: a1ex on January 13, 2017, 11:46:14 AM
You confirmed it's working here (http://www.magiclantern.fm/forum/index.php?topic=18083.msg177751#msg177751).

In other words: does this script work on the build you have tried there, but not on the latest lua_fix?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 13, 2017, 03:44:33 PM
Sorry for not getting back: I've been trying to understand what is going on.

I've used this simple test script:

function test_lens()
    local start = lens.focus_distance -- position lens near macro end
        repeat
           lens.focus(-1,1,false)
        until lens.focus_distance >= lens.hyperfocal
        -- now go back
        repeat
           lens.focus(1,1,false)
        until lens.focus_distance <= start
end

test_menu = menu.new
{
    parent = "Shoot",
    name = "Test Lens Move",
    submenu =
{
{
name = "Run Script",
help = "Does what it says after pressing SET",
select = function(this) task.create(test_lens) end,
}
    }
}


I proved this script runs as expected on my 5D3 using the latest nightly .123 build (sic). I used a Sigma 10-20 to test the script.

I then used the script (with no other scripts running) on the experimental EOSM Lua_fix build.

The lens starts to move from its initial position towards infinity, but using very small/micro steps (I'm using the 24-105 F/4L at 24.

It doesnt stop at the hyperfocal (as with the 5D3) and keeps going until soft-limit error, ie doesn't do the return to the start, as it should.

That's it so far :(

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 13, 2017, 05:41:13 PM
The new focus stuff is not included in this branch yet. EOSM still needs some work on the focus branch too (https://bitbucket.org/hudson/magic-lantern/pull-requests/748)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 13, 2017, 05:48:28 PM
Do the focus commands work better on EOS M on that branch? You may need to hack it a bit to compile though.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 13, 2017, 05:54:57 PM
A1ex/David

Sorry, I'm 'only' fit for scripting...and only just  ;)

No C compiling...at least not yet.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 24, 2017, 04:53:35 PM
Noticed there are two APIs for taking a picture: shoot() and camera.shoot(). Obviously, they are out of sync, as I've been only updating the latter.

Additionally, there are also camera.bulb() and camera.burst().

What's the best way to fix?

- keep the two in sync by calling the same function (would still require duplicate documentation)
- remove shoot() and leave just camera.shoot()
- move all others to global namespace
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 24, 2017, 05:30:49 PM
@A1ex

I personally always use camera.shoot() and test if I need to use camera.bulb().

My gut feeling is that those writing, and publishing scripts, would defer to the guidance/views of people like yourself. Including what approach is best for you to implement.

As I said in another post, the main issues at the moment are around guessing what some Lua calls actually mean/require and what simply is not active yet, but appears in the documentation. 

As usual, just my humble views.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 25, 2017, 02:35:29 AM
Made a few updates; latest docs are here (http://builds.magiclantern.fm/jenkins/view/Experiments/job/lua_fix/ML_Lua_API_Documentation/index.html). Please review, also considering this discussion (http://www.magiclantern.fm/forum/index.php?topic=18833).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 25, 2017, 07:41:00 AM
@A1ex

Many thanks for finding the time to initiate this 'scrub down' of the Lua documentation.

The immediate help is clear to me, eg removing references to calls/function that are not yet enabled.

Also providing guidance as to use, eg in lens.focus.

Finally, how do you suggest we manage others 'adding value'. From my experience is can be confusing if many, in parallel, are trying to edit/change a document. I say this as there will be a time (soon), when others, such as myself, may wish to add helpful text/clarification to the documentation.

Once again: many thanks for kick-starting this Lua doc update.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 25, 2017, 08:10:45 AM
Quote from: garry23 on January 25, 2017, 07:41:00 AM
Finally, how do you suggest we manage others 'adding value'. From my experience is can be confusing if many, in parallel, are trying to edit/change a document.

As long as they do not touch the same sections (even if the edits are in the same file), pull requests will handle it just fine. If there are conflicts, these can be resolved manually.

These can be done from the web interface, see https://www.magiclantern.fm/forum/index.php?topic=7940.0 . It's only a matter of editing the comments.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 28, 2017, 12:21:58 AM
While troubleshooting this script (http://www.magiclantern.fm/forum/index.php?topic=4997.msg179155#msg179155), I've smelled some issues related to multitasking (which I didn't really understand how it's implemented in Lua, other than "it has semaphores, appears to work, g3gg0 merged it, so it's probably OK"), so I've added a simple test to api_test.lua.

Do not attempt to run it outside QEMU, unless you have a ROM backup and a camera I know how to reflash (550D or 60D).


function taskA()
    printf("Task A started.\n")
    local i
    for i = 1,100 do
        printf("Task A: %d\n", i)
        task.yield(math.random(10,50))
    end
end

function taskB()
    printf("Task B started.\n")
    local i
    for i = 1,100 do
        printf("Task B: %d\n", i)
        task.yield(math.random(10,50))
    end
end

function test_multitasking()
    printf("Testing multitasking...\n")

    task.create(taskA)
    task.create(taskB)
    task.yield(5000)

    printf("Multitasking tests completed.\n")
    printf("\n")
end


This gives camera lockup or reboot, in the best case. Happens on both nightly and lua_fix. It's not hard to imagine an unlucky sequence of events that may (http://www.magiclantern.fm/forum/index.php?topic=12627.msg170133#msg170133) result (http://www.magiclantern.fm/forum/index.php?topic=14847.msg144047#msg144047) in permanent camera bricking (hence the above warning).

I've got some partial success with the ThreadsTutorial (http://lua-users.org/wiki/ThreadsTutorial) page. Removed the current semaphore guards and defined the following:

#define lua_lock(L)    lua_take_sem(L, 0, 0)
#define lua_unlock(L)   lua_give_sem(L, 0)

/* create this somewhere at startup; single-script testing only */
static struct semaphore * semm = NULL;

int lua_take_sem(lua_State * L, int timeout, struct semaphore ** assoc_semaphore)
{
    take_semaphore(semm, 0);
}

int lua_give_sem(lua_State * L, struct semaphore ** assoc_semaphore)
{
    give_semaphore(semm);
}


With this, I no longer get crashes or reboots, and the error message looks like this:

(http://a1ex.magiclantern.fm/bleeding-edge/qemu/lua-fail.png) (http://a1ex.magiclantern.fm/bleeding-edge/qemu/lua-fail2.png)

The error message is not always the same, but it's along the same lines. Showing two runs (same code) on the lua_fix branch.

What I think it happens: when calling C functions, Lua calls lua_unlock before and lua_lock after the function (source) (http://lua-users.org/lists/lua-l/2012-11/msg00048.html); therefore, while a C function is running, another thread is free to interrupt at the wrong moment.

This invalidates the following approach:

Quote from: dmilligan on February 18, 2016, 11:12:51 PM
2. Long running API calls (like camera.shoot) should "give" the semaphore while they are executing.

The ThreadsTutorial page mentions each thread (task in DryOS) needs a separate Lua state, to be created either with lua_open (from scratch) or with lua_newthread (so they can share global variables). I've found this example (http://gamedev.stackexchange.com/questions/111099/multiple-lua-scripts-using-newthread) using the second method, but it only works on Lua 5.1, and I don't understand Lua internals well enough to port the code to a newer version.

As I have little or no experience with Lua, and zero experience with multithreaded Lua, any help is welcome.

Otherwise, I'm afraid I'll have to remove the multi-threading functionality (event handlers included). I agree this functionality is very useful, but not at the cost of totally random behavior.

@garry23: please double-check you have a backup copy of your ROM, just in case.
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on January 28, 2017, 05:14:12 AM
Sounds scary so I made sure I had the ROM backup ready and the emergency crew on standby before running the test. It didn't get very far, froze and needed a battery pull. Luckily the camera, an EOSM, survived unscathed.

(https://c1.staticflickr.com/1/480/31718799494_f48c5f1357.jpg)


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2017-1-27 21:05:08
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 104
    apex = 6.
    ms = 16
    value = 0.015624
  aperture = table:
    raw = 56
    apex = 6.
    value = 8
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 80
      apex = 9
      value = 22.6
  iso = table:
    raw = 96
    apex = 8
    value = 800
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 6500
  mode = 3
  metering_mode = 3
  drive_mode = 1
  model = "Canon EOS M"
  model_short = "EOSM"
  firmware = "2.0.2"
  temperature = 198
  state = 0
  reboot = function: p
  bulb = function: p
  burst = function: p
  shoot = 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:
  clear = function: p
  hide = function: p
  show = function: p
  write = function: p
lv = table:
  enabled = true
  paused = false
  running = true
  zoom = 1
  start = function: p
  pause = function: p
  resume = function: p
  wait = function: p
  stop = function: p
  info = function: p
lens = table:
  name = "EF-S17-55mm f/2.8 IS USM"
  focal_length = 17
  focus_distance = 655350
  hyperfocal = 1918
  dof_near = 1895
  dof_far = 1000000
  af = true
  af_mode = 0
  focus = function: p
  autofocus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  circle = function: p
  screenshot = function: p
  line = function: p
  notify_box = function: p
  on = function: p
  rect = function: p
  print = function: p
  draw = function: p
  load = function: p
  off = function: p
  clear = function: p
  pixel = function: p
key = table:
  last = 10
  wait = function: p
  press = function: p
menu = table:
  visible = false
  new = function: p
  set = function: p
  block = function: p
  close = function: p
  open = function: p
  get = function: p
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 19
  ms_clock = 19292
  prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 5764
    folder_number = 100
    free_space = 31117312
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 5764
    folder_number = 100
    free_space = 31117312
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    yday = 27
    min = 5
    sec = 10
    hour = 21
    isdst = false
    month = 1
    wday = 6
    year = 2017
    day = 27
  rename = function: p
  remove = function: p
  directory = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:32: in function <ML/SCRIPTS/API_TEST.LUA:31>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:31: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:77: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:788: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:810: in main chunktask = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 28, 2017, 04:43:14 PM
I'm not looking for testing, I'm looking for suggestions from those familiar with multithreading in Lua.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 28, 2017, 05:41:10 PM
@a1ex

I'm afraid I will be off the map for about a month and can't afford to 'experiment' for a while, i.e. I'm taking four camera bodies away with me and need 'stability'.

I'll keep an eye on progress and will reconnect with the Lua experiments when I'm back.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 02, 2017, 06:31:05 PM
Added latest Lua docs on the nightly builds page:

http://builds.magiclantern.fm/lua_api/

I still have some trouble with CSS, so a bit of help would be welcome. I'd like to keep the navigation menu from the Builds site, but it looks like there is some conflict between the two styles, so it's probably best to tweak ldoc.css somehow.

The page with navigation menu enabled is here (notice the different style once you switch to other pages):

http://builds.magiclantern.fm/lua_api/index2.html

As I'm not an expert in web design, suggestions are welcome.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on February 02, 2017, 06:52:42 PM
Once again A1ex thanks for keeping the docs in sync with the 'fixes'.

BTW does lens.focus not return anything now?

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 02, 2017, 06:57:27 PM
It returns the same as before. The old docs had it missing as well...
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on February 02, 2017, 07:00:07 PM
 :)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 11, 2017, 10:12:27 PM
Found a temporary workaround for the multitasking issue.

If one task calls yield, and other Lua tasks or event handlers that may be interrupting it are allowed to complete their execution before the first task resumes, things appear to work fine (https://bitbucket.org/hudson/magic-lantern/commits/d5b3449f67a95b06d59bcbf1cb534bb9147290a6).

So I've implemented a workaround that simply throws an error if two tasks call yield() at the same time (which causes the camera to crash). That's probably good enough as a temporary workaround for merging into the nightly, until a proper solution is found (which, given my lack of experience with multi-threaded programs, and also the eagerness of ML community to solve this issue, will probably take years or more).

This update touches more than just Lua - a lot of internals were fine-tuned to pass the Lua API tests, and I'd like to merge it in the nightly before proceeding with recent ports (100D and 70D), as some changes are helpful for those models as well. Therefore, please test and report your experience with the latest experimental Lua build - not just for Lua, but also for everything else.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 12, 2017, 09:44:20 AM
@A1ex

First try at the latest experimental build.

I simply removed all the supplied Lua scripts from the ML folder and put my Landscape Bracketing script in the folder, which works on the current Nightly.

I set the script to autoload.

On restart I switched to LV to observe the console and ML 'froze' at the console announcement saying my script was loading.

Not sure where to go now.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 12, 2017, 10:25:29 AM
Just ran the API test and get the following error

TEST.LUA 765 assertion failed

....'globals assert'....

....765
....905
....921

....not enabling autorun error
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 12, 2017, 02:24:18 PM
Works here. Did the camera have something to focus on?

(I thought it's obvious from the error message)
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 12, 2017, 04:19:56 PM
@A1ex

The problem I'm having (5D3) is that I can't even get the experimental build running as when I load my main script, that runs with the current nightly, the ML script menu just freezes.

What I don't know is if anything has changed between the nightly and the latest Lua Fix experiment, ie that is in my script.

Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 12, 2017, 04:26:53 PM
When it freezes the following text, in red, is displayed in the top left of the LV screen

[2] ? stack overflow free = 0 used = 0
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on March 12, 2017, 06:20:41 PM
Quote from: garry23 on March 12, 2017, 04:19:56 PM
What I don't know is if anything has changed between the nightly and the latest Lua Fix experiment, ie that is in my script.

Lots and lots of stuff changed (https://bitbucket.org/hudson/magic-lantern/pull-requests/720/lua-fixes-part-2/diff#comment-None). There are many breaking changes to the Lua API, so I would expect stuff to be broken, what's concerning is the stack overflow. Looking over your script, I don't immediately see anything that would cause something like that.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 12, 2017, 06:44:41 PM
@dmilligan

As I said above, without knowing the 'changes', I just don't know how/where to start 'debugging'.

The main issue is my script freezes ML when I try and run it, ie not autoload, simply run it (with the error posted above).

This I find strange.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 12, 2017, 07:20:42 PM
Confirmed. What I find puzzling: the build from the website crashes, but my local compilation (from the same changeset) works just fine.

Edit: it was indeed an issue on the build server. Recompiled after cleaning the workspace and now it's working.

Guess it's high time adding some automatic tests to the nightly server (run each build in QEMU), to catch similar issues.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 12, 2017, 07:43:25 PM
:-)))))))

In the nicest possible way, I'm glad it was such an error.

I was beginning to feel stupid: again!  ;)

I'll try the latest as soon as I can and provide feedback.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 12, 2017, 10:13:38 PM
First strangeness connected with latest Lua fix.

My script generates an error "...lens.focus only works in LV...", but I'm in LV.

Obviously I need a hint here.

Cheers

Garry

Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 12, 2017, 10:50:10 PM
Are you actually seeing a live preview (updated at roughly 30 frames per second), or are you in some other camera mode derived from LiveView (such as Canon menu entered from LiveView, or quick review after taking a picture in LiveView) ?

The former is considered LiveView by ML, but the latter is not (even if the mirror may be raised). Focus commands are only known to work in LiveView.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 12, 2017, 10:58:38 PM
@A1ex

I run my script explicitly from Live View.

As I said before, the script ran perfectly before the last experimental build.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 12, 2017, 11:29:32 PM
Best guess: in check_lens_ready, you call lens.focus repeatedly until it succeeds.


repeat
msleep(200)
until lens.focus(0,1,false)


This call is not running in LiveView - you call this function right after camera.shoot(), so it actually waits for the camera to return to LiveView after taking a picture.

Before, lens.focus returned false outside LiveView; now it raises an error if the preconditions (LiveView and AF enabled) are not met. It still returns false when the lens could not be moved (for example, reached the limit). Was the previous behavior better?

To fix this error, you could try either waiting until lv.running (or even forcing it with lv.start(), which should cover long image review settings), or wrapping lens.focus with a pcall (to catch the error and to keep the logic unchanged).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 13, 2017, 07:40:51 AM
@A1ex

Thanks for the insight.

I got my script to run by explicitly calling lv.start before every lens.focus: as a proof of principle.

The problem is the mirror slaps up and down now, ie I'm stacking and don't need/want the mirror to move.

Do you have any further thoughts?

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 13, 2017, 10:02:01 AM
I've got it running by inserting this at the beginning of first loop in your move() function:


function move(direction)
  ...
  repeat
            msleep(500)
            lv.start()
            ....
            focus commands
            take_brackets()
  until ...
end


If LiveView is already on, lv.start() will do nothing.

If you are in image review mode, lv.start() will bring you back to LiveView (without waiting for the image review to finish).

If you call it while Canon firmware is already attempting to return to LiveView (e.g. immediately after taking a picture with image review off), you have a race condition. ML notices the camera is not in LiveView, so it queues a fake press on the LiveView button. Meanwhile, Canon code might enable LiveView. By the time the LiveView button press gets interpreted, the camera is likely already in LiveView, so the effect will be the opposite.

Hence the delay before attempting to start LiveView.

That's because camera.shoot() does not also wait until the camera returns to LiveView. It only waits until Canon firmware reports the picture has been taken (so you can take a second picture or change settings straight away). LiveView is a different task.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 13, 2017, 01:42:05 PM
@A1ex

Once again thanks for the insight.

I'll use the 'Lua Fix', and your insight/hints, as an opportunity to refactor/tidy-up my scripts.

Cheers!

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 13, 2017, 09:59:31 PM
@A1ex

Looked at my script, following your insight, and used the following snippet in the end:

repeat
   msleep(200)
until lv.running


I used this 'upfront' and once, as you suggested. I also found I needed it after my shoot function, ie:

function my_shoot()
camera.shoot(false)
repeat
msleep(200)
until lv.running
end


I think you hinted at this.

One thought I had was whether it worth putting a bool check in camera.shoot and lens.focus that could be used by the scripter to tell ML Lua to wait for AF and LV or any other critical event/state, that you are aware of, but mortals like myself are not  :) ;)

Bottom line: once again thanks for all the background hardwork and for supporting 'idiots' like myself.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 16, 2017, 08:24:49 AM
Carrying testing with the latest Lua fix experimental branch, but noticed no 50D version.

Is there a reason for this?

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 16, 2017, 08:30:25 AM
Looks like it's a bug, and the experimental build page doesn't have a way to flag broken builds (it simply lists all the successful ones). Will fix later.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 16, 2017, 08:43:50 AM
 :) Cheers
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 26, 2017, 12:22:43 AM
I've revised the behavior of "complex" scripts a bit: in the initial concept, they were started, and if they could not be unloaded, they were automatically configured to autorun. Now this is no longer necessary (and probably a bit confusing as well), because any script (be it simple or complex) can be set to autorun from menu.

Please give it a try, as I'd like to merge it soon. Not only for Lua itself (which doesn't seem very popular these days), but for the other backend updates made to pass the Lua API tests.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 26, 2017, 08:38:27 AM
@A1ex

Going to test latest Lua experimental build against my scripts.

One thing that is not clear to me is that there is mention of lens.focus_pos but I can't find any info on this. Is it a different call to the current lens move ?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 26, 2017, 09:10:58 AM
Lots of info on focus_pos here (http://www.magiclantern.fm/forum/index.php?topic=4997.msg170048#msg170048). It's not moving the lens in any way, and right now it's probably only useful for research.

Also found a typo that prevented lens.focus_pos from appearing in the HTML docs.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 26, 2017, 09:22:11 AM
@A1ex

Ok, thanks.

BTW tested build on my 5D3 with my main landscape bracketing script and my HFD positioning script. All looks OK.

Will test on 50D later today.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 26, 2017, 09:39:43 AM
@A1ex

Just found some time to do a quick 50D test on latest build.

See a strange thing, ie relative to 5D3, which runs my two scripts fine: Console stays on.

Three lines saying:

Black level: 1790
Duplicate Menu: Press FUNC (2)
Duplicate Menu: Press FUNC (2)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 29, 2017, 05:15:35 PM
Managed to review all the changes and updated the PR description:

https://bitbucket.org/hudson/magic-lantern/pull-requests/720/lua-fixes-part-2/diff

If anything looks weird to you, please say it now. Otherwise, it's ready to merge from my side.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on March 29, 2017, 10:23:06 PM
@a1ex

I did try and scan the code, but bluntly could add no value until I test things in camera.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on April 04, 2017, 09:51:56 PM
Last weekend I was testing magiclantern-lua_fix.2017Mar26.60D111 mainly for stability of standard ML functions for still shooting. Looks good to me on my 60D. Especially the dynamic ML menu is much appreciated! Next weekend I will do similar tests w/ 100D.

The only Lua script I have in use so far is lens.lua from the manual_lens_info branch which was not running successfully on this build. I had to realize that certain changes  from manual_lens_info branch are not included in lua_fix, like moving common ui code into lib/ui.lua (bdcd13e) or introduction of  xmp.lua metadata library (ed6b260).

@dmilligan @dfort
Wouldn't it be useful to combine these two branches into one as both are providing useful Lua improvements (and much more of course)?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 04, 2017, 11:30:24 PM
I've synchronized manual_lens_info with lua_fix, but right now I'm too tired to play with it. Only checked whether it compiles (and found a minor problem in lua_fix that way).
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on April 05, 2017, 08:47:04 AM
Thx a1ex. Much appreciated. I know there is a lot ongoing. Exciting times. Thx again.

Sent from my SM-T719 using Tapatalk
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on April 05, 2017, 09:39:29 AM
@nikfreak  @a1ex
Just recognised that 100D disappeared from experimentals for lua_fix and manual_lens_info. Probably broken build?

Sent from my SM-T719 using Tapatalk

Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 08, 2017, 04:17:39 PM
@a1ex

Just tested the latest Lua.fix (4th April) on my 5D3 and 50D.

Although not a full test, my two 'go to' scripts, Auto Landscape Bracketing and 'Move to HFD or Inf', both seem to behave as expected on both cams.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 11, 2017, 09:18:00 AM
@A1ex

I had a thought last night that I welcome your insight on.

Many times when writing Lua, I wish I had access to a ML C variable, ie 'just' reading it.

For example, the position of the spotmeter.

Would it be too difficult to add the following functionality to Lua?


get_ML_variable(var_name)

Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on April 11, 2017, 01:34:54 PM
While it might technically be possible if the particular variable is a public global. It's not a very good idea from an API standpoint. It would violate the idea of encapsulation and expose implementation details to the consumer. The result would be very "fragile" code. It would make it much harder to change or refactor ML core without potential breaking scripts.

Think of an API as a contract. A contract should explicitly define all the interactions between the parties. There shouldn't be loopholes or backdoors, as this would be.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 11, 2017, 05:45:45 PM
@dmilligan

I 'feared' you would say something like that  ;)

Pity, as without access to some of the ML functionality, scripting will be 'held back', i.e. 'Restricted' to accessing the normal Canon info such as exposure etc.

Oh well, back in my box   :)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on April 11, 2017, 05:55:53 PM
I would read @dmiligan's answer in another way. Instead of adressing ML specific  variables with a generic call as you suggested there should be the possibility to extend the list of API interfaces delivering the required information independent of the type and name of the variable currently in use for ML. But that would need more programming efforts in Lua of course, right?

Sent from my SM-T719 using Tapatalk

Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on April 11, 2017, 06:06:23 PM
@JohanJ

Good point.

If that is the case, it would be good for us to create a 'list' of potential API hooks.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on May 07, 2017, 01:06:28 AM
I got some instability with the latest Lua Update and fixes build for 60D magiclantern-lua_fix.2017May01.60D111. Basically my camera is just freezing. It could happen directly after starting up the camera or during shut down. It definitively happens when walking through the card file system using file_man module. Otherwise there is no reproducible reason or pattern. The only way out is pulling the battery.

Unfortunately there is no crash log I could provide for analyzing the circumstances. Did a low level formatting of the SD card but nothing changed. Using the latest nightly instead of the lua_fix build does not show these problems.

Is there anybody else encountering this problem?

Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on May 07, 2017, 01:11:46 AM
Quote from: JohanJ on May 07, 2017, 01:06:28 AM
Basically my camera is just freezing. It could happen directly after starting up the camera or during shut down. It definitively happens when walking through the card file system using file_man module.

I've actually found this bug in QEMU in the previous build, and only fixed half of it (it's one of those bugs found with -d memchk (http://www.magiclantern.fm/forum/index.php?topic=2864.msg184125#msg184125)). There's still a warning left, but I could no longer reproduce the crash in QEMU after the fix. Did not try this build on a real camera yet.

Both parts of this bug are use-after-free triggered by a race condition (on menu_remove). I'm analyzing this kind of bugs in this branch (https://bitbucket.org/hudson/magic-lantern/commits/branch/thread-safety) and this topic (https://www.magiclantern.fm/forum/index.php?topic=18907.0), but I have no experience with how to deal with them properly.

Was the previous build (Apr04) not affected by this issue? (old versions are here (http://builds.magiclantern.fm/jenkins/view/Experiments/job/lua_fix/) for now)
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on May 08, 2017, 09:19:08 PM
Just tried lua_fix Build #398 (04-Apr-2017 23:29:58). It has similar issues too as soon as file_man.mo is active! I did not get a total freeze but file_man is behaving odd after a while: when toggling through the folders the entire file structure suddenly disappeared and from this very moment trash/info/menu/q buttons were dead, and so was the back screen. It was still possible to take pictures but you cannot review them, att all. To get out from there I had to pull the battery, re-boot was not enough.

It all comes down to file_man.mo for builds both from 04/04 and 05/01. As long as the module is not activated, both builds seem to work properly (as far I could test it right now, which was not that deep!!).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on May 13, 2017, 08:52:31 AM
@A1ex

May have found a bug: if not it's ML-LUA strangeness  ;)

Here's the test code (running on latest Lua, but checked against previous Lua versions as well):

display.rect(300, 300, 100, 100, COLOR.RED, COLOR.WHITE)
display.print("TEST", 300, 320, FONT.LARGE ,COLOR.GREEN1,COLOR.TRANSPARENT)


The issue is the text displays a black background, ie not a transparent one.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on May 13, 2017, 10:28:41 AM
In this case, "transparent" means the underlying image VRAM is visible. There's also TRANSPARENT_BLACK, similar to the one used for Canon's info overlays in LiveView (semi-transparent), or COLOR_TRANSPARENT_GRAY (only defined in bmp.h, and not exposed because not all camera models can use it).

For the bitmap overlay, there's NO_BG_ERASE defined in bmp.h, but currently it's only used for internal ML code that required this behavior before this change (http://www.magiclantern.fm/forum/index.php?topic=18351.0) (but it's not exposed to Lua).

There's also the SHADOW_FONT flag, not yet exposed to Lua, but could be helpful (as it only draws the background pixels that are adjacent to a foreground pixel).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on May 13, 2017, 05:06:47 PM
@A1ex

Thanks for the info.

BTW you are just about to see another posting from me, introducing a new 'feature', ie a focus bar.

It will be interesting to see what you think.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on May 21, 2017, 01:53:08 AM
Suspecting some stack corruption from lua_getfield (which appears to require a lua_pop, but that doesn't happen everywhere, see e.g. lua_dryos.c), I've started to dig inside the Lua C API (which I still don't really understand) and got some questions:

1) Is there some easy way to check the stack usage of our C functions? (for example, to make sure each lua_getfield call is paired with a lua_pop, but not only)

I can imagine some API test that calls every such function 1000 times or so to check whether it will overflow the stack, but that doesn't look very nice.

The LUA_FIELD_* macros appear to address this purpose, but they are not used everywhere; as a first step, I'd refactor all the calls to lua_getfield to use similar macros. But I suspect there are more instances of similar behavior, not obvious from the function names.

2) I've also stumbled upon the LUA_PARAM* macros. The Lua manual recommends (https://www.lua.org/pil/26.1.html) luaL_checkinteger/number/string/whatever for the same purpose. Any reason we use those long macros, instead of the standard functions?

3) Most of the C tables allow setting arbitrary fields besides the predefined ones (but not all - font doesn't). What is the rationale behind this? Does any of the existing scripts make use of this feature?

I'm tempted to make them read-only, so it would catch typos when accessing these fields, rather than creating new fields that have no effect. Example: you could write in a script: lv.emabled = true (typo) and with the current behavior, you'll probably spend some time figuring out why this doesn't enter LiveView.

4) Most of the fields (from various objects) appear in 3 places (and it's easy for them to become inconsistent, as it doesn't give a compiler error, and I couldn't come up with a way to check them in api_test.lua either). For example, in lua_battery, all the fields (level, id, performance etc) appear in luaCB_battery_index, in luaCB_battery_newindex (on the long line with strcmp) and on lua_battery_fields. Any suggestions for reducing these repetitions?
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on May 22, 2017, 06:15:08 PM
1. You might not always want to pop a getfield:
  - if it's going to be the value returned from a function
  - if some other lua API call is going to consume/pop it
  - if it's going to be an argument to a function call or the function being called (which will result in it and the other arguments getting popped)

Keeping track of what's going on the the stack is probably the single hardest part of writing lua API stuff in C, I don't really know of a way to automatically verify stack operations, because what happens to the stack simply depends on what it is trying to be accomplished. You'll notice in the lua API docs in gray on the right side are three values for each function, these values describe what that particular function does to the stack.

Sometimes you have to write something so complicated that the only way to do it is to make code comments of what is going on with the stack. Something relatively simple in Lua is very challenging to write the equivalent C. For example to simple do a nested function call like: foo(1, bar(2,t[3]), 4) in C you would need to:
push foo on the stack
push 1 on the stack
push bar on the stack
push 2 on the stack
push t on the stack
push 3 on the stack
getfield
call
push 4 on the stack
call

2. They do a lot more than those built in functions, for example providing a way to specify the default value for optional parameters, and also inserting the name of the parameter into the error message (that way the user maybe has some idea of what they did wrong).

3. Probably a good idea to make those tables readonly.

4. to be continued...

Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 23, 2017, 10:52:06 PM
I think I've found a fix for file_man crashing. Maybe not the cleanest way, but at least I no longer get warnings in QEMU. Ended up doing some major changes on the menu backend, such as enforcing valid names on every single menu entry (to avoid null pointer issues).

Also renamed dryos.prefix to dryos.image_prefix and made sure it's actually working (with an API test that also shows how to get the file name of the current image).

Didn't look into stack issues yet.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 24, 2017, 09:41:06 AM
@a1ex

Just tried the Latest Build (2017-06-23 22:42): my birthday build as it happens :)

I've only got access to my EOSM at the moment and all looks OK apart from a minor observable.

When I double tap the screen to go into the ML menu, the screen flashes Orange.

I'll keep testing. So far my EOSM Toggler script works as 'normal', as does my focus bar script.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on June 24, 2017, 10:50:22 PM
Did some testing with the latest lua_fix.2017Jun24 both with 60D and 100D.
From a still photography's point of view a stable solution on both cameras, which is great! Did not dig into mlv though.

And the good news is that file manager is solid now. No hanging what ever I tried to provoke.

Still there is one artifact worth to mention. When activating modules and booting the camera I always get a console window with an assert message in the end, see log file below (same for 60D and 100D)

ML ASSERT:
a
at ../../src/stdio.c:44 (streq), task module_task
lv:0 mode:2


Magic Lantern version : lua_fix.2017Jun24.60D111
Mercurial changeset   : fe6b0207f229+744f5868a308+ (lua_fix)
Built on 2017-06-23 22:49:10 UTC by jenkins@nightly.
Free Memory  : 389K + 1546K


I had chosen dual_iso, ettr and file_man modules. The console remains active unless I turn it off in Debug/Module Debug (Off -->ON --> Off).

Strange also that additionally activating lua.mo provokes an assert again on (re)boot and writes an additional assert.log but the console window disappears after a few seconds and remains inactive. Is there any change in the console window handling lua.mo takes advantage of but other modules not (yet)?

Also not clear whether this assert has any consequence besides the console behavior and lots of log files written to the memory card.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 24, 2017, 11:07:09 PM
@JohanJ: that's yet another null pointer issue (likely in one of these modules, during initialization). Before, it went out unnoticed; that assert won't change the old behavior (whether it was good or bad), other than printing a message. Will look into it.

Yes, Lua.mo hides the console after startup.

@garry23: is the orange screen a regression over previous build, or it was there from the beginning?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 24, 2017, 11:55:57 PM
@a1ex

The orange flash only appeared in the latest build.

Cheers


Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 12:01:56 AM
How does it look like?

It would be very helpful if you can compile the code and run "hg bisect" to narrow down the change that caused it, as I have no idea what it might be.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 08:23:21 AM
@a1ex

Also get this assert file, every time I switch on:

ML ASSERT:
a
at ../../src/stdio.c:44 (streq), task module_task
lv:1 mode:3
Magic Lantern version : lua_fix.2017Jun24.EOSM202
Mercurial changeset   : fe6b0207f229+744f5868a308+ (lua_fix)
Built on 2017-06-23 22:43:05 UTC by jenkins@nightly.
Free Memory  : 187K + 3209K


Also just tested with all my scripts removed, to prove it was no me. Orange flash still occurs.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 09:43:49 AM
Still no idea how the "orange flash" looks like - a video would be best.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 10:08:53 AM
@a1ex


(http://thumb.ibb.co/gvthXk/Untitled_1.gif) (http://ibb.co/gvthXk)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 10:12:15 AM
May I see a similar video with the previous build, to know how you expect it to behave? If possible, with the same settings and test scene.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 10:29:28 AM
@a1ex

Build 2017-01-25 23:34:20

No orange flash.

BTW this is not a high priority matter for me ;-)


(http://thumb.ibb.co/ezBcXk/Untitled_2.gif) (http://ibb.co/ezBcXk)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 10:49:05 AM
Well, it's an unexpected change that I have no idea where it comes from. Looks like the exposure increases when you touch the screen (maybe for autofocus), and since the menu does not appear instantly, you can see the image getting brighter.

That's why I've asked for the two tests to be done at the same settings and test scene.

The puzzling part is - why there is a difference between builds?

There are some differences between the screenshots (for example, the most recent one has some dots on it). Not sure where they come from (cropmarks? AF?)

Also, you can find older builds here: https://builds.magiclantern.fm/jenkins/view/Experiments/job/lua_fix/
Can you narrow it down to a more recent build?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 10:54:53 AM
@a1ex

Just reloaded the latest experimental Lua build and the orange flash occurs with no modules loaded and cropmarks off.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 11:41:30 AM
@a1ex

Just tried all the Lua fix builds in Jenkins down to #381: all appear to have an orange flash.

The build that doesn't have the flash is this one:


(http://thumb.ibb.co/f8UaJQ/VRAM0.jpg) (http://ibb.co/f8UaJQ)

upload your photos online (http://imgbb.com/)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 12:42:07 PM
Ah, it's a build from the focus_pos branch; that one is based on 4708e20 (somewhere between #381 and #371). Can you check whether #371 has the flash?

Assuming #371 doesn't have the flash, I'm compiling intermediate builds here: https://builds.magiclantern.fm/jenkins/job/lua_fix_dbg
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 01:09:54 PM
@a1ex

#371 does (sic) have the flash.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 01:29:07 PM
Can you check 4708e (first from https://builds.magiclantern.fm/jenkins/job/lua_fix_dbg/4 ) and 43c863 (last from https://builds.magiclantern.fm/jenkins/job/lua_fix_dbg/8 ) ?

If one of them has the flash, you can proceed narrowing down within the other builds from the same list.

Otherwise, can you check some older builds from lua_fix, and also the latest regular (non-experimental) build?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 01:45:48 PM
@a1ex

4708e and 43c863  both flash.

Have looked back as far as I could in Lua fix, ie #369, which also flashes.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 02:04:10 PM
What about this one? https://builds.magiclantern.fm/jenkins/job/lua_fix_dbg/10/
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 03:07:59 PM
Yes: still flashes.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 03:26:08 PM
Can you try the Jan26 lua_focus_pos build again?

Hint: they are identical.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 03:30:09 PM
@a1ex

That build, ie this one, doesn't flash.


(http://thumb.ibb.co/f8UaJQ/VRAM0.jpg) (http://ibb.co/f8UaJQ)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 25, 2017, 03:38:14 PM
Tested in the same conditions as the previous builds, or just swapped an older card, possibly with different settings?

Please check the Help screen of the lua_fix_dbg #10 and compare the changeset IDs.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 03:48:20 PM
@a1ex

All I did was replace the .fir, .bin and the ML folder.

All camera settings unchanged.

Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on June 25, 2017, 03:52:20 PM

(http://thumb.ibb.co/gFtBa5/qwww.jpg) (http://ibb.co/gFtBa5)


The above flashes
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on June 25, 2017, 06:36:50 PM
Quote from: a1ex on June 24, 2017, 11:07:09 PM
That's yet another null pointer issue (likely in one of these modules, during initialization).

I tested all modules booting them separately or in a combination they are required to function (like mlv_snd needs mlv_rec to be activated too) and found the following candidates creating asserts:

dual_iso.mo
ML ASSERT:
a
at ../../src/stdio.c:44 (streq), task module_task
lv:0 mode:2


deflick.mo:

ML ASSERT:
a
at ../../src/stdio.c:44 (streq), task module_task
lv:0 mode:2


raw_rec.mo (2 different ones)

ML ASSERT:
new_entry->name
at ../../src/menu.c:1224 (menu_add), task module_task
lv:0 mode:2


ML ASSERT:
entry->name
at ../../src/menu.c:6430 (check_duplicate_entries), task menu_redraw_task
lv:0 mode:2
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on June 29, 2017, 12:23:12 PM
Fixed the first two locally (the asserts caught yet another menu bug).

For the last two, there's no raw_rec module in this branch, and mlv_lite doesn't give any errors. The raw_rec I already had on the card did not trigger any error (it refused to load, with status OldAPI).
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on June 29, 2017, 02:36:34 PM
Quote from: a1ex on June 29, 2017, 12:23:12 PM
For the last two, there's no raw_rec module in this branch, and mlv_lite doesn't give any errors. The raw_rec I already had on the card did not trigger any error (it refused to load, with status OldAPI).

Strange! I will check the SD card when returning home tonight. Normally I am deleting ML folders, auto...bin and .fir before loading a new version. No idea how this module came in there otherwise.

[EDIT] @a1ex: downloaded lua_fix for 100D and 60D from experiments page again: raw_rec.mo is definitively included in the modules folder for these builds. Probably a left-ower in makefile? When starting the raw_rec module on 100D I get exactly the same error messages as reported here:  http://www.magiclantern.fm/forum/index.php?topic=16040.msg186543#msg186543
Might be obsolete though when emliminating raw_rec.mo from these builds.

Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on July 01, 2017, 04:12:48 PM
Good catch - the build system was not smart enough to remove it when running "make clean"...

Pushed the fix and rebuilding now.

In the mean time, here's what I'm working on (http://www.magiclantern.fm/forum/index.php?topic=19933) (as the exact location of th issue is often not obvious from the crash logs).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on July 01, 2017, 06:18:47 PM
@a1ex

Of no great importance to me, but that orange flash still occurs with the latest experimental nightly.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on July 01, 2017, 06:25:50 PM
OK, I should probably create a build binary identical to Jan26 lua_focus_pos. Currently, the only difference between that (which doesn't flash) and #299 (which flashes) is the version number, build date and similar strings (but the strings have slightly different lengths, which resulted in different offsets in the binary). There should be no functional difference at all.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on July 01, 2017, 08:38:27 PM
Quote from: a1ex on July 01, 2017, 04:12:48 PM
Good catch - the build system was not smart enough to remove it when running "make clean"...

make clean for modules pretty much never works because of this (in modules/Makefile):

MODULES_CLEAN_ALL_TARGETS = $(call targets_rules, $(shell ls -d */), clean)


The rule tries to run clean on every directory it finds in the modules folder, regardless of whether or not that folder actually has a makefile in it. As soon as you get to a folder without a makefile, the whole things errors out and nothing after that folder gets cleaned. This is a huge problem when switching branches with different modules in them, since the version control will delete the makefile when switching branches, but none of the build files or the directory.

A long time ago, I made a patch that prevented this rule from failing, by only trying clean on directories that had makefiles inside them, but this still doesn't fix the issue of switching branches leaving behind build files, but no makefile that tells how to delete them.

So for a complete solution, I would recommend changing the module build system to work something like this: have all modules create all their build files in a subdirectory (e.g. bin/). Then have the modules/Makefile, clean by simply deleting all modules/*/bin/ directories it finds, rather than relying on calling the module's makefile (which might not be present). Of course this would be a rather sweeping change to module build system and require touch a lot of files.

Putting build files in a subdirectory would have the added benefit of avoiding all the clutter in the modules' source directories which can make it hard to find the actual source files when browsing to them.

Doubt I'll have time to do it myself, but it would be a good easy coding task.
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on July 01, 2017, 08:45:48 PM
QuoteThis is a huge problem when switching branches with different modules in them, since the version control will delete the makefile when switching branches, but none of the build files or the directory.
Oh yes.
Title: Re: Lua Scripting (lua.mo)
Post by: grnbrg on July 02, 2017, 12:30:01 AM

(http://thumb.ibb.co/gBO09a/5_Dmk_II_error.png) (http://ibb.co/gBO09a)

how to post pictures online for free (http://imgbb.com/)
Isolated the crash I was having last week, related to LiveView and shutter speed.  Running this against todays (Jul01) lua_fix build.


-- 5DmkII LiveView crash test
-- 5DmkII + LV + fast shutter speeds causes a crash.

menu.close()
console.show()

print ("This will work.")

key.wait()

task.yield(1000) -- wait for the key to be released

camera.shutter.value = (1/8000)

print ("Shutter value: ", camera.shutter.value)

lv.start()

print ("This will work.  (Sort of.  It also starts a recording?)")

key.wait()

task.yield(1000)

camera.shutter.value=(1/4000)

print ("Shutter value: ", camera.shutter.value)

print ("This will crash.")

key.wait()

task.yield(1000)

camera.shutter.value = (1/8000)

print ("Shutter value: ", camera.shutter.value)

key.wait()

print("Done.")


Interestingly, this only crashes on my 5DmkII.  My 70D runs it flawlessly.

Essentially, (on the 5DmkII) once LiveView has been activated, trying to set a shutter speed faster than 1/4000th of a second crashes the script with a complaint that "camera.shutter.value" (or whichever shutter field) can't be set.  Odd.


(Brian) grnbrg.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on July 02, 2017, 01:08:47 AM
Quote
Essentially, (on the 5DmkII) once LiveView has been activated, trying to set a shutter speed faster than 1/4000th of a second crashes the script with a complaint that "camera.shutter.value" (or whichever shutter field) can't be set.

Same does the 5D3 when running this script in Movie mode (Canon limitation).

If you need faster shutter speeds, look into shutter fine-tuning (Movie menu). You should be able to push it to 1/50000 on 5D2 (5D3 only goes to 1/25000).

Quote
(Sort of.  It also starts a recording?)")

Did you press SET when the script was waiting for a key? key.wait() doesn't keep the event from reaching the Canon firmware (maybe I should fix that, as it's not expected behavior, but it's a bit tricky to handle in a cross-platform way, as there are some other gui events that are similar to buttons, but should be passed back, and they are model-specific)
Title: Re: Lua Scripting (lua.mo)
Post by: bastien42 on July 05, 2017, 12:48:59 PM
Quote from: nikfreak on July 05, 2017, 12:02:08 PM
bastien42, the whole overlay (inlcuding waveform, histo, scope etc..) will be visible in playback mode like on all other cameras which have "BTN_ZEBRAS_FOR_PLAYBACK" defined. Guess it will be included into the experimentals once a1ex finds it worth to include. I could update ofc the 1st post with a "nightly" but that wouldn't be the same "experimental" build that a1ex provides you. I personally find we are already overdue with becoming part of the nightlies and i decided to not merge the "experimental" stuff myself as it would just interfere.
So I'm passing by to just ask when and if a1ex saw the new update that nikfreak did if no I shall just ask for it can't wait to have a hand on it and when do you find you could implement it into the experimental cheers :)

so you know the link to the conversation for background ^^ : http://www.magiclantern.fm/forum/index.php?topic=16040.600 (http://www.magiclantern.fm/forum/index.php?topic=16040.600)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on July 06, 2017, 10:21:18 AM
Quote(Sort of.  It also starts a recording?)")

Hopefully fixed. That means, key.wait() should now block the key(s) it's waiting for, and pass all other events to Canon.

For example, in hello.lua:

print "Press SET to exit."
key.wait(KEY.SET)
console.hide()


That means, you can press any key other than SET, and it will be passed to Canon code (or to other ML modules). Or, you can press SET to close the console; in this case, SET should not perform other actions (such as starting to record on 5D2).

That's a very simplistic way of handling keys; for more general cases, you can use event.keypress (where you can choose what keys to block and what keys to allow, useful for interactive scripts), or keys.lua (it blocks all keys, so it's suitable only for full-screen apps like editor and calc).
Title: Re: Lua Scripting (lua.mo)
Post by: grnbrg on July 11, 2017, 04:29:05 AM
Quote from: a1ex on July 02, 2017, 01:08:47 AM
Quote from: grnbrg on July 02, 2017, 12:30:01 AM

Essentially, (on the 5DmkII) once LiveView has been activated, trying to set a shutter speed faster than 1/4000th of a second crashes the script with a complaint that "camera.shutter.value" (or whichever shutter field) can't be set.  Odd.

Same does the 5D3 when running this script in Movie mode (Canon limitation).


I found a solution!  At least for my needs...  The shutter speed limitation is only imposed in movie mode.  This (on the 5DmkII, at least) is controlled by a menu option:

(http://support-hk.canon-asia.com/img/G0041035.jpg)

If I set this to "Stills only", I get the full range of shutter speeds back.  I suspect the reason I had no issues with the 70D is that body selects movie mode via a hardware switch.

Thanks for your time and work!



Brian.
Title: Re: Lua Scripting (lua.mo)
Post by: BBA on July 21, 2017, 11:58:57 PM
I need your advice to help me choose a good environment for debugging Lua scripts before testing and using them in camera.

One way or another, the question has already been asked but I would like to add some requirements (if possible).

The on-camera Lua uses modules libraries to help (thanks very much for that) Lua scripting developers.
I have tried to emulate some of those modules (sometimes in a dirty way I am afraid, but nevertheless it still provides some help).
For instance, the menu emulation is not a priority...

I would really like to emulate a minimum set of the display module functions (to display lines, rectangles, text) and debug the scripts on a desktop computer (I am on a mac).
It would really help a lot.

I have tried to use the "turtle.lua" module in the ZeroBrane studio environment which, in turn, makes use of a wxWidgets module (require "wx") .
This environment seems interesting as some static checks can be made on the code (I am a newbie).
The problem is that the pointers are difficult to follow as only the "reference" address to user data is displayed while debugging : those references can change over time.

What do you think ?
Should I continue in that direction or do you know a better environment to use ?
Is there something I should better use in "Visual Studio Code" ?

Many thanks in advance for your help !


Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on July 23, 2017, 09:58:32 AM
@BBA

I wasn't going to post on your last comments, but here goes.

Like you, I would love to have a proper Lua development environment running.

I currently use Visual Studio Code, but have failed to even get it running in debug mode: I'm sure the problem is me, as I also still have issues compiling ML. Bluntly, I get 'confused' with all the references to forks etc.

So, I can code, ie in Lua and even a little C++, but my issues start when I try and debug or compile.

So my Lua workflow is very simple and inefficient. Use VSC as a 'text editor' and try and debug via ML in-camera errors: Ugh!!!!!
Title: Re: Lua Scripting (lua.mo)
Post by: chris_overseas on July 23, 2017, 12:06:31 PM
It might be worth looking at IntelliJ IDEA Community edition (https://www.jetbrains.com/idea/download/) combined with the Lua plugin (https://plugins.jetbrains.com/plugin/5055-lua - don't download this, just install it through IDEA by choosing File->Settings->Plugins->Browse Repositories and search for "Lua"). Note that I haven't tried the Lua plugin myself (and given it is written by the 3rd party, it's quality is uncertain), but it does appear to have some debugging support and a host of other useful features. IDEA itself is superb for the other languages I use (Java, Kotlin, Python) and I can't imagine using any other IDE for those. I also dabble in a bit of C/C++ for Arduino using CLion which is a C++ IDE based on the same codebase as IDEA, so the Lua plugin should work with CLion too.

If anyone does try the above, I'd be interested to hear how it goes.
Title: Re: Lua Scripting (lua.mo)
Post by: BBA on July 23, 2017, 03:30:07 PM
@garry23

Never mind, thank you for you post : you are welcome !
I agree with you.
Honestly, I am impressed by the results you can achieve with (y)our inefficient workflow... like with the « focus.lua » script.
I have tried the focus bar at home (not last version though) : impressive to see the sharpness that can be achieved when « correctly » focusing : thanks very much for that !!!

One thing is that when « drawing » man machine interfaces, it is important to see the end result : interactive debugging is a necessity because it may be necessary to restart from scratch at any time to better display/interact with things.
Little story : I have coded in Fortran 77+ thousands of lines of code for a « plotting graphics package »: I could  just print, on a listing, the values of the variables to find the errors (between compiling and linking sessions) : It's like blind work but somehow, I liked it because it was somehow like a detective story. I was younger and there was no other way to do that. At the end, I could still find an error a day (plotter pens are very precise). I think It makes you careful at avoiding errors at the time of writing ( when you know the language, which needs tests and errors ).

There are more effective development tools now : with internet, everything is exploding (in french : explosion combinatoire ). It becomes important to be able to follow a correct path in that jungle and avoid the foreseeable dead ends (bad english ?).
I have managed to partially emulate the display module with wxLua in the ZeroBraneStudio environment though I only know a very small part of the wxWidgets capabilities. As it is, it is dirty and wx would need to be studied further because there are lots of useful features there.
That's why I decided to post here : I think it is it a « correct » direction to go but I have no experience at all at a higher level.
I don't want to make a perfect/complete emulation (always a work in progress), only the necessary functions we use.
Maybe I am wrong but the Qemu environment has been said to be usable to test lua scripts.

I use ZeroBrane Studio because it is the Lua environment I have been able to easily push the further (furthest?) for ML lua scripting :
- i can test snippets of code and debug them : it is useful to learn lua which needs to be learnt carefully and deeply;
- it has a « use as scratchpad » project mode where you can  « live » test small scripts, changing values and options in real time;
- the code can be statically analyzed (till a certain point : first use of (undeclared) variables, unused declared variables, unused function parameters,....);
- I can use wxLua with it to draw : I hope to be able to use event driven code to emulate part of the key module and, maybe, a dirty lens module ; I am less interested in menu bars, radio buttons, ....

@chris_overseas

I had not seen your post before.
Thank you; I will take a look
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on July 23, 2017, 03:34:42 PM
@chris_overseas

Downloaded and tried the IDEA Lua: as usual I failed :-(

Too many errors in just getting it going and too complicated.

I'll stick with my inefficient, but for me workable, workflow.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on July 23, 2017, 06:31:25 PM
@BBA

Pleased you've tried out the focus bar. I must say it is the script I'm most proud of.

BTW the latest version provides a nice feature that allows you to optimize the depth of field at infinity and in the near field, using different blur criterion. Giving you the best chance of nailing the optimum capture for your needs.

Then, of course, if one image is not sufficient, you can use the focus stacking feature.

Of course the above is my humble view. Based on feedback, i.e. not much, you and I may be the only ones using it  ;)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: grnbrg on August 05, 2017, 11:59:06 PM
:sigh:  Hopefully this is actually a bug this time, and not something that seems pretty obvious in hindsight.


-- 70D LV exposure test
-- If run in LV, high speed continuous mode, will trigger a burst of 3 frames.

menu.close()
console.show()

print("Click?")

key.wait()

camera.shutter.value = 1/500
camera.iso.value=100
camera.shoot(false)

key.wait()


This script should fire a single frame, and does in most combinations.

However, in Live View, with the drive mode set to high speed (7fps), this script fires the shutter 3 times.



Brian.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on August 06, 2017, 12:14:57 AM
5D3 1.2.3, high speed continuous mode in LiveView: takes only one picture.

However, after trying a couple of times, I've managed to make the camera a bit unresponsive (script stuck somewhere after showing "Click?", most keys working for menu navigation, except SET and joystick press, which did not do anything). Will try to reproduce and fix this one.

Does this behavior have anything to do with key handling? (e.g. does it help if you just close the menu and use a fixed delay?)

Do other ML features that rely on picture taking (e.g. intervalometer) take multiple pictures at once in this mode?

(side note: there is a setting in ML to take a few pictures at once for e.g. motion detection, but it shouldn't apply here)
Title: Re: Lua Scripting (lua.mo)
Post by: grnbrg on August 06, 2017, 01:00:08 AM
Key handling doesn't appear to be relevant -- I came across this in the middle of another script, and pared it down to a testable example.

Just confirmed that the basic intervalometer fires 3 frame bursts where a single exposure is correct, and camera.burst(1) fires 3 frames.  Advanced bracketing seems to work fine.


Brian.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on August 06, 2017, 01:11:17 AM
What about camera.burst(2) ?

"3 frame bursts where a single exposure is correct" -> you mean, only one of these 3 pictures has the exposure you expect, and the other two have different exposures?

Is it a regression over the regular builds? (you can try the 10/12-bit experimental build, or older builds from nikfreak)

If you can compile ML, does this also take 3 pictures?


/* don't click me, debug.c */
static void run_test()
{
    msleep(2000);
    call("Release");
}
Title: Re: Lua Scripting (lua.mo)
Post by: grnbrg on August 09, 2017, 04:05:56 AM
"3 frame bursts where a single exposure is correct" -> I expect a single shutter actuation and get three.

I have reproduced the issue with the June 24th and July 6th lua_fix builds -- Will test with the Oct 26, 2016 mainline beta tonight.

I reset the camera settings and ML settings to defaults, and while it did not fix the issue, I'm now (usually*) getting two exposures per camera.shoot(false) + LV + high speed continuous call.  Not really in a position to compile a binary.  Also, slow shutter speeds seem to work -- a 1 second shutter time didn't double or triple.  Will titrate this and report, if I can identify where the problem starts.

*.... usually?

I expanded the test script to shoot a series of -- 1/8000s, 1/4000s, 1/2000s and 1/1000s one after the other.  Usually, each call to camera.shoot(false) is producing two images, as though the function has been called twice.  But occasionally a run of the test script will produce 7 images, not 8.



Brian.

Edit:  Tested with the older mainline binary -- still getting double shutter activations.

When running the following test script:


-- 70D LV exposure test
-- If run in LV, high speed continuous mode, will trigger a burst of 3 frames.

menu.close()
console.show()

print("Click?")

key.wait()

camera.shutter.value = 1/25
camera.iso.value=100
camera.shoot(false)
camera.shutter.value = 1/10
camera.shoot(false)
camera.shutter.value = 1/5
camera.shoot(false)
camera.shutter.value = 1/4
camera.shoot(false)


key.wait()


the 1/25s call results in two images.  The subsequent three calls each reliably result in a single image.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on September 02, 2017, 11:03:48 PM
Updates:
- menu.select now also works on submenus (api_test.lua for examples)
- bunch of fixes regarding dynamically built (sub)menus
- console now works alongside ML overlays (todo: clean up the menu)
- file_man still crashes :(

Builds will appear shortly.
Title: Re: Lua Scripting (lua.mo)
Post by: tajino on September 10, 2017, 05:10:13 PM
Would it be possible with the current ML lua API to get the current running intervalometer countdown time until the next shot is fired? I know we can get/set interval.time but how to know the time remaining until the next shot is fired.

What I'm trying to accomplish is to resume live view a few user defined seconds before the next interval.time is reached, to allow some time for auto ETTR to do its work. This only applies to shooting simple silent pic with LV power saving turn on. Currently when LV resumes for the next silent pic, there is not enough time for ETTR to work before the silent pic is taken.

Or there is a better way of doing this? Thanks.
Title: Re: Lua Scripting (lua.mo)
Post by: thomasfli on October 16, 2017, 06:19:20 PM
I do not know if this has been reported before, but I tried to use the 2017Sep11.600d102 version and the camera using that, the camera won't even turn on. As soon as the card is plugged in, the SD lamp starts blinking multiple times, pauses, and blinks in the same pattern again.

This definitely is related to this build, since when plugging in a card with a stable version of ML, everything works as it should.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on November 05, 2017, 08:01:33 PM
Small updates:
- fixed 600D (tested in qemu)
- fixed led_blink (https://bitbucket.org/hudson/magic-lantern/issues/2808/lua-led-blink-not-working-as-expected)
- lens.autofocusing (http://www.magiclantern.fm/forum/index.php?topic=20869.0), console.visible (http://www.magiclantern.fm/forum/index.php?topic=20835.msg192547#msg192547), lv.overlays (http://www.magiclantern.fm/forum/index.php?topic=20838.msg192570#msg192570), lv.vidmode (readonly)
- camera.gui (http://www.magiclantern.fm/forum/index.php?topic=19571.msg184894#msg184894).play/menu (rw), play_photo, play_movie, qr, idle (readonly)

Would lv.overlays fit better as camera.gui.lv_overlays instead? (it's related to GUI modes/states, but only applies to LiveView).

To keep the scripting API requests organized, I'd like to remind you there's a dedicated board for them (https://www.magiclantern.fm/forum/index.php?board=64). Feel free to use it.

If you have scripting API requests or suggestions posted elsewhere, please ask a moderator to move them (so we can find them easily when working on Lua).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on November 05, 2017, 08:09:17 PM
@a1ex

Thanks for the fix and the education.  :)

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on November 05, 2017, 10:51:52 PM
Thanks for the new builds. Any reason why 100D is not listed (anymore)? Tx
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 03, 2017, 11:07:59 PM
100D is on the way, just waiting for some recent backends (http://www.magiclantern.fm/forum/index.php?topic=2864.msg190254#msg190254).

Meanwhile, got an important fix on the stdio side (errors should no longer be truncated), a backwards-incompatible change in menu.get (http://www.magiclantern.fm/forum/index.php?topic=21145.0) and also the scripts are now sorted by file name (http://www.magiclantern.fm/forum/index.php?topic=21155) when loading.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 04, 2017, 08:40:35 AM
@a1ex

Just tried the latest Lua-fix branch and all appear OK: thanks.

Have noted one strangeness on the EOSM.

Previously I could clear the ML menu back to Canon with a half shutter press.

If I do that now, nothing happens and I get the red half wheel in the bottom right.

I have to explicitly do a double screen press.

I've changed nothing in the camera.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 04, 2017, 10:03:24 AM
There was no change to menu backend or key handling. Does the issue go away if you just swap in the previous build? Does it happen with the default ML configuration? (no settings changed, no modules loaded). Does it happen with only Lua loaded, and no scripts running in background?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 04, 2017, 10:13:45 AM
@a1ex

Strange, as I said it was on both cameras.

I did a canon reset and problem has gone away.

Could have been a coincidence or my set up.

Let's see if any others report,

All running OK now.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 04, 2017, 10:36:07 AM
BTW: what does that red half wheel mean?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 04, 2017, 11:32:16 AM
It means you can't use the scrollwheel to navigate ML menus (the events would be interpreted as exposure controls by Canon firmware, and ML can't do much about that, as they are handled by another processor (http://www.magiclantern.fm/forum/index.php?topic=17596.0)). On most cameras, that happens when browsing ML menu while recording. On 500D, that also happens in standby (in movie mode).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 04, 2017, 11:41:41 AM
@a1ex

Thanks  :)
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 04, 2017, 02:10:27 PM
@a1ex

BTW on an EOSM with the 11-22mm lens, in the lens locked/transportation mode, you can still access  the ML menu and scroll/access the menu items.

In this configuration pressing the half shutter brings up the red scroll wheel symbol and, of course, doesn't allow you to use the half shutter to exit the ML menu.

Just info, not looking for action.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: Rubencho on December 05, 2017, 03:35:19 PM
Hi,

Having a strange issue. I simply don't have the RAW recording nor the Crop mode option on my camera. I've installed the last Lua update from 3rd of December, for a 5DMIII with a 1.2.3 firmware. They don't appear in the Movie section. Any idea why is not there?

Thanks.
Title: Re: Lua Scripting (lua.mo)
Post by: walter_schulz on December 07, 2017, 01:54:35 PM
Module tab
Title: Re: Lua Scripting (lua.mo)
Post by: vifino on December 15, 2017, 11:24:47 PM
Hi.

I've used one of the previous experimental builds on my 5D2, but now the new experimental build doesn't seem to have a 5D2 option any longer.
Could someone provide a current build or must I build it myself?

Thank you,
vifino.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 16, 2017, 01:36:42 AM
Minor update:
- fixed issue #2821 (https://bitbucket.org/hudson/magic-lantern/issues/2821/green-display) (was affecting all camera models on this branch)
- fixed initialization of some rarely used fields (https://bitbucket.org/hudson/magic-lantern/commits/cd5a40ae0672acfcfa20a7d9b9f4c85dbb735b9e?at=lua_fix) when creating new menus from a script (http://www.magiclantern.fm/forum/index.php?topic=21258.0)
- camera.gui.mode (current Canon dialog, low-level, get/set - wrapper for SetGUIRequestMode / CURRENT_GUI_MODE)
- fixed camera.gui functions on 60D, maybe also on other models (please test)
- 1100D and 5D2 are back (likely a build system issue; not sure if fixed; might come back later on other models)




Call for testers - as lately I've been hunting various bugs on this branch, and noticed some of the changes introduced model-specific issues (for example, api_test.lua was failing on 60D on one of the earliest tests).

For every single camera model available on the Experiments page (lua_fix build), please run:

- api_test.lua (upload the log)
- selftest.mo -> stubs tests (upload the log)
- bench.mo -> memory benchmarks (upload the screenshot)
- overall sanity check (for example, if you decide to take this build out and use it for a couple of hours, please report back)

Reason (don't like to repeat myself, but...): I'd like to merge this into mainline, but I'm unable to test all this stuff myself. Besides the updates to the Lua module, there were significant changes done to ML core, in order to make the Lua API behave in a somewhat sane way (and pass the scripting API tests). That means, these changes may affect every single ML functionality - not just Lua.

Sure, I have made these changes with good intentions (to fix things), but unfortunately each camera model has its own quirks, and this particular branch uncovered a lot of them. I keep discovering broken stuff (that's not broken in regular nightlies) almost every time I play with this branch. Therefore, I need your help to narrow down these issues and be able to merge lua_fix without breaking too much stuff at once.

You may ask - why I'm not running all this stuff in QEMU? The emulation is not exactly good enough to run api_test.lua, though it can already run simpler scripts, but I'm making progress polishing the emulation. There's even a quick start guide (https://bitbucket.org/hudson/magic-lantern/src/qemu/contrib/qemu/#rst-header-running-ml-lua-scripts), although the functionality is quite limited right now.




edit: so far received tests from:
- 600D (irvcobb); status: passed (minor bug found in image_prefix)
- 70D (lojzik, esas); status: autofocus not working (needs investigation), sticky half-shutter not present (minor)
- 650D (walter, esas); autofocus issues; please re-run api_test.lua
- 100D (scherbakoff.dima)
- 6D (Audionut) - bug in image_prefix
- 50D (aprofiti) - mostly OK, screen flickers a lot
- (waiting for others)
Title: Re: Lua Scripting (lua.mo)
Post by: scherbakoff.dima on December 18, 2017, 09:15:39 AM
Quote from: a1ex on December 16, 2017, 01:36:42 AM
- 1100D and 5D2 are back (likely a build system issue; not sure if fixed; might come back later on other models)

100D is missing currently,may be it's affected by build system issue too? If you fix it, can you upload build for 100D of lua-fix, please?

Thanks in advance :)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 18, 2017, 09:43:52 AM
Solved, also for 70D. Any others still missing?

(todo: highlight them on the builds page - it currently just lists all the successfully built zips, but doesn't know to detect missing ones)
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on December 23, 2017, 08:04:23 PM
some test on magiclantern-lua_fix.2017Dec19.70D112
-
(http://thumb.ibb.co/kwrqpm/BENCH1.png) (http://ibb.co/kwrqpm)

- luatest.log: https://drive.google.com/file/d/1kZ870XWBPZXDPBjCNO4v2x6_-mNJbQcj/view?usp=sharing
I recall some assertion error in "console" on display during api_test that is not in log. Is it possible?
- build without selftest.mo


Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 23, 2017, 08:18:16 PM
Will check; not sure if the assertions are saved in the log file, but you should be able to write down the line number (which can be looked up in api_test.lua to find exactly what went wrong). Running this test from default ML settings might help (no other modules loaded or settings changed), although it should tolerate a few variations.

New lua_fix build available, with selftest.mo for 70D and temperature reporting from esas (otherwise identical).
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on December 23, 2017, 09:01:52 PM
magiclantern-lua_fix.2017Dec23.70D112 tests:

logs: https://drive.google.com/drive/folders/1pF8Zv15SLbEOjOE5zEe5z3btghO0IQll?usp=sharing
assertion failed on api_test.lua:464
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 23, 2017, 09:45:32 PM
Tried to reproduce this snippet in QEMU (emulation is not yet good enough to run all the tests), but I've got assert at line 424 instead. Commented it out and the remaining menu tests passed.

In the selftest.log there are a few failed tests, at autofocus routines. Did the camera have something to focus on?
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on December 23, 2017, 10:17:26 PM
I have camera on tripod and with focus is not problem and I have focus beep during failed focus test

sorry, my mistake, I have error on 424 too. If I comment 424, I get assert error on 1208.


Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 23, 2017, 10:26:15 PM
The second error is autofocus related (just like the failed stub tests).

Does it help if you disable continuous AF and manually focus using half-shutter?
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on December 23, 2017, 10:59:36 PM
I don't understand. I have on-shot AF and camera is focused before tests (I test, If focus is possible before tests).
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 23, 2017, 11:26:00 PM
All Canon DSLRs I've tried will wait for you to press the shutter button halfway in order to focus; to my knowledge, the 70D will autofocus continuously (although I've never tried that, so maybe the assumptions I'm using in ML about autofocus may not be valid on this camera).

I hope it's clear from the context (e.g. api_test.lua messages near the error) that we are talking about autofocus in LiveView.

So... if you configure AF in LiveView to behave like on the older models, do these tests pass?
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on December 24, 2017, 12:37:07 AM
luatest - now it's ok, I exceeded timeout for one user interaction, sorry.
stubs test - I have FlexiZone - single, in movie mode, if I disable Servo AF before tests, Servo AF is enabled by itself
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on December 24, 2017, 12:48:45 PM
Quote from: a1ex on December 16, 2017, 01:36:42 AM
Call for testers - as lately I've been hunting various bugs on this branch, and noticed some of the changes introduced model-specific issues (for example, api_test.lua was failing on 60D on one of the earliest tests).

For every single camera model available on the Experiments page (lua_fix build), please run:

- api_test.lua (upload the log)
- selftest.mo -> stubs tests (upload the log)
- bench.mo -> memory benchmarks (upload the screenshot)
- overall sanity check (for example, if you decide to take this build out and use it for a couple of hours, please report back)

650D preliminary
====
http://filehorst.de/d/cbiJgEiI

Used a rather slow card with about 20 MByte/s write and >45 MByte/s read.
Odd observation:
With Global Draw OFF read performance dropped from 43.x to about 38.x. Not what I expected.
No time for field test right now.

Title: Re: Lua Scripting (lua.mo)
Post by: esas on December 24, 2017, 05:22:06 PM
Have beent testing on 70D and 650D. Unfortunately battery died on 70D and can't charge before christmas is over.

On both 70D and 650D it fails focus tests. Best case has been 3 fails on 70D, normally 10-15 fails on both 650D or 70D.

On luatest it fails at 424 on both cameraes. On 650D it also failed once  on 270 (on first attempt, second failed at 424).

Results from 650D:

(http://thumb.ibb.co/fsAMvR/VRAM1.jpg) (http://ibb.co/fsAMvR)

(http://thumb.ibb.co/ig9EFR/VRAM0.jpg) (http://ibb.co/ig9EFR)
.



===============================================================================
ML/SCRIPTS/api_test.lua - 2017-12-24 16:43:30
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "api_test.lua"
camera = table:
  shutter = table:
    raw = 96
    apex = 5
    ms = 31
    value = 0.03125
  aperture = table:
    raw = 40
    apex = 4
    value = 4
    min = table:
      raw = 31
      apex = 2.875
      value = 2.7
    max = table:
      raw = 87
      apex = 9.874999
      value = 30.6
  iso = table:
    raw = 104
    apex = 9
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5200
  mode = 3
  metering_mode = 4
  drive_mode = 0
  model = "Canon EOS 650D"
  model_short = "650D"
  firmware = "1.0.4"
  temperature = 151
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  reboot = function: p
  bulb = function: p
  shoot = function: p
  burst = function: p
  wait = 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:
  hide = function: p
  write = function: p
  clear = function: p
  show = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  pause = function: p
  start = function: p
  resume = function: p
  stop = function: p
  info = function: p
  wait = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  rect = function: p
  clear = function: p
  screenshot = function: p
  off = function: p
  line = function: p
  draw = function: p
  pixel = function: p
  print = function: p
  on = function: p
  load = function: p
  notify_box = function: p
  circle = function: p
key = table:
  last = 10
  press = function: p
  wait = function: p
menu = table:
  visible = false
  open = function: p
  get = function: p
  block = function: p
  new = function: p
  close = function: p
  set = function: p
  select = function: p
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 11
  ms_clock = 11384
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 131072
    drive_letter = "B"
    file_number = 1854
    folder_number = 100
    free_space = 123521024
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    cluster_size = 131072
    drive_letter = "B"
    file_number = 1854
    folder_number = 100
    free_space = 123521024
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    yday = 358
    isdst = false
    sec = 31
    min = 43
    day = 24
    wday = 1
    month = 12
    hour = 16
    year = 2017
  directory = function: p
  call = function: p
  rename = function: p
  remove = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/api_test.lua:36: in function <ML/SCRIPTS/api_test.lua:35>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/api_test.lua:35: in function 'globals.print_table'
ML/SCRIPTS/api_test.lua:81: in function 'globals.generic_tests'
ML/SCRIPTS/api_test.lua:1338: in function 'globals.api_tests'
ML/SCRIPTS/api_test.lua:1364: in main chunktask = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...

===============================================================================
ML/SCRIPTS/api_test.lua - 2017-12-24 16:47:19
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "api_test.lua"
camera = table:
  shutter = table:
    raw = 96
    apex = 5
    ms = 31
    value = 0.03125
  aperture = table:
    raw = 40
    apex = 4
    value = 4
    min = table:
      raw = 31
      apex = 2.875
      value = 2.7
    max = table:
      raw = 87
      apex = 9.874999
      value = 30.6
  iso = table:
    raw = 104
    apex = 9
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5200
  mode = 3
  metering_mode = 4
  drive_mode = 0
  model = "Canon EOS 650D"
  model_short = "650D"
  firmware = "1.0.4"
  temperature = 154
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  bulb = function: p
  reboot = function: p
  burst = function: p
  wait = function: p
  shoot = 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:
  clear = function: p
  write = function: p
  show = function: p
  hide = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  resume = function: p
  pause = function: p
  info = function: p
  start = function: p
  wait = function: p
  stop = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  load = function: p
  rect = function: p
  circle = function: p
  draw = function: p
  clear = function: p
  notify_box = function: p
  off = function: p
  line = function: p
  pixel = function: p
  on = function: p
  screenshot = function: p
  print = function: p
key = table:
  last = 10
  press = function: p
  wait = function: p
menu = table:
  visible = false
  block = function: p
  set = function: p
  new = function: p
  close = function: p
  select = function: p
  get = function: p
  open = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 15
  ms_clock = 15208
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 131072
    drive_letter = "B"
    file_number = 1854
    folder_number = 100
    free_space = 123519872
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 131072
    drive_letter = "B"
    file_number = 1854
    folder_number = 100
    free_space = 123519872
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  date = table:
    day = 24
    month = 12
    sec = 20
    isdst = false
    hour = 16
    wday = 1
    yday = 358
    year = 2017
    min = 47
  directory = function: p
  rename = function: p
  remove = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/api_test.lua:36: in function <ML/SCRIPTS/api_test.lua:35>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/api_test.lua:35: in function 'globals.print_table'
ML/SCRIPTS/api_test.lua:81: in function 'globals.generic_tests'
ML/SCRIPTS/api_test.lua:1338: in function 'globals.api_tests'
ML/SCRIPTS/api_test.lua:1364: in main chunktask = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Start LiveView...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Canon GUI tests completed.

Testing ML menu API...




[Pass] is_play_mode() => 0x1
[Pass] src = fio_malloc(size) => 0x4a28409c
[Pass] dst = fio_malloc(size) => 0x4aa880a8
[Pass] memcmp(dst, src, 4097) => 0xffffffc2
[Pass] edmac_memcpy(dst, src, 4097) => 0x4aa880a8
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x4aa880a8
[Pass] memcmp(dst, src, size) => 0xffffffee
[Pass] edmac_memcpy(dst, src, size) => 0x4aa880a8
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0x6a
[Pass] edmac_memcpy_start(dst, src, size) => 0x4aa880a8
       dt => 0x2949
[Pass] copied => 0x4010d8
[Pass] copied => 0x4010d8
[Pass] copied => 0x4010d8
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0x84
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x7a0274
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x7af
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0x105
[Pass] tries[1] => 0xef
[Pass] tries[2] => 0x115
[Pass] tries[3] => 0xdf
[Pass] failr[0] => 0x94
[Pass] failw[0] => 0xdd
[Pass] failr[1] => 0x63
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xf1
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x14
       times[1] / tries[1] => 0x14
       times[2] / tries[2] => 0x16
       times[3] / tries[3] => 0x16
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[FAIL] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x3
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x407f9bfc
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x3
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x4a28409c
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x3
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xaa1c
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x3
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xaa8e
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x1eeae
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0x129
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xff
[Pass] ABS((get_us_clock_value() - t0) - 110000) => 0x1d0
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x1eeb0
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0x25c
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0x23b
[Pass] ABS((get_us_clock_value() - t0) - 310000) => 0x32d
       t0 = *(uint32_t*)0xC0242014 => 0x1ee
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0x3bc41
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x6
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x1d
       Date/time: 2017/12/24 16:41:29
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x1f
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x20198
[Pass] p = (void*)_malloc(50*1024) => 0x11f668
[Pass] CACHEABLE(p) => 0x11f668
       m1 = MALLOC_FREE_MEMORY => 0x13988
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x20198
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x2f9634
[Pass] p = (void*)_AllocateMemory(256*1024) => 0x7f9bbc
[Pass] CACHEABLE(p) => 0x7f9bbc
       m1 = GetFreeMemForAllocateMemory() => 0x2b9628
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x2f9634
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x20198
       m02 = GetFreeMemForAllocateMemory() => 0x2f9634
[Pass] p = (void*)_alloc_dma_memory(256*1024) => 0x407f9bfc
[Pass] UNCACHEABLE(p) => 0x407f9bfc
[Pass] CACHEABLE(p) => 0x7f9bfc
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x407f9bfc
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(24*1024*1024) => 0x42200068
[Pass] UNCACHEABLE(p) => 0x42200068
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x20198
       m12 = GetFreeMemForAllocateMemory() => 0x2f9634
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
[Pass] suite = shoot_malloc_suite_contig(24*1024*1024) => 0x11f668
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1800000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x11f690
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1800000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42200064
[Pass] UNCACHEABLE(p) => 0x42200064
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0x11f668
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1f44000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x11f690
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1f44000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ddc0064
[Pass] UNCACHEABLE(p) => 0x4ddc0064
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(64*1024*1024) => 0x11f668
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x7
[Pass] suite->size => 0x4000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x11f690
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1738000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4a284088
[Pass] UNCACHEABLE(p) => 0x4a284088
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f6f0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3534000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42200064
[Pass] UNCACHEABLE(p) => 0x42200064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f728
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3934000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x419ff0a4
[Pass] UNCACHEABLE(p) => 0x419ff0a4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f760
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3a0c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x49f240e4
[Pass] UNCACHEABLE(p) => 0x49f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f798
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3ae4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x47f240e4
[Pass] UNCACHEABLE(p) => 0x47f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f7d0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3bbc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x45f240e4
[Pass] UNCACHEABLE(p) => 0x45f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f808
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ddc0064
[Pass] UNCACHEABLE(p) => 0x4ddc0064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x4000000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0x11f668
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x7
[Pass] suite->size => 0x5b00000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x11f690
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1738000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4a284088
[Pass] UNCACHEABLE(p) => 0x4a284088
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f6f0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3534000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42200064
[Pass] UNCACHEABLE(p) => 0x42200064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f728
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3934000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x419ff0a4
[Pass] UNCACHEABLE(p) => 0x419ff0a4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f760
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3a0c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x49f240e4
[Pass] UNCACHEABLE(p) => 0x49f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f798
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3ae4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x47f240e4
[Pass] UNCACHEABLE(p) => 0x47f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f7d0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3bbc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x45f240e4
[Pass] UNCACHEABLE(p) => 0x45f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x11f808
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x5b00000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ddc0064
[Pass] UNCACHEABLE(p) => 0x4ddc0064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x5b00000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x1b3c9c
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x1b3c80
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x1b3c60
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0xc00600ac
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] task_max => 0x68
[Pass] task_max => 0x68
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0xc00800b2
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0xc00a024e
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0xc00c00c2
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[FAIL] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
=========================================================
Test complete, 12167 passed, 12 failed.
.

Title: Re: Lua Scripting (lua.mo)
Post by: scherbakoff.dima on December 26, 2017, 11:04:26 AM
I've just run tests on 100D/SL1. Test 19.12 build for some hours of shooting with extensive use of ML photo pictures -- everything is OK for me. Cannot say anything about video because I don't shoot it.

I've got great stuck after stub tests run. Red card light didn't stop after some minutes after pushing switch to off state. Had to remove battery to get camera reboot. Reboot was a bit longer than usual. Currently ML is running normally.

p.s. Compared stub log to last poster's one -- looks like mine hanged abnormally. How can I help to debug it? I'm not able to build ML myself because my big and heavy laptop is at university's dormitory and lacks proper internet connection (biggest university at Ural thinks that students don't need stable internet access  :D ).

UPD reason: fixed small typo



===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2017-12-21 20:19:35
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 0
    apex = -7.
    ms = 0
    value = 0
  aperture = table:
    raw = 40
    apex = 4
    value = 4
    min = table:
      raw = 40
      apex = 4
      value = 4
    max = table:
      raw = 80
      apex = 9
      value = 22.6
  iso = table:
    raw = 0
    apex = 0
    value = 0
  ec = table:
    raw = 5
    value = 0.624999
  flash_ec = table:
    raw = -11
    value = -1.375
  kelvin = 6400
  mode = 2
  metering_mode = 3
  drive_mode = 1
  model = "Canon EOS 100D"
  model_short = "100D"
  firmware = "1.0.1"
  temperature = 153
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  wait = function: p
  reboot = function: p
  bulb = function: p
  burst = function: p
  shoot = 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:
  show = function: p
  write = function: p
  clear = function: p
  hide = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  pause = function: p
  start = function: p
  resume = function: p
  info = function: p
  wait = function: p
  stop = function: p
lens = table:
  name = "EF-S55-250mm f/4-5.6 IS STM"
  focal_length = 0
  focus_distance = 90
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
  autofocus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  off = function: p
  pixel = function: p
  clear = function: p
  notify_box = function: p
  on = function: p
  circle = function: p
  screenshot = function: p
  load = function: p
  draw = function: p
  rect = function: p
  line = function: p
  print = function: p
key = table:
  last = 10
  press = function: p
  wait = function: p
menu = table:
  visible = false
  set = function: p
  select = function: p
  block = function: p
  get = function: p
  close = function: p
  new = function: p
  open = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 63
  ms_clock = 63676
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 303
    folder_number = 100
    free_space = 7248608
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 303
    folder_number = 100
    free_space = 7248608
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    year = 2017
    min = 19
    day = 21
    hour = 20
    wday = 5
    yday = 355
    sec = 36
    isdst = false
    month = 12
  remove = function: p
  rename = function: p
  directory = function: p
  call = function: p
interval = table:
  time = 1
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:36: in function <ML/SCRIPTS/API_TEST.LUA:35>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:35: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:81: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1338: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1364: in main chunktask = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2017-12-26 12:42:42
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 0
    apex = -7.
    ms = 0
    value = 0
  aperture = table:
    raw = 40
    apex = 4
    value = 4
    min = table:
      raw = 40
      apex = 4
      value = 4
    max = table:
      raw = 80
      apex = 9
      value = 22.6
  iso = table:
    raw = 0
    apex = 0
    value = 0
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 16
    value = 2
  kelvin = 6400
  mode = 2
  metering_mode = 1
  drive_mode = 1
  model = "Canon EOS 100D"
  model_short = "100D"
  firmware = "1.0.1"
  temperature = 160
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  wait = function: p
  shoot = function: p
  reboot = function: p
  bulb = function: p
  burst = 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:
  show = function: p
  hide = function: p
  clear = function: p
  write = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  wait = function: p
  start = function: p
  stop = function: p
  info = function: p
  pause = function: p
  resume = function: p
lens = table:
  name = "EF-S55-250mm f/4-5.6 IS STM"
  focal_length = 0
  focus_distance = 90
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  off = function: p
  draw = function: p
  clear = function: p
  notify_box = function: p
  rect = function: p
  pixel = function: p
  load = function: p
  on = function: p
  line = function: p
  screenshot = function: p
  print = function: p
  circle = function: p
key = table:
  last = 10
  press = function: p
  wait = function: p
menu = table:
  visible = false
  get = function: p
  new = function: p
  close = function: p
  set = function: p
  select = function: p
  open = function: p
  block = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 29
  ms_clock = 29363
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 482
    folder_number = 100
    free_space = 5351136
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 482
    folder_number = 100
    free_space = 5351136
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  date = table:
    isdst = false
    month = 12
    year = 2017
    sec = 43
    min = 42
    yday = 360
    wday = 3
    hour = 12
    day = 26
  directory = function: p
  call = function: p
  rename = function: p
  remove = function: p
interval = table:
  time = 1
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:36: in function <ML/SCRIPTS/API_TEST.LUA:35>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:35: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:81: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1338: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1364: in main chunktask = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Canon GUI tests completed.

Testing ML menu API...



[Pass] is_play_mode() => 0x1
[Pass] src = fio_malloc(size) => 0x4a8240a8
[Pass] dst = fio_malloc(size) => 0x4b0280b4
[Pass] memcmp(dst, src, 4097) => 0xdb
[Pass] edmac_memcpy(dst, src, 4097) => 0x4b0280b4
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x4b0280b4
[Pass] memcmp(dst, src, size) => 0x5d
[Pass] edmac_memcpy(dst, src, size) => 0x4b0280b4
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0xffffff7f
[Pass] edmac_memcpy_start(dst, src, size) => 0x4b0280b4
       dt => 0x28e5
[Pass] copied => 0x40144c
[Pass] copied => 0x40144c
[Pass] copied => 0x40144c
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0x12
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0xeedf8
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0xdcf
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0xf2
[Pass] tries[1] => 0x102
[Pass] tries[2] => 0x10a
[Pass] tries[3] => 0xea
[Pass] failr[0] => 0x6d
[Pass] failw[0] => 0xb2
[Pass] failr[1] => 0x71
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xb1
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x23
       times[1] / tries[1] => 0x23
       times[2] / tries[2] => 0x25
       times[3] / tries[3] => 0x26
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x3
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x40826a44
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x3
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x4a8240a8
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x3
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xdd54
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x1
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xddb4
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x32efc
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0x123
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0x104
[Pass] ABS((get_us_clock_value() - t0) - 110000) => 0x47
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x32efe
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0xcc
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0xad
[Pass] ABS((get_us_clock_value() - t0) - 310000) => 0x5f
       t0 = *(uint32_t*)0xC0242014 => 0x5e30f
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0x9af7c
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x2
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x32
       Date/time: 2017/12/26 12:35:50
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x33
[Pass] MOD(s1-s0, 60) => 0x1
[Pass] MOD(s1-s0, 60) => 0x1
       m0 = MALLOC_FREE_MEMORY => 0x84b40
[Pass] p = (void*)_malloc(50*1024) => 0xfc628
[Pass] CACHEABLE(p) => 0xfc628
       m1 = MALLOC_FREE_MEMORY => 0x78330
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x84b40
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x216298
[Pass] p = (void*)_AllocateMemory(256*1024) => 0xaa81c0
[Pass] CACHEABLE(p) => 0xaa81c0
       m1 = GetFreeMemForAllocateMemory() => 0x1d628c
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x2162f8
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x60
       m01 = MALLOC_FREE_MEMORY => 0x84b40
       m02 = GetFreeMemForAllocateMemory() => 0x2162f8
[Pass] p = (void*)_alloc_dma_memory(256*1024) => 0x40aa8200
[Pass] UNCACHEABLE(p) => 0x40aa8200
[Pass] CACHEABLE(p) => 0xaa8200
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40aa8200
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(24*1024*1024) => 0x42200068
[Pass] UNCACHEABLE(p) => 0x42200068
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x84b40
       m12 = GetFreeMemForAllocateMemory() => 0x2162f8
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0



(http://thumb.ibb.co/kbdium/BENCH1.png) (http://ibb.co/kbdium)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 20, 2018, 10:56:46 PM
Updates:

- fixed issue #2824 (https://bitbucket.org/hudson/magic-lantern/issues/2824/wrong-rapresentation-of-decimal-numbers-in) (decimal number precision when printing; thanks dmilligan and aprofiti)
- all models now have the Sticky HalfShutter feature (the assertion at 424 was just a reminder for that); after understanding how it works (http://www.magiclantern.fm/forum/index.php?topic=17596.0), I see no reason why these wouldn't work on all models, but they are untested; please report back
- all models except EOS M have the Sticky DOF feature (same as above; EOS M doesn't have a DOF button)
- I could verify a large part of api_test.lua in QEMU (http://www.magiclantern.fm/forum/index.php?topic=2864.msg195347#msg195347)
- DOF info fix from garry23 (mostly untested, sorry)
- yet another series of menu refactors and cleanups
- included some updates on auto bracketing (http://www.magiclantern.fm/forum/index.php?topic=21428) and silent pictures (https://www.magiclantern.fm/forum/index.php?topic=12523.msg196174#msg196174) (not exactly related to Lua)

Call for testers (http://www.magiclantern.fm/forum/index.php?topic=14828.msg194706#msg194706) still valid (got reports for 4 camera models out of 16...)

If autofocus still fails, make sure the camera has something to lock focus on, and try disabling any sort of continuous AF you might have enabled in Canon menu. If it still doesn't work, that would require somebody who owns the troublesome camera to take a closer look.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 21, 2018, 09:49:55 AM
@a1ex

Thanks for the new Lua experimental build.

Had a very quick look on my 5D3 this morning and things look good, i.e.dofs look ok and auto bracketing seems 'better'.

Once again cheers.

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 21, 2018, 11:52:52 AM
@a1ex

BTW is there a reason that, when auto bracketing, the process doesn't return to a 'normal' (liewview) screen view: Rather it stops at the 'last image taken' review screen, which I can clear with a half-shutter.

My Canon review is set to off.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 21, 2018, 12:28:12 PM
Yes, it goes to PLAY mode to look at the last image. If you set the review to 2 seconds, it won't have to do that any more.

BTW, raw-based tools (such as Auto ETTR) are not able to use that trick, because the raw data is not available in PLAY mode (only in QuickReview).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on January 21, 2018, 12:32:34 PM
That did it  :)

Thanks for the insight.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on January 21, 2018, 08:01:46 PM
650D:
HS: LV for more than 30 minutes, check!
DOF: Weird things happening with FRSP and sticky set. Hitting DOF preview button takes a pic, sometimes with "RAW error" message. Which info can I provide helping you hunting this one down?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 21, 2018, 08:10:59 PM
That one is likely hard to fix - the DOF button also sends half-shutter events. Will check later, but I expect similar behavior on all models.
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on January 21, 2018, 09:54:14 PM
Confirmed, same DOF issue with 7D. Haven't been able to get a single FRSP with 7D because "Raw error" happening all the time.

Another question btw: DOF sticky is not persistent. Gone after taking a pic. I suppose this is intentional but it would really be convinient to have this option persistent for macro focus stacking/intervalometer together with FRSP.
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on January 27, 2018, 07:49:31 PM
70D
magiclantern-lua_fix.2018Jan20.70D112
STUBTEST.LOG
[Pass] is_play_mode() => 0x1
[Pass] src = fio_malloc(size) => 0x424100a8
[Pass] dst = fio_malloc(size) => 0x42c140b4
[Pass] memcmp(dst, src, 4097) => 0x6b
[Pass] edmac_memcpy(dst, src, 4097) => 0x42c140b4
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x42c140b4
[Pass] memcmp(dst, src, size) => 0x8f
[Pass] edmac_memcpy(dst, src, size) => 0x42c140b4
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0xffffffae
[Pass] edmac_memcpy_start(dst, src, size) => 0x42c140b4
       dt => 0x16e4
[Pass] copied => 0x40114c
[Pass] copied => 0x40114c
[Pass] copied => 0x40114c
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0x77
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x1269f0
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x980
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0xdc
[Pass] tries[1] => 0x10b
[Pass] tries[2] => 0x117
[Pass] tries[3] => 0xea
[Pass] failr[0] => 0x68
[Pass] failw[0] => 0x89
[Pass] failr[1] => 0x68
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xbe
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x30
       times[1] / tries[1] => 0x2f
       times[2] / tries[2] => 0x3d
       times[3] / tries[3] => 0x32
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x6
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x40933c18
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x6
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x424100a8
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x6
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xac94
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x5
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xacfa
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x38b3c
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0xed
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xd2
[Pass] ABS((get_us_clock_value() - t0) - 110000) => 0x345
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x38b3e
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0x3be
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0x3a0
[Pass] ABS((get_us_clock_value() - t0) - 310000) => 0x36a
       t0 = *(uint32_t*)0xC0242014 => 0x26e86
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0x61f5e
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x9
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0xa
       Date/time: 2018/01/27 18:56:10
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0xc
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x37940
[Pass] p = (void*)_malloc(50*1024) => 0x128730
[Pass] CACHEABLE(p) => 0x128730
       m1 = MALLOC_FREE_MEMORY => 0x2b130
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x37940
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x257b10
[Pass] p = (void*)_AllocateMemory(256*1024) => 0x933bd8
[Pass] CACHEABLE(p) => 0x933bd8
       m1 = GetFreeMemForAllocateMemory() => 0x217b04
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x257b10
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x37940
       m02 = GetFreeMemForAllocateMemory() => 0x257b10
[Pass] p = (void*)_alloc_dma_memory(256*1024) => 0x40933c18
[Pass] UNCACHEABLE(p) => 0x40933c18
[Pass] CACHEABLE(p) => 0x933c18
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40933c18
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(24*1024*1024) => 0x42410098
[Pass] UNCACHEABLE(p) => 0x42410098
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x37940
       m12 = GetFreeMemForAllocateMemory() => 0x257b10
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
[Pass] suite = shoot_malloc_suite_contig(24*1024*1024) => 0x125120
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1800000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x125148
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1800000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42410094
[Pass] UNCACHEABLE(p) => 0x42410094
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0x125120
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x2000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x125148
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48c00064
[Pass] UNCACHEABLE(p) => 0x48c00064
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(64*1024*1024) => 0x125120
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x3
[Pass] suite->size => 0x4000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x125148
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1f00000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42410094
[Pass] UNCACHEABLE(p) => 0x42410094
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1251a8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3f00000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48c00064
[Pass] UNCACHEABLE(p) => 0x48c00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1251e0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ac00070
[Pass] UNCACHEABLE(p) => 0x4ac00070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x4000000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0x125120
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x13
[Pass] suite->size => 0xf300000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x125148
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1f00000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42410094
[Pass] UNCACHEABLE(p) => 0x42410094
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1251a8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3f00000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48c00064
[Pass] UNCACHEABLE(p) => 0x48c00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1251e0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4214000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ac00070
[Pass] UNCACHEABLE(p) => 0x4ac00070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125218
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x42fc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48b140e4
[Pass] UNCACHEABLE(p) => 0x48b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125250
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x43e4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x467140e4
[Pass] UNCACHEABLE(p) => 0x467140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125288
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x44cc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c9140e4
[Pass] UNCACHEABLE(p) => 0x5c9140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1252c0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x45b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a5140e4
[Pass] UNCACHEABLE(p) => 0x5a5140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1252f8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x469c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x581140e4
[Pass] UNCACHEABLE(p) => 0x581140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125330
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4784000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4af140e4
[Pass] UNCACHEABLE(p) => 0x4af140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125368
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x486c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x443140e4
[Pass] UNCACHEABLE(p) => 0x443140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1253a0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x686c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55e00064
[Pass] UNCACHEABLE(p) => 0x55e00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1253d8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x6b80000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x57e00070
[Pass] UNCACHEABLE(p) => 0x57e00070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125410
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x8b80000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x58200064
[Pass] UNCACHEABLE(p) => 0x58200064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125448
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x8e94000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a200070
[Pass] UNCACHEABLE(p) => 0x5a200070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125480
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xae94000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a600064
[Pass] UNCACHEABLE(p) => 0x5a600064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1254b8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb1a8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c600070
[Pass] UNCACHEABLE(p) => 0x5c600070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1254f0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xd1a8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x44400064
[Pass] UNCACHEABLE(p) => 0x44400064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125528
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xd4bc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x46400070
[Pass] UNCACHEABLE(p) => 0x46400070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125560
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xf300000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x46800064
[Pass] UNCACHEABLE(p) => 0x46800064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0xf300000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x1ec2bc
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x1ec2a0
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x1ec280
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0xdeda00f0
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] task_max => 0x84
[Pass] task_max => 0x84
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0xdedc00c8
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0xdede025e
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0xdee000f2
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x1
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
=========================================================
Test complete, 12809 passed, 10 failed.
.


LUATEST.LOG
===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-1-27 19:25:29
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 75
    apex = 2.375
    ms = 193
    value = 0.192776
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 80
      apex = 9.
      value = 22.6
  iso = table:
    raw = 104
    apex = 9.
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 6400
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 70D"
  model_short = "70D"
  firmware = "1.1.2"
  temperature = 161
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  reboot = function: p
  burst = function: p
  bulb = function: p
  wait = function: p
  shoot = 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 = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  resume = function: p
  pause = function: p
  stop = function: p
  wait = function: p
  start = function: p
  info = function: p
lens = table:
  name = "EF-S24mm f/2.8 STM"
  focal_length = 0
  focus_distance = 90
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
  autofocus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  on = function: p
  line = function: p
  rect = function: p
  load = function: p
  clear = function: p
  pixel = function: p
  screenshot = function: p
  draw = function: p
  circle = function: p
  notify_box = function: p
  off = function: p
  print = function: p
key = table:
  last = 10
  press = function: p
  wait = function: p
menu = table:
  visible = false
  get = function: p
  select = function: p
  new = function: p
  set = function: p
  block = function: p
  open = function: p
  close = function: p
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 9
  ms_clock = 9957
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 4622
    folder_number = 100
    free_space = 14272384
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 4622
    folder_number = 100
    free_space = 14272384
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    day = 27
    month = 1
    sec = 30
    yday = 27
    min = 25
    isdst = false
    hour = 19
    year = 2018
    wday = 7
  directory = function: p
  rename = function: p
  call = function: p
  remove = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
  level = 56
  id = 1
  performance = 0
  time = nil
  drain_rate = 18
task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_4623.CR2: 27560045
B:/DCIM/100CANON/IMG_4623.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
B:/DCIM/100CANON/ABC_4624.CR2: 27558742
B:/DCIM/100CANON/ABC_4624.JPG not found.
B:/DCIM/100CANON/ABC_4625.CR2: 27568768
B:/DCIM/100CANON/ABC_4625.JPG not found.
Bracketed pictures...
B:/DCIM/100CANON/IMG_4626.CR2: 25058480
B:/DCIM/100CANON/IMG_4626.JPG not found.
B:/DCIM/100CANON/IMG_4627.CR2: 27565028
B:/DCIM/100CANON/IMG_4627.JPG not found.
B:/DCIM/100CANON/IMG_4628.CR2: 23739077
B:/DCIM/100CANON/IMG_4628.JPG not found.
Bulb picture...
Elapsed time: 13248
B:/DCIM/100CANON/IMG_4629.CR2: 14612305
B:/DCIM/100CANON/IMG_4629.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
Half-shutter test OK.

Testing module 'lv'...
LiveView is running; stopping...
Starting LiveView...
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: ML
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Setting zoom to x1...
Setting zoom to x5...
Setting zoom to x10...
Setting zoom to x5...
Setting zoom to x1...
Setting zoom to x10...
Setting zoom to x1...
Pausing LiveView...
Resuming LiveView...
Stopping LiveView...
LiveView tests completed.


Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 6310
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
19...18...17...16...15...Autofocus triggered.
Autofocus completed.
Focus distance: 1630
Focusing backward...
Focus distance: 655350
Focus motor position: 1824
Focusing forward with step size 3, wait=true...
...................
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 3, wait=true...
.....................
Focus distance: 655350
Focus motor position: 1824
Focus range: 19 steps forward, 21 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 3, wait=false...
.............................................
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 3, wait=false...
................................................
Focus distance: 960
Focus motor position: 1569
Focus range: 45 steps forward, 48 steps backward.
Motor steps: 1534 forward, 1279 backward, 255 lost.
Focusing forward with step size 2, wait=true...
...
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 2, wait=true...
...
Focus distance: 655350
Focus motor position: 1824
Focus range: 128 steps forward, 127 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 2, wait=false...
...
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 2, wait=false...
...
Focus distance: 655350
Focus motor position: 1824
Focus range: 154 steps forward, 152 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 1, wait=true...
...
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 1, wait=true...
...
Focus distance: 655350
Focus motor position: 1824
Focus range: 456 steps forward, 456 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 1, wait=false...
...
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 1, wait=false...
...
Focus distance: 655350
Focus motor position: 1824
Focus range: 464 steps forward, 467 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.

Focus test completed.

Testing exposure settings...
Camera    : Canon EOS 70D (70D) 1.1.2
Lens      : EF-S24mm f/2.8 STM
Shoot mode: 3
Shutter   : ,5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : 2.8 (raw 32, f/2.8, apex 3.)
Av range  : 2.8..22 (raw 32..80, f/2.8..f/22.6, apex 3...9.)
ISO       : €1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
Setting aperture to random values...
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.
Movie recording tests completed.

Done! 


memory benchmark: https://photos.app.goo.gl/jj2UPSj8ZxCmAaAA2
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on January 30, 2018, 12:35:22 PM
70D
magiclantern-lua_fix.2018Jan30.70D112 test

stubtest.log
[Pass] is_play_mode() => 0x1
[Pass] src = fio_malloc(size) => 0x42104084
[Pass] dst = fio_malloc(size) => 0x42908090
[Pass] memcmp(dst, src, 4097) => 0x7d
[Pass] edmac_memcpy(dst, src, 4097) => 0x42908090
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x42908090
[Pass] memcmp(dst, src, size) => 0x3
[Pass] edmac_memcpy(dst, src, size) => 0x42908090
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0x29
[Pass] edmac_memcpy_start(dst, src, size) => 0x42908090
       dt => 0x182b
[Pass] copied => 0x401870
[Pass] copied => 0x401870
[Pass] copied => 0x401870
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0xffffffba
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x1266a8
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x12c0
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0xf8
[Pass] tries[1] => 0xf4
[Pass] tries[2] => 0xf4
[Pass] tries[3] => 0x108
[Pass] failr[0] => 0x75
[Pass] failw[0] => 0xa0
[Pass] failr[1] => 0x6a
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xb0
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x2c
       times[1] / tries[1] => 0x31
       times[2] / tries[2] => 0x2d
       times[3] / tries[3] => 0x2d
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x6
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x40933b10
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x6
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x42104084
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x6
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xa90e
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x2
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xa96e
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x2d310
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0xf2
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xd5
[Pass] ABS((get_us_clock_value() - t0) - 110000) => 0xa6
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x2d312
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0x11b
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0xfc
[Pass] ABS((get_us_clock_value() - t0) - 310000) => 0xb0
       t0 = *(uint32_t*)0xC0242014 => 0x69452
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0xa4c72
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x7
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x1c
       Date/time: 2018/01/30 12:08:28
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x1e
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x37b20
[Pass] p = (void*)_malloc(50*1024) => 0x1283e8
[Pass] CACHEABLE(p) => 0x1283e8
       m1 = MALLOC_FREE_MEMORY => 0x2b310
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x37b20
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x257be0
[Pass] p = (void*)_AllocateMemory(256*1024) => 0x933ad0
[Pass] CACHEABLE(p) => 0x933ad0
       m1 = GetFreeMemForAllocateMemory() => 0x217bd4
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x257be0
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x37b20
       m02 = GetFreeMemForAllocateMemory() => 0x257be0
[Pass] p = (void*)_alloc_dma_memory(256*1024) => 0x40933b10
[Pass] UNCACHEABLE(p) => 0x40933b10
[Pass] CACHEABLE(p) => 0x933b10
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40933b10
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(24*1024*1024) => 0x42104074
[Pass] UNCACHEABLE(p) => 0x42104074
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x37b20
       m12 = GetFreeMemForAllocateMemory() => 0x257b80
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x60
[Pass] suite = shoot_malloc_suite_contig(24*1024*1024) => 0x125160
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1800000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x125188
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1800000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0x125160
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x2000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x125188
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(64*1024*1024) => 0x125160
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0xa
[Pass] suite->size => 0x4000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x125188
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1251e8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x220c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4410407c
[Pass] UNCACHEABLE(p) => 0x4410407c
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125220
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x22f4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48b140e4
[Pass] UNCACHEABLE(p) => 0x48b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125258
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x23dc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x467140e4
[Pass] UNCACHEABLE(p) => 0x467140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125290
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x24c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c9140e4
[Pass] UNCACHEABLE(p) => 0x5c9140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1252c8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x25ac000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a5140e4
[Pass] UNCACHEABLE(p) => 0x5a5140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125300
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2694000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x581140e4
[Pass] UNCACHEABLE(p) => 0x581140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125338
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x277c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4af140e4
[Pass] UNCACHEABLE(p) => 0x4af140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125370
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2864000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x443140e4
[Pass] UNCACHEABLE(p) => 0x443140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1253a8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48c00064
[Pass] UNCACHEABLE(p) => 0x48c00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x4000000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0x125160
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x14
[Pass] suite->size => 0xf700000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x125188
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1251e8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x220c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4410407c
[Pass] UNCACHEABLE(p) => 0x4410407c
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125220
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x22f4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48b140e4
[Pass] UNCACHEABLE(p) => 0x48b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125258
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x23dc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x467140e4
[Pass] UNCACHEABLE(p) => 0x467140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125290
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x24c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c9140e4
[Pass] UNCACHEABLE(p) => 0x5c9140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1252c8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x25ac000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a5140e4
[Pass] UNCACHEABLE(p) => 0x5a5140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125300
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2694000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x581140e4
[Pass] UNCACHEABLE(p) => 0x581140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125338
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x277c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4af140e4
[Pass] UNCACHEABLE(p) => 0x4af140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125370
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2864000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x443140e4
[Pass] UNCACHEABLE(p) => 0x443140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1253a8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4864000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48c00064
[Pass] UNCACHEABLE(p) => 0x48c00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1253e0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4b78000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ac00070
[Pass] UNCACHEABLE(p) => 0x4ac00070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125418
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x6b78000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55e00064
[Pass] UNCACHEABLE(p) => 0x55e00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125450
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x6e8c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x57e00070
[Pass] UNCACHEABLE(p) => 0x57e00070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125488
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x8e8c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x58200064
[Pass] UNCACHEABLE(p) => 0x58200064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1254c0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x91a0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a200070
[Pass] UNCACHEABLE(p) => 0x5a200070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1254f8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb1a0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a600064
[Pass] UNCACHEABLE(p) => 0x5a600064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125530
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb4b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c600070
[Pass] UNCACHEABLE(p) => 0x5c600070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x125568
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xd4b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x44400064
[Pass] UNCACHEABLE(p) => 0x44400064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1255a0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xd7c8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x46400070
[Pass] UNCACHEABLE(p) => 0x46400070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1255d8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xf700000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x46800064
[Pass] UNCACHEABLE(p) => 0x46800064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0xf700000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x1ebeb4
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x1ebe80
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x1ebe60
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0xdacc00ee
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] task_max => 0x84
[Pass] task_max => 0x84
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0xdace00c6
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0xdad00308
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0xdad200de
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x1
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
=========================================================
Test complete, 13449 passed, 10 failed.
.


luatest.log
2 tests (problem in first test -> restart)
===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-1-30 12:12:52
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 0
    apex = -7.
    ms = 0
    value = 0
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 80
      apex = 9.
      value = 22.6
  iso = table:
    raw = 109
    apex = 9.625
    value = 2500
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 6400
  mode = 2
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 70D"
  model_short = "70D"
  firmware = "1.1.2"
  temperature = 166
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  reboot = function: p
  wait = function: p
  bulb = function: p
  burst = function: p
  shoot = 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 = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  info = function: p
  wait = function: p
  start = function: p
  resume = function: p
  stop = function: p
  pause = function: p
lens = table:
  name = "EF-S24mm f/2.8 STM"
  focal_length = 24
  focus_distance = 510
  hyperfocal = 10875
  dof_near = 491
  dof_far = 530
  af = true
  af_mode = 0
  focus = function: p
  autofocus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  on = function: p
  clear = function: p
  rect = function: p
  print = function: p
  line = function: p
  draw = function: p
  circle = function: p
  pixel = function: p
  off = function: p
  load = function: p
  screenshot = function: p
  notify_box = function: p
key = table:
  last = 10
  wait = function: p
  press = function: p
menu = table:
  visible = false
  new = function: p
  block = function: p
  get = function: p
  select = function: p
  close = function: p
  set = function: p
  open = function: p
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 143
  ms_clock = 143540
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 4639
    folder_number = 100
    free_space = 15569184
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 4639
    folder_number = 100
    free_space = 15569184
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  date = table:
    year = 2018
    isdst = false
    sec = 53
    day = 30
    wday = 3
    yday = 30
    min = 12
    month = 1
    hour = 12
  directory = function: p
  remove = function: p
  rename = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
  level = 35
  id = 1
  performance = 0
  time = nil
  drain_rate = 20
task = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Please switch to M mode.
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_4640.CR2: 28472807
B:/DCIM/100CANON/IMG_4640.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
B:/DCIM/100CANON/ABC_4641.CR2: 28475751
B:/DCIM/100CANON/ABC_4641.JPG not found.
B:/DCIM/100CANON/ABC_4642.CR2: 28475684
B:/DCIM/100CANON/ABC_4642.JPG not found.
Bracketed pictures...
B:/DCIM/100CANON/IMG_4643.CR2: 25995871
B:/DCIM/100CANON/IMG_4643.JPG not found.
B:/DCIM/100CANON/IMG_4644.CR2: 28478890
B:/DCIM/100CANON/IMG_4644.JPG not found.
B:/DCIM/100CANON/IMG_4645.CR2: 19046998
B:/DCIM/100CANON/IMG_4645.JPG not found.
Bulb picture...
Elapsed time: 13090
B:/DCIM/100CANON/IMG_4646.CR2: 14474791
B:/DCIM/100CANON/IMG_4646.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Main task yielding.
Task C started.
Task C finished.

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-1-30 12:22:20
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 75
    apex = 2.375
    ms = 193
    value = 0.192776
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 80
      apex = 9.
      value = 22.6
  iso = table:
    raw = 104
    apex = 9.
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 6400
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 70D"
  model_short = "70D"
  firmware = "1.1.2"
  temperature = 185
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  wait = function: p
  bulb = function: p
  reboot = function: p
  burst = function: p
  shoot = 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:
  hide = function: p
  write = function: p
  clear = function: p
  show = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  pause = function: p
  resume = function: p
  info = function: p
  wait = function: p
  start = function: p
  stop = function: p
lens = table:
  name = "EF-S24mm f/2.8 STM"
  focal_length = 0
  focus_distance = 90
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  on = function: p
  line = function: p
  pixel = function: p
  load = function: p
  rect = function: p
  off = function: p
  circle = function: p
  draw = function: p
  notify_box = function: p
  print = function: p
  screenshot = function: p
  clear = function: p
key = table:
  last = 10
  wait = function: p
  press = function: p
menu = table:
  visible = false
  open = function: p
  get = function: p
  close = function: p
  new = function: p
  set = function: p
  block = function: p
  select = function: p
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 17
  ms_clock = 17424
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 4646
    folder_number = 100
    free_space = 15399648
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 4646
    folder_number = 100
    free_space = 15399648
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    year = 2018
    day = 30
    wday = 3
    isdst = false
    yday = 30
    min = 22
    hour = 12
    month = 1
    sec = 21
  directory = function: p
  rename = function: p
  remove = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
  level = 29
  id = 1
  performance = 0
  time = nil
  drain_rate = 52
task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_4647.CR2: 27102597
B:/DCIM/100CANON/IMG_4647.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
B:/DCIM/100CANON/ABC_4648.CR2: 27100107
B:/DCIM/100CANON/ABC_4648.JPG not found.
B:/DCIM/100CANON/ABC_4649.CR2: 27095704
B:/DCIM/100CANON/ABC_4649.JPG not found.
Bracketed pictures...
B:/DCIM/100CANON/IMG_4650.CR2: 25252101
B:/DCIM/100CANON/IMG_4650.JPG not found.
B:/DCIM/100CANON/IMG_4651.CR2: 27074924
B:/DCIM/100CANON/IMG_4651.JPG not found.
B:/DCIM/100CANON/IMG_4652.CR2: 18521940
B:/DCIM/100CANON/IMG_4652.JPG not found.
Bulb picture...
Elapsed time: 12664
B:/DCIM/100CANON/IMG_4653.CR2: 14477602
B:/DCIM/100CANON/IMG_4653.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
Half-shutter test OK.

Testing module 'lv'...
Starting LiveView...
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: ML
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: ML
Setting zoom to x1...
Setting zoom to x5...
Setting zoom to x10...
Setting zoom to x5...
Setting zoom to x1...
Setting zoom to x10...
Setting zoom to x1...
Pausing LiveView...
Resuming LiveView...
Stopping LiveView...
LiveView tests completed.


Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 510
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
19...18...17...16...15...14...13...12...Autofocus triggered.
Autofocus completed.
Focus distance: 410
Focusing backward...
Focus distance: 655350
Focus motor position: 1824
Focusing forward with step size 3, wait=true...
....................
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 3, wait=true...
...................
Focus distance: 655350
Focus motor position: 1824
Focus range: 20 steps forward, 19 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 3, wait=false...
...............................................
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 3, wait=false...
................................................
Focus distance: 655350
Focus motor position: 1824
Focus range: 47 steps forward, 48 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 2, wait=true...
...
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 2, wait=true...
...
Focus distance: 655350
Focus motor position: 1824
Focus range: 128 steps forward, 127 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 2, wait=false...
...
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 2, wait=false...
...
Focus distance: 655350
Focus motor position: 1824
Focus range: 152 steps forward, 150 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 1, wait=true...
...
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 1, wait=true...
...
Focus distance: 655350
Focus motor position: 1824
Focus range: 457 steps forward, 457 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.
Focusing forward with step size 1, wait=false...
...
Focus distance: 160
Focus motor position: 290
Focusing backward with step size 1, wait=false...
...
Focus distance: 655350
Focus motor position: 1824
Focus range: 469 steps forward, 470 steps backward.
Motor steps: 1534 forward, 1534 backward, 0 lost.

Focus test completed.

Testing exposure settings...
Camera    : Canon EOS 70D (70D) 1.1.2
Lens      : EF-S24mm f/2.8 STM
Shoot mode: 3
Shutter   : ,5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : 2.8 (raw 32, f/2.8, apex 3.)
Av range  : 2.8..22 (raw 32..80, f/2.8..f/22.6, apex 3...9.)
ISO       : €1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
Setting aperture to random values...
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.
Movie recording tests completed.

Done!

Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on January 31, 2018, 01:49:06 PM
I noticed a strange behavior of umm_alloc while working on a modified version of "config.lua" which use recursion to traverse submenus and is used by a complex script:

I believe that memory isn't free when a local variable is declared inside a function or a large number of function call occurs.

So I decided to reproduce on a simple script:
-- Test umm_malloc heap
--
local num = 100000

--function property.LENS_NAME:handler(value)
--end

function testHeap()
  local t = {"1","2","3","4","5"}
  return t
end

for i=0, num, 1 do
  testHeap()
end

This one free heap correctly when ending.

But if I add a property.LENS_NAME:handler(value) to make it a complex script, I get:

num = 1000   -> free umm_heap: 236KB
num = 10000 -> free umm_heap: 222KB

Here I get always the same values when rebooting the camera, instead I noticied in the other script that some times umm_heap was 156KB and sometimes up to 222KB.

Is this a normal behavior or is there something to check inside the backend?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on January 31, 2018, 02:32:49 PM
Tried calling collectgarbage() after the loop => 242KB after 10000 and 1000000 iterations.

I'm not sure when it runs (maybe dmilligan already knows without googling), but looks like we can call it at the end of the initialization stage of a "complex" script:: https://stackoverflow.com/questions/18273123/run-garbage-collector

Also found an interesting example here: http://luatut.com/collectgarbage.html

With this:

collectgarbage('stop')
for i=0, num, 1 do
  testHeap()
end
print(collectgarbage('count'))
collectgarbage('restart')


I've got 175K after 10000 iterations and 5.5K after 100000, with a malloc error in the Debug menu (1100D, QEMU). That's a good test for exercising the general-purpose memory backend in ML (which is used when the umm buffer gets full). From this test, my conclusion is that garbage collection gets done during that loop, just we don't know when it happens exactly (it's certainly not done after the last iteration).
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on January 31, 2018, 03:41:14 PM
If the Lua garbage collector is anything like other collectors I'm more familiar with, it likely uses some sort of heuristic to decide when to run. The goal being to optimize the trade off between running too often which would hurt performance and not running often enough which would leave unused memory unreclaimed for longer. If that's the case (I don't have any specific experience with the lua garbage collector), the heuristic is probably tuned for systems that have more free memory than we do. If it's a real problem, you could try adjusting it to running more often (IDK how or where to do that), but if it's just something you noticed, but is not causing issues, I would leave it alone.
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on January 31, 2018, 03:57:00 PM
At the moment it doesn't seems to cause any problems with config's lib.
I'll check later the memory usage between older and newer implementation because at the moment I'm using a lot of stuffs to debug.

Maybe Lua garbage collector can be called after copying the new values from menu to config's data structure, before writing .cfg to card.
This will allow to free memory on each saving instead only on the first run if placed at the end of "lens.lua" initialization
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 04, 2018, 12:04:40 AM
Updates:

- yet another DOF info fix (https://www.magiclantern.fm/forum/index.php?topic=9741.msg196737#msg196737) (hopefully this time is correct; cross-checked with cBlur (http://www.cblur.org/en/))
- Q button available on EOS M (https://bitbucket.org/hudson/magic-lantern/pull-requests/722/eos-m-long-press-set-q-to-open-submenus/diff) (long press); tested with editor.lua (which wasn't able to open the menu, to my knowledge - or did it have some hidden shortcut?); refactored (https://bitbucket.org/hudson/magic-lantern/commits/5ac9cf69fe2705df2d5092b9b02213abfec782a3) for other models, but didn't automate this test yet (so there might be some camera models where this doesn't work)
- lens info (focus distance, focal length etc) updated outside LiveView! (available to Lua and all other modules)

The last item was discovered a long time ago (https://www.magiclantern.fm/forum/index.php?topic=2864.msg169977#msg169977), with low-level MPU communication functions. Only recently, given these QEMU advances (https://www.magiclantern.fm/forum/index.php?topic=2864.msg195347#msg195347), I could figure out how to call this with the high-level API (it was prop_request_change; had to identify the property and make sure I'm not passing bogus data).

There are several (https://www.magiclantern.fm/forum/index.php?topic=4518.0) feature (https://www.magiclantern.fm/forum/index.php?topic=6527.0) requests (https://www.magiclantern.fm/forum/index.php?topic=9643.0) we had to turn down because of lack of lens info outside LiveView (mostly exposure-related). Now they are no longer pipe dreams :)

Also looking into the exposure override / aperture issue with FRSP (couldn't figure it out yet, but made some progress understanding the internals) and the LiveView exposure bug with manual lenses (to reproduce: with or without ML loaded, set Canon lens to f/22, then remove it, then use a manual lens in LiveView and take a picture).
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on February 04, 2018, 03:53:26 AM
Quoteor did it have some hidden shortcut?
The lua_touch branch. The editor is actually [the most] useful on that branch with an EOSM, there's an on screen touch keyboard.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 04, 2018, 08:08:32 AM
Cool, I should get that working in QEMU (as none of my cameras has touch screen). Startup logs (https://builds.magiclantern.fm/jenkins/view/Experiments/job/startup-log/) from cameras with touch screen are welcome (they should cover you interacting with the touch screen, of course), outside LiveView (as LiveView is way too verbose).

A while ago I played with a 700D for a few weeks, and I had an (unfinished) attempt to make the ML menu touch-screen friendly (https://www.magiclantern.fm/forum/index.php?topic=18544.0), btw.
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on February 04, 2018, 08:27:46 AM
Now there is no magiclantern-lua_fix.XXX.70D112 build. Is it bug or feature?
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on February 04, 2018, 08:55:11 AM
@a1ex

Thanks for the continuous Lua Fix updates, including fixing my silly diffraction typo  :-[

Just loaded the latest fixes onto one of one EOSMs and diffraction looks good now.

The Q working in Menus is great, and I loved the real time feedback icon.

Got to look into any other updates to see if I can exploit these for photography  ;)

BTW the holy grail fix for me would include the following (typed here for fun, as I know all these are real challenges or unachievable):
- Seamless silent across all 'shutter' speed space, ie as a shoot option
- Moving EOSM lenses, and potentially more refined than we currently can
- More refined lens position feedback

Once again, thanks for the latest push.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 19, 2018, 12:57:31 PM
Camera 50D

Got errors with manual_lens_info branch Feb19 (has Feb17 lua_fix changes):

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-2-19 12:39:29
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 101
    apex = 5.625
    ms = 20
    value = 0.020263
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 88
      apex = 10.
      value = 32
  iso = table:
    raw = 104
    apex = 9.
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5200
  mode = 3
  metering_mode = 4
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 152
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  bulb = function: p
  burst = function: p
  wait = function: p
  shoot = 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:
  show = function: p
  hide = function: p
  write = function: p
  clear = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  start = function: p
  stop = function: p
  info = function: p
  wait = function: p
  pause = function: p
  resume = function: p
lens = table:
  name = "17-50mm"
  focal_length = 17
  focus_distance = 0
  hyperfocal = 5466
  dof_near = 11139225
  dof_far = 1000000
  af = true
  af_mode = 514
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  rect = function: p
  off = function: p
  pixel = function: p
  print = function: p
  line = function: p
  circle = function: p
  on = function: p
  screenshot = function: p
  clear = function: p
  load = function: p
  notify_box = function: p
  draw = function: p
key = table:
  last = 20
  press = function: p
  wait = function: p
menu = table:
  visible = false
  get = function: p
  select = function: p
  new = function: p
  close = function: p
  open = function: p
  block = function: p
  set = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 17
  ms_clock = 17951
  image_prefix = "IMG_"
  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 = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/102CANON/"
  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 = 4096
    drive_letter = "A"
    file_number = 422
    folder_number = 102
    free_space = 818432
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 422
    folder_number = 102
    free_space = 818432
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  date = table:
    isdst = false
    min = 39
    yday = 1
    sec = 30
    wday = 65
    year = 2018
    day = 19
    month = 2
    hour = 12
  remove = function: p
  directory = function: p
  rename = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:36: in function <ML/SCRIPTS/API_TEST.LUA:35>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:35: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:81: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:1338: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1364: in main chunktask = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...


Can find picture in CF but assertion is triggered:

(https://thumb.ibb.co/j9HmVn/VRAM1.jpg) (https://ibb.co/j9HmVn)

Same errors with latest lua_fix nightly (Run some quick tests a month ago and if I remember correctly api_test was failing also before).

Camera in M mode, lens AF swith ON and 0,7GB free space on CF.

Edit: filename _MG_0424.CR2 , Should I try to reset Canon's setting?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 19, 2018, 01:04:45 PM
Yeah, this test is good at finding issues, though it only does so with the particular combination of Canon settings you have set when running it :D
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 19, 2018, 01:17:35 PM
Tested again with lua_fix build after camera's settings reset:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-2-19 13:08:53
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 112
    apex = 7.
    ms = 8
    value = 0.007812
  aperture = table:
    raw = 48
    apex = 5.
    value = 5.6
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 88
      apex = 10.
      value = 32
  iso = table:
    raw = 0
    apex = 0
    value = 0
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5200
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 158
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  bulb = function: p
  burst = function: p
  reboot = function: p
  shoot = function: p
  wait = 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
  hide = function: p
  clear = function: p
  show = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  resume = function: p
  stop = function: p
  start = function: p
  info = function: p
  wait = function: p
  pause = function: p
lens = table:
  name = "17-50mm"
  focal_length = 32
  focus_distance = 0
  hyperfocal = 9688
  dof_near = 1552657632
  dof_far = 1000000
  af = true
  af_mode = 0
  focus = function: p
  autofocus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  line = function: p
  rect = function: p
  on = function: p
  print = function: p
  draw = function: p
  pixel = function: p
  clear = function: p
  screenshot = function: p
  load = function: p
  circle = function: p
  notify_box = function: p
  off = function: p
key = table:
  last = 20
  press = function: p
  wait = function: p
menu = table:
  visible = false
  new = function: p
  open = function: p
  set = function: p
  close = function: p
  block = function: p
  select = function: p
  get = function: p
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 47
  ms_clock = 47855
  image_prefix = "IMG_"
  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 = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/102CANON/"
  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 = 4096
    drive_letter = "A"
    file_number = 425
    folder_number = 102
    free_space = 746144
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 425
    folder_number = 102
    free_space = 746144
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  date = table:
    min = 8
    year = 2018
    day = 19
    wday = 65
    month = 2
    yday = 1
    sec = 54
    hour = 13
    isdst = false
  rename = function: p
  remove = function: p
  directory = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:36: in function <ML/SCRIPTS/API_TEST.LUA:35>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:35: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:81: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:1338: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1364: in main chunktask = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Start LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
A:/DCIM/102CANON/IMG_0426.CR2: 20705356
A:/DCIM/102CANON/IMG_0426.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
A:/DCIM/102CANON/ABC_0427.CR2: 20686900
A:/DCIM/102CANON/ABC_0427.JPG not found.
A:/DCIM/102CANON/ABC_0428.CR2: 20690368
A:/DCIM/102CANON/ABC_0428.JPG not found.
Bracketed pictures...
A:/DCIM/102CANON/IMG_0429.CR2: 19010223
A:/DCIM/102CANON/IMG_0429.JPG not found.
A:/DCIM/102CANON/IMG_0430.CR2: 20691711
A:/DCIM/102CANON/IMG_0430.JPG not found.
A:/DCIM/102CANON/IMG_0431.CR2: 21265995
A:/DCIM/102CANON/IMG_0431.JPG not found.
Bulb picture...
Elapsed time: 11599
A:/DCIM/102CANON/IMG_0432.CR2: 11809061
A:/DCIM/102CANON/IMG_0432.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...

This time it taken more pictures but got an assert on test_keys() (I could hear half-shutter beep)

(https://thumb.ibb.co/dNp8An/VRAM3.jpg) (https://ibb.co/dNp8An)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 19, 2018, 05:57:12 PM
Reproduced in QEMU. The console also flickers a lot during the test - does it happen on real hardware?

edit: possibly false alarm, it was a bug in my emulation, or it might be the 50D MPU that behaves in a different way; can you print key.last right before the assertion?
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 19, 2018, 06:12:16 PM
Quote from: a1ex on February 19, 2018, 05:57:12 PM
Reproduced in QEMU. The console also flickers a lot during the test - does it happen on real hardware?

Yes, It flicker also on real hardware (a little bit faster but it's still annoiyng) it may be canon's code redrawing photo info display, It doesn't flicker when in photo review mode.
It's me or some times ago console was displayed fullscreen and semi-transparent?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 19, 2018, 06:16:03 PM
Yeah, I've been playing with the layout a bit. It should still be semi-transparent in LiveView and PLAY mode (whenever you have an image behind it). It's no longer true?

Thought to make it a bit larger in ML menu, and have it go out of the way as you navigate (for example, if you move the scroll bar to the bottom half, the console should automatically go to the top side).
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 19, 2018, 06:26:37 PM
It's semi transparent in PLAY mode (I don't remember if it was larger) an LV (moves up to avoid cover bottom bar info)
In Photo info it's not semi-transparent and it flickers a lot.
In Ml menu it get resized (show last 3 lines) and cover bottom bar (menu's .info and .info2)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 19, 2018, 06:30:40 PM
In photo mode, there's nothing behind to make use of transparency (possibly just the last LiveView frame or last viewed photo, but transparency wouldn't make much sense to me in this case). The bitmap overlay is only one, you can't have multiple transparent layers; you can only make parts of it transparent to see the image overlay (LiveView etc).

Got a quick test for you to run, from the dm-spy-experiments branch, compiled with CONFIG_DEBUG_INTERCEPT=y -- place this code in debug.c and select Don't click me:

static void run_test()
{
    msleep(1000);
    SetGUIRequestMode(GUIMODE_PLAY);
    msleep(1000);
    debug_intercept();
    msleep(1000);
    SW1(1,100);
    SW1(0,100);
    msleep(1000);
    debug_intercept();
}


It goes to PLAY mode, "presses" half-shutter from there (just like the Lua half-shutter test does), and records Canon's debug messages, including MPU messages.
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 19, 2018, 06:55:51 PM
I can't do at the moment. I'll try to report it before going to sleep.

One thing I noticed some time ago and stilo presente, is a very high CPU usage in Photo display maybe related to redrawing. Can refresh rate be reduced or stopped/starded on demand to save battery?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 19, 2018, 07:00:36 PM
Most likely yes - there is a similar hack done while recording raw video. Didn't really look too much into the GUI subsystem, partly because we didn't have the tools to understand how it works (but now we have them).
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 20, 2018, 12:43:43 AM
Quote from: a1ex on February 19, 2018, 05:57:12 PM
can you print key.last right before the assertion?
It prints "2"

Quote from: a1ex on February 19, 2018, 06:30:40 PM
Got a quick test for you to run, from the dm-spy-experiments branch, compiled with CONFIG_DEBUG_INTERCEPT=y -- place this code in debug.c and select Don't click me:

"Make zip" fails and also lua is not compiled
../../scripts/lib/../../src/config.c:908:14: error: 'DISPLAY_IS_ON' undeclared (first use in this function)
         if (!DISPLAY_IS_ON) beep();
              ^
make[5]: *** [../../scripts/lib/config.o] Error 1

..............

[ MKDIR    ]   ML directory structure...
cp ../modules/*/*.mo /Users/alex/Desktop/pullML/tmp/platform/50D.109/zip/ML/modules/
/Library/Developer/CommandLineTools/usr/bin/make -C ../../installer/50D.109 autoexec-fir.bin
[ VERSION  ]   ../../platform/50D.109/version.bin
make[1]: *** No rule to make target `../../src/mutex.h', needed by `installer.o'.  Stop.
make: *** [installer_check] Error 2


But I copied ML files from zip folder and worked.
Her is the log file (https://drive.google.com/file/d/1IdeIGJ8WvzZBDdSvkA9fT905qWjADxNX/view?usp=sharing). Hope it helps

Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 20, 2018, 12:59:50 AM
The mutex.h error suggests it needs a "make clean" (the Makefiles won't figure this out on their own).

Not sure why it even attempts to build ../../scripts/lib/config.o (will check later).

Just FYI - the annotated MPU events from this log:

1D763>    PropMgr:0008f90c:00:00: *** mpu_send(08 06 04 16 01 00 00), from ff85c124                  ; PROP_REMOTE_SW1
1DF1F> **INT-36h*:0008f974:00:00: *** mpu_recv(06 05 06 09 00 00), from ff97763c                     ; BGMT_UNPRESS_ZOOM_IN
1E0D2> **INT-36h*:0008f974:00:00: *** mpu_recv(06 05 06 0a 00 00), from ff97763c                     ; BGMT_UNPRESS_ZOOM_OUT
1F824> **INT-36h*:0008f974:00:00: *** mpu_recv(24 22 0a 08 5f 00 01 00 01 03 a0 10 00 50 01 01 58 20 25 01 01 00 68 04 01 00 17 01 00 00 00 00 00 00 00), from ff97763c ; PD_NotifyOlcInfoChanged
1FDA7> **INT-36h*:0008f974:00:00: *** mpu_recv(06 05 04 00 00 01), from ff97763c                     ; NotifyGUIEvent
1FF2A> **INT-36h*:0008f974:00:00: *** mpu_recv(06 05 03 17 99 00), from ff97763c                     ; PROP_EFIC_TEMP
22679>    PropMgr:0008f90c:00:00: *** mpu_send(08 06 00 00 04 00 00), from ff85c124                  ; Complete WaitID = NotifyGUIEvent
24A1F> **INT-36h*:0008f974:00:00: *** mpu_recv(06 04 05 00 00), from ff97763c                        ; EVENTID_METERING_START_SW1ON
2F3D8> **INT-36h*:0008f974:00:00: *** mpu_recv(10 0f 0a 08 41 00 02 00 01 02 e8 00 00 00 00 00), from ff97763c ; PD_NotifyOlcInfoChanged
2FA59> **INT-36h*:0008f974:00:00: *** mpu_recv(0c 0b 0a 08 00 02 01 02 00 00 80 00), from ff97763c   ; PD_NotifyOlcInfoChanged
34175>    PropMgr:0008f90c:00:00: *** mpu_send(08 06 04 16 00 00 00), from ff85c124                  ; PROP_REMOTE_SW1
3446B> **INT-36h*:0008f974:00:00: *** mpu_recv(06 05 04 16 00 00), from ff97763c                     ; PROP_REMOTE_SW1
36BC8>    PropMgr:0008f90c:00:00: *** mpu_send(06 05 03 19 01 00), from ff85c124                     ; PROP_TFT_STATUS
4B556> **INT-36h*:0008f974:00:00: *** mpu_recv(06 04 05 0b 00), from ff97763c                        ; EVENTID_METERING_TIMER_START_SW1OFF
4C05F> **INT-36h*:0008f974:00:00: *** mpu_recv(0e 0d 0a 08 40 00 01 02 e3 00 00 00 00 00), from ff97763c ; PD_NotifyOlcInfoChanged
4CA64> **INT-36h*:0008f974:00:00: *** mpu_recv(0a 08 0a 08 01 00 03 00 00), from ff97763c            ; PD_NotifyOlcInfoChanged
59F3B>    PropMgr:0008f90c:00:00: *** mpu_send(06 05 03 19 01 00), from ff85c124                     ; PROP_TFT_STATUS
B932D>    PropMgr:0008f90c:00:00: *** mpu_send(06 05 03 19 00 00), from ff85c124                     ; PROP_TFT_STATUS


Reproduced the issue using the info from this log.
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 20, 2018, 01:11:58 AM
Quote from: a1ex on February 20, 2018, 12:59:50 AM
The mutex.h error suggests it needs a "make clean" (the Makefiles won't figure this out on their own).
Pretty sure I have done it. Retried "make clean" from /50D.109 and also from root directory, but it show up again.

Quote from: a1ex on February 20, 2018, 12:59:50 AM
Reproduced the issue using the info from this log.
Can you explain what's wrong? :)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 20, 2018, 01:41:08 AM
Quote
Pretty sure I have done it. Retried "make clean" from /50D.109 and also from root directory, but it show up again.

Try this patch:

--- a/platform/Makefile.platform.extras
+++ b/platform/Makefile.platform.extras
@@ -52,2 +52,3 @@
installer_check: | autoexec.bin
+       $(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) clean
        $(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) autoexec-fir.bin


QuoteCan you explain what's wrong? :)

It's not exactly clear to me either. That 2 is the half-shutter unpress event; 1 is half-shutter press (module.h). Does it always happen on the first iteration, or it's random?

At first I've assumed it must be EVENTID_METERING_TIMER_START (aka half-shutter unpress) somehow being triggered on the "press" event, but that doesn't happen in your log, so I'm a bit puzzled.
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 20, 2018, 02:02:37 AM
Patch works but I had to check indentation (tab character) otherwise makefile won't works:
diff --git a/platform/Makefile.platform.extras b/platform/Makefile.platform.extras
--- a/platform/Makefile.platform.extras
+++ b/platform/Makefile.platform.extras
@@ -50,6 +50,7 @@
# do not actually build the FIR - just the plain binary
# also clean the installer directory afterwards; we are not going to use the results, just make sure it builds
installer_check: | autoexec.bin
+ $(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) clean
$(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) autoexec-fir.bin
$(MAKE) -C $(INSTALLER_DIR)/$(ML_MODEL_DIR) clean



Quote from: a1ex on February 20, 2018, 01:41:08 AM
It's not exactly clear to me either. That 2 is the half-shutter unpress event; 1 is half-shutter press (module.h). Does it always happen on the first iteration, or it's random?

Do you want me to run the test more times to see if appears in other logs?
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on February 21, 2018, 01:28:07 PM
Run Stubs Api tests in dm-spy-experiment and lua_fix.
Only selftest module loaded and movie record enabled.

[Pass] is_play_mode() => 0x1
[Pass] src = fio_malloc(size) => 0x421140ac
[Pass] dst = fio_malloc(size) => 0x429180b8
[Pass] memcmp(dst, src, 4097) => 0xffffff31
[Pass] edmac_memcpy(dst, src, 4097) => 0x429180b8
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x429180b8
[Pass] memcmp(dst, src, size) => 0xffffff41
[Pass] edmac_memcpy(dst, src, size) => 0x429180b8
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0xaf
[Pass] edmac_memcpy_start(dst, src, size) => 0x429180b8
       dt => 0x300a
[Pass] copied => 0x401000
[Pass] copied => 0x401000
[Pass] copied => 0x401000
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0xffffff7f
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x1050d0
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x660
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0x10f
[Pass] tries[1] => 0xe5
[Pass] tries[2] => 0xf8
[Pass] tries[3] => 0xfc
[Pass] failr[0] => 0x7c
[Pass] failw[0] => 0x55
[Pass] failr[1] => 0x61
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0x58
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x1a
       times[1] / tries[1] => 0x1d
       times[2] / tries[2] => 0x19
       times[3] / tries[3] => 0x1c
Cache tests finished.

[Pass] f = FIO_CreateFile("test.dat") => 0x3
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x40990038
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x3
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x421140ac
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x3
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0x1d7f4
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x6
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0x1d7f6
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x182
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0x112
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xe3
[Pass] ABS((get_us_clock_value() - t0) - 110000) => 0x1f
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x184
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0xc1
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0x91
[Pass] ABS((get_us_clock_value() - t0) - 310000) => 0x39
       t0 = *(uint32_t*)0xC0242014 => 0x2c9bd
       msleep(250)
       t1 = *(uint32_t*)0xC0242014 => 0x6899e
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x5
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x18
       Date/time: 2018/02/21 12:40:24
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x1a
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x22bd0
[Pass] p = (void*)_malloc(50*1024) => 0x106e18
[Pass] CACHEABLE(p) => 0x106e18
       m1 = MALLOC_FREE_MEMORY => 0x163d0
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x22bd0
[Pass] ABS((m0-m1) - 50*1024) => 0x0
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x3a9e20
[Pass] p = (void*)_AllocateMemory(256*1024) => 0x98fff8
[Pass] CACHEABLE(p) => 0x98fff8
       m1 = GetFreeMemForAllocateMemory() => 0x369e14
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x3a9e20
[Pass] ABS((m0-m1) - 256*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x22bd0
       m02 = GetFreeMemForAllocateMemory() => 0x3a9e20
[Pass] p = (void*)_alloc_dma_memory(256*1024) => 0x40990038
[Pass] UNCACHEABLE(p) => 0x40990038
[Pass] CACHEABLE(p) => 0x990038
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40990038
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(24*1024*1024) => 0x4211408c
[Pass] UNCACHEABLE(p) => 0x4211408c
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x22bd0
       m12 = GetFreeMemForAllocateMemory() => 0x3a9e20
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
[Pass] suite = shoot_malloc_suite_contig(24*1024*1024) => 0x990028
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1800000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x99004c
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1800000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42114088
[Pass] UNCACHEABLE(p) => 0x42114088
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0x990114
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1be8000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x990138
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1be8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42114088
[Pass] UNCACHEABLE(p) => 0x42114088
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(64*1024*1024) => 0x990114
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x7
[Pass] suite->size => 0x4000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x990138
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1be8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42114088
[Pass] UNCACHEABLE(p) => 0x42114088
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9901b0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1bf4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42000064
[Pass] UNCACHEABLE(p) => 0x42000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990208
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x20dc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5bb140e4
[Pass] UNCACHEABLE(p) => 0x5bb140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990280
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x25c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x59b140e4
[Pass] UNCACHEABLE(p) => 0x59b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9902f8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2aac000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x57b140e4
[Pass] UNCACHEABLE(p) => 0x57b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990370
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2f94000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55b140e4
[Pass] UNCACHEABLE(p) => 0x55b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9903e8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x54000064
[Pass] UNCACHEABLE(p) => 0x54000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x4000000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0x990114
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x12
[Pass] suite->size => 0xbf00000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x990138
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1be8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42114088
[Pass] UNCACHEABLE(p) => 0x42114088
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9901b0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1bf4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42000064
[Pass] UNCACHEABLE(p) => 0x42000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990208
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x20dc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5bb140e4
[Pass] UNCACHEABLE(p) => 0x5bb140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990280
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x25c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x59b140e4
[Pass] UNCACHEABLE(p) => 0x59b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9902f8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2aac000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x57b140e4
[Pass] UNCACHEABLE(p) => 0x57b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990370
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2f94000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55b140e4
[Pass] UNCACHEABLE(p) => 0x55b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9903e8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4aa8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x54000064
[Pass] UNCACHEABLE(p) => 0x54000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990460
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x65bc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x56000064
[Pass] UNCACHEABLE(p) => 0x56000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9904d8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x80d0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x58000064
[Pass] UNCACHEABLE(p) => 0x58000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990550
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x9be4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a000064
[Pass] UNCACHEABLE(p) => 0x5a000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9905c8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xa0cc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x53b140e4
[Pass] UNCACHEABLE(p) => 0x53b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990640
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xa5b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x51b140e4
[Pass] UNCACHEABLE(p) => 0x51b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9906b8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xaa9c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4fb140e4
[Pass] UNCACHEABLE(p) => 0x4fb140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990730
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xaf84000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4db140e4
[Pass] UNCACHEABLE(p) => 0x4db140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x9907a8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb46c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4bb140e4
[Pass] UNCACHEABLE(p) => 0x4bb140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990820
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb954000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x49b140e4
[Pass] UNCACHEABLE(p) => 0x49b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990898
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xbe3c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x47b140e4
[Pass] UNCACHEABLE(p) => 0x47b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x990910
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xbf00000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x45b140e4
[Pass] UNCACHEABLE(p) => 0x45b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0xbf00000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x1853ec
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x1853c0
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x1853a0
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0x57c00aa
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] task_max => 0x68
[Pass] task_max => 0x68
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0x57e0084
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0x5800146
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0x582005e
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[FAIL] is_pure_play_photo_mode() => 0x1
[FAIL] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[FAIL] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0

3 Fails in dm-spy-experiment

12727 passed, 23-24 failed in lua_fix branch (I can't find log on CF). lv_focus_status test fails 2 or 3 times then appears to Pass, some UI_Lock errors in console.

After finishing test camera is locked up in a movie record and I need to remove battery.

I have also an hypothesis of a possible wrong stub regarding drawing on screen, due to be unable in attempt to port flexinfo to 50D. So I tried Redraw Test and nothing is show on screen only blue Led blinks 3 times. What should happen?
Draw rectangle test works.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on February 21, 2018, 01:38:09 PM
Drawing on the screen is currently done by writing directly to video memory. In all other models, Canon code only redraws when it has something to redraw (with minor exceptions). Not so with 50D - here, Canon code redraws itself over and over (and for some unknown reason, it does not redraw the entire screen, just a very large part of it).

Redraw does not have visible side effects on its own - Canon code is flicker-free when redrawing itself. Try running the rectangle test at the same time.

lv_focus_status will probably fail in LiveView - if it's like 500D, it won't autofocus by pressing half-shutter. Not sure how to fix.

is_pure_play_photo_mode() -> this should return true when reviewing an image in PLAY mode (it's tested from Lua as well). This works by comparing the return value of get_current_dialog_handler() with some predefined stub (PlayMain_handler - Canon dialog function used for reviewing images). To check, print the result of get_current_dialog_handler() somewhere while in PLAY mode, and compare it with the PlayMain_handler stub.
Title: Re: Lua Scripting (lua.mo)
Post by: Audionut on February 27, 2018, 12:25:33 AM
(https://imghost.io/images/2018/02/27/BENCH0.png)

https://www.dropbox.com/s/dxo2vgok52u2ulg/LUATEST.LOG?dl=0
https://www.dropbox.com/s/si3dbcx02g9qeuf/STUBTEST.LOG?dl=0

And a crash log from the null pointer test.
https://www.dropbox.com/s/p5dweum93lnbby8/CRASH00.LOG?dl=0
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on March 23, 2018, 12:13:10 AM
The Call for testers (https://www.magiclantern.fm/forum/index.php?topic=14828.msg194706#msg194706) post is showing that most of the cameras that I own haven't been tested yet. Since I'm a bit stuck on my other projects and short on time to get myself unstuck -- let the testing being.

First up, EOSM.

api_test.lua

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-3-22 14:09:55
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 104
    apex = 6.
    ms = 16
    value = 0.015625
  aperture = table:
    raw = 59
    apex = 6.375
    value = 9.100001
    min = table:
      raw = 40
      apex = 4.
      value = 4.
    max = table:
      raw = 80
      apex = 9.
      value = 22.6
  iso = table:
    raw = 101
    apex = 8.625
    value = 1250
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 6500
  mode = 20
  metering_mode = 5
  drive_mode = 0
  model = "Canon EOS M"
  model_short = "EOSM"
  firmware = "2.0.2"
  temperature = 208
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  reboot = function: p
  bulb = function: p
  wait = function: p
  burst = function: p
  shoot = 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:
  hide = function: p
  write = function: p
  show = function: p
  clear = function: p
lv = table:
  enabled = true
  paused = false
  running = true
  zoom = 1
  overlays = 2
  pause = function: p
  resume = function: p
  stop = function: p
  wait = function: p
  info = function: p
  start = function: p
lens = table:
  name = "EF-M11-22mm f/4-5.6 IS STM"
  focal_length = 11
  focus_distance = 450
  hyperfocal = 721
  dof_near = 287
  dof_far = 1125
  af = false
  af_mode = 3
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  clear = function: p
  screenshot = function: p
  print = function: p
  pixel = function: p
  notify_box = function: p
  on = function: p
  off = function: p
  draw = function: p
  load = function: p
  circle = function: p
  rect = function: p
  line = function: p
key = table:
  last = 10
  press = function: p
  wait = function: p
menu = table:
  visible = false
  get = function: p
  select = function: p
  new = function: p
  block = function: p
  set = function: p
  open = function: p
  close = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 12
  ms_clock = 12319
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 6056
    folder_number = 100
    free_space = 31111424
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 6056
    folder_number = 100
    free_space = 31111424
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    yday = 81
    sec = 57
    wday = 5
    day = 22
    year = 2018
    min = 9
    month = 3
    isdst = false
    hour = 14
  directory = function: p
  rename = function: p
  remove = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:36: in function <ML/SCRIPTS/API_TEST.LUA:35>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:35: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:81: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:1338: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1364: in main chunktask = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...


Doesn't get very far, tried a few times but it keeps getting stuck. No Assert log though the screen indicates that it did a traceback.

(https://farm1.staticflickr.com/808/40067456075_b548255cb1.jpg) (https://flic.kr/p/243CbLc)

selftest.mo -> stubs tests
[Pass] is_play_mode() => 0x1
[INFO] Camera model: Canon EOS M 2.0.2 (0x80000331 EOSM)
[Pass] is_camera("DIGIC", "*") => 0x1
[Pass] is_camera(__camera_model_short, firmware_version) => 0x1
[Pass] src = fio_malloc(size) => 0x4de1a084
[Pass] dst = fio_malloc(size) => 0x4e61e090
[Pass] memcmp(dst, src, 4097) => 0xa2
[Pass] edmac_memcpy(dst, src, 4097) => 0x4e61e090
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x4e61e090
[Pass] memcmp(dst, src, size) => 0x31
[Pass] edmac_memcpy(dst, src, size) => 0x4e61e090
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0xffffffa6
[Pass] edmac_memcpy_start(dst, src, size) => 0x4e61e090
       dt => 0x2975
[Pass] copied => 0x4005f0
[Pass] copied => 0x4005f0
[Pass] copied => 0x4005f0
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0x61
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x806b18
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x18d0
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0x107
[Pass] tries[1] => 0xf4
[Pass] tries[2] => 0x107
[Pass] tries[3] => 0xe6
[Pass] failr[0] => 0x84
[Pass] failw[0] => 0xf7
[Pass] failr[1] => 0x67
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xeb
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x1a
       times[1] / tries[1] => 0x1b
       times[2] / tries[2] => 0x1b
       times[3] / tries[3] => 0x1b
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x3
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x4085b300
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x3
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x4de1a084
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x3
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xcb30
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x1
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xcb9e
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x32c02
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0x118
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xf9
[Pass] ABS((get_us_clock() - t0) - 110000) => 0x372
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x32c04
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0x3ff
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0x3e5
[Pass] ABS((get_us_clock() - t0) - 310000) => 0x224
       t0 = GET_DIGIC_TIMER() => 0xee0b2
       msleep(250)
       t1 = GET_DIGIC_TIMER() => 0x2a6bd
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x3
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x5
       Date/time: 2018/03/22 14:18:05
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x7
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x3e720
[Pass] p = (void*)_malloc(50*1024) => 0x131168
[Pass] CACHEABLE(p) => 0x131168
       m1 = MALLOC_FREE_MEMORY => 0x31f10
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x3e720
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x33f248
[Pass] p = (void*)_AllocateMemory(128*1024) => 0x85b2c0
[Pass] CACHEABLE(p) => 0x85b2c0
       m1 = GetFreeMemForAllocateMemory() => 0x31f23c
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x33f248
[Pass] ABS((m0-m1) - 128*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x3e720
       m02 = GetFreeMemForAllocateMemory() => 0x33f248
[Pass] p = (void*)_alloc_dma_memory(128*1024) => 0x4085b300
[Pass] UNCACHEABLE(p) => 0x4085b300
[Pass] CACHEABLE(p) => 0x85b300
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x4085b300
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(16*1024*1024) => 0x4de1a074
[Pass] UNCACHEABLE(p) => 0x4de1a074
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x3e720
       m12 = GetFreeMemForAllocateMemory() => 0x33f248
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
[Pass] suite = shoot_malloc_suite_contig(16*1024*1024) => 0x11d6e8
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x12a948
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4de1a070
[Pass] UNCACHEABLE(p) => 0x4de1a070
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0x11d6e8
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x12b4000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x12a948
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x12b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4de1a070
[Pass] UNCACHEABLE(p) => 0x4de1a070
       largest_shoot_block = suite->size => 0x12b4000
[INFO] largest_shoot_block: 19MB
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(largest_shoot_block + 1024*1024) => 0x11d6e8
[Pass] suite->signature => 'MemSuite'
[FAIL] suite->num_chunks => 0x1
[Pass] suite->size => 0x13b4000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x12a948
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x13b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4de1a070
[Pass] UNCACHEABLE(p) => 0x4de1a070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x13b4000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0x11d6e8
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x3
[Pass] suite->size => 0x1700000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x12a948
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x13b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4de1a070
[Pass] UNCACHEABLE(p) => 0x4de1a070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x131168
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x149c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ae00064
[Pass] UNCACHEABLE(p) => 0x4ae00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1311a0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x1700000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x419ff0a4
[Pass] UNCACHEABLE(p) => 0x419ff0a4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x1700000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[FAIL] suite->num_chunks => 0x1
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x213d2c
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x213d00
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x213ce0
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0xed0a00b0
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] get_task_name_from_id(current_task->taskId) => 'run_test'
[Pass] task_max => 0x68
[Pass] task_max => 0x68
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0xed0c00b6
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0xed0e0200
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0xed100066
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[FAIL] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x1
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
=========================================================
Test complete, 11351 passed, 41 failed.
.


Got through it but had 41 failed tests. The EOSM2 that still has a long way to go before it is even ready for testing fared about the same on this (https://www.magiclantern.fm/forum/index.php?topic=15895.msg197888#msg197888).

bench.mo -> memory benchmarks
(https://farm1.staticflickr.com/795/40961005621_136a6d8a8e.jpg) (https://flic.kr/p/25pzRUR)

Ok--I doubt this is what the BENCH0.PPM file should look like. Maybe it is the CONFIG_MENU_TIMEOUT_FIX clearing out the screen every few seconds that is doing this?
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on March 23, 2018, 01:15:16 AM
Next up 700D

I thought this one would just breeze through the tests but the problems started early in the testing.


api_test.lua
ML ASSERT:
0
at ../../src/raw.c:609 (raw_lv_realloc_buffer), task livev_hiprio_task
lv:0 mode:3

livev_hiprio_task stack: 1d70d8 [1d7250-1d3250]
0x000C26E0 @ ba728:1d7138
0x000C2650 @ c2740:1d7130
0x000C00BC @ c2680:1d7128
0x0007F5DC @ c025c:1d7108
0x0007EF78 @ 7f638:1d70d8

Magic Lantern version : Nightly.2018Mar22.700D115
Mercurial changeset   : eeb12511d8ce (lua_fix)
Built on 2018-03-22 15:48:25 UTC by rosiefort@RosieFoComputer.
Free Memory  : 148K + 2033K


Ugh. This is using the latest changeset. Ok--so maybe starting in Movie mode is a problem? It sat there with a prompt to "Please switch to M mode" but it was on M mode!

(https://farm1.staticflickr.com/804/40252185214_54753af299.jpg) (https://flic.kr/p/24jWYim)

Figured out that what needed to be done was to switch to Photo mode. Then it got into the lens focus test which takes a while so I waited, and waited...

(https://farm1.staticflickr.com/791/40252184694_0877bf7e9e.jpg) (https://flic.kr/p/24jWY9o)

Yeah, that's the battery running out of juice.
...
Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 1650
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
19...18...17...16...15...14...13...Autofocus triggered.
Autofocus completed.
Focus distance: 2240
Focusing backward...


Cut to the chase, this was with the EFS 10-18mm STM lens and lua seems to have a problem with this rather new lens so I switched to an old beat up 28-105mm with "ULTRASONIC" focusing.


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-3-22 16:57:17
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 72
    apex = 2.
    ms = 250
    value = 0.25
  aperture = table:
    raw = 48
    apex = 5.
    value = 5.6
    min = table:
      raw = 37
      apex = 3.625
      value = 3.5
    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 = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS REBEL T5i"
  model_short = "700D"
  firmware = "1.1.5"
  temperature = 151
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  shoot = function: p
  burst = function: p
  reboot = function: p
  bulb = function: p
  wait = 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:
  show = function: p
  hide = function: p
  clear = function: p
  write = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  pause = function: p
  resume = function: p
  info = function: p
  wait = function: p
  stop = function: p
  start = function: p
lens = table:
  name = "EF28-105mm f/3.5-4.5 USM"
  focal_length = 28
  focus_distance = 6820
  hyperfocal = 7424
  dof_near = 3582
  dof_far = 82567
  af = true
  af_mode = 0
  focus = function: p
  autofocus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  load = function: p
  circle = function: p
  screenshot = function: p
  on = function: p
  off = function: p
  notify_box = function: p
  draw = function: p
  rect = function: p
  line = function: p
  pixel = function: p
  clear = function: p
  print = function: p
key = table:
  last = 10
  wait = function: p
  press = function: p
menu = table:
  visible = false
  close = function: p
  block = function: p
  set = function: p
  open = function: p
  select = function: p
  get = function: p
  new = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 10
  ms_clock = 10582
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 2856
    folder_number = 100
    free_space = 30632800
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 2856
    folder_number = 100
    free_space = 30632800
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  date = table:
    min = 57
    day = 22
    year = 2018
    sec = 18
    yday = 81
    wday = 5
    isdst = false
    hour = 16
    month = 3
  remove = function: p
  call = function: p
  rename = function: p
  directory = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:36: in function <ML/SCRIPTS/API_TEST.LUA:35>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:35: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:81: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1338: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1364: in main chunktask = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Stop LiveView...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Stop LiveView...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Stop LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Start LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Start LiveView...
Enter MENU mode...
Exit MENU mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_2857.CR2: 23307950
B:/DCIM/100CANON/IMG_2857.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
B:/DCIM/100CANON/ABC_2858.CR2: 23344953
B:/DCIM/100CANON/ABC_2858.JPG not found.
B:/DCIM/100CANON/ABC_2859.CR2: 23343067
B:/DCIM/100CANON/ABC_2859.JPG not found.
Bracketed pictures...
B:/DCIM/100CANON/IMG_2860.CR2: 20986212
B:/DCIM/100CANON/IMG_2860.JPG not found.
B:/DCIM/100CANON/IMG_2861.CR2: 23347363
B:/DCIM/100CANON/IMG_2861.JPG not found.
B:/DCIM/100CANON/IMG_2862.CR2: 26957563
B:/DCIM/100CANON/IMG_2862.JPG not found.
Bulb picture...
Elapsed time: 11727
B:/DCIM/100CANON/IMG_2863.CR2: 16875701
B:/DCIM/100CANON/IMG_2863.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
Half-shutter test OK.

Testing module 'lv'...
Starting LiveView...
Overlays: ML
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Setting zoom to x1...
Setting zoom to x5...
Setting zoom to x10...
Setting zoom to x5...
Setting zoom to x1...
Setting zoom to x10...
Setting zoom to x1...
Pausing LiveView...
Resuming LiveView...
Stopping LiveView...
LiveView tests completed.


Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 610
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
19...18...17...16...15...14...13...Autofocus triggered.
Autofocus completed.
Focus distance: 880
Focusing backward...
Focus distance: 1100
Focus motor position: 0
Focusing forward with step size 3, wait=true...
...
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 3, wait=true...
....
Focus distance: 2590
Focus motor position: 0
Focus range: 3 steps forward, 4 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 3, wait=false...
........................
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 3, wait=false...
...............................
Focus distance: 655350
Focus motor position: 0
Focus range: 24 steps forward, 31 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 2, wait=true...
.......................................
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 2, wait=true...
..........................................
Focus distance: 655350
Focus motor position: 0
Focus range: 39 steps forward, 42 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 2, wait=false...
.................................................................................................
Focus distance: 510
Focus motor position: 0
Focusing backward with step size 2, wait=false...
...
Focus distance: 655350
Focus motor position: 0
Focus range: 97 steps forward, 113 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 1, wait=true...
................................................................................................
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 1, wait=true...
...........................................................................................
Focus distance: 655350
Focus motor position: 0
Focus range: 96 steps forward, 91 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 1, wait=false...
...
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 1, wait=false...
...
Focus distance: 655350
Focus motor position: 0
Focus range: 205 steps forward, 188 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.

Focus test completed.

Testing exposure settings...
Camera    : Canon EOS REBEL T5i (700D) 1.1.5
Lens      : EF28-105mm f/3.5-4.5 USM
Shoot mode: 3
Shutter   : �5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : �5.6 (raw 48, f/5.6, apex 5.)
Av range  : �3.5..�22 (raw 37..80, f/3.5..f/22.6, apex 3.625..9.)
ISO       : �1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
Setting aperture to random values...
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.
Movie recording tests completed.

Done!


selftest.mo -> stubs tests
[Pass] is_play_mode() => 0x1
[INFO] Camera model: Canon EOS REBEL T5i 1.1.5 (0x80000326 700D)
[Pass] is_camera("DIGIC", "*") => 0x1
[Pass] is_camera(__camera_model_short, firmware_version) => 0x1
[Pass] src = fio_malloc(size) => 0x4a104084
[Pass] dst = fio_malloc(size) => 0x4a908090
[Pass] memcmp(dst, src, 4097) => 0xffffff6a
[Pass] edmac_memcpy(dst, src, 4097) => 0x4a908090
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x4a908090
[Pass] memcmp(dst, src, size) => 0xffffffa8
[Pass] edmac_memcpy(dst, src, size) => 0x4a908090
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0x11
[Pass] edmac_memcpy_start(dst, src, size) => 0x4a908090
       dt => 0x2979
[Pass] copied => 0x400670
[Pass] copied => 0x400670
[Pass] copied => 0x400670
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0x8
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x7f5888
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x1170
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0xef
[Pass] tries[1] => 0xfc
[Pass] tries[2] => 0x100
[Pass] tries[3] => 0xfd
[Pass] failr[0] => 0x73
[Pass] failw[0] => 0xcb
[Pass] failr[1] => 0x6b
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xec
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x1d
       times[1] / tries[1] => 0x1d
       times[2] / tries[2] => 0x1d
       times[3] / tries[3] => 0x1d
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x3
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x4084cb04
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x3
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x4a104084
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x3
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xad6c
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x1
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xaddc
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x2ed32
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0x113
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xf9
[Pass] ABS((get_us_clock() - t0) - 110000) => 0x21d
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x2ed34
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0x2a9
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0x28d
[Pass] ABS((get_us_clock() - t0) - 310000) => 0xf7
       t0 = GET_DIGIC_TIMER() => 0x2a30f
       msleep(250)
       t1 = GET_DIGIC_TIMER() => 0x667c4
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x4
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x17
       Date/time: 2018/03/22 17:17:23
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x18
[Pass] MOD(s1-s0, 60) => 0x1
[Pass] MOD(s1-s0, 60) => 0x1
       m0 = MALLOC_FREE_MEMORY => 0x25e00
[Pass] p = (void*)_malloc(50*1024) => 0x1199e8
[Pass] CACHEABLE(p) => 0x1199e8
       m1 = MALLOC_FREE_MEMORY => 0x195f0
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x25e00
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x324348
[Pass] p = (void*)_AllocateMemory(128*1024) => 0x84cac4
[Pass] CACHEABLE(p) => 0x84cac4
       m1 = GetFreeMemForAllocateMemory() => 0x30433c
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x324348
[Pass] ABS((m0-m1) - 128*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x25e00
       m02 = GetFreeMemForAllocateMemory() => 0x324348
[Pass] p = (void*)_alloc_dma_memory(128*1024) => 0x4084cb04
[Pass] UNCACHEABLE(p) => 0x4084cb04
[Pass] CACHEABLE(p) => 0x84cb04
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x4084cb04
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(16*1024*1024) => 0x4a104074
[Pass] UNCACHEABLE(p) => 0x4a104074
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x25e00
       m12 = GetFreeMemForAllocateMemory() => 0x324348
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
[Pass] suite = shoot_malloc_suite_contig(16*1024*1024) => 0x1199e8
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x119a10
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4a104070
[Pass] UNCACHEABLE(p) => 0x4a104070
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0x1199e8
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x21c4000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x119a10
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x21c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ddc0064
[Pass] UNCACHEABLE(p) => 0x4ddc0064
       largest_shoot_block = suite->size => 0x21c4000
[INFO] largest_shoot_block: 34MB
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(largest_shoot_block + 1024*1024) => 0x1199e8
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x2
[Pass] suite->size => 0x22c4000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x119a10
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x18b8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4a104070
[Pass] UNCACHEABLE(p) => 0x4a104070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x119a70
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x22c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42200064
[Pass] UNCACHEABLE(p) => 0x42200064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x22c4000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0x1199e8
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x7
[Pass] suite->size => 0x5b00000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x119a10
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x18b8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4a104070
[Pass] UNCACHEABLE(p) => 0x4a104070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x119a70
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x36b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42200064
[Pass] UNCACHEABLE(p) => 0x42200064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x119aa8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3ab4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x419ff0a4
[Pass] UNCACHEABLE(p) => 0x419ff0a4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x119ae0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3b8c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x49f240e4
[Pass] UNCACHEABLE(p) => 0x49f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x119b18
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3c64000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x47f240e4
[Pass] UNCACHEABLE(p) => 0x47f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x119b50
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3d3c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x45f240e4
[Pass] UNCACHEABLE(p) => 0x45f240e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x119b88
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x5b00000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ddc0064
[Pass] UNCACHEABLE(p) => 0x4ddc0064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x5b00000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x1b3c8c
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x1b3c60
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x1b3c40
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0xdda800c6
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] get_task_name_from_id(current_task->taskId) => 'run_test'
[Pass] task_max => 0x68
[Pass] task_max => 0x68
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0xddaa00b0
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0xddac027c
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0xddae00a4
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x1
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
=========================================================
Test complete, 11782 passed, 0 failed.
.


bench.mo -> memory benchmarks
(https://farm5.staticflickr.com/4771/40961614251_6650c09714.jpg) (https://flic.kr/p/25pCYQt)

Title: Re: Lua Scripting (lua.mo)
Post by: dfort on March 23, 2018, 01:42:13 AM
7D

api_test.lua

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-3-22 16:20:24
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 104
    apex = 6.
    ms = 16
    value = 0.015625
  aperture = table:
    raw = 48
    apex = 5.
    value = 5.6
    min = table:
      raw = 37
      apex = 3.625
      value = 3.5
    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 = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 7D"
  model_short = "7D"
  firmware = "2.0.3"
  temperature = 146
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  burst = function: p
  shoot = function: p
  bulb = function: p
  wait = 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
  show = function: p
  clear = function: p
  hide = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  info = function: p
  start = function: p
  stop = function: p
  pause = function: p
  wait = function: p
  resume = function: p
lens = table:
  name = "EF28-105mm f/3.5-4.5 USM"
  focal_length = 28
  focus_distance = 655350
  hyperfocal = 7424
  dof_near = 7342
  dof_far = 1000000
  af = true
  af_mode = 0
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  off = function: p
  screenshot = function: p
  notify_box = function: p
  draw = function: p
  load = function: p
  pixel = function: p
  circle = function: p
  rect = function: p
  on = function: p
  clear = function: p
  line = function: p
  print = function: p
key = table:
  last = 20
  press = function: p
  wait = function: p
menu = table:
  visible = false
  set = function: p
  close = function: p
  open = function: p
  get = function: p
  select = function: p
  block = function: p
  new = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 14
  ms_clock = 14625
  image_prefix = "IMG_"
  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 = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/100EOS7D/"
  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 = 9999
    folder_number = 100
    free_space = 31216704
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "A"
    file_number = 9999
    folder_number = 100
    free_space = 31216704
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  date = table:
    min = 20
    sec = 24
    wday = 5
    year = 2018
    isdst = false
    month = 3
    hour = 16
    day = 22
    yday = 81
  call = function: p
  remove = function: p
  directory = function: p
  rename = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
  level = 76
  id = 0
  performance = 3
  time = nil
  drain_rate = 33
task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...


Like the EOSM the 7D didn't get through the test though it failed on a different test.

(https://farm1.staticflickr.com/792/40919929352_c65ec7da4c.jpg) (https://flic.kr/p/25kXknj)

selftest.mo -> stubs tests
[Pass] is_play_mode() => 0x1
[INFO] Camera model: Canon EOS 7D 2.0.3 (0x80000250 7D)
[Pass] is_camera("DIGIC", "*") => 0x1
[Pass] is_camera(__camera_model_short, firmware_version) => 0x1
[Pass] src = fio_malloc(size) => 0x423280a8
[Pass] dst = fio_malloc(size) => 0x42b2c0b4
[Pass] memcmp(dst, src, 4097) => 0x35
[Pass] edmac_memcpy(dst, src, 4097) => 0x42b2c0b4
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x42b2c0b4
[Pass] memcmp(dst, src, size) => 0x55
[Pass] edmac_memcpy(dst, src, size) => 0x42b2c0b4
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0x45
[Pass] edmac_memcpy_start(dst, src, size) => 0x42b2c0b4
       dt => 0x3ab7
[Pass] copied => 0x400acc
[Pass] copied => 0x400acc
[Pass] copied => 0x400acc
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0xffffff7f
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x908b70
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x630
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0xdf
[Pass] tries[1] => 0xfc
[Pass] tries[2] => 0x101
[Pass] tries[3] => 0x10c
[Pass] failr[0] => 0x87
[Pass] failw[0] => 0xb5
[Pass] failr[1] => 0x81
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xe4
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x1d
       times[1] / tries[1] => 0x1f
       times[2] / tries[2] => 0x1f
       times[3] / tries[3] => 0x1f
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[FAIL] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[FAIL] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[FAIL] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x3
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x40b077bc
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x3
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x423280a8
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x3
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xbb6
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x3
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xbd8
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x26cc
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0x136
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0x110
[Pass] ABS((get_us_clock() - t0) - 110000) => 0x115
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x26d4
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0x1ad
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0x188
[Pass] ABS((get_us_clock() - t0) - 310000) => 0x103
       t0 = GET_DIGIC_TIMER() => 0x75640
       msleep(250)
       t1 = GET_DIGIC_TIMER() => 0xb1174
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x6
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x36
       Date/time: 2018/03/22 16:31:54
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x38
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x59698
[Pass] p = (void*)_malloc(50*1024) => 0xaa2f0
[Pass] CACHEABLE(p) => 0xaa2f0
       m1 = MALLOC_FREE_MEMORY => 0x4ce88
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x59698
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x290c80
[Pass] p = (void*)_AllocateMemory(128*1024) => 0x998944
[Pass] CACHEABLE(p) => 0x998944
       m1 = GetFreeMemForAllocateMemory() => 0x270c74
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x290c80
[Pass] ABS((m0-m1) - 128*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x59698
       m02 = GetFreeMemForAllocateMemory() => 0x290c80
[Pass] p = (void*)_alloc_dma_memory(128*1024) => 0x40998984
[Pass] UNCACHEABLE(p) => 0x40998984
[Pass] CACHEABLE(p) => 0x998984
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40998984
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(16*1024*1024) => 0x42328098
[Pass] UNCACHEABLE(p) => 0x42328098
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x59698
       m12 = GetFreeMemForAllocateMemory() => 0x290c80
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
[Pass] suite = shoot_malloc_suite_contig(16*1024*1024) => 0xaa2f0
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0xaa318
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42328094
[Pass] UNCACHEABLE(p) => 0x42328094
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0xaa2f0
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1f80000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0xaa318
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1f80000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x52000064
[Pass] UNCACHEABLE(p) => 0x52000064
       largest_shoot_block = suite->size => 0x1f80000
[INFO] largest_shoot_block: 32MB
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(largest_shoot_block + 1024*1024) => 0xaa2f0
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x2
[Pass] suite->size => 0x2080000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0xaa318
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x17d4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42328094
[Pass] UNCACHEABLE(p) => 0x42328094
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa378
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2080000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x52000064
[Pass] UNCACHEABLE(p) => 0x52000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x2080000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0xaa2f0
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0xb
[Pass] suite->size => 0xb700000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0xaa318
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x17d4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42328094
[Pass] UNCACHEABLE(p) => 0x42328094
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa378
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3754000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x52000064
[Pass] UNCACHEABLE(p) => 0x52000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa3b0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x37d0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5bf800e4
[Pass] UNCACHEABLE(p) => 0x5bf800e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa3e8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x384c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x59f800e4
[Pass] UNCACHEABLE(p) => 0x59f800e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa420
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x38c8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x57f800e4
[Pass] UNCACHEABLE(p) => 0x57f800e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa458
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x3944000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55f800e4
[Pass] UNCACHEABLE(p) => 0x55f800e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa490
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x39c0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x53f800e4
[Pass] UNCACHEABLE(p) => 0x53f800e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa4c8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x5940000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x54000064
[Pass] UNCACHEABLE(p) => 0x54000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa500
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x78c0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x56000064
[Pass] UNCACHEABLE(p) => 0x56000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa538
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x9840000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x58000064
[Pass] UNCACHEABLE(p) => 0x58000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0xaa570
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb700000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a000064
[Pass] UNCACHEABLE(p) => 0x5a000064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0xb700000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x191c54
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x191c20
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x191c00
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0x189800bc
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] get_task_name_from_id(current_task->taskId) => 'run_test'
[Pass] task_max => 0x68
[Pass] task_max => 0x68
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0x189a0090
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0x189c0300
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0x189e007a
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x1
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
=========================================================
Test complete, 12095 passed, 7 failed.
.


Failed a few tests. Looks like some of the iterations of HALFSHUTTER_PRESSED and get_focus_confirmation.

bench.mo -> memory benchmarks
(https://farm5.staticflickr.com/4778/40252730324_dfd9d20f7d.jpg) (https://flic.kr/p/24jZLkN)
Title: Drain battery until 50% to 90% using Lua script suggested by A1ex?
Post by: l_d_allan on March 28, 2018, 12:32:01 AM
*** EDIT ***
Starting to work, but seems to time-out. See Feature Request (https://www.magiclantern.fm/forum/index.php?topic=21824.msg198960#msg198960) for more info.

This rusty C++ developer (and Lua pre-newbie) hopes a Feature Request (https://www.magiclantern.fm/forum/index.php?topic=21824.msg198947#msg198947) can be accomplished with a Lua script suggested by A1ex.

Suggested PoC (https://en.wikipedia.org/wiki/Proof_of_concept) Lua loop from A1ex earlier today with hard-wired parameters of 10 second delay until battery at 50%:
Quote

-- Discharge battery until 50%
-- battery.level is reported in percentage
while battery.level > 50 do
    -- optionally print battery level somewhere (exercise for the reader)
    msleep(10000)
end


tl;dr (https://en.wiktionary.org/wiki/tl;dr) ? Sorry ...

The intention is to "baby" the Li-Ion battery so that it isn't stored for an extended period of time at 100%. My impression is this can be preferred to get a longer life-time out of the battery. So, maybe our batteries would last 5 years instead of 3?

I realize this issue may be a "Who cares?" ... since reputable knock-off clones aren't that expensive.

Actual script might have a parameter of 90% rather than 50%.

Perhaps issue a "Beep" or "Flash Light" within the loop to confirm something is happening. Or actually cause the text with the Battery Percent to show up on the LCD screen.
Title: Re: Lua Scripting (lua.mo)
Post by: lojzik on April 04, 2018, 11:34:37 AM
magiclantern-lua_fix.2018Mar31.70D112 test

stubtest.log ok (in previous builds was problem)
[Pass] is_play_mode() => 0x1
[INFO] Camera model: Canon EOS 70D 1.1.2 (0x80000325 70D)
[Pass] is_camera("DIGIC", "*") => 0x1
[Pass] is_camera(__camera_model_short, firmware_version) => 0x1
[Pass] src = fio_malloc(size) => 0x42104084
[Pass] dst = fio_malloc(size) => 0x42908090
[Pass] memcmp(dst, src, 4097) => 0x26
[Pass] edmac_memcpy(dst, src, 4097) => 0x42908090
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x42908090
[Pass] memcmp(dst, src, size) => 0x2f
[Pass] edmac_memcpy(dst, src, size) => 0x42908090
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0x1d
[Pass] edmac_memcpy_start(dst, src, size) => 0x42908090
       dt => 0x1822
[Pass] copied => 0x400a70
[Pass] copied => 0x400a70
[Pass] copied => 0x400a70
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0x26
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x8d2634
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x1160
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0xf1
[Pass] tries[1] => 0xf6
[Pass] tries[2] => 0x105
[Pass] tries[3] => 0xfc
[Pass] failr[0] => 0x6b
[Pass] failw[0] => 0xbc
[Pass] failr[1] => 0x77
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xda
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x2d
       times[1] / tries[1] => 0x2a
       times[2] / tries[2] => 0x2a
       times[3] / tries[3] => 0x2d
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x6
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x40933aa4
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x6
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x42104084
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x6
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xaa32
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x2
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xaa96
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x387c0
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0xe9
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xd3
[Pass] ABS((get_us_clock() - t0) - 110000) => 0x64
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x387c2
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0xd4
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0xbc
[Pass] ABS((get_us_clock() - t0) - 310000) => 0x52
       t0 = GET_DIGIC_TIMER() => 0x8ccb
       msleep(250)
       t1 = GET_DIGIC_TIMER() => 0x44e36
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x4
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x2d
       Date/time: 2018/04/04 10:18:45
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x2f
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x4b5e8
[Pass] p = (void*)_malloc(50*1024) => 0x113500
[Pass] CACHEABLE(p) => 0x113500
       m1 = MALLOC_FREE_MEMORY => 0x3edd8
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x4b5e8
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x24337c
[Pass] p = (void*)_AllocateMemory(128*1024) => 0x933a64
[Pass] CACHEABLE(p) => 0x933a64
       m1 = GetFreeMemForAllocateMemory() => 0x223370
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x24337c
[Pass] ABS((m0-m1) - 128*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x4b5e8
       m02 = GetFreeMemForAllocateMemory() => 0x24337c
[Pass] p = (void*)_alloc_dma_memory(128*1024) => 0x40933aa4
[Pass] UNCACHEABLE(p) => 0x40933aa4
[Pass] CACHEABLE(p) => 0x933aa4
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x40933aa4
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(16*1024*1024) => 0x42104074
[Pass] UNCACHEABLE(p) => 0x42104074
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x4b5e8
       m12 = GetFreeMemForAllocateMemory() => 0x24337c
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x0
[Pass] suite = shoot_malloc_suite_contig(16*1024*1024) => 0x113458
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x113500
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0x113458
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x2000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x113500
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       largest_shoot_block = suite->size => 0x2000000
[INFO] largest_shoot_block: 32MB
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(largest_shoot_block + 1024*1024) => 0x113458
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x2
[Pass] suite->size => 0x2100000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x113500
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113538
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2100000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4410407c
[Pass] UNCACHEABLE(p) => 0x4410407c
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x2100000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0x113458
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x14
[Pass] suite->size => 0xf700000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x113500
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113538
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x220c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4410407c
[Pass] UNCACHEABLE(p) => 0x4410407c
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113570
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x22f4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48b140e4
[Pass] UNCACHEABLE(p) => 0x48b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1135a8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x23dc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x467140e4
[Pass] UNCACHEABLE(p) => 0x467140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1135e0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x24c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c9140e4
[Pass] UNCACHEABLE(p) => 0x5c9140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113618
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x25ac000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a5140e4
[Pass] UNCACHEABLE(p) => 0x5a5140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113650
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2694000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x581140e4
[Pass] UNCACHEABLE(p) => 0x581140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113688
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x277c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4af140e4
[Pass] UNCACHEABLE(p) => 0x4af140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1136c0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2864000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x443140e4
[Pass] UNCACHEABLE(p) => 0x443140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1136f8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4864000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48c00064
[Pass] UNCACHEABLE(p) => 0x48c00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113730
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4b78000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ac00070
[Pass] UNCACHEABLE(p) => 0x4ac00070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113768
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x6b78000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55e00064
[Pass] UNCACHEABLE(p) => 0x55e00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1137a0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x6e8c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x57e00070
[Pass] UNCACHEABLE(p) => 0x57e00070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1137d8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x8e8c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x58200064
[Pass] UNCACHEABLE(p) => 0x58200064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113810
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x91a0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a200070
[Pass] UNCACHEABLE(p) => 0x5a200070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113848
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb1a0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a600064
[Pass] UNCACHEABLE(p) => 0x5a600064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113880
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb4b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c600070
[Pass] UNCACHEABLE(p) => 0x5c600070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1138b8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xd4b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x44400064
[Pass] UNCACHEABLE(p) => 0x44400064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1138f0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xd7c8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x46400070
[Pass] UNCACHEABLE(p) => 0x46400070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x113928
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xf700000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x46800064
[Pass] UNCACHEABLE(p) => 0x46800064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0xf700000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x21b32c
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x21b300
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x21b2e0
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0xdb6c00f0
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] get_task_name_from_id(current_task->taskId) => 'run_test'
[Pass] task_max => 0x84
[Pass] task_max => 0x84
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0xdb6e00c8
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0xdb7002aa
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0xdb7200e0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x1
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
=========================================================
Test complete, 12822 passed, 0 failed.
.


luatest.log assertion failed on line 944
===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-4-4 10:20:31
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 0
    apex = -7.
    ms = 0
    value = 0
  aperture = table:
    raw = 56
    apex = 6.
    value = 8.
    min = table:
      raw = 48
      apex = 5.
      value = 5.6
    max = table:
      raw = 91
      apex = 10.375001
      value = 36.400001
  iso = table:
    raw = 72
    apex = 5.
    value = 100
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 6400
  mode = 2
  metering_mode = 3
  drive_mode = 17
  model = "Canon EOS 70D"
  model_short = "70D"
  firmware = "1.1.2"
  temperature = 158
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  shoot = function: p
  bulb = function: p
  wait = function: p
  burst = 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:
  hide = function: p
  clear = function: p
  show = function: p
  write = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  wait = function: p
  start = function: p
  stop = function: p
  info = function: p
  resume = function: p
  pause = function: p
lens = table:
  name = "EF-S18-135mm f/3.5-5.6 IS STM"
  focal_length = 135
  focus_distance = 520
  hyperfocal = 120171
  dof_near = 519
  dof_far = 520
  af = true
  af_mode = 0
  autofocus = function: p
  focus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  pixel = function: p
  notify_box = function: p
  print = function: p
  line = function: p
  screenshot = function: p
  draw = function: p
  circle = function: p
  rect = function: p
  clear = function: p
  off = function: p
  on = function: p
  load = function: p
key = table:
  last = 10
  press = function: p
  wait = function: p
menu = table:
  visible = false
  open = function: p
  block = function: p
  get = function: p
  new = function: p
  select = function: p
  set = function: p
  close = function: p
movie = table:
  recording = false
  stop = function: p
  start = function: p
dryos = table:
  clock = 16
  ms_clock = 16782
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 5136
    folder_number = 100
    free_space = 15559680
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 5136
    folder_number = 100
    free_space = 15559680
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    yday = 94
    isdst = false
    year = 2018
    month = 4
    min = 20
    hour = 10
    day = 4
    sec = 32
    wday = 4
  remove = function: p
  rename = function: p
  directory = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
  level = 17
  id = 2
  performance = 3
  time = nil
  drain_rate = 92
task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Stop LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Enter MENU mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Please switch to M mode.
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_5137.CR2: 25356804
B:/DCIM/100CANON/IMG_5137.JPG not found. 


memory benchmark stops on memcpy cacheable (verifying)
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on April 10, 2018, 05:17:00 PM
Been poking around lua snippets a while thinking about automating darkframe creation in camera. The idea goes something like this:
I record a my mlv files and as a last step I activate a luascript which does following:
1 - Gets metadata info from an mlv file to be used when creating the corresponding darkframe file

2- Records the darkframe file depending on what metadata information the script finds in the corresponding mlv. This means I would need the script to find shutter/iso/camera name and so on.

3 - Once the darkframe is recorded the script moves on to the next mlv and if it´s the same setting as a darkframe file already created it simply skips this file and moves on to check the next mlv and so on.

By using the script one can simply leave out darkframe creation while filming and simply do this in post while mlv files still are on CF/SD card. Now I havn´t seen any examples of lua finding mlv metadata so that is my first question. is it even possible to fetch metadata from an mlv? Only script I can find which seems to do this is here:
https://bitbucket.org/hudson/magic-lantern/src/raw_benchmark/scripts/extra/rawbench.lua?fileviewer=file-view-default
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 10, 2018, 05:35:35 PM
There is a Lua script (https://www.magiclantern.fm/forum/index.php?topic=17091.msg165766#msg165766) that can read some metadata from MLVs (number of frames and total file size). See also this Python script (https://www.magiclantern.fm/forum/index.php?topic=21694.0), as documentation.

Caveat: probably won't work out of the box with the latest builds, but you can still extract some code snippets from there.

For dark frame, it might be interesting to close the shutter and possibly move the mirror, in the same way Canon firmware does for phase-detect autofocus in LiveView. Had a couple of attempts in this direction, but didn't know what I was doing; might be worth a second try. If that could work, you will be able to fully automate the dark frame capture.
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on April 10, 2018, 05:43:21 PM
Thanks, yes, checked that script in particular. Will start to poke from there. Maybe something which could lead to a ML Lua API module called mlv. Only ideas atm. Still early in the lua game...

QuoteFor dark frame, it might be interesting to close the shutter and possibly move the mirror, in the same way Canon firmware does for phase-detect autofocus in LiveView. Had a couple of attempts in this direction, but didn't know what I was doing; might be worth a second try. If that could work, you will be able to fully automate the dark frame capture.
Oh yes!
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on April 11, 2018, 08:18:07 AM
Another idea here would be to have mlv_lite produce maybe a xmp file with actual settings when recording a mlv. Lua would pick up info from a file easier then bytewise from the actual mlv itself?
Another thought is to produce a lua script in post with the help of bash which iterates all mlv files on card and produces a lua script with all camera settings it can pick up from the mlv files. Then back to cam for recording.
Quite some possibilities here...
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on April 11, 2018, 09:34:20 AM
Trying this on my eosm with crop_rec_4k branch:
menu.close()
console.show()
camera.shutter.value = 1/50
camera.iso.value=800
menu.set("Movie", "FPS override", "ON")
menu.set("RAW video", "Resolution", 1736)
menu.set("Sound recording", "Enable sound", "OFF")
movie.start()
msleep(2000)
movie.stop()

Two problems. menu.set("Movie", "FPS override", "ON") doesn´t turn on in console it says "Could not set value ON for menu movie FPS override"
The other one is that movie.stop() doesn´t seem to work with raw recording but works with H.264 recording so raw just continues until it stops by itself.
Is it possible to change FPS override to for instance:
menu.set("Movie", "FPS override", "24.002000"")
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 11, 2018, 09:42:38 AM
When you turn on FPS override, the value displayed in the menu is not "ON" - it's the actual frame rate. Try setting it to 1 (numeric value, meaning the internal state of that menu entry).

To change the override value, try:

menu.set("FPS override", "Desired FPS", "23.976")


Changing menu items by string works by toggling the option many times, until reaching the desired string (or prefix). A bit error-prone and sometimes slow, but seems to handle custom logic in many cases (but there are still rough edges).

Will check movie start/stop later; I'd expect it to work, but...
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on April 11, 2018, 10:26:48 AM
Some testing:
menu.set("FPS override", "Desired FPS", "24.002")
gave me a result of 16.003 fps.
Tested also:
menu.set("FPS override", "Desired FPS", "24") and think it resulted in 2 fps

Should this work to set FPS override to ON?
menu.set("Movie", "FPS override", "1")
If so, did not work.

Maybe this will work:
menu.set("FPS override", "Actual FPS", "24")
Nope...
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on April 13, 2018, 02:34:00 PM
Tried on my 100D and it does seem to work with:
movie.stop()
There´s some delay added to the stop so I wrongly assumed it wasn´t stopping from script when running it on my eosm.

FPS override is still something left out there not working. "Desired FPS" is a loose canon... 8)
Maybe has something todo with this. If anyone has a tip here please share:
QuoteChanging menu items by string works by toggling the option many times, until reaching the desired string (or prefix). A bit error-prone and sometimes slow, but seems to handle custom logic in many cases (but there are still rough edges).
Does it mean moving directly to desired fps is causing the issue? So moving/scrolling to desired fps step by step will be better?(guessing...)

It seems timing with key.press is more accurate than using movie.stop():
-- Movie start

menu.close()

camera.shutter.value = 1/50
camera.iso.value=800
menu.set("RAW video", "Resolution", 1736)
menu.set("Sound recording", "Enable sound", "OFF")
key.press(KEY.REC)
msleep(4000)
key.press(KEY.REC)
Title: Re: Lua Scripting (lua.mo)
Post by: stan101 on April 15, 2018, 10:18:59 AM
Canon 70D version magiclantern-lua_fix.2018Mar31.70D112.zip

Memory Benchmark:
mode: play-ph lcd, global draw on
Display on 72.24 mb/s
Display off 72.39 mb/s
memcpy cacheable

This often went as high as low 80's with a only a difference of less than 1 mb. On one occasion I ran it and the display off was marginally slower.

Lua Test
===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-4-15 14:59:15
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 101
    apex = 5.625
    ms = 20
    value = 0.020263
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 21
      apex = 1.625
      value = 1.7
    max = table:
      raw = 72
      apex = 8.
      value = 16
  iso = table:
    raw = 104
    apex = 9.
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 8
    value = 1.
  kelvin = 5300
  mode = 3
  metering_mode = 3
  drive_mode = 19
  model = "Canon EOS 70D"
  model_short = "70D"
  firmware = "1.1.2"
  temperature = 172
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  bulb = function: p
  reboot = function: p
  shoot = function: p
  wait = function: p
  burst = 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:
  clear = function: p
  show = function: p
  write = function: p
  hide = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  stop = function: p
  pause = function: p
  start = function: p
  wait = function: p
  info = function: p
  resume = function: p
lens = table:
  name = "18-35mm"
  focal_length = 35
  focus_distance = 820
  hyperfocal = 23096
  dof_near = 796
  dof_far = 845
  af = true
  af_mode = 0
  focus = function: p
  autofocus = function: p
display = table:
  idle = nil
  height = 480
  width = 720
  clear = function: p
  notify_box = function: p
  off = function: p
  circle = function: p
  rect = function: p
  load = function: p
  screenshot = function: p
  pixel = function: p
  draw = function: p
  line = function: p
  print = function: p
  on = function: p
key = table:
  last = 10
  wait = function: p
  press = function: p
menu = table:
  visible = false
  get = function: p
  close = function: p
  open = function: p
  set = function: p
  new = function: p
  block = function: p
  select = function: p
movie = table:
  recording = false
  start = function: p
  stop = function: p
dryos = table:
  clock = 91
  ms_clock = 91742
  image_prefix = "IMG_"
  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/100CANON/"
  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 = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 7381
    folder_number = 100
    free_space = 7715808
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    cluster_size = 32768
    drive_letter = "B"
    file_number = 7381
    folder_number = 100
    free_space = 7715808
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    min = 59
    sec = 16
    wday = 1
    year = 2018
    yday = 105
    day = 15
    isdst = false
    hour = 14
    month = 4
  rename = function: p
  remove = function: p
  call = function: p
  directory = function: p
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: p
battery = table:
  level = 72
  id = 1
  performance = 3
  time = nil
  drain_rate = 30
task = table:
  create = function: p
  yield = function: p
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_7382.CR2 not found.
B:/DCIM/100CANON/IMG_7382.JPG not found.


Stub Test

[Pass] is_play_mode() => 0x1
[INFO] Camera model: Canon EOS 70D 1.1.2 (0x80000325 70D)
[Pass] is_camera("DIGIC", "*") => 0x1
[Pass] is_camera(__camera_model_short, firmware_version) => 0x1
[Pass] src = fio_malloc(size) => 0x4212009c
[Pass] dst = fio_malloc(size) => 0x429240a8
[Pass] memcmp(dst, src, 4097) => 0x4
[Pass] edmac_memcpy(dst, src, 4097) => 0x429240a8
[Pass] memcmp(dst, src, 4097) => 0x0
[Pass] edmac_memcpy(dst, src, 4097) => 0x429240a8
[Pass] memcmp(dst, src, size) => 0x53
[Pass] edmac_memcpy(dst, src, size) => 0x429240a8
[Pass] memcmp(dst, src, size) => 0x0
[Pass] memcmp(dst, src, size) => 0xffffffd2
[Pass] edmac_memcpy_start(dst, src, size) => 0x429240a8
       dt => 0x18d4
[Pass] copied => 0x4170d8
[Pass] copied => 0x4170d8
[Pass] copied => 0x4170d8
[Pass] memcmp(dst, src, copied) => 0x0
[Pass] memcmp(dst, src, copied + 16) => 0xffffffef
       edmac_memcpy_finish()
       free(src)
       free(dst)
Cache test A (EDMAC on BMP buffer)...
[Pass] bmp = bmp_load("ML/CROPMKS/CINESCO2.BMP", 1) => 0x8cea90
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x149e
[Pass] old => 0x0
[Pass] irq => 0xc0
[Pass] differences => 0x0
Cache test B (FIO on 8K buffer)...
[Pass] tries[0] => 0xe9
[Pass] tries[1] => 0x10d
[Pass] tries[2] => 0xf3
[Pass] tries[3] => 0xff
[Pass] failr[0] => 0x66
[Pass] failw[0] => 0xb2
[Pass] failr[1] => 0x6a
[Pass] failw[1] => 0x0
[Pass] failr[2] => 0x0
[Pass] failw[2] => 0xcc
[Pass] failr[3] => 0x0
[Pass] failw[3] => 0x0
       times[0] / tries[0] => 0x26
       times[1] / tries[1] => 0x26
       times[2] / tries[2] => 0x26
       times[3] / tries[3] => 0x25
Cache tests finished.

[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x2
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] f = FIO_CreateFile("test.dat") => 0x5
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
[Pass] FIO_WriteFile(f, (void*)0xFF000000, 0x10000) => 0x10000
       FIO_CloseFile(f)
[Pass] FIO_GetFileSize("test.dat", &size) => 0x0
[Pass] size => 0x20000
[Pass] p = (void*)_alloc_dma_memory(0x20000) => 0x4092f734
[Pass] f = FIO_OpenFile("test.dat", O_RDONLY | O_SYNC) => 0x5
[Pass] FIO_ReadFile(f, p, 0x20000) => 0x20000
       FIO_CloseFile(f)
       _free_dma_memory(p)
[Pass] count => 0x3a98
[Pass] buf = fio_malloc(0x1000000) => 0x4212009c
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000000
[Pass] f = FIO_OpenFile("test.dat", O_RDWR | O_SYNC) => 0x5
[Pass] FIO_SeekSkipFile(f, 0, SEEK_END) => 0x82000000
[Pass] FIO_WriteFile(f, buf, 0x10) => 0x10
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_END) => 0x81fffff0
[Pass] FIO_WriteFile(f, buf, 0x30) => 0x30
[Pass] FIO_SeekSkipFile(f, 0x20, SEEK_SET) => 0x20
[Pass] FIO_SeekSkipFile(f, 0x30, SEEK_CUR) => 0x50
[Pass] FIO_SeekSkipFile(f, -0x20, SEEK_CUR) => 0x30
[Pass] FIO_GetFileSize_direct("test.dat") => 0x82000020
[Pass] is_file("test.dat") => 0x1
[Pass] FIO_RemoveFile("test.dat") => 0x0
[Pass] is_file("test.dat") => 0x0
[Pass] SetTimerAfter(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xdebe
       msleep(900)
[Pass] timer_func => 0x0
       msleep(200)
[Pass] timer_func => 0x1
[Pass] ABS((timer_time/1000 - t0) - 1000) => 0x8
[Pass] ABS((timer_arg - ta0) - 1000) => 0xa
[Pass] timer = SetTimerAfter(1000, timer_cbr, overrun_cbr, 0) => 0xdf1e
       msleep(400)
       CancelTimer(timer)
[Pass] timer_func => 0x0
       msleep(1500)
[Pass] timer_func => 0x0
[Pass] SetHPTimerAfterNow(0, timer_cbr, overrun_cbr, 0) => 0x15
[Pass] timer_func => 0x2
[Pass] SetHPTimerAfterNow(100000, timer_cbr, overrun_cbr, 0) => 0x38b86
       msleep(90)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 100000) => 0xe1
[Pass] ABS(DeltaT(timer_arg, ta0) - 100000) => 0xc8
[Pass] ABS((get_us_clock() - t0) - 110000) => 0x22a
[Pass] SetHPTimerAfterNow(90000, next_tick_cbr, overrun_cbr, 0) => 0x38b88
       msleep(80)
[Pass] timer_func => 0x0
       msleep(20)
[Pass] timer_func => 0x3
       msleep(80)
[Pass] timer_func => 0x3
       msleep(20)
[Pass] timer_func => 0x1
[Pass] ABS(DeltaT(timer_time, t0) - 300000) => 0x2a6
[Pass] ABS(DeltaT(timer_arg, ta0) - 300000) => 0x28c
[Pass] ABS((get_us_clock() - t0) - 310000) => 0x239
       t0 = GET_DIGIC_TIMER() => 0x5d780
       msleep(250)
       t1 = GET_DIGIC_TIMER() => 0x99b19
[Pass] ABS(MOD(t1-t0, 1048576)/1000 - 250) => 0x4
       LoadCalendarFromRTC( &now )
       s0 = now.tm_sec => 0x33
       Date/time: 2018/04/15 14:14:51
       msleep(1500)
       LoadCalendarFromRTC( &now )
       s1 = now.tm_sec => 0x35
[Pass] MOD(s1-s0, 60) => 0x2
[Pass] MOD(s1-s0, 60) => 0x2
       m0 = MALLOC_FREE_MEMORY => 0x4c6c0
[Pass] p = (void*)_malloc(50*1024) => 0x112490
[Pass] CACHEABLE(p) => 0x112490
       m1 = MALLOC_FREE_MEMORY => 0x3feb0
       _free(p)
       m2 = MALLOC_FREE_MEMORY => 0x4c6c0
[Pass] ABS((m0-m1) - 50*1024) => 0x10
[Pass] ABS(m0-m2) => 0x0
       m0 = GetFreeMemForAllocateMemory() => 0x242724
[Pass] p = (void*)_AllocateMemory(128*1024) => 0x92f6f4
[Pass] CACHEABLE(p) => 0x92f6f4
       m1 = GetFreeMemForAllocateMemory() => 0x222718
       _FreeMemory(p)
       m2 = GetFreeMemForAllocateMemory() => 0x242724
[Pass] ABS((m0-m1) - 128*1024) => 0xc
[Pass] ABS(m0-m2) => 0x0
       m01 = MALLOC_FREE_MEMORY => 0x4c6c0
       m02 = GetFreeMemForAllocateMemory() => 0x242724
[Pass] p = (void*)_alloc_dma_memory(128*1024) => 0x4092f734
[Pass] UNCACHEABLE(p) => 0x4092f734
[Pass] CACHEABLE(p) => 0x92f734
[Pass] UNCACHEABLE(CACHEABLE(p)) => 0x4092f734
       _free_dma_memory(p)
[Pass] p = (void*)_shoot_malloc(16*1024*1024) => 0x4212008c
[Pass] UNCACHEABLE(p) => 0x4212008c
       _shoot_free(p)
       m11 = MALLOC_FREE_MEMORY => 0x4c6c0
       m12 = GetFreeMemForAllocateMemory() => 0x242784
[Pass] ABS(m01-m11) => 0x0
[Pass] ABS(m02-m12) => 0x60
[Pass] suite = shoot_malloc_suite_contig(16*1024*1024) => 0xff700
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x1000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x1123d0
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x1000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42120088
[Pass] UNCACHEABLE(p) => 0x42120088
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite_contig(0) => 0xff700
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x1
[Pass] suite->size => 0x2000000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x112238
[Pass] chunk->signature => 'MemChunk'
[Pass] chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       largest_shoot_block = suite->size => 0x2000000
[INFO] largest_shoot_block: 32MB
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(largest_shoot_block + 1024*1024) => 0xff700
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x2
[Pass] suite->size => 0x2100000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x112238
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112308
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2100000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4410407c
[Pass] UNCACHEABLE(p) => 0x4410407c
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0x2100000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] suite = shoot_malloc_suite(0) => 0xff700
[Pass] suite->signature => 'MemSuite'
[Pass] suite->num_chunks => 0x14
[Pass] suite->size => 0xf700000
[Pass] chunk = GetFirstChunkFromSuite(suite) => 0x112238
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2000000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x42104070
[Pass] UNCACHEABLE(p) => 0x42104070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112308
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x220c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4410407c
[Pass] UNCACHEABLE(p) => 0x4410407c
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112340
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x22f4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x581140e4
[Pass] UNCACHEABLE(p) => 0x581140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112378
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x23dc000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4af140e4
[Pass] UNCACHEABLE(p) => 0x4af140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1123b0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x24c4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48b140e4
[Pass] UNCACHEABLE(p) => 0x48b140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1123e8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x25ac000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x467140e4
[Pass] UNCACHEABLE(p) => 0x467140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112490
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2694000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c9140e4
[Pass] UNCACHEABLE(p) => 0x5c9140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1124c8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x277c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a5140e4
[Pass] UNCACHEABLE(p) => 0x5a5140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112500
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x2864000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x443140e4
[Pass] UNCACHEABLE(p) => 0x443140e4
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112538
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4864000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x58200064
[Pass] UNCACHEABLE(p) => 0x58200064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112570
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x4b78000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a200070
[Pass] UNCACHEABLE(p) => 0x5a200070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1125a8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x6b78000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5a600064
[Pass] UNCACHEABLE(p) => 0x5a600064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1125e0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x6e8c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x5c600070
[Pass] UNCACHEABLE(p) => 0x5c600070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112618
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x8e8c000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x44400064
[Pass] UNCACHEABLE(p) => 0x44400064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112650
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0x91a0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x46400070
[Pass] UNCACHEABLE(p) => 0x46400070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112688
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb1a0000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x46800064
[Pass] UNCACHEABLE(p) => 0x46800064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1126c0
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xb4b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48800070
[Pass] UNCACHEABLE(p) => 0x48800070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x1126f8
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xd4b4000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x48c00064
[Pass] UNCACHEABLE(p) => 0x48c00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112730
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xd7c8000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x4ac00070
[Pass] UNCACHEABLE(p) => 0x4ac00070
       chunk = GetNextMemoryChunk(suite, chunk) => 0x112768
[Pass] chunk->signature => 'MemChunk'
[Pass] total += chunk->size => 0xf700000
[Pass] p = GetMemoryAddressOfMemoryChunk(chunk) => 0x55e00064
[Pass] UNCACHEABLE(p) => 0x55e00064
       chunk = GetNextMemoryChunk(suite, chunk) => 0x0
[Pass] total => 0xf700000
       shoot_free_suite(suite); suite = 0; chunk = 0;
[Pass] strlen("abc") => 0x3
[Pass] strlen("qwertyuiop") => 0xa
[Pass] strlen("") => 0x0
[Pass] strcpy(msg, "hi there") => 0x21a324
[Pass] msg => 'hi there'
[Pass] snprintf(a, sizeof(a), "foo") => 0x3
[Pass] snprintf(b, sizeof(b), "foo") => 0x3
[Pass] strcmp(a, b) => 0x0
[Pass] snprintf(a, sizeof(a), "bar") => 0x3
[Pass] snprintf(b, sizeof(b), "baz") => 0x3
[Pass] strcmp(a, b) => 0xfffffff8
[Pass] snprintf(a, sizeof(a), "Display") => 0x7
[Pass] snprintf(b, sizeof(b), "Defishing") => 0x9
[Pass] strcmp(a, b) => 0x4
[Pass] snprintf(buf, 3, "%d", 1234) => 0x2
[Pass] buf => '12'
[Pass] memcpy(foo, bar, 6) => 0x21a300
[Pass] foo => 'asdfghuiop'
[Pass] memset(bar, '*', 5) => 0x21a2e0
[Pass] bar => '*****hjkl;'
       bzero32(bar + 5, 5)
[Pass] bar => '****'
       EngDrvOut(LCD_Palette[0], 0x1234)
[Pass] shamem_read(LCD_Palette[0]) => 0x1234
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       call("TurnOffDisplay")
[Pass] DISPLAY_IS_ON => 0x0
       call("TurnOnDisplay")
[Pass] DISPLAY_IS_ON => 0x1
       task_create("test", 0x1c, 0x1000, test_task, 0) => 0xe09800ee
[Pass] test_task_created => 0x1
[Pass] get_current_task_name() => 'run_test'
[Pass] get_task_name_from_id(current_task->taskId) => 'run_test'
[Pass] task_max => 0x84
[Pass] task_max => 0x84
[Pass] mq = mq ? mq : (void*)msg_queue_create("test", 5) => 0xe09a00c8
[Pass] msg_queue_post(mq, 0x1234567) => 0x0
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x0
[Pass] m => 0x1234567
[Pass] msg_queue_receive(mq, (struct event **) &m, 500) => 0x9
[Pass] sem = sem ? sem : create_named_semaphore("test", 1) => 0xe09c026e
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] take_semaphore(sem, 500) => 0x9
[Pass] give_semaphore(sem) => 0x0
[Pass] take_semaphore(sem, 500) => 0x0
[Pass] give_semaphore(sem) => 0x0
[Pass] rlock = rlock ? rlock : CreateRecursiveLock(0) => 0xe09e00c6
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] AcquireRecursiveLock(rlock, 500) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0x0
[Pass] ReleaseRecursiveLock(rlock) => 0xf
       SetGUIRequestMode(1); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x1
       SetGUIRequestMode(2); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x2
       SetGUIRequestMode(0); msleep(1000);
[Pass] CURRENT_GUI_MODE => 0x0
[Pass] display_idle() => 0x1
       GUI_Control(BGMT_PLAY, 0, 0, 0); msleep(1000);
[Pass] PLAY_MODE => 0x1
[Pass] MENU_MODE => 0x0
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(1000);
[Pass] MENU_MODE => 0x1
[Pass] PLAY_MODE => 0x0
[Pass] dialog->type => 'DIALOG'
       GUI_Control(BGMT_MENU, 0, 0, 0); msleep(500);
[Pass] MENU_MODE => 0x0
[Pass] PLAY_MODE => 0x0
       SW1(1,100)
[Pass] HALFSHUTTER_PRESSED => 0x1
       SW1(0,100)
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x1
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x1
[Pass] is_play_mode() => 0x1
[Pass] is_pure_play_photo_mode() => 0x0
[Pass] is_pure_play_movie_mode() => 0x0
=========================================================
Test complete, 12814 passed, 8 failed.
.


Stack focusing is working well.. I trialed it a few times. I will get and and shoot with this version tomorrow and see if anything comes of it and report back.



Title: Re: Lua Scripting (lua.mo)
Post by: stan101 on April 15, 2018, 10:36:52 AM
For people who are not au fait with this type of testing as I wasn't, here are some further details on how to set up the tests for the 70D. It may be the same for other cameras:

1. Enter Magic Lantern by hitting delete then click any button.
2. Use the left or right direction button to scroll across to the "Modules" tab, The icon is four squares with the top right square out of place.
3. Turn on "bench", "lua", and "selftest" by scrolling to them individually and hit the 'set" button.
4. Restart the camera.
5. After restart re-enter Magic Lantern by hitting delete then click any button.
6. Scroll across to "Scripts". It is one tab to the left of "Modules."
7. Run "Script API Tests". You may be asked to change to manual mode on the camera. Check the screen for info. After it is complete, Restart your camera to clear the screen.
8. Scroll across to "Debug". It is two tabs  to the right of "Scripts."
9. Scroll down and enter "Benchmarks" then scroll down to "Memory Benchmarks" and run it. After it finishes take a photo of the results or somehow record them. After it is complete, Restart your camera to clear the screen.
10.  After restart re-enter Magic Lantern by hitting delete then click any button.
11. Scroll down to "Self Tests" and enter it. At the top will be "Stubs API Test". Run it. You may be asked to change to movie mode. Do so.
12. After it completes that test, shut down the camera and reamove the memory card.
13. Navigate into the memory on a PC and find "LUATEST.LOG" in the root directory of the card.
14.Navigate to ML\Logs folder and find "Stubtest.log."
15. Put the info into a post here.
Title: Re: Lua Scripting (lua.mo)
Post by: saulbass on May 02, 2018, 09:33:43 PM
not sure if this is possible - but would be useful to have a lua scripted beep command so that when the script is waiting for user input - the camera bleeps - saves having to watch the camera on long script runs.
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on May 07, 2018, 05:35:23 AM
Here's a recurring nightmare. In all cases the api_test.lua script would stop on the ISO test and show this error:

650D (https://www.magiclantern.fm/forum/index.php?topic=7473.msg201059#msg201059)
(https://farm1.staticflickr.com/827/41898303382_06e8f50f15.jpg) (https://flic.kr/p/26QpKT5)

600D (https://www.magiclantern.fm/forum/index.php?topic=15360.msg201102#msg201102)
(https://farm1.staticflickr.com/906/41042927645_bdfae5bcb6.jpg) (https://flic.kr/p/25wPJtx)

1100D (in QEMU) (https://www.magiclantern.fm/forum/index.php?topic=1009.msg201029#msg201029)
(https://farm1.staticflickr.com/828/28037073638_16600fb4df.jpg) (https://flic.kr/p/JHxkcm)

However, the exposure tests pass fine as long as it is either run by it self or, as @mk11174 pointed out, rearranged so that it runs before the IO tests.

Looks like maybe a memory leak or something that is way beyond my comprehension.
Title: Re: Lua Scripting (lua.mo)
Post by: dmilligan on May 07, 2018, 02:48:26 PM
@saulbass https://builds.magiclantern.fm/lua_api/modules/global.html#beep
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on May 25, 2018, 04:29:09 PM
I´m trying to check if movie mode is set or not via a lua script and if not tell me to set i to movie mode:

Based on this idea:
while camera.mode == MODE.MOVIE
do
display.notify_box("Set camera to MOVIE mode")
msleep(1000)
end


I am thinking it could be possible to put in a "not" in the mix but this isn´t working:
while not camera.mode == MODE.MOVIE
do
display.notify_box("Set camera to MOVIE mode")
msleep(1000)
end


camera.mode == MODE.PHOTO
isn´t legit either so how to go on here? David, Garry, A1ex, somenone else?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on May 25, 2018, 04:47:22 PM
Maybe it doesn't like the indentation (http://lua-users.org/wiki/LuaStyleGuide)?

Ah, wait, it's not Python. Here you go (https://www.lua.org/pil/3.2.html). Or here (https://builds.magiclantern.fm/lua_api/modules/constants.html#MODE).
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on May 25, 2018, 05:07:41 PM
Indentation can always improve  :P
Anyway, will check some more from the links tonight.
Thanks!
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on May 25, 2018, 10:42:27 PM
Lovely stuff. Lua, so very useful:
while camera.mode ~= MODE.MOVIE
do
display.notify_box("Set camera to MOVIE mode")
msleep(1000)
end

Title: Re: Lua Scripting (lua.mo)
Post by: Danne on June 01, 2018, 03:18:25 PM
Been tinkering with two preset scripts with the intention to fast get into a basic movie mode either in 5xzoom or when in regular 1080p mode. All in all most settings are being applied as expected but there are two things that I cannot seem to get right yet. Here are both scripts in question:

preset 1
-- 10bit_5x_iso100_2.5k

menu.set("Overlay", "Global Draw", "OFF")
console.hide()
menu.close()
while camera.mode ~= MODE.MOVIE do
   display.notify_box("enable MOVIE mode")
   msleep(1000)
end

    menu.set("Sound recording", "Enable sound", "ON")
while menu.get("Sound recording", "Enable sound", "") ~= "ON" do
   display.notify_box("enable mlv_snd.mo and restart to record sound")
   msleep(1000)
end

    lv.zoom = 5
    menu.set("Overlay", "Zebras", "OFF")
    menu.set("Overlay", "Magic Zoom", "OFF")
    menu.set("Overlay", "Cropmarks", "OFF")
    menu.set("Overlay", "Spotmeter", "OFF")
    menu.set("Overlay", "False color", "OFF")
    menu.set("Overlay", "Histogram", "OFF")
    menu.set("Overlay", "Waveform", "OFF")
    menu.set("Overlay", "Vectorscope", "OFF")
    menu.set("Display", "Clear overlays", "OFF")

    menu.set("Movie", "RAW video", "ON")
    menu.set("RAW video", "Resolution", 2560)
    menu.set("RAW video", "Data format", "10-bit lossless")
    menu.set("RAW video", "Preview", "Real-time")
    camera.shutter.value = 1/50
    camera.iso.value=100
    menu.close()

if menu.get("FPS override", "Actual FPS", "") >= "24.999" then
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
end

    menu.set("Overlay", "Global Draw", "LiveView")


preset 2
-- 12bit_iso100_1080p

menu.set("Overlay", "Global Draw", "OFF")
console.hide()
menu.close()
while camera.mode ~= MODE.MOVIE do
   display.notify_box("enable MOVIE mode")
   msleep(1000)
end

    menu.set("Sound recording", "Enable sound", "ON")
while menu.get("Sound recording", "Enable sound", "") ~= "ON" do
   display.notify_box("enable mlv_snd.mo and restart to record sound")
   msleep(1000)
end

    lv.zoom = 1
    menu.set("Overlay", "Focus Peak", "OFF")
    menu.set("Overlay", "Zebras", "OFF")
    menu.set("Overlay", "Magic Zoom", "F+HS, Med, TL, 2:1")
    menu.set("Overlay", "Cropmarks", "OFF")
    menu.set("Overlay", "Spotmeter", "OFF")
    menu.set("Overlay", "False color", "OFF")
    menu.set("Overlay", "Histogram", "OFF")
    menu.set("Overlay", "Waveform", "OFF")
    menu.set("Overlay", "Vectorscope", "OFF")
    menu.set("Display", "Clear overlays", "OFF")
    menu.set("Overlay", "Global Draw", "LiveView")

    menu.set("Movie", "RAW video", "ON")
    menu.set("RAW video", "Resolution", 1920)
    menu.set("RAW video", "Data format", "12-bit lossless")
    menu.set("RAW video", "Preview", "Auto")
    camera.shutter.value = 1/50
    camera.iso.value=100
    menu.close()


About magic zoom:
In preset 2 I set magic zoom mode accordingly:
    menu.set("Overlay", "Magic Zoom", "F+HS, Med, TL, 2:1")
This works good but I really like to set magic zoom to this instead:
    menu.set("Overlay", "Magic Zoom", "HalfS, Med, TL, 2:1")
This won´t apply. Seems default underlaying mode is F+HS, Med, TL, 2:1 and getting the Halfshutter option added will not apply.
I then do following to get the halfshutter setting applied but still not working:
    menu.set("Overlay", "Magic Zoom", "Trigger mode", "HalfShutter")
To my logic this should do the trick? Ideas?

About FPS override:
FPS override is really picky. If you don´t specify exactly what´s going on after specifying Desired fps it will punish the user with complete randomness:
Working example:
    menu.set("FPS override", "Desired FPS", "24 (from 30)")
But only if (from 30) part is specified and correctly added.
If doing line below this you get around 16 fps instead of 24fps:
    menu.set("FPS override", "Desired FPS", "24)


If working with the eosm one have to something like this to find out the actual fps and add accordingly to get a correct 24fps via lua(very crude example):
   if menu.get("FPS override", "Actual FPS", "29.973") == "29.973"
    then
    menu.set("FPS override", "Desired FPS", "24 (from 30)")
    end
    if menu.get("FPS override", "Actual FPS", "29.975") == "29.975"
    then
    menu.set("FPS override", "Desired FPS", "24 (from 30)")
    end
    if menu.get("FPS override", "Actual FPS", "29.958") == "29.958"
    then
    menu.set("FPS override", "Desired FPS", "24 (from 30)")
    end

Title: Re: Lua Scripting (lua.mo)
Post by: dfort on June 01, 2018, 10:44:28 PM
Experimented around with Danne's latest lua scripts and they work though what also works is copying a settings folder with all the settings needed to set the desired bit depth, which modules to turn on, etc. and copying this settings folder onto each card. Maybe a lua script that can create the desired settings and maybe even restart ML to get the modules loaded might be another way to get all these settings in order? Maybe a combination of the two techniques?

This is what is in my settings folder:

LUA.EN
MLV_LITE.EN
MLV_SND.EN
SD_UHS.EN
SDOVER~1.LEN


MLV_LITE.CFG
# Config file for module mlv_lite (MLV_LITE.MO)

raw.video.enabled = 1

raw.res_x = 6

raw.write.speed = 5195

raw.preview = 1

raw.output_format = 7



MAGIC.CFG
# Magic Lantern Nightly.2018Jun01.700D115 (f938717fc0f1 (crop_rec_4k_mlv_lite_snd_sd_uhs_HDR_ext_all_bits) tip)
# Built on 2018-06-01 11:39:01 UTC by dan@dans-MBP
# Configuration saved on 2018/06/01 19:08:45
beta.warn = 1

menu.first = -2

fps.preset = 1

fps.override.idx = 32

fps.override = 1

hist.draw = 0

spotmeter.draw = 0

zebra.draw = 0

global.draw = 1



There's also a MENU.CFG though that might not be essential to getting these settings working?
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on June 04, 2018, 05:03:38 PM
I have put up my recent lua scripts here:

lua_magic
https://bitbucket.org/Dannephoto/lua_magic/

Found a way to enable FPS override from lua hopefully getting correct Desired fps. Since menu.set needs more info than just fps number we need some checking before applying:
-- warn if in mv720p
if menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "61" then
   display.notify_box("Set cam to mv1080p and run script again")
   msleep(1000)
   display.notify_box("Set cam to mv1080p and run script again")
   msleep(1000)
   return
end

-- workaround by range check to be able to set FPS override numbers
if menu.get("FPS override", "Actual FPS", "") >= "23" and menu.get("FPS override", "Actual FPS", "") <= "24" then
   menu.set("FPS override", "Desired FPS", "24 (from 24)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "25" and menu.get("FPS override", "Actual FPS", "") <= "26" then
   menu.set("FPS override", "Desired FPS", "24 (from 25)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "29" and menu.get("FPS override", "Actual FPS", "") <= "30" then
   menu.set("FPS override", "Desired FPS", "24 (from 30)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "51" then
   menu.set("FPS override", "Desired FPS", "24 (from 50)")
   camera.shutter.value = 1/60
elseif menu.get("FPS override", "Actual FPS", "") >= "59" and menu.get("FPS override", "Actual FPS", "") <= "60" then
   menu.set("FPS override", "Desired FPS", "24 (from 60)")
   camera.shutter.value = 1/60
end

-- let´s go into zoom mode
   lv.zoom = 5


Couldn´t enable FPS override any other way the working with menu.select and key.press. Glad that worked at least. Cool stuff.
-- now turn FPS override to on
   menu.select("Movie", "FPS override")
   menu.open()     -- open ML menu
   key.press(KEY.SET)
   menu.close()


Full script here:
-- 5x_2.5k_10bit_iso100_24fps

-- warn if not movie mode
   menu.set("Overlay", "Global Draw", "OFF")
   console.hide()
   menu.close()
while camera.mode ~= MODE.MOVIE do
   display.notify_box("enable MOVIE mode")
   msleep(1000)
end

-- set regular live view and turn FPS override OFF
   lv.zoom = 1
   menu.set("Movie", "FPS override", "OFF")
   msleep(400)

-- enable sound
   menu.set("Sound recording", "Enable sound", "ON")
if menu.get("Sound recording", "Enable sound", "") ~= "ON" then
   display.notify_box("enable mlv_snd.mo and restart to record sound")
   msleep(1000)
   display.notify_box("enable mlv_snd.mo and restart to record sound")
   msleep(1000)
   return
end

-- warn if in mv720p
if menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "61" then
   display.notify_box("Set cam to mv1080p and run script again")
   msleep(1000)
   display.notify_box("Set cam to mv1080p and run script again")
   msleep(1000)
   return
end

-- workaround by range check to be able to set FPS override numbers
if menu.get("FPS override", "Actual FPS", "") >= "23" and menu.get("FPS override", "Actual FPS", "") <= "24" then
   menu.set("FPS override", "Desired FPS", "24 (from 24)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "25" and menu.get("FPS override", "Actual FPS", "") <= "26" then
   menu.set("FPS override", "Desired FPS", "24 (from 25)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "29" and menu.get("FPS override", "Actual FPS", "") <= "30" then
   menu.set("FPS override", "Desired FPS", "24 (from 30)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "51" then
   menu.set("FPS override", "Desired FPS", "24 (from 50)")
   camera.shutter.value = 1/60
elseif menu.get("FPS override", "Actual FPS", "") >= "59" and menu.get("FPS override", "Actual FPS", "") <= "60" then
   menu.set("FPS override", "Desired FPS", "24 (from 60)")
   camera.shutter.value = 1/60
end

-- let´s go into zoom mode
   lv.zoom = 5

-- now turn FPS override to on
   menu.select("Movie", "FPS override")
   menu.open()     -- open ML menu
   key.press(KEY.SET)
   menu.close()

-- Overlay
   menu.set("Overlay", "Zebras", "OFF")
   menu.set("Overlay", "Magic Zoom", "OFF")
   menu.set("Overlay", "Cropmarks", "OFF")
   menu.set("Overlay", "Spotmeter", "OFF")
   menu.set("Overlay", "False color", "OFF")
   menu.set("Overlay", "Histogram", "OFF")
   menu.set("Overlay", "Waveform", "OFF")
   menu.set("Overlay", "Vectorscope", "OFF")
   menu.set("Display", "Clear overlays", "OFF")

-- Movie
   menu.set("Movie", "RAW video", "ON")
   menu.set("Movie", "HDR video", "OFF")
   menu.set("RAW video", "Resolution", 2560)
   menu.set("RAW video", "Data format", "10-bit lossless")
   menu.set("RAW video", "Preview", "Real-time")
   camera.iso.value=100
   menu.close()

-- warn if FPS override still is wrongly set
if menu.get("FPS override", "Actual FPS", "") >= "24.999" then
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
end

-- done, turn on global draw
   menu.set("Overlay", "Global Draw", "LiveView")

-- go back to menu origin
   menu.select("Scripts")





Another issue in getting into Magic Zoom settings but this seems to do the trick to get what we want:
-- magic zoom quite stubborn one to set(two step operation)
   menu.set("Magic Zoom", "Trigger mode", "HalfShutter")
   menu.set("Overlay", "Magic Zoom", "HalfS, Med, TL, 2:1")


Full script:
-- mv1080p_12bit_iso100_24fps

-- warn if not movie mode
   menu.set("Overlay", "Global Draw", "OFF")
   console.hide()
   menu.close()
while camera.mode ~= MODE.MOVIE do
   display.notify_box("enable MOVIE mode")
   msleep(1000)
end

-- set regular live view and turn FPS override OFF
   lv.zoom = 1
   menu.set("Movie", "FPS override", "OFF")
   msleep(400)

-- enable sound
   menu.set("Sound recording", "Enable sound", "ON")
if menu.get("Sound recording", "Enable sound", "") ~= "ON" then
   display.notify_box("enable mlv_snd.mo and restart to record sound")
   msleep(1000)
   display.notify_box("enable mlv_snd.mo and restart to record sound")
   msleep(1000)
   return
end

-- warn if in mv720p
if menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "61" then
   display.notify_box("Set cam to mv1080p and run script again")
   msleep(1000)
   display.notify_box("Set cam to mv1080p and run script again")
   msleep(1000)
   return
end

-- workaround by range check to be able to set FPS override numbers
if menu.get("FPS override", "Actual FPS", "") >= "23" and menu.get("FPS override", "Actual FPS", "") <= "24" then
   menu.set("FPS override", "Desired FPS", "24 (from 24)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "25" and menu.get("FPS override", "Actual FPS", "") <= "26" then
   menu.set("FPS override", "Desired FPS", "24 (from 25)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "29" and menu.get("FPS override", "Actual FPS", "") <= "30" then
   menu.set("FPS override", "Desired FPS", "24 (from 30)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "51" then
   menu.set("FPS override", "Desired FPS", "24 (from 50)")
   camera.shutter.value = 1/60
elseif menu.get("FPS override", "Actual FPS", "") >= "59" and menu.get("FPS override", "Actual FPS", "") <= "60" then
   menu.set("FPS override", "Desired FPS", "24 (from 60)")
   camera.shutter.value = 1/60
end

-- now turn FPS override to on
   menu.select("Movie", "FPS override")
   menu.open()     -- open ML menu
   key.press(KEY.SET)
   menu.close()

-- Overlay
    menu.set("Overlay", "Focus Peak", "OFF")
    menu.set("Overlay", "Zebras", "OFF")

-- magic zoom quite stubborn one to set(two step operation)
   menu.set("Magic Zoom", "Trigger mode", "HalfShutter")
   menu.set("Overlay", "Magic Zoom", "HalfS, Med, TL, 2:1")

   menu.set("Overlay", "Cropmarks", "OFF")
   menu.set("Overlay", "Spotmeter", "OFF")
   menu.set("Overlay", "False color", "OFF")
   menu.set("Overlay", "Histogram", "OFF")
   menu.set("Overlay", "Waveform", "OFF")
   menu.set("Overlay", "Vectorscope", "OFF")
   menu.set("Display", "Clear overlays", "OFF")

-- Movie
   menu.set("Movie", "RAW video", "ON")
   menu.set("Movie", "HDR video", "OFF")
   menu.set("RAW video", "Resolution", 1920)
   menu.set("RAW video", "Data format", "12-bit lossless")
   menu.set("RAW video", "Preview", "Auto")
   camera.iso.value=100
   menu.close()

-- warn if FPS override still is wrongly set
if menu.get("FPS override", "Actual FPS", "") >= "24.999" then
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
   display.notify_box("Set FPS override to 24 or you´re in deep shit.")
   msleep(1000)
end

-- done, turn on global draw
   menu.set("Overlay", "Global Draw", "LiveView")

-- go back to menu origin
   menu.select("Scripts")


Title: Re: Lua Scripting (lua.mo)
Post by: Danne on June 05, 2018, 12:54:48 PM
Interesting workaround to get correct FPS override number. If you set Desired fps higher then original fps running the script will give random low fps in this case aiming for 24. Going from lower let´s say 16 to 24 fps will give correct numbers. Solution is to rerun lua script one more time to correct for the first issue:
-- workaround. May need an extra pass(if higher fps than actual)
while menu.get("FPS override", "Actual FPS", "") <= "23" or menu.get("FPS override", "Actual FPS", "") >= "25" or menu.get("Movie", "FPS override", "") == "OFF" do
   menu.set("Movie", "FPS override", "OFF")
   msleep(1000)

if menu.get("FPS override", "Actual FPS", "") >= "23" and menu.get("FPS override", "Actual FPS", "") <= "24" then
   menu.set("FPS override", "Desired FPS", "24 (from 24)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "25" and menu.get("FPS override", "Actual FPS", "") <= "26" then
   menu.set("FPS override", "Desired FPS", "24 (from 25)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "29" and menu.get("FPS override", "Actual FPS", "") <= "30" then
   menu.set("FPS override", "Desired FPS", "24 (from 30)")
   camera.shutter.value = 1/50
elseif menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "51" then
   menu.set("FPS override", "Desired FPS", "24 (from 50)")
   camera.shutter.value = 1/60
elseif menu.get("FPS override", "Actual FPS", "") >= "59" and menu.get("FPS override", "Actual FPS", "") <= "60" then
   menu.set("FPS override", "Desired FPS", "24 (from 60)")
   camera.shutter.value = 1/60
end

-- now turn FPS override to on
   menu.select("Movie", "FPS override")
   menu.open()     -- open ML menu
   key.press(KEY.SET)
   menu.close()
end
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on June 08, 2018, 10:39:37 PM
Just finished a "darkframe creator"  lua script. Running the script will start recording 3 second mlv files starting with 12-bit lossless and then change iso from 100-6400. It starts in mv1080p then moves on to 5xZoom mode, then movie crop mode. Not included Crop rec yet. All will be recorden in 24fps and they can then be used in Switch or batch_mlv or Mlv App, mlv_dump for further automation averaging. 10bit files are excluded. Results often worse with 10bit files.
All my lua files belongs here:
https://bitbucket.org/Dannephoto/lua_magic/
and can be downloaded directly here:
https://bitbucket.org/Dannephoto/lua_magic/downloads/lua_magic.dmg


-- darkframe creator

--[[
Will create 3 second MLV files with following settings:
* iso 100-6400 iso
* FPS override set to 24
* mv1080p (1920x1080) 12-bit lossless, 14bit-lossless, 12-bit, 14bit
* 5xZoom (highest setting) 12-bit lossless(For 5D3 also 14bit lossless and 12-bit)
* Movie crop mode (whatever set to when starting) 12-bit lossless(For 5D3 also 14bit lossless and 12-bit)
* For further darkframe automation on mac check "Switch" https://www.magiclantern.fm/forum/index.php?topic=15108.0
* On windows check "batch_mlv" https://www.magiclantern.fm/forum/index.php?topic=10526.msg188558#msg188558
* Note that processing will take a while so why not have a coffe while waiting...
* don´t forget to film with your lens cap on
--]]

-- warn if in mv720p
if menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "61" then
   menu.set("Overlay", "Global Draw", "OFF")
   display.notify_box("Set cam to mv1080p and run script again")
   msleep(1000)
   display.notify_box("Set cam to mv1080p and run script again")
   msleep(1000)
   return
end

-- warn if not movie mode
  lv.zoom = 1
  console.hide()
  menu.close()
while camera.mode ~= MODE.MOVIE do
  display.notify_box("enable MOVIE mode")
  msleep(1000)
end

-- some pointers before starting
  display.notify_box("Put your lens cap on when filming")
  msleep(2000)
  display.notify_box("Put your lens cap on when filming")
  msleep(2000)
  display.notify_box("This will take about five minutes to finish")
  msleep(2000)
  display.notify_box("This will take about five minutes to finish")
  msleep(2000)

-- Overlay
  menu.set("Overlay", "Global Draw", "OFF")

-- global start off setting
if menu.get("Movie", "Movie crop mode", "") == "ON" then
  menu.select("Movie", "Movie crop mode")
  menu.open()     -- open ML menu
  key.press(KEY.SET)
  menu.close()
end
  camera.iso.value=100
  camera.shutter.value = 1/50
  menu.set("RAW video", "Data format", "12-bit lossless")
  menu.set("Sound recording", "Enable sound", "OFF")

-- Movie settings
  menu.set("Movie", "HDR video", "OFF")
  menu.set("Movie", "RAW video", "ON")
  menu.set("RAW video", "Resolution", 1920)
  menu.set("RAW video", "Preview", "Auto")

-- workaround. May need an extra pass(if higher fps than actual)
while menu.get("FPS override", "Actual FPS", "") <= "23" or menu.get("FPS override", "Actual FPS", "") >= "25" or menu.get("Movie", "FPS override", "") == "OFF" do
  lv.zoom = 1
  menu.set("Movie", "FPS override", "OFF")
  msleep(1000)

  if menu.get("FPS override", "Actual FPS", "") >= "23" and menu.get("FPS override", "Actual FPS", "") <= "24" then
    menu.set("FPS override", "Desired FPS", "24 (from 24)")
    camera.shutter.value = 1/50
  elseif menu.get("FPS override", "Actual FPS", "") >= "25" and menu.get("FPS override", "Actual FPS", "") <= "26" then
    menu.set("FPS override", "Desired FPS", "24 (from 25)")
    camera.shutter.value = 1/50
  elseif menu.get("FPS override", "Actual FPS", "") >= "29" and menu.get("FPS override", "Actual FPS", "") <= "30" then
    menu.set("FPS override", "Desired FPS", "24 (from 30)")
    camera.shutter.value = 1/50
  elseif menu.get("FPS override", "Actual FPS", "") >= "49" and menu.get("FPS override", "Actual FPS", "") <= "51" then
    menu.set("FPS override", "Desired FPS", "24 (from 50)")
    camera.shutter.value = 1/60
  elseif menu.get("FPS override", "Actual FPS", "") >= "59" and menu.get("FPS override", "Actual FPS", "") <= "60" then
    menu.set("FPS override", "Desired FPS", "24 (from 60)")
    camera.shutter.value = 1/60
  end

-- now turn FPS override to on
  menu.select("Movie", "FPS override")
  menu.open()     -- open ML menu
  key.press(KEY.SET)
  menu.close()
end

-- ISO
  i = 100
-------------------------------------- 
-- mv1080p (1920x1080) 24 FPS override
--------------------------------------
   display.notify_box("12-bit lossless mv1080p")
while menu.get("RAW video", "Data format", "") ~= "14-bit" do
   camera.iso.value=(i)
   key.press(KEY.REC)
   msleep(4000)
   movie.stop()
   msleep(3000)
  if menu.get("ISO", "Equivalent ISO", "") ~= "6400" then
    i = i * 2
  else
    i = 100
    if
      menu.get("RAW video", "Data format", "") == "12-bit lossless" then
      display.notify_box("14-bit lossless mv1080p")
      menu.set("RAW video", "Data format", "14-bit lossless")
    elseif
      menu.get("RAW video", "Data format", "") == "14-bit lossless" then
      display.notify_box("12-bit mv1080p")
      menu.set("RAW video", "Data format", "12-bit")
    elseif
      menu.get("RAW video", "Data format", "") == "12-bit" then
      display.notify_box("14-bit mv1080p")
      menu.set("RAW video", "Data format", "14-bit")
    end
  end
end

-- last darkframe round 14-bit
  i = 100
  camera.iso.value=100
while menu.get("ISO", "Equivalent ISO", "") ~= "6400" do
  key.press(KEY.REC)
  msleep(4000)
  movie.stop()
  msleep(3000)
  i = i * 2
  camera.iso.value=(i)
  msleep(1000)
end

-- last 6400 iso
if menu.get("ISO", "Equivalent ISO", "") == "6400" then
  key.press(KEY.REC)
  msleep(4000)
  movie.stop()
  msleep(3000)
end
----------------------------------------- 
-- 5xZoom highest setting 24 FPS override
-----------------------------------------
  i = 100
  lv.zoom = 5
  camera.iso.value=100
  camera.shutter.value = 1/50
  menu.set("RAW video", "Data format", "12-bit lossless")
  menu.set("RAW video", "Resolution", 2880)
  display.notify_box("12-bit lossless 5xzoom")

while menu.get("RAW video", "Data format", "") ~= "12-bit" do
   camera.iso.value=(i)
   key.press(KEY.REC)
   msleep(4000)
   movie.stop()
   msleep(3000)
  if menu.get("ISO", "Equivalent ISO", "") ~= "6400" then
    i = i * 2
  else
    i = 100
    if menu.get("RAW video", "Data format", "") == "12-bit lossless" and camera.model_short == "5D3" then
      display.notify_box("14-bit lossless 5xzoom")
      menu.set("RAW video", "Data format", "14-bit lossless")
    elseif
      menu.get("RAW video", "Data format", "") == "14-bit lossless" and camera.model_short == "5D3" then
      display.notify_box("12-bit 5xzoom")
      menu.set("RAW video", "Data format", "12-bit")
    elseif camera.model_short ~= "5D3" then
      menu.set("RAW video", "Data format", "12-bit")
    end
  end
end

-- last darkframe round 12-bit
if camera.model_short == "5D3" then
  i = 100
  camera.iso.value=100
  while menu.get("ISO", "Equivalent ISO", "") ~= "6400" do
    key.press(KEY.REC)
    msleep(4000)
    movie.stop()
    msleep(3000)
    i = i * 2
    camera.iso.value=(i)
    msleep(1000)
  end

-- last 6400 iso
  if menu.get("ISO", "Equivalent ISO", "") == "6400" then
    key.press(KEY.REC)
    msleep(4000)
    movie.stop()
    msleep(3000)
  end
end
----------------------------------
-- Movie crop mode 24 FPS override
----------------------------------
  lv.zoom = 1
  i = 100
  camera.iso.value=100
  camera.shutter.value = 1/50
  menu.set("RAW video", "Data format", "12-bit lossless")
if menu.get("Movie", "Movie crop mode", "") == "OFF" then
  menu.select("Movie", "Movie crop mode")
  menu.open()     -- open ML menu
  key.press(KEY.SET)
  menu.close()
  display.notify_box("12-bit lossless Movie crop mode")

while menu.get("RAW video", "Data format", "") ~= "12-bit" do
   camera.iso.value=(i)
   key.press(KEY.REC)
   msleep(4000)
   movie.stop()
   msleep(3000)
  if menu.get("ISO", "Equivalent ISO", "") ~= "6400" then
    i = i * 2
  else
    if menu.get("RAW video", "Data format", "") == "12-bit lossless" and camera.model_short == "5D3" then
      display.notify_box("14-bit lossless Movie crop mode")
      menu.set("RAW video", "Data format", "14-bit lossless")
    elseif
      menu.get("RAW video", "Data format", "") == "14-bit lossless" and camera.model_short == "5D3" then
      display.notify_box("12-bit Movie crop mode")
      menu.set("RAW video", "Data format", "12-bit")
    elseif camera.model_short ~= "5D3" then
      menu.set("RAW video", "Data format", "12-bit")
    end
  end
end

-- last darkframe round 12-bit
if camera.model_short == "5D3" then
  i = 100
  camera.iso.value=100
  while menu.get("ISO", "Equivalent ISO", "") ~= "6400" do
    key.press(KEY.REC)
    msleep(4000)
    movie.stop()
    msleep(3000)
    i = i * 2
    camera.iso.value=(i)
    msleep(1000)
  end

-- last 6400 iso
  if menu.get("ISO", "Equivalent ISO", "") == "6400" then
    key.press(KEY.REC)
    msleep(4000)
    movie.stop()
    msleep(3000)
  end
end

if menu.get("Movie", "Movie crop mode", "") == "ON" then
   menu.select("Movie", "Movie crop mode")
   menu.open()     -- open ML menu
   key.press(KEY.SET)
   menu.close()
end
end

-- Starting point
  camera.iso.value=100
  camera.shutter.value = 1/50
  menu.set("RAW video", "Data format", "12-bit lossless")
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on September 20, 2018, 04:09:40 PM
Finally managed to clean up and test yet another round of fixes.

- api_test.lua passes on 5D2 and 500D (this one was hard, took me a week of intensive work, then had to take a break and focus on something else)
- lens.focus and other focus tools should refuse to work if continuous AF (photo mode) or movie servo AF (movie mode) is enabled in Canon menu
- menu.set: fixed issues reported by Danne (https://bitbucket.org/hudson/magic-lantern/commits/1900af4e42044d0435d4557a6a47e0ec932bf19a?at=lua_fix) (FPS override and some other "tricky" menus)
- dryos.sd_card, dryos.cf_card, fixed dryos.card.free_space, removed card.cluster_size
- moved dryos.dcim_dir to dryos.shooting_card.dcim_dir
- api_test.lua: the error messages should now appear in the log file; more obvious popups when user action is needed
- other: #2901 (https://bitbucket.org/hudson/magic-lantern/issues/2901), menu flicker (https://bitbucket.org/hudson/magic-lantern/commits/6147d5a9eb48977fbeebc8eaacbfea0ba7359da9?at=lua_fix), some more minor fixes.

Let's retry the API tests, hopefully they will pass this time.

P.S. I've got everything I need to emulate touchscreen functionality in QEMU on 700D, so I'm going to revisit lua_touch as well.
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on September 20, 2018, 04:33:58 PM
@a1ex

On business travel at the moment, but will test on EOSM and 5D3 when I get back home.

Thanks for continuing to push the Lua capability.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on September 20, 2018, 06:10:45 PM
Looks good on 50D apart the movie stop command apparently not working.

I switched to movie mode by entering lv and enabling movie record (simple, not raw) in ML menu, then recording started automatically and wasn't stopping (waited less tan a minute, it should stop after sleep(1)), so i stopped manually by pressing set and exited LV, then assert were triggered.

I'll retry later
Edit: noting to do.. now it freezes

Here is the log:


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-9-20 16:56:10
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 75
    apex = 2.375
    ms = 193
    value = 0.192776
  aperture = table:
    raw = 0
    apex = 0
    value = 0
    min = table:
      raw = 0
      apex = 0
      value = 0
    max = table:
      raw = 0
      apex = 0
      value = 0
  iso = table:
    raw = 104
    apex = 9.
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 158
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  wait = function: 0xa00a50
  shoot = function: 0xa01b24
  reboot = function: 0xa01af8
  bulb = function: 0xa01d58
  burst = function: 0xa01dd8
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: 0x9ff478
  clear = function: 0x9ff3c4
  hide = function: 0x9ff3d4
  show = function: 0x9ff3e4
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  info = function: 0xa02304
  start = function: 0xa01f60
  stop = function: 0xa01f70
  resume = function: 0xa025f8
  wait = function: 0xa029c8
  pause = function: 0xa02608
lens = table:
  name = ""
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = false
  af_mode = 771
  autofocus = function: 0xa034ac
  focus = function: 0xa03674
display = table:
  idle = nil
  height = 480
  width = 720
  on = function: 0xa03f00
  pixel = function: 0xa05154
  notify_box = function: 0xa03fb4
  rect = function: 0xa04b28
  screenshot = function: 0xa03e1c
  line = function: 0xa04e8c
  draw = function: 0xa0409c
  off = function: 0xa03ef0
  load = function: 0xa041e4
  circle = function: 0xa04858
  clear = function: 0xa03e0c
  print = function: 0xa05320
key = table:
  last = 20
  wait = function: 0xa05830
  press = function: 0xa05af8
menu = table:
  visible = false
  new = function: 0xa07f20
  select = function: 0xa07010
  get = function: 0xa072c4
  close = function: 0xa05e58
  block = function: 0xa06060
  open = function: 0xa05e70
  set = function: 0xa070e4
movie = table:
  recording = false
  stop = function: 0xa03a74
  start = function: 0xa03b08
dryos = table:
  clock = 10
  ms_clock = 10306
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0xa09214
    children = function: 0xa090cc
    files = function: 0xa08fb0
    parent = table:
      exists = true
      create = function: 0xa09214
      children = function: 0xa090cc
      files = function: 0xa08fb0
      parent = table:
        exists = true
        create = function: 0xa09214
        children = function: 0xa090cc
        files = function: 0xa08fb0
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0xa09214
      children = function: 0xa090cc
      files = function: 0xa08fb0
      parent = table:
        exists = true
        create = function: 0xa09214
        children = function: 0xa090cc
        files = function: 0xa08fb0
        parent = table:
          exists = true
          create = function: 0xa09214
          children = function: 0xa090cc
          files = function: 0xa08fb0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/101CANON/"
    file_number = 1790
    folder_number = 101
    free_space = 6608
    image_path = function: 0xa093f0
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0xa09214
      children = function: 0xa090cc
      files = function: 0xa08fb0
      parent = table:
        exists = true
        create = function: 0xa09214
        children = function: 0xa090cc
        files = function: 0xa08fb0
        parent = table:
          exists = true
          create = function: 0xa09214
          children = function: 0xa090cc
          files = function: 0xa08fb0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/101CANON/"
    file_number = 1790
    folder_number = 101
    free_space = 6608
    image_path = function: 0xa093f0
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  cf_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0xa09214
      children = function: 0xa090cc
      files = function: 0xa08fb0
      parent = table:
        exists = true
        create = function: 0xa09214
        children = function: 0xa090cc
        files = function: 0xa08fb0
        parent = table:
          exists = true
          create = function: 0xa09214
          children = function: 0xa090cc
          files = function: 0xa08fb0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/101CANON/"
    file_number = 1790
    folder_number = 101
    free_space = 6608
    image_path = function: 0xa093f0
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  sd_card = nil
  date = table:
    day = 20
    yday = 1
    month = 9
    wday = 2
    hour = 16
    min = 56
    isdst = false
    year = 2018
    sec = 11
  remove = function: 0xa08aa4
  call = function: 0xa087cc
  rename = function: 0xa089d0
  directory = function: 0xa08b10
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0xa09e30
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1471: in function <ML/SCRIPTS/API_TEST.LUA:1467>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1467: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1506: in main chunktask = table:
  yield = function: 0xa0a498
  create = function: 0xa0a618
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
CF card (A:/) present
- free space: 6608 MiB
- next image: A:/DCIM/101CANON/IMG_1791.CR2
- DCIM dir. : A:/DCIM/101CANON/
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Start LiveView...
Stop LiveView...
Start LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Start LiveView...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
A:/DCIM/101CANON/IMG_1791.CR2: 21376548
A:/DCIM/101CANON/IMG_1791.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
A:/DCIM/101CANON/ABC_1792.CR2: 21336894
A:/DCIM/101CANON/ABC_1792.JPG not found.
A:/DCIM/101CANON/ABC_1793.CR2: 21336837
A:/DCIM/101CANON/ABC_1793.JPG not found.
Bracketed pictures...
A:/DCIM/101CANON/IMG_1794.CR2: 18407421
A:/DCIM/101CANON/IMG_1794.JPG not found.
A:/DCIM/101CANON/IMG_1795.CR2: 21310153
A:/DCIM/101CANON/IMG_1795.JPG not found.
A:/DCIM/101CANON/IMG_1796.CR2: 20568828
A:/DCIM/101CANON/IMG_1796.JPG not found.
Bulb picture...
Elapsed time: 11737
A:/DCIM/101CANON/IMG_1797.CR2: 11930947
A:/DCIM/101CANON/IMG_1797.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
Half-shutter test OK.

Testing module 'lv'...
Starting LiveView...
Overlays: ML
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: ML
Setting zoom to x1...
Setting zoom to x5...
Setting zoom to x10...
Setting zoom to x5...
Setting zoom to x1...
Setting zoom to x10...
Setting zoom to x1...
Pausing LiveView...
Resuming LiveView...
Stopping LiveView...
LiveView tests completed.


Testing lens focus functionality...
This test requires an electronic lens.
Testing exposure settings...
Camera    : Canon EOS 50D (50D) 1.0.9
Lens      :
Shoot mode: 3
Shutter   : Ç5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : Å0.0 (raw 0, f/0, apex 0)
Av range  : Å0.0..Å0.0 (raw 0..0, f/0..f/0, apex 0..0)
ISO       : Ä1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
This lens does not have variable aperture (skipping test).
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.

ML/SCRIPTS/API_TEST.LUA:1447: assertion failed!
stack traceback:
[C]: in function 'globals.assert'
ML/SCRIPTS/API_TEST.LUA:1447: in function 'globals.test_movie'
ML/SCRIPTS/API_TEST.LUA:1484: in function <ML/SCRIPTS/API_TEST.LUA:1467>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1467: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1506: in main chunk


Using previous build it will fail at line 552 under test_keys() function. New build prints a warning in log about half shutter button

P.S: A1ex, Do you have more commits to push on lua_fix? Can you have a look why selftest "Small-block malloc test" will not works if I merge this on manual_lens?

Edit2: I noticed that lens wasn't screwed, so Af test wasn't enabled. Redone test and first AF test was ok, then it get in a loop trying to focus over infinity and and printing "lens is stuck?"


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-9-20 18:38:37
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 75
    apex = 2.375
    ms = 193
    value = 0.192776
  aperture = table:
    raw = 40
    apex = 4.
    value = 4.
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 88
      apex = 10.
      value = 32
  iso = table:
    raw = 104
    apex = 9.
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 158
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  burst = function: 0x9f37e8
  wait = function: 0x9f2460
  reboot = function: 0x9f3508
  bulb = function: 0x9f3768
  shoot = function: 0x9f3534
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:
  hide = function: 0x9f0de4
  write = function: 0x9f0e88
  clear = function: 0x9f0dd4
  show = function: 0x9f0df4
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  start = function: 0x9f3970
  pause = function: 0x9f4018
  stop = function: 0x9f3980
  info = function: 0x9f3d14
  wait = function: 0x9f43d8
  resume = function: 0x9f4008
lens = table:
  name = "17-50mm"
  focal_length = 17
  focus_distance = 0
  hyperfocal = 3836
  dof_near = 1358705152
  dof_far = 1000000
  af = true
  af_mode = 0
  focus = function: 0x9f5084
  autofocus = function: 0x9f4ebc
display = table:
  idle = nil
  height = 480
  width = 720
  pixel = function: 0x9f6b64
  circle = function: 0x9f6268
  line = function: 0x9f689c
  load = function: 0x9f5bf4
  print = function: 0x9f6d30
  rect = function: 0x9f6538
  notify_box = function: 0x9f59c4
  draw = function: 0x9f5aac
  off = function: 0x9f5900
  on = function: 0x9f5910
  clear = function: 0x9f581c
  screenshot = function: 0x9f582c
key = table:
  last = 20
  press = function: 0x9f7508
  wait = function: 0x9f7240
menu = table:
  visible = false
  set = function: 0x9f8af4
  open = function: 0x9f7880
  close = function: 0x9f7868
  get = function: 0x9f8cd4
  select = function: 0x9f8a20
  new = function: 0x9f9930
  block = function: 0x9f7a70
movie = table:
  recording = false
  start = function: 0x9f5518
  stop = function: 0x9f5484
dryos = table:
  clock = 12
  ms_clock = 12899
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0x9fac24
    children = function: 0x9faadc
    files = function: 0x9fa9c0
    parent = table:
      exists = true
      create = function: 0x9fac24
      children = function: 0x9faadc
      files = function: 0x9fa9c0
      parent = table:
        exists = true
        create = function: 0x9fac24
        children = function: 0x9faadc
        files = function: 0x9fa9c0
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9fac24
      children = function: 0x9faadc
      files = function: 0x9fa9c0
      parent = table:
        exists = true
        create = function: 0x9fac24
        children = function: 0x9faadc
        files = function: 0x9fa9c0
        parent = table:
          exists = true
          create = function: 0x9fac24
          children = function: 0x9faadc
          files = function: 0x9fa9c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/102CANON/"
    file_number = 1812
    folder_number = 102
    free_space = 5412
    image_path = function: 0x9fae00
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9fac24
      children = function: 0x9faadc
      files = function: 0x9fa9c0
      parent = table:
        exists = true
        create = function: 0x9fac24
        children = function: 0x9faadc
        files = function: 0x9fa9c0
        parent = table:
          exists = true
          create = function: 0x9fac24
          children = function: 0x9faadc
          files = function: 0x9fa9c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/102CANON/"
    file_number = 1812
    folder_number = 102
    free_space = 5412
    image_path = function: 0x9fae00
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  cf_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9fac24
      children = function: 0x9faadc
      files = function: 0x9fa9c0
      parent = table:
        exists = true
        create = function: 0x9fac24
        children = function: 0x9faadc
        files = function: 0x9fa9c0
        parent = table:
          exists = true
          create = function: 0x9fac24
          children = function: 0x9faadc
          files = function: 0x9fa9c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/102CANON/"
    file_number = 1812
    folder_number = 102
    free_space = 5412
    image_path = function: 0x9fae00
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  sd_card = nil
  date = table:
    day = 20
    hour = 18
    month = 9
    yday = 1
    wday = 2
    sec = 38
    isdst = false
    min = 38
    year = 2018
  rename = function: 0x9fa3e0
  call = function: 0x9fa1dc
  remove = function: 0x9fa4b4
  directory = function: 0x9fa520
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0x9fb840
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:1471: in function <ML/SCRIPTS/API_TEST.LUA:1467>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:1467: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1506: in main chunktask = table:
  create = function: 0x9fc028
  yield = function: 0x9fbea8
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
CF card (A:/) present
- free space: 5412 MiB
- next image: A:/DCIM/102CANON/IMG_1813.CR2
- DCIM dir. : A:/DCIM/102CANON/
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
A:/DCIM/102CANON/IMG_1813.CR2: 18622312
A:/DCIM/102CANON/IMG_1813.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
A:/DCIM/102CANON/ABC_1814.CR2: 18612035
A:/DCIM/102CANON/ABC_1814.JPG not found.
A:/DCIM/102CANON/ABC_1815.CR2: 18636418
A:/DCIM/102CANON/ABC_1815.JPG not found.
Bracketed pictures...
A:/DCIM/102CANON/IMG_1816.CR2: 17129986
A:/DCIM/102CANON/IMG_1816.JPG not found.
A:/DCIM/102CANON/IMG_1817.CR2: 18624202
A:/DCIM/102CANON/IMG_1817.JPG not found.
A:/DCIM/102CANON/IMG_1818.CR2: 21540350
A:/DCIM/102CANON/IMG_1818.JPG not found.
Bulb picture...
Elapsed time: 11848
A:/DCIM/102CANON/IMG_1819.CR2: 15562635
A:/DCIM/102CANON/IMG_1819.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
Half-shutter test OK.

Testing module 'lv'...
Starting LiveView...
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: ML
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: ML
Setting zoom to x1...
Setting zoom to x5...
Setting zoom to x10...
Setting zoom to x5...
Setting zoom to x1...
Setting zoom to x10...
Setting zoom to x1...
Pausing LiveView...
Resuming LiveView...
Stopping LiveView...
LiveView tests completed.


Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 0
Autofocus in LiveView...
Is there something to focus on?
29...Please trigger autofocus (half-shutter / AF-ON / * ).
59...58...57...56...55...54...53...52...51...50...49...48...Autofocus triggered.
Autofocus completed.
Focus distance: 0
Focusing backward...
Focus distance: 0
Focus motor position: 13242
Focusing forward with step size 3, wait=true...
...
ML/SCRIPTS/API_TEST.LUA:1362: lens.focus() requires autofocus enabled.
stack traceback:
[C]: in function 'lens.focus'
ML/SCRIPTS/API_TEST.LUA:1362: in function 'test_lens_focus'
ML/SCRIPTS/API_TEST.LUA:1482: in function <ML/SCRIPTS/API_TEST.LUA:1467>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:1467: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1506: in main chunk
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on September 20, 2018, 08:21:02 PM
Will look into malloc issues, but now I need to take a break, sorry.

AF test: maybe worth trying some other lens? Follow focus working? Maybe it breaks after AF test? (you could try commenting out the calls to lens.autofocus).

Movie recording test: you could run just that (remove other tests from the script) and see if there's any message on the screen. Maybe add some printf's in movie_end (shoot.c) and see where it fails. It presses SET and checks some pre- and post-conditions.
Title: Re: Lua Scripting (lua.mo)
Post by: David_Hugh on September 20, 2018, 11:36:06 PM
Here's the log for 70D! Looks pretty similar to what was posted before...

ML/SCRIPTS/API_TEST.LUA - 2018-9-20 22:41:54
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 115
    apex = 7.375
    ms = 6
    value = 0.006024
  aperture = table:
    raw = 21
    apex = 1.625
    value = 1.7
    min = table:
      raw = 21
      apex = 1.625
      value = 1.7
    max = table:
      raw = 72
      apex = 8.
      value = 16
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 2500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 70D"
  model_short = "70D"
  firmware = "1.1.2"
  temperature = 155
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  shoot = function: 0xc0a3a4
  bulb = function: 0xc0a5d8
  wait = function: 0xc092d0
  burst = function: 0xc0a658
  reboot = function: 0xc0a378
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:
  hide = function: 0xc07c54
  show = function: 0xc07c64
  clear = function: 0xc07c44
  write = function: 0xc07cf8
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  stop = function: 0xc0a7f0
  info = function: 0xc0ab84
  pause = function: 0xc0ae88
  start = function: 0xc0a7e0
  wait = function: 0xc0b248
  resume = function: 0xc0ae78
lens = table:
  name = "18-35mm"
  focal_length = 23
  focus_distance = 540
  hyperfocal = 16423
  dof_near = 525
  dof_far = 555
  af = true
  af_mode = 0
  focus = function: 0xc0bef4
  autofocus = function: 0xc0bd2c
display = table:
  idle = nil
  height = 480
  width = 720
  line = function: 0xc0d70c
  clear = function: 0xc0c68c
  pixel = function: 0xc0d9d4
  print = function: 0xc0dba0
  off = function: 0xc0c770
  notify_box = function: 0xc0c834
  load = function: 0xc0ca64
  rect = function: 0xc0d3a8
  draw = function: 0xc0c91c
  circle = function: 0xc0d0d8
  on = function: 0xc0c780
  screenshot = function: 0xc0c69c
key = table:
  last = 10
  wait = function: 0xc0e0b0
  press = function: 0xc0e378
menu = table:
  visible = false
  get = function: 0xc0fb44
  open = function: 0xc0e6f0
  new = function: 0xc107a0
  block = function: 0xc0e8e0
  set = function: 0xc0f964
  select = function: 0xc0f890
  close = function: 0xc0e6d8
movie = table:
  recording = false
  stop = function: 0xc0c2f4
  start = function: 0xc0c388
dryos = table:
  clock = 49
  ms_clock = 49459
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0xc11a94
    children = function: 0xc1194c
    files = function: 0xc11830
    parent = table:
      exists = true
      create = function: 0xc11a94
      children = function: 0xc1194c
      files = function: 0xc11830
      parent = table:
        exists = true
        create = function: 0xc11a94
        children = function: 0xc1194c
        files = function: 0xc11830
        parent = nil
        path = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xc11a94
      children = function: 0xc1194c
      files = function: 0xc11830
      parent = table:
        exists = true
        create = function: 0xc11a94
        children = function: 0xc1194c
        files = function: 0xc11830
        parent = table:
          exists = true
          create = function: 0xc11a94
          children = function: 0xc1194c
          files = function: 0xc11830
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 6459
    folder_number = 100
    free_space = 30385
    image_path = function: 0xc11c70
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  shooting_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xc11a94
      children = function: 0xc1194c
      files = function: 0xc11830
      parent = table:
        exists = true
        create = function: 0xc11a94
        children = function: 0xc1194c
        files = function: 0xc11830
        parent = table:
          exists = true
          create = function: 0xc11a94
          children = function: 0xc1194c
          files = function: 0xc11830
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 6459
    folder_number = 100
    free_space = 30385
    image_path = function: 0xc11c70
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  cf_card = nil
  sd_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xc11a94
      children = function: 0xc1194c
      files = function: 0xc11830
      parent = table:
        exists = true
        create = function: 0xc11a94
        children = function: 0xc1194c
        files = function: 0xc11830
        parent = table:
          exists = true
          create = function: 0xc11a94
          children = function: 0xc1194c
          files = function: 0xc11830
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 6459
    folder_number = 100
    free_space = 30385
    image_path = function: 0xc11c70
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  date = table:
    isdst = false
    hour = 22
    month = 9
    year = 2018
    min = 41
    wday = 5
    yday = 263
    day = 20
    sec = 54
  call = function: 0xc1104c
  rename = function: 0xc11250
  directory = function: 0xc11390
  remove = function: 0xc11324
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0xc126b0
battery = table:
  level = 99
  id = 0
  performance = 3
  time = nil
  drain_rate = 33
task = table:
  create = function: 0xc12e98
  yield = function: 0xc12d18
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
SD card (B:/) present
- free space: 30385 MiB
- next image: B:/DCIM/100CANON/IMG_6460.JPG
- DCIM dir. : B:/DCIM/100CANON/
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Canon GUI tests completed.

Testing ML menu API...

ML/SCRIPTS/API_TEST.LUA:390: assertion failed!
stack traceback:
[C]: in function 'assert'
ML/SCRIPTS/API_TEST.LUA:390: in function 'test_menu'
ML/SCRIPTS/API_TEST.LUA:1476: in function <ML/SCRIPTS/API_TEST.LUA:1467>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:1467: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1506: in main chunk
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on September 21, 2018, 12:25:10 AM
Quote from: a1ex on September 20, 2018, 08:21:02 PM
AF test: maybe worth trying some other lens? Follow focus working? Maybe it breaks after AF test? (you could try commenting out the calls to lens.autofocus).
I suspect that is more likely the lens not supported... It's a Tamron lens that doesn't report focus distance in Focus tab and also no Follow focus after pressing PLAY button...

Unfortunately I don't have another AF lens to try, just another couple of manuals lenses...
However just the steps increment AF test seems to fail

Quote from: a1ex on September 20, 2018, 08:21:02 PM
Movie recording test: you could run just that (remove other tests from the script) and see if there's any message on the screen. Maybe add some printf's in movie_end (shoot.c) and see where it fails. It presses SET and checks some pre- and post-conditions.
Already backtracked code previously because I was suspecting for SET button not pressed as I noticed some times ago that half shutter doesn't work with non raw movie recording in 50D, don't know if it the same for other camera.

I tried to put some debugging messages and seems problem is that fake_simble_button() doesn't works due to Locked UI:

(https://thumb.ibb.co/nJS39z/VRAM0.png) (https://ibb.co/nJS39z)

Tried with and without REC Key set to HalfShutter
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on September 21, 2018, 01:43:08 AM
7D test looks good:


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-9-20 15:32:35
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 101
    apex = 5.625
    ms = 20
    value = 0.020263
  aperture = table:
    raw = 48
    apex = 5.
    value = 5.6
    min = table:
      raw = 37
      apex = 3.625
      value = 3.5
    max = table:
      raw = 80
      apex = 9.
      value = 22.6
  iso = table:
    raw = 104
    apex = 9.
    value = 1600
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 7D"
  model_short = "7D"
  firmware = "2.0.3"
  temperature = 146
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  shoot = function: 0xb6bf34
  bulb = function: 0xb6c168
  reboot = function: 0xb6bf08
  wait = function: 0xb6ae60
  burst = function: 0xb6c1e8
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:
  hide = function: 0xb697e4
  write = function: 0xb69888
  clear = function: 0xb697d4
  show = function: 0xb697f4
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  info = function: 0xb6c714
  stop = function: 0xb6c380
  wait = function: 0xb6cdd8
  resume = function: 0xb6ca08
  start = function: 0xb6c370
  pause = function: 0xb6ca18
lens = table:
  name = "EF28-105mm f/3.5-4.5 USM"
  focal_length = 28
  focus_distance = 880
  hyperfocal = 7424
  dof_near = 797
  dof_far = 983
  af = true
  af_mode = 0
  focus = function: 0xb6da84
  autofocus = function: 0xb6d8bc
display = table:
  idle = nil
  height = 480
  width = 720
  rect = function: 0xb6ef38
  on = function: 0xb6e310
  print = function: 0xb6f730
  circle = function: 0xb6ec68
  line = function: 0xb6f29c
  notify_box = function: 0xb6e3c4
  screenshot = function: 0xb6e22c
  off = function: 0xb6e300
  load = function: 0xb6e5f4
  draw = function: 0xb6e4ac
  clear = function: 0xb6e21c
  pixel = function: 0xb6f564
key = table:
  last = 20
  press = function: 0xb6ff08
  wait = function: 0xb6fc40
menu = table:
  visible = false
  set = function: 0xb714f4
  select = function: 0xb71420
  close = function: 0xb70268
  get = function: 0xb716d4
  open = function: 0xb70280
  new = function: 0xb72330
  block = function: 0xb70470
movie = table:
  recording = false
  start = function: 0xb6df18
  stop = function: 0xb6de84
dryos = table:
  clock = 19
  ms_clock = 19435
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0xb73624
    children = function: 0xb734dc
    files = function: 0xb733c0
    parent = table:
      exists = true
      create = function: 0xb73624
      children = function: 0xb734dc
      files = function: 0xb733c0
      parent = table:
        exists = true
        create = function: 0xb73624
        children = function: 0xb734dc
        files = function: 0xb733c0
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0xb73624
      children = function: 0xb734dc
      files = function: 0xb733c0
      parent = table:
        exists = true
        create = function: 0xb73624
        children = function: 0xb734dc
        files = function: 0xb733c0
        parent = table:
          exists = true
          create = function: 0xb73624
          children = function: 0xb734dc
          files = function: 0xb733c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/100EOS7D/"
    file_number = 17
    folder_number = 100
    free_space = 30482
    image_path = function: 0xb73800
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0xb73624
      children = function: 0xb734dc
      files = function: 0xb733c0
      parent = table:
        exists = true
        create = function: 0xb73624
        children = function: 0xb734dc
        files = function: 0xb733c0
        parent = table:
          exists = true
          create = function: 0xb73624
          children = function: 0xb734dc
          files = function: 0xb733c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/100EOS7D/"
    file_number = 17
    folder_number = 100
    free_space = 30482
    image_path = function: 0xb73800
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  cf_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0xb73624
      children = function: 0xb734dc
      files = function: 0xb733c0
      parent = table:
        exists = true
        create = function: 0xb73624
        children = function: 0xb734dc
        files = function: 0xb733c0
        parent = table:
          exists = true
          create = function: 0xb73624
          children = function: 0xb734dc
          files = function: 0xb733c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/100EOS7D/"
    file_number = 17
    folder_number = 100
    free_space = 30482
    image_path = function: 0xb73800
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  sd_card = nil
  date = table:
    wday = 5
    hour = 15
    day = 20
    min = 32
    month = 9
    sec = 35
    isdst = false
    yday = 263
    year = 2018
  directory = function: 0xb72f20
  call = function: 0xb72bdc
  rename = function: 0xb72de0
  remove = function: 0xb72eb4
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0xb74240
battery = table:
  level = 59
  id = 0
  performance = 3
  time = nil
  drain_rate = 33
task = table:
  create = function: 0xb74a28
  yield = function: 0xb748a8
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
CF card (A:/) present
- free space: 30482 MiB
- next image: A:/DCIM/100EOS7D/IMG_0018.CR2
- DCIM dir. : A:/DCIM/100EOS7D/
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Stop LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
A:/DCIM/100EOS7D/IMG_0018.CR2: 26615415
A:/DCIM/100EOS7D/IMG_0018.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
A:/DCIM/100EOS7D/ABC_0019.CR2: 31920840
A:/DCIM/100EOS7D/ABC_0019.JPG not found.
A:/DCIM/100EOS7D/ABC_0020.CR2: 30492116
A:/DCIM/100EOS7D/ABC_0020.JPG not found.
Bracketed pictures...
A:/DCIM/100EOS7D/IMG_0021.CR2: 25987980
A:/DCIM/100EOS7D/IMG_0021.JPG not found.
A:/DCIM/100EOS7D/IMG_0022.CR2: 30908496
A:/DCIM/100EOS7D/IMG_0022.JPG not found.
A:/DCIM/100EOS7D/IMG_0023.CR2: 16403388
A:/DCIM/100EOS7D/IMG_0023.JPG not found.
Bulb picture...
Elapsed time: 12700
A:/DCIM/100EOS7D/IMG_0024.CR2: 14301987
A:/DCIM/100EOS7D/IMG_0024.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
Half-shutter test OK.

Testing module 'lv'...
Starting LiveView...
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: ML
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: ML
Setting zoom to x1...
Setting zoom to x5...
Setting zoom to x10...
Setting zoom to x5...
Setting zoom to x1...
Setting zoom to x10...
Setting zoom to x1...
Pausing LiveView...
Resuming LiveView...
Stopping LiveView...
LiveView tests completed.


Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 1100
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
59...58...57...56...55...54...Autofocus triggered.
Autofocus completed.
Focus distance: 655350
Focusing backward...
Focus distance: 655350
Focus motor position: 9
Focusing forward with step size 3, wait=true...
........
Focus distance: 470
Focus motor position: -1895
Focusing backward with step size 3, wait=true...
...........
Focus distance: 655350
Focus motor position: 7
Focus range: 8 steps forward, 11 steps backward.
Motor steps: 1904 forward, 1902 backward, 2 lost.
Focusing forward with step size 3, wait=false...
................
Focus distance: 470
Focus motor position: -1895
Focusing backward with step size 3, wait=false...
.................
Focus distance: 655350
Focus motor position: 0
Focus range: 16 steps forward, 17 steps backward.
Motor steps: 1902 forward, 1895 backward, 7 lost.
Focusing forward with step size 2, wait=true...
.............................................
Focus distance: 470
Focus motor position: -1896
Focusing backward with step size 2, wait=true...
............................................
Focus distance: 655350
Focus motor position: 0
Focus range: 45 steps forward, 44 steps backward.
Motor steps: 1896 forward, 1896 backward, 0 lost.
Focusing forward with step size 2, wait=false...
...........................................................................................
Focus distance: 470
Focus motor position: -1895
Focusing backward with step size 2, wait=false...
.................................................................................................
Focus distance: 655350
Focus motor position: 3
Focus range: 91 steps forward, 97 steps backward.
Motor steps: 1895 forward, 1898 backward, 3 lost.

Focus test completed.

Testing exposure settings...
Camera    : Canon EOS 7D (7D) 2.0.3
Lens      : EF28-105mm f/3.5-4.5 USM
Shoot mode: 3
Shutter   : Ç5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : Å5.6 (raw 48, f/5.6, apex 5.)
Av range  : Å3.5..Å22 (raw 37..80, f/3.5..f/22.6, apex 3.625..9.)
ISO       : Ä1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
Setting aperture to random values...
Error: aperture delta 0.275001 EV (expected < 0.1875, Å9.9, method=2)
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.
Movie recording tests completed.

Done!
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on September 21, 2018, 01:46:21 AM
EOSM test, not so good:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-9-20 16:51:36
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 104
    apex = 6.
    ms = 16
    value = 0.015625
  aperture = table:
    raw = 37
    apex = 3.625
    value = 3.5
    min = table:
      raw = 24
      apex = 2.
      value = 2.
    max = table:
      raw = 80
      apex = 9.
      value = 22.6
  iso = table:
    raw = 72
    apex = 5.
    value = 100
  ec = table:
    raw = 0
    value = 0
  flash = "auto"
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 6500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS M"
  model_short = "EOSM"
  firmware = "2.0.2"
  temperature = 228
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  burst = function: 0xb34cf8
  shoot = function: 0xb34a44
  reboot = function: 0xb34a18
  bulb = function: 0xb34c78
  wait = function: 0xb33970
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:
  clear = function: 0xb322e4
  write = function: 0xb32398
  hide = function: 0xb322f4
  show = function: 0xb32304
lv = table:
  enabled = true
  paused = false
  running = true
  zoom = 1
  overlays = 2
  pause = function: 0xb35528
  info = function: 0xb35224
  resume = function: 0xb35518
  start = function: 0xb34e80
  stop = function: 0xb34e90
  wait = function: 0xb358e8
lens = table:
  name = "EF-M22mm f/2 STM"
  focal_length = 22
  focus_distance = 655350
  hyperfocal = 7322
  dof_near = 7242
  dof_far = 1000000
  af = true
  af_mode = 0
  focus = function: 0xb36594
  autofocus = function: 0xb363cc
display = table:
  idle = nil
  height = 480
  width = 720
  clear = function: 0xb36d2c
  screenshot = function: 0xb36d3c
  load = function: 0xb37104
  print = function: 0xb38240
  draw = function: 0xb36fbc
  pixel = function: 0xb38074
  on = function: 0xb36e20
  circle = function: 0xb37778
  off = function: 0xb36e10
  line = function: 0xb37dac
  rect = function: 0xb37a48
  notify_box = function: 0xb36ed4
key = table:
  last = 10
  press = function: 0xb38a18
  wait = function: 0xb38750
menu = table:
  visible = false
  get = function: 0xb3a1e4
  select = function: 0xb39f30
  block = function: 0xb38f80
  set = function: 0xb3a004
  open = function: 0xb38d90
  close = function: 0xb38d78
  new = function: 0xb3ae40
movie = table:
  recording = false
  stop = function: 0xb36994
  start = function: 0xb36a28
dryos = table:
  clock = 9
  ms_clock = 9705
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0xb3c134
    children = function: 0xb3bfec
    files = function: 0xb3bed0
    parent = table:
      exists = true
      create = function: 0xb3c134
      children = function: 0xb3bfec
      files = function: 0xb3bed0
      parent = table:
        exists = true
        create = function: 0xb3c134
        children = function: 0xb3bfec
        files = function: 0xb3bed0
        parent = nil
        path = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xb3c134
      children = function: 0xb3bfec
      files = function: 0xb3bed0
      parent = table:
        exists = true
        create = function: 0xb3c134
        children = function: 0xb3bfec
        files = function: 0xb3bed0
        parent = table:
          exists = true
          create = function: 0xb3c134
          children = function: 0xb3bfec
          files = function: 0xb3bed0
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 7446
    folder_number = 100
    free_space = 30382
    image_path = function: 0xb3c310
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  shooting_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xb3c134
      children = function: 0xb3bfec
      files = function: 0xb3bed0
      parent = table:
        exists = true
        create = function: 0xb3c134
        children = function: 0xb3bfec
        files = function: 0xb3bed0
        parent = table:
          exists = true
          create = function: 0xb3c134
          children = function: 0xb3bfec
          files = function: 0xb3bed0
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 7446
    folder_number = 100
    free_space = 30382
    image_path = function: 0xb3c310
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  cf_card = nil
  sd_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xb3c134
      children = function: 0xb3bfec
      files = function: 0xb3bed0
      parent = table:
        exists = true
        create = function: 0xb3c134
        children = function: 0xb3bfec
        files = function: 0xb3bed0
        parent = table:
          exists = true
          create = function: 0xb3c134
          children = function: 0xb3bfec
          files = function: 0xb3bed0
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 7446
    folder_number = 100
    free_space = 30382
    image_path = function: 0xb3c310
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  date = table:
    day = 20
    min = 51
    hour = 16
    wday = 5
    month = 9
    isdst = false
    yday = 263
    sec = 37
    year = 2018
  call = function: 0xb3b6ec
  directory = function: 0xb3ba30
  remove = function: 0xb3b9c4
  rename = function: 0xb3b8f0
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0xb3cd50
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1471: in function <ML/SCRIPTS/API_TEST.LUA:1467>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1467: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1506: in main chunktask = table:
  yield = function: 0xb3d3b8
  create = function: 0xb3d538
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
SD card (B:/) present
- free space: 30382 MiB
- next image: B:/DCIM/100CANON/IMG_7447.CR2
- DCIM dir. : B:/DCIM/100CANON/
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...

ML/SCRIPTS/API_TEST.LUA:293: assertion failed!
stack traceback:
[C]: in function 'globals.assert'
ML/SCRIPTS/API_TEST.LUA:293: in function 'globals.test_camera_gui'
ML/SCRIPTS/API_TEST.LUA:1475: in function <ML/SCRIPTS/API_TEST.LUA:1467>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1467: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1506: in main chunk
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on September 21, 2018, 03:08:25 AM
700D is good too. I take it that the 5D3 has been thoroughly tested.


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2018-9-21 02:12:57
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 125
    apex = 8.625
    ms = 3
    value = 0.002533
  aperture = table:
    raw = 40
    apex = 4.
    value = 4.
    min = table:
      raw = 37
      apex = 3.625
      value = 3.5
    max = table:
      raw = 80
      apex = 9.
      value = 22.6
  iso = table:
    raw = 120
    apex = 11.000001
    value = 6400
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 4500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS REBEL T5i"
  model_short = "700D"
  firmware = "1.1.5"
  temperature = 150
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  wait = function: 0xb16f00
  reboot = function: 0xb17fa8
  bulb = function: 0xb18208
  burst = function: 0xb18288
  shoot = function: 0xb17fd4
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: 0xb15928
  clear = function: 0xb15874
  hide = function: 0xb15884
  show = function: 0xb15894
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  start = function: 0xb18410
  resume = function: 0xb18aa8
  info = function: 0xb187b4
  stop = function: 0xb18420
  wait = function: 0xb18e78
  pause = function: 0xb18ab8
lens = table:
  name = "EF28-105mm f/3.5-4.5 USM"
  focal_length = 28
  focus_distance = 655350
  hyperfocal = 10371
  dof_near = 10211
  dof_far = 1000000
  af = true
  af_mode = 0
  autofocus = function: 0xb1995c
  focus = function: 0xb19b24
display = table:
  idle = nil
  height = 480
  width = 720
  notify_box = function: 0xb1a464
  clear = function: 0xb1a2bc
  screenshot = function: 0xb1a2cc
  draw = function: 0xb1a54c
  rect = function: 0xb1afd8
  circle = function: 0xb1ad08
  load = function: 0xb1a694
  on = function: 0xb1a3b0
  line = function: 0xb1b33c
  off = function: 0xb1a3a0
  pixel = function: 0xb1b604
  print = function: 0xb1b7d0
key = table:
  last = 10
  wait = function: 0xb1bce0
  press = function: 0xb1bfa8
menu = table:
  visible = false
  set = function: 0xb1d594
  block = function: 0xb1c510
  open = function: 0xb1c320
  get = function: 0xb1d774
  new = function: 0xb1e3d0
  select = function: 0xb1d4c0
  close = function: 0xb1c308
movie = table:
  recording = false
  start = function: 0xb19fb8
  stop = function: 0xb19f24
dryos = table:
  clock = 9
  ms_clock = 9968
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0xb1f6c4
    children = function: 0xb1f57c
    files = function: 0xb1f460
    parent = table:
      exists = true
      create = function: 0xb1f6c4
      children = function: 0xb1f57c
      files = function: 0xb1f460
      parent = table:
        exists = true
        create = function: 0xb1f6c4
        children = function: 0xb1f57c
        files = function: 0xb1f460
        parent = nil
        path = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xb1f6c4
      children = function: 0xb1f57c
      files = function: 0xb1f460
      parent = table:
        exists = true
        create = function: 0xb1f6c4
        children = function: 0xb1f57c
        files = function: 0xb1f460
        parent = table:
          exists = true
          create = function: 0xb1f6c4
          children = function: 0xb1f57c
          files = function: 0xb1f460
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 4816
    folder_number = 100
    free_space = 30383
    image_path = function: 0xb1f8a0
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  shooting_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xb1f6c4
      children = function: 0xb1f57c
      files = function: 0xb1f460
      parent = table:
        exists = true
        create = function: 0xb1f6c4
        children = function: 0xb1f57c
        files = function: 0xb1f460
        parent = table:
          exists = true
          create = function: 0xb1f6c4
          children = function: 0xb1f57c
          files = function: 0xb1f460
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 4816
    folder_number = 100
    free_space = 30383
    image_path = function: 0xb1f8a0
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  cf_card = nil
  sd_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xb1f6c4
      children = function: 0xb1f57c
      files = function: 0xb1f460
      parent = table:
        exists = true
        create = function: 0xb1f6c4
        children = function: 0xb1f57c
        files = function: 0xb1f460
        parent = table:
          exists = true
          create = function: 0xb1f6c4
          children = function: 0xb1f57c
          files = function: 0xb1f460
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 4816
    folder_number = 100
    free_space = 30383
    image_path = function: 0xb1f8a0
    type = "SD"
    _card_ptr = userdata
    path = "B:/"
  date = table:
    sec = 58
    isdst = false
    year = 2018
    hour = 2
    yday = 264
    min = 12
    day = 21
    month = 9
    wday = 6
  call = function: 0xb1ec7c
  remove = function: 0xb1ef54
  directory = function: 0xb1efc0
  rename = function: 0xb1ee80
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0xb202e0
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:1471: in function <ML/SCRIPTS/API_TEST.LUA:1467>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:1467: in function 'api_tests'
ML/SCRIPTS/API_TEST.LUA:1506: in main chunktask = table:
  yield = function: 0xb20948
  create = function: 0xb20ac8
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
SD card (B:/) present
- free space: 30383 MiB
- next image: B:/DCIM/100CANON/IMG_4817.CR2
- DCIM dir. : B:/DCIM/100CANON/
File I/O tests completed.

Testing Canon GUI functions...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Stop LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Start LiveView...
Enter MENU mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_4817.CR2: 27375458
B:/DCIM/100CANON/IMG_4817.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
B:/DCIM/100CANON/ABC_4818.CR2: 27368745
B:/DCIM/100CANON/ABC_4818.JPG not found.
B:/DCIM/100CANON/ABC_4819.CR2: 27367243
B:/DCIM/100CANON/ABC_4819.JPG not found.
Bracketed pictures...
B:/DCIM/100CANON/IMG_4820.CR2: 25458672
B:/DCIM/100CANON/IMG_4820.JPG not found.
B:/DCIM/100CANON/IMG_4821.CR2: 27376957
B:/DCIM/100CANON/IMG_4821.JPG not found.
B:/DCIM/100CANON/IMG_4822.CR2: 15054972
B:/DCIM/100CANON/IMG_4822.JPG not found.
Bulb picture...
Elapsed time: 11706
B:/DCIM/100CANON/IMG_4823.CR2: 14105453
B:/DCIM/100CANON/IMG_4823.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
Half-shutter test OK.

Testing module 'lv'...
Starting LiveView...
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: ML
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: ML
Setting zoom to x1...
Setting zoom to x5...
Setting zoom to x10...
Setting zoom to x5...
Setting zoom to x1...
Setting zoom to x10...
Setting zoom to x1...
Pausing LiveView...
Resuming LiveView...
Stopping LiveView...
LiveView tests completed.


Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 6820
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
59...58...57...56...55...54...53...52...51...50...49...48...47...46...45...44...43...42...41...40...39...38...Autofocus triggered.
Autofocus completed.
Focus distance: 880
Focusing backward...
Focus distance: 655350
Focus motor position: 0
Focusing forward with step size 3, wait=true...
.........
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 3, wait=true...
.......
Focus distance: 655350
Focus motor position: 0
Focus range: 9 steps forward, 7 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 3, wait=false...
..................................
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 3, wait=false...
...............
Focus distance: 655350
Focus motor position: 0
Focus range: 34 steps forward, 15 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 2, wait=true...
.............................................
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 2, wait=true...
............................................
Focus distance: 655350
Focus motor position: 0
Focus range: 45 steps forward, 44 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 2, wait=false...
...
Focus distance: 470
Focus motor position: 0
Focusing backward with step size 2, wait=false...
.................................................................................
Focus distance: 655350
Focus motor position: 0
Focus range: 115 steps forward, 81 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.

Focus test completed.

Testing exposure settings...
Camera    : Canon EOS REBEL T5i (700D) 1.1.5
Lens      : EF28-105mm f/3.5-4.5 USM
Shoot mode: 3
Shutter   : Ç5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : Å4.0 (raw 40, f/4., apex 4.)
Av range  : Å3.8..Å24 (raw 39..82, f/3.8..f/24.6, apex 3.875..9.25)
ISO       : Ä1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
Setting aperture to random values...
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.
Movie recording tests completed.

Done!
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on September 21, 2018, 07:15:42 AM
Quote from: aprofiti on September 21, 2018, 12:25:10 AM
I tried to put some debugging messages and seems problem is that fake_simble_button() doesn't works due to Locked UI:

That must be from those half-shutter tricks, so we'll probably need to disengage these somehow.

That fake_simple_button considering UI locks must be a bit overkill; I should double-check that. At least, the shutter bit should not affect things, so we may leave it out (gui-common.c, try 0xFFFE instead of 0xFFFF). I believe that's enough to pass the test (but then, I've expected the Lua tests tweaking for 5D2 would take half an hour or so, and it took an entire week...)

Quote
ML/SCRIPTS/API_TEST.LUA:293:

Likely returned from PLAY mode to LiveView. Any sort of Canon dialog pops up that would prevent ML from considering that GUI mode as "idle"? Maybe that shooting mode indicator with huge fonts? Can it be disabled from Canon menu?

On 500D, there was one indicator telling you to autofocus with the back button, rather than half-shutter. The 500D cannot focus with half-shutter in LiveView. That dialog was pretty annoying after a while, and there was a feature request to remove it (just don't remember where), so... I've disabled that dialog.

Quote
ML/SCRIPTS/API_TEST.LUA:390: assertion failed!

Right, FPS override missing (and enabling it in its current state would probably fail the test anyway).

The 70D may also fail at lens.autofocus(). If you comment out these tests from api_test.lua, do the others pass?
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on September 21, 2018, 12:57:02 PM
Quote from: a1ex on September 21, 2018, 07:15:42 AM
That must be from those half-shutter tricks, so we'll probably need to disengage these somehow.

That fake_simple_button considering UI locks must be a bit overkill; I should double-check that. At least, the shutter bit should not affect things, so we may leave it out (gui-common.c, try 0xFFFE instead of 0xFFFF).

Now it stop the movie :) Still trigger an Assertion at line 1454 but that's movie review which is not available on 50D.

If I enter LV manually, I get in console "UILock: 00000000 -> 41000000 -> 00000000"
when recoding start it prints "UILock: 8300017f -> 41000001 -> 8300017f (!!!)"

May be useful to know? Maybe is not halfshutter?
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on September 21, 2018, 01:18:20 PM
Quote from: aprofiti on September 21, 2018, 12:57:02 PM
Now it stop the movie :) Still trigger an Assertion at line 1454 but that's movie review which is not available on 50D.

Confirmed in QEMU - the 50D does not even attempt to play the movie. So... the only thing we can do is to add an exception.

Or figure out how to implement movie playback, but that's a bit more difficult.

Quote
If I enter LV manually, I get in console "UILock: 00000000 -> 41000000 -> 00000000"
when recoding start it prints "UILock: 8300017f -> 41000001 -> 8300017f (!!!)"

Confirmed on 5D2; the UI lock change for blocking half-shutter is not yet confirmed when prop_request_change returns, since that's requested from another property handler. Appears to be a false alarm.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 23, 2018, 11:33:19 PM
Holidays are here, so I could finally look into this again. It's both refreshing that I could sit down for a couple of days to troubleshoot some long-standing issues, and frustrating that I could not achieve more than "just" a few bug fixes.

Most important changes:
- 5D2/50D: fixed memory allocation issues with many small blocks from shoot_malloc (reported by aprofiti (https://www.magiclantern.fm/forum/index.php?topic=18083.msg207261#msg207261))
- 600D/1100D: fixed Q menu navigation (it was totally broken (https://www.magiclantern.fm/forum/index.php?topic=15360.msg209576#msg209576) and nobody complained)
- fixed lua.directory.children to allow recursive directory listing (sample code in api_test.lua (https://bitbucket.org/hudson/magic-lantern/commits/75fab56ce060eab1a5f76ed2fa78907aa14c0c43#chg-scripts/api_test.lua))
- expecting api_test.lua to succeed on 50D and 70D, but only tested in QEMU
- log file moved into ML/LOGS

Is it ready for mainline? You tell me. Please run the usual tests and report back.

Quote from: a1ex on December 16, 2017, 01:36:42 AM
For every single camera model available on the Experiments page (lua_fix build), please run:

- api_test.lua (upload the log)
- selftest.mo -> stubs tests (upload the log)
- bench.mo -> memory benchmarks (upload the screenshot)
- overall sanity check (for example, if you decide to take this build out and use it for a couple of hours, please report back)

Happy Holidays!

... or maybe Merry Christmas? not there yet :)
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 24, 2018, 08:20:12 AM
@a1ex

Only minor suggestion is that, if you can, can you add the fix to the depth of field code, i.e. https://bitbucket.org/hudson/magic-lantern/issues/2912/focusc-needs-updating-with-one-line-of

Not a prime issue, as I can easily correct in Lua.

BTW why do you use two infinities in the Lua module?  That is the focus position and dof report infinity as different numbers. Once again, not an issue, just curious.

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 24, 2018, 08:51:28 AM
Sure, will check. I was also hoping to add a QEMU test for DOF calculations (i.e. for each focus distance possibly reported by the lens, write down the computed values and compare them to some reference calculator).

Two infinities:
- focus distance: reported by Canon in cm as 16-bit values; their choice was 65535 = infinity. Lua reports it in mm, so without a special code path to handle this, it ends up as 655350 mm.
- DOF code: arbitrary choice made by Trammell many years ago (before I joined); nobody questioned it yet.

Lua seems to use math.huge (http://lua-users.org/wiki/MathLibraryTutorial) for infinity, but for some reason, it's not printed correctly (possibly related to this issue (https://www.magiclantern.fm/forum/index.php?topic=23090)).
Title: Re: Lua Scripting (lua.mo)
Post by: garry23 on December 24, 2018, 10:01:39 AM
@a1ex

Many thanks for the insight.

As I say, not an issue, as I can handle 'differences' in my scripts.

BTW DoF equations are simplifications, based on assuming a simple lens equation. Many good reads out there, eg http://www.janrik.net/DOFpostings/PM1/DOFInvestigations1.htm and https://www.panohelp.com/thinlensformula.html

Cheers

Garry
Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on January 01, 2019, 09:09:41 PM
Test result for 60D using build lua_fix.2018Dec23.60D111

running API_TEST.LUA ended with ERR70 crash when the script was processing movie tests. Crashed in movie mode in funktion movie.stopp. I had to pull the battery.

Logfiles:
LUATEST.LOG
CRASH00.LOG
LOG000.LOG


Stubs test in selftest.mo: 1 failed
Logfile STUBTEST.LOG

Memory benchmarks in bench.mo
BENCH1.JPG

All files can be downloaded from here: (https://drive.google.com/folderview?id=1cB3xiqxRolLwItIjJhXmRoFRlUQ_K2N1)

One observation during field tests:
shortcut keys for focus patterns do not work anymore.

EDIT: Shortcut keys for focus patterns work as defined as long as back screen is off (neither Canon info screen nor leveling meter should be active). I guess that is as designed, so ignore the previous observation.

Title: Re: Lua Scripting (lua.mo)
Post by: JohanJ on January 02, 2019, 06:45:57 PM
Test results for 100D using build lua_fix.2018Dec23.100D101

All files can be downloaded from here (https://drive.google.com/folderview?id=1-21gjGbycJIO-gkW5dkrMjYr0ZYAgLmd)

One strange artefact identified using long-press Q/SET button: the ML overlay symbol for long-press Q/set remains visible after Q button was released. You can see this orange little ring as a sticky symbol even when scrolling through Canon menus or even in Play mode when reviewing a picture. One has to (short) press SET again to let the symbol disappear. Two screenshots available in the download folder (https://drive.google.com/folderview?id=1-21gjGbycJIO-gkW5dkrMjYr0ZYAgLmd).
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on January 25, 2019, 05:19:19 PM
Quote from: JohanJ on January 02, 2019, 06:45:57 PM
...the ML overlay symbol for long-press Q/set remains visible after Q button was released...

Let's bring some more attention to that. Here are your screenshots:

(https://farm5.staticflickr.com/4899/31931091697_f1ae3c65ab.jpg) (https://flic.kr/p/QDDc6K)

(https://farm5.staticflickr.com/4890/46820453582_32cfc601be.jpg) (https://flic.kr/p/2ekn4DG)

I looked through the issues in Bitbucket (https://bitbucket.org/hudson/magic-lantern/issues?status=new&status=open) and couldn't find anything about this. I'd suggest filing a bug report. Sorry I can't help more at the moment.

Your stub test log does show something that I can help with.

[INFO] Camera model: Canon EOS 100D 1.0.1 (0x80000346 100D)
...
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
...
=========================================================
Test complete, 11688 passed, 14 failed.
.


I'll bet you ran this test in movie mode, right? Try starting the test in photo mode. The test will prompt you when to switch to movie mode.

This isn't obvious and I couldn't find anything posted about it but I've been going crazy lately trying to get a perfect test run on the EOSM and it turns out that it is because those tests fail while the camera is in LiveView and being a mirrorless, the EOSM is always in LiveView mode.

Ran the tests on the 700D, I annotated the test to find where it was failing on the EOSM/EOSM2:

Movie Mode
...
[INFO] Camera model: Canon EOS REBEL T5i 1.1.5 (0x80000326 700D)
...
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[FAIL] wait_focus_status(1000, 3) => 0x0
[FAIL] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
...
=========================================================
Test complete, 11772 passed, 20 failed.
.


Start test in photo mode then switch to movie mode when prompted:
...
[INFO] Camera model: Canon EOS REBEL T5i 1.1.5 (0x80000326 700D)
...
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[INFO] ****** EOSM/M2 usually fails here but sometimes passes ******
[Pass] wait_focus_status(1000, 3) => 0x1
[Pass] lv_focus_status => 0x3
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] wait_focus_status(1000, 3) => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x1
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x1
[Pass] get_focus_confirmation() => 0x0
[Pass] HALFSHUTTER_PRESSED => 0x0
[Pass] lv_focus_status => 0x1
...
=========================================================
Test complete, 11782 passed, 0 failed.
.


Hum--interesting that the test that triggers the fail runs 5 times in photo mode and 10 times in movie mode and reports two tests per iteration.
Title: Re: Lua Scripting (lua.mo)
Post by: scrax on February 25, 2019, 07:39:04 PM
Quote from: a1ex on December 23, 2018, 11:33:19 PM
- 600D/1100D: fixed Q menu navigation (it was totally broken (https://www.magiclantern.fm/forum/index.php?topic=15360.msg209576#msg209576) and nobody complained)

Is it ready for mainline? You tell me. Please run the usual tests and report back.

Long time away, happy to see you all again....

Made the tests on my 600D and here results:
- lua tests      passed all
- stub tests    passed all


attached zip file with all the resulting .log and .ppm


----------------------------------------
EDIT
----------------------------------------

in unified I've tried to load all the modules after enabling flexinfo for 600D and got err70 when going in LV from photo mode. After some try found out that was the lua module the cause and that was the error log:


ASSERT: pPSLuckyTbl
at ClrHistAlgor.c:81, task CLR_CALC
lv:0 mode:3

CLR_CALC stack: 135c00 [137050-133050]
0xUNKNOWN  @ ff07e414:137048
0xUNKNOWN  @ ff1fbb10:137020
0xFF1FB56C @ ff037048:137008
0xUNKNOWN  @ ff1fb59c:136ff8
0xUNKNOWN  @ ff1fb624:136fd8
0xFF31362C @ ff12ab64:136fa8
0xFF3EEEFC @ ff31398c:136f20
0xFF0142FC @ ff3eef8c:135c38
0x00C80478 @ c809c8:135c00

Magic Lantern version : Nightly.2019Feb26.600D102
Mercurial changeset   : 7a3b5fa3f4c6+ (unified)
Built on 2019-02-26 01:27:33 UTC by [email protected].
Free Memory  : 192K + 520K


as already reported the lua_fix branch is not affected so to me this is a sign that the fix works
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 20, 2019, 10:40:33 AM
Quote from: dfort on September 21, 2018, 01:46:21 AM
EOSM test, not so good

Solved. Got one of these to test Danne's updates, and couldn't believe how broken ML is on this camera. I mean, not even the "Hello World" script was working...

Now it's a little better, but still, don't expect miracles. Pretty much "all" I wanted from this update was to pass the Lua API tests. There's plenty of other stuff to fix, that either I didn't address, or I've fixed locally but needs more testing. Many of the issues are likely easy, just time-consuming, others are a little harder. I'll see what I can do.

Also, the waveform crash (https://www.magiclantern.fm/forum/index.php?topic=23673) identified by @garry23, and the persistent long-press icon on 100D, should be fixed.
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on March 20, 2019, 12:21:27 PM
Run some non-scientific shots with 650D. ISOless (2) error with Dual-ISO not gone completely but changed manners. Before I had to reset ML settings to get rid of it and now I have a hard time to provoke it: error occured only *once* and was not persistent after restart! Lua.mo not loaded.T:

EDIT: Found a way to provoke error ... sort of. Just turn cam on and off. Somewhere between 2-5 out of 10 times ISOless error shows up. Was not able to see it 2 times in a row, yet. Can live with that.
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on March 20, 2019, 02:24:57 PM
Quote from: a1ex on March 20, 2019, 10:40:33 AM
Solved. Got one of these to test Danne's updates, and couldn't believe how broken ML is on this camera. I mean, not even the "Hello World" script was working...
Yeah, this camera do need a lot of fixing but very good to learn and play with as the issues are mostly "almost already working" state. Great to see lua fixes. Super tool.
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on March 20, 2019, 07:54:22 PM
Quote from: a1ex on March 20, 2019, 10:40:33 AM
Got one of these to test Danne's updates, and couldn't believe how broken ML is on this camera.

Yay! The EOSM is going to get some more love. Hope you got an EF-M IS lens for your EOSM.  ;)

Quote from: a1ex on March 20, 2019, 10:40:33 AM
Pretty much "all" I wanted from this update was to pass the Lua API tests.

Of course I had to try it out. It did get through all of the tests but it was an interesting journey getting there so I thought I'd document it.

First try:
Testing picture taking functions...
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_7537.CR2: 18609788
B:/DCIM/100CANON/IMG_7537.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).

ML/SCRIPTS/API_TEST.LUA:1094: assertion failed!
stack traceback:
[C]: in function 'globals.assert'
ML/SCRIPTS/API_TEST.LUA:1094: in function 'globals.test_camera_take_pics'
ML/SCRIPTS/API_TEST.LUA:1574: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunk


Hum, been playing around with different settings so better clear out all my Canon settings, format the card, turn on only the essential settings and try it again. Let's see, what are the essential settings I use? Switch from jpeg to raw stills, continuous shooting mode, fire shutter without lens, turn on back button focus and put it in manual mode.

Take two:
Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 1540
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
59...58...57...56...55...54...53...52...51...50...49...48...47...46...45...44...43...42...41...40...39...38...37...36...35...34...33...32...31...30...29...28...27...26...25...24...23...22...21...20...19...18...17...16...15...14...13...12...11...10...9...8...7...6...5...4...3...2...1...0...
ML/SCRIPTS/API_TEST.LUA:1428: Autofocus not triggered.


Darn it, wasn't paying attention and missed the user prompt to trigger autofocus.

Take three:
ML/SCRIPTS/API_TEST.LUA:1441: lens.focus() requires continuous AF disabled.
stack traceback:
[C]: in function 'lens.focus'
ML/SCRIPTS/API_TEST.LUA:1441: in function 'globals.test_lens_focus'
ML/SCRIPTS/API_TEST.LUA:1579: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunk


Oops, forgot that resetting to Canon defaults puts the camera in continuous autofocus mode. Turned that off.

Take four:
(https://farm8.staticflickr.com/7924/46705809474_5e9f453964.jpg) (https://flic.kr/p/2eaetX9)

Uh, what's happening? I had an EF-M lens mounted and the lua test has always had problems with these lenses even though these were designed specifically for the M series of cameras. As you can see it is stuck in an endless loop and the lens isn't budging. Turned off the camera before the battery died and found this in the log.

Focus distance: 7600
Focusing backward...

ML/SCRIPTS/API_TEST.LUA:1441: lens.focus() only works in LiveView.
stack traceback:
[C]: in function 'lens.focus'
ML/SCRIPTS/API_TEST.LUA:1441: in function 'test_lens_focus'
ML/SCRIPTS/API_TEST.LUA:1579: 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


Switched to an EF lens with the EF to EF-M adapter and finally got through the tests. I did forget to set movie mode to manual but it looks like it got through the movie tests anyway.


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-3-20 12:11:39
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 75
    apex = 2.375
    ms = 193
    value = 0.192776
  aperture = table:
    raw = 48
    apex = 5.
    value = 5.6
    min = table:
      raw = 22
      apex = 1.75
      value = 1.8
    max = table:
      raw = 80
      apex = 9.
      value = 22.6
  iso = table:
    raw = 72
    apex = 5.
    value = 100
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5200
  mode = 3
  metering_mode = 3
  drive_mode = 1
  model = "Canon EOS M"
  model_short = "EOSM"
  firmware = "2.0.2"
  temperature = 236
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  shoot = function: 0xc32124
  bulb = function: 0xc32358
  reboot = function: 0xc320f8
  wait = function: 0xc31050
  burst = function: 0xc323d8
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:
  clear = function: 0xc2f9c4
  write = function: 0xc2fa78
  hide = function: 0xc2f9d4
  show = function: 0xc2f9e4
lv = table:
  enabled = true
  paused = false
  running = true
  zoom = 1
  overlays = 2
  resume = function: 0xc32bf8
  info = function: 0xc32904
  stop = function: 0xc32570
  wait = function: 0xc32fc8
  pause = function: 0xc32c08
  start = function: 0xc32560
lens = table:
  name = "EF50mm f/1.8 STM"
  focal_length = 50
  focus_distance = 1990
  hyperfocal = 23596
  dof_near = 1849
  dof_far = 2155
  af = true
  af_mode = 0
  focus = function: 0xc33c74
  autofocus = function: 0xc33aac
display = table:
  idle = nil
  height = 480
  width = 720
  print = function: 0xc35920
  notify_box = function: 0xc345b4
  screenshot = function: 0xc3441c
  pixel = function: 0xc35754
  off = function: 0xc344f0
  rect = function: 0xc35128
  load = function: 0xc347e4
  circle = function: 0xc34e58
  line = function: 0xc3548c
  on = function: 0xc34500
  clear = function: 0xc3440c
  draw = function: 0xc3469c
key = table:
  last = 10
  wait = function: 0xc35e30
  press = function: 0xc360f8
menu = table:
  visible = false
  open = function: 0xc36470
  new = function: 0xc38520
  get = function: 0xc378c4
  block = function: 0xc36660
  select = function: 0xc37610
  set = function: 0xc376e4
  close = function: 0xc36458
movie = table:
  recording = false
  start = function: 0xc34108
  stop = function: 0xc34074
dryos = table:
  clock = 12
  ms_clock = 12218
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0xc39844
    children = function: 0xc396cc
    files = function: 0xc395b0
    parent = table:
      exists = true
      create = function: 0xc39844
      children = function: 0xc396cc
      files = function: 0xc395b0
      parent = table:
        exists = true
        create = function: 0xc39844
        children = function: 0xc396cc
        files = function: 0xc395b0
        parent = nil
        path = "B:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xc39844
      children = function: 0xc396cc
      files = function: 0xc395b0
      parent = table:
        exists = true
        create = function: 0xc39844
        children = function: 0xc396cc
        files = function: 0xc395b0
        parent = table:
          exists = true
          create = function: 0xc39844
          children = function: 0xc396cc
          files = function: 0xc395b0
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 7567
    folder_number = 100
    free_space = 15180
    image_path = function: 0xc39a20
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  shooting_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xc39844
      children = function: 0xc396cc
      files = function: 0xc395b0
      parent = table:
        exists = true
        create = function: 0xc39844
        children = function: 0xc396cc
        files = function: 0xc395b0
        parent = table:
          exists = true
          create = function: 0xc39844
          children = function: 0xc396cc
          files = function: 0xc395b0
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 7567
    folder_number = 100
    free_space = 15180
    image_path = function: 0xc39a20
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  cf_card = nil
  sd_card = table:
    drive_letter = "B"
    dcim_dir = table:
      exists = true
      create = function: 0xc39844
      children = function: 0xc396cc
      files = function: 0xc395b0
      parent = table:
        exists = true
        create = function: 0xc39844
        children = function: 0xc396cc
        files = function: 0xc395b0
        parent = table:
          exists = true
          create = function: 0xc39844
          children = function: 0xc396cc
          files = function: 0xc395b0
          parent = nil
          path = "B:/"
        path = "B:/DCIM/"
      path = "B:/DCIM/100CANON/"
    file_number = 7567
    folder_number = 100
    free_space = 15180
    image_path = function: 0xc39a20
    type = "SD"
    path = "B:/"
    _card_ptr = userdata
  date = table:
    month = 3
    sec = 41
    isdst = false
    hour = 12
    min = 11
    yday = 79
    wday = 4
    day = 20
    year = 2019
  rename = function: 0xc38fd0
  remove = function: 0xc390a4
  directory = function: 0xc39110
  call = function: 0xc38dcc
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0xc3a460
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1568: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunktask = table:
  yield = function: 0xc3aac8
  create = function: 0xc3ac48
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
SD card (B:/) present
- free space: 15180 MiB
- next image: B:/DCIM/100CANON/IMG_7568.CR2
- DCIM dir. : B:/DCIM/100CANON/
- B:/DCIM/
  - B:/DCIM/100CANON/
  - B:/DCIM/EOSMISC/
- B:/MISC/
- B:/ML/
  - B:/ML/FONTS/
    - B:/ML/FONTS/ARGNOR23.RBF
    - B:/ML/FONTS/ARGNOR32.RBF
    - B:/ML/FONTS/TERM20.RBF
    - B:/ML/FONTS/ARGHLF22.RBF
    - B:/ML/FONTS/TERM12.RBF
    - B:/ML/FONTS/ARGNOR28.RBF
  - B:/ML/MODULES/
    - B:/ML/MODULES/SILENT.MO
    - B:/ML/MODULES/DUAL_ISO.MO
    - B:/ML/MODULES/LUA.MO
    - B:/ML/MODULES/ARKANOID.MO
    - B:/ML/MODULES/MLV_PLAY.MO
    - B:/ML/MODULES/FILE_MAN.MO
    - B:/ML/MODULES/EOSM_202.SYM
    - B:/ML/MODULES/AUTOEXPO.MO
    - B:/ML/MODULES/MLV_LITE.MO
    - B:/ML/MODULES/DEFLICK.MO
    - B:/ML/MODULES/SELFTEST.MO
    - B:/ML/MODULES/BENCH.MO
    - B:/ML/MODULES/PIC_VIEW.MO
    - B:/ML/MODULES/EDMAC.MO
    - B:/ML/MODULES/IMG_NAME.MO
    - B:/ML/MODULES/MLV_SND.MO
    - B:/ML/MODULES/MLV_REC.MO
    - B:/ML/MODULES/ETTR.MO
    - B:/ML/MODULES/ADV_INT.MO
    - B:/ML/MODULES/LOADING.LCK
  - B:/ML/SETTINGS/
    - B:/ML/SETTINGS/LUA.EN
    - B:/ML/SETTINGS/MAGIC.CFG
    - B:/ML/SETTINGS/MENUS.CFG
  - B:/ML/SCRIPTS/
    - B:/ML/SCRIPTS/LIB/
      - B:/ML/SCRIPTS/LIB/LOGGER.LUA
      - B:/ML/SCRIPTS/LIB/KEYS.LUA
      - B:/ML/SCRIPTS/LIB/CONFIG.LUA
      - B:/ML/SCRIPTS/LIB/STRICT.LUA
    - B:/ML/SCRIPTS/CALC.LUA
    - B:/ML/SCRIPTS/SCRNSHOT.LUA
    - B:/ML/SCRIPTS/RECDELAY.LUA
    - B:/ML/SCRIPTS/EDITOR.LUA
    - B:/ML/SCRIPTS/PONG.LUA
    - B:/ML/SCRIPTS/MENUTEST.LUA
    - B:/ML/SCRIPTS/HELLO.LUA
    - B:/ML/SCRIPTS/SOKOBAN.LUA
    - B:/ML/SCRIPTS/COPY2M.LUA
    - B:/ML/SCRIPTS/UNLOAD.LUA
    - B:/ML/SCRIPTS/API_TEST.LUA
  - B:/ML/DATA/
    - B:/ML/DATA/FF8P.LUT
    - B:/ML/DATA/FF8R.LUT
    - B:/ML/DATA/APSC8R.LUT
    - B:/ML/DATA/APSC8P.LUT
  - B:/ML/CROPMKS/
    - B:/ML/CROPMKS/CINESCO2.BMP
    - B:/ML/CROPMKS/CRSSMTR2.BMP
    - B:/ML/CROPMKS/PHIVIDEO.BMP
    - B:/ML/CROPMKS/PHIPHOTO.BMP
    - B:/ML/CROPMKS/PASSPORT.BMP
  - B:/ML/LOGS/
    - B:/ML/LOGS/ROM1.BIN
    - B:/ML/LOGS/ROM0.BIN
    - B:/ML/LOGS/LUATEST.LOG
  - B:/ML/DOCS
  - B:/ML/README
- B:/AUTOEXEC.BIN
- B:/ML-SETUP.FIR
File I/O tests completed.

Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Stop LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Enter MENU mode...
Exit MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
B:/DCIM/100CANON/IMG_7568.CR2: 15934665
B:/DCIM/100CANON/IMG_7568.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
B:/DCIM/100CANON/ABC_7569.CR2: 15862970
B:/DCIM/100CANON/ABC_7569.JPG not found.
B:/DCIM/100CANON/ABC_7570.CR2: 15893316
B:/DCIM/100CANON/ABC_7570.JPG not found.
Bracketed pictures...
B:/DCIM/100CANON/IMG_7571.CR2: 29530223
B:/DCIM/100CANON/IMG_7571.JPG not found.
B:/DCIM/100CANON/IMG_7572.CR2: 15777412
B:/DCIM/100CANON/IMG_7572.JPG not found.
B:/DCIM/100CANON/IMG_7573.CR2: 14038449
B:/DCIM/100CANON/IMG_7573.JPG not found.
Bulb picture...
Elapsed time: 12235
B:/DCIM/100CANON/IMG_7574.CR2: 14095226
B:/DCIM/100CANON/IMG_7574.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
Half-shutter test OK.

Testing module 'lv'...
LiveView is running; stopping...
Starting LiveView...
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: ML
Overlays: ML
Overlays:
- Zebras: LumaFast, over 99%
- Focus Peak: OFF
- Magic Zoom: OFF
- Cropmarks: OFF
- Spotmeter: Percent, AFbox
- False color: OFF
- Histogram: RAW RGB, Log
- Waveform: OFF
- Vectorscope: OFF
Turning everything off:
- Zebras: LumaFast, over 99% -> OFF
- Spotmeter: Percent, AFbox -> OFF
- Histogram: RAW RGB, Log -> OFF
Turning on one by one:
- Zebras: ON/OFF (LumaFast, over 99%)
- Focus Peak: ON/OFF (ON,0.5,local)
- Magic Zoom: ON/OFF (F+HS, Med, TL, 2:1)
- Cropmarks: ON/OFF (CINESCO2.BMP)
- Spotmeter: ON/OFF (Percent, AFbox)
- False color: ON/OFF (Marshall)
- Histogram: ON/OFF (RAW RGB, Log)
- Waveform: ON/OFF (Small)
- Vectorscope: ON/OFF (ON)
Turning everything on:
- Zebras: ON
- Focus Peak: ON
- Magic Zoom: ON
- Cropmarks: ON
- Spotmeter: ON
- False color: ON
- Histogram: ON
- Waveform: ON
- Vectorscope: ON
Restoring previous state:
- Zebras: LumaFast, over 99%
- Focus Peak: OFF
- Magic Zoom: OFF
- Cropmarks: OFF
- Spotmeter: Percent, AFbox
- False color: OFF
- Histogram: RAW RGB, Log
- Waveform: OFF
- Vectorscope: OFF
Overlays working :)
Overlays: disabled
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: disabled
Overlays: Canon
Overlays: Canon
Overlays: disabled
Overlays: ML
Overlays: disabled
Overlays: ML
Setting zoom to x1...
Setting zoom to x5...
Setting zoom to x10...
Setting zoom to x5...
Setting zoom to x1...
Setting zoom to x10...
Setting zoom to x1...
Pausing LiveView...
Resuming LiveView...
Stopping LiveView...
LiveView tests completed.


Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 340
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
59...58...57...Autofocus triggered.
Autofocus completed.
Focus distance: 8610
Focusing backward...
Focus distance: 655350
Focus motor position: 268
Focusing forward with step size 3, wait=true...
.........................
Focus distance: 340
Focus motor position: 3073
Focusing backward with step size 3, wait=true...
............................
Focus distance: 655350
Focus motor position: 268
Focus range: 25 steps forward, 28 steps backward.
Motor steps: 2805 forward, 2805 backward, 0 lost.
Focusing forward with step size 3, wait=false...
.......................................................
Focus distance: 530
Focus motor position: 2054
Focusing backward with step size 3, wait=false...
..............................................
Focus distance: 530
Focus motor position: 2054
Focus range: 55 steps forward, 46 steps backward.
Motor steps: 1786 forward, 0 backward, 1786 lost.
Focusing forward with step size 2, wait=true...
...
Focus distance: 530
Focus motor position: 2054
Focusing backward with step size 2, wait=true...
...
Focus distance: 530
Focus motor position: 2054
Focus range: 164 steps forward, 164 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.
Focusing forward with step size 2, wait=false...
...
Focus distance: 530
Focus motor position: 2054
Focusing backward with step size 2, wait=false...
...
Focus distance: 530
Focus motor position: 2054
Focus range: 170 steps forward, 171 steps backward.
Motor steps: 0 forward, 0 backward, 0 lost.

Focus test completed.

Testing exposure settings...
Camera    : Canon EOS M (EOSM) 2.0.2
Lens      : EF50mm f/1.8 STM
Shoot mode: 3
Shutter   : Ç5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : Å5.6 (raw 48, f/5.6, apex 5.)
Av range  : Å1.8..Å22 (raw 22..80, f/1.8..f/22.6, apex 1.75..9.)
ISO       : Ä1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
Setting aperture to random values...
Error: aperture delta 0.26 EV (expected < 0.1875, Å1.8, method=2)
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.
Movie recording tests completed.

Done!


Note that there is an error towards the end of the log. Not sure what it means.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 20, 2019, 08:26:44 PM
QuoteSwitched to an EF lens with the EF to EF-M adapter and finally got through the tests.

That's right, I've tested with an EF lens, and all other continuous AF features turned off. Don't have any EF-M lenses yet; the 22mm STM seems to be the only half-decent one (for what I'd use), but that's probably not the trickiest lens for ML. On full frame, that lens is equivalent to 35mm f/3.2 - not *that* tempting in low light (but then, you can't compare its size with a Samyang 35mm/1.4).

If the EF-M lenses attempt to move, at least a tiny bit, my best guess is that ML might be checking the wrong status bits while waiting for a confirmation. If you comment out the waiting functions from lens_focus(), it might work better. For example, for a quick test, one could use prop_request_change instead of prop_request_change_wait, comment out lens_focus_wait(), and set a larger delay in the focus settings menu. If that works, we need to find out how to tell when the AF motion was finished. If that doesn't work, we need to find out how EOS utility performs the autofocus commands (that's what I did years ago on 550D iirc). Of course, assuming EOS utility can do remote focus on the EOS M (I do not have it installed).

QuoteML/SCRIPTS/API_TEST.LUA:1094: assertion failed!

First assertion (line 1094) was probably picture not taken because camera couldn't autofocus. No big deal.

QuoteNote that there is an error towards the end of the log. Not sure what it means.

I've also got that last error a few times, in LiveView, on other models. It means ML tried to set some aperture, and Canon firmware picked something a bit too different from what ML asked. In this case, the difference was 0.26 EV, and ML expected a difference smaller than 0.1875 EV. Not sure why it happens, probably not a big deal either.
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on March 21, 2019, 04:56:32 AM
Quote from: a1ex on March 20, 2019, 08:26:44 PM
Don't have any EF-M lenses yet; the 22mm STM seems to be the only half-decent one (for what I'd use), but that's probably not the trickiest lens for ML.

An interesting lens is the EF-M 28mm f/3.5 Macro IS STM. It has a built in light and has IS so it shows the shutter-bug (https://www.magiclantern.fm/forum/index.php?topic=21728.msg207275#msg207275).

Quote from: a1ex on March 20, 2019, 08:26:44 PM
If you comment out the waiting functions from lens_focus(), it might work better. For example, for a quick test, one could use prop_request_change instead of prop_request_change_wait, comment out lens_focus_wait(), and set a larger delay in the focus settings menu. If that works, we need to find out how to tell when the AF motion was finished.

Tried this and it didn't work:

src/lens.c
                /* request and wait for confirmation */
                prop_request_change_wait(PROP_LV_LENS_DRIVE_REMOTE, &focus_cmd, 4, 100000);

                /* also wait for confirmation from PROP_LV_FOCUS_DONE */
                // lens_focus_wait();


I kept adding to the timeout value until I thought it was way too much but maybe I didn't go far enough?

Quote from: a1ex on March 20, 2019, 08:26:44 PM
If that doesn't work, we need to find out how EOS utility performs the autofocus commands (that's what I did years ago on 550D iirc). Of course, assuming EOS utility can do remote focus on the EOS M (I do not have it installed).

EOS Utility can do very little on the EOSM, certainly not tethered capture or anything like that.

Here is what EOS Utility looks like without a camera connected:

(https://farm8.staticflickr.com/7860/40466039443_3c87591a9a.jpg) (https://flic.kr/p/24DR2He)

And this is what happens when the EOSM is connected:

(https://farm8.staticflickr.com/7885/47379041282_a4fa815ec1.jpg) (https://flic.kr/p/2fbHYj7)

Same thing with the EOSM2.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on March 22, 2019, 04:06:06 PM
Quote from: dfort on March 21, 2019, 04:56:32 AM
                prop_request_change_wait(PROP_LV_LENS_DRIVE_REMOTE, &focus_cmd, 4, 100000);

Sorry, my English is broken. I wanted to say, don't use prop_request_change_wait, but replace it with prop_request_change (without wait). Then, from ML menu, you could configure a fixed delay, such as 50 ms or whatever. That one ends up as "extra_delay" in the source code.

If the lens moves after these changes, disabling our waiting for confirmation might do the trick (or, the diagnostic logs captured while attempting to focus could give further hints).

If the lens does not move at all... then all we can do is:
- capture debug logs during autofocus (need to find out who decides the direction and speed - the main CPU or the MPU?)
- disable focus functionality for EF-M lenses (easiest, but a bit messy)
- reverse engineer the MPU firmware (hard, time consuming, not a priority for me at the time of writing)
Title: Re: Lua Scripting (lua.mo)
Post by: dfort on March 22, 2019, 09:22:56 PM
Your English is fine, my reading is broken.

Tried this:

src/lens.c
#else
                /* request and wait for confirmation */
                // prop_request_change_wait(PROP_LV_LENS_DRIVE_REMOTE, &focus_cmd, 4, 1000);
prop_request_change(PROP_LV_LENS_DRIVE_REMOTE, &focus_cmd, 4);

                /* also wait for confirmation from PROP_LV_FOCUS_DONE */
                // lens_focus_wait();
#endif


(https://farm8.staticflickr.com/7860/40477886573_1ab291ed7a.jpg) (https://flic.kr/p/24ETKs6)

But still no focus movement. I take it that the message in the log is just from turning off the camera after letting it run several minutes.

LUATEST.LOG

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-3-22 12:03:33
===============================================================================

Module tests...

Testing lens focus functionality...
Focus distance: 655350
Autofocus in LiveView...
Please trigger autofocus (half-shutter / AF-ON / * ).
Autofocus triggered.
Autofocus completed.
Focus distance: 370
Focusing backward...

ML/SCRIPTS/API_TEST.LUA:1441: lens.focus() only works in LiveView.
stack traceback:
[C]: in function 'lens.focus'
ML/SCRIPTS/API_TEST.LUA:1441: in function 'test_lens_focus'
ML/SCRIPTS/API_TEST.LUA:1579: 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


The EF-M lenses haven't been able to pass the lua tests for as long as I can remember. Seems like everything else works but those lenses don't seem to move the same way EF/EF-S lenses move.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 18, 2019, 07:46:18 PM
If anyone has a (working) 50mm/1.8 II lens (not the newer STM), or any other lens that does not report focus distance, I'd like you to run the Lua API test with both unified (main) build, and with latest lua_fix experimental build. Camera model doesn't matter much.

Reason: I expect lens.focus to fail on these lenses, as discussed here (https://www.magiclantern.fm/forum/index.php?topic=23856), but the same function is likely to work fine in mainline.
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on April 18, 2019, 10:41:05 PM
I have problems running on 50D with a tamron 17-50mm wich doesn't report focus distance in focus tab.

Can't run because it lock the camera in both unified and lua_fix (tested unified feb 04-18 and appears to run up to AF test then camera powered down for uknow reasons).

This is what I got in the log of lua_fix:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-18 20:12:47
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 107
    apex = 6.375
    ms = 12
    value = 0.012048
  aperture = table:
    raw = 35
    apex = 3.375
    value = 3.2
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 88
      apex = 10
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 149
  state = 0
  reboot = function: p
  bulb = function: p
  shoot = 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:
  hide = function: p
  clear = function: p
  show = function: p
  write = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  start = function: p
  pause = function: p
  resume = function: p
  wait = function: p
  stop = function: p
  info = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  pixel = function: p
  screenshot = function: p
  rect = function: p
  circle = function: p
  clear = function: p
  on = function: p
  print = function: p
  line = function: p
  notify_box = function: p
  off = function: p
  draw = function: p
  load = function: p
key = table:
  last = 0
  wait = function: p
  press = function: p
menu = table:
  visible = false
  new = function: p
  get = function: p
  block = function: p
  close = function: p
  open = function: p
  set = 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
  stop = function: p
  start = function: p
dryos = table:
  clock = 39
  ms_clock = 39732
  prefix = "IMG_"
  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 = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  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 = 4096
    drive_letter = "A"
    file_number = 2409
    folder_number = 109
    free_space = 1198336
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2409
    folder_number = 109
    free_space = 1198336
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  date = table:
    hour = 20
    min = 12
    day = 18
    sec = 49
    month = 4
    year = 2019
    yday = 1
    wday = 2
    isdst = false
  call = function: p
  directory = function: p
  remove = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'api_tests'task = table:
  yield = function: p
  create = 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 50D (50D) 1.0.9
Lens      : 17-50mm
Shoot mode: 3
Shutter   : ,80 (raw 107, 0.012048s, 12ms, apex 6.375)
Aperture  : 3.2 (raw 35, f/3.2, apex 3.375)
Av range  : 2.8..32 (raw 32..88, f/2.799999..f/32, apex 3...10)
ISO       : 200 (raw 80, 200, apex 6.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-18 20:14:43
===============================================================================

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 = 35
    apex = 3.375
    value = 3.2
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 88
      apex = 10
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 153
  state = 0
  bulb = function: p
  reboot = function: p
  shoot = 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:
  hide = function: p
  show = function: p
  write = function: p
  clear = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  stop = function: p
  info = function: p
  pause = function: p
  start = function: p
  wait = function: p
  resume = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  pixel = function: p
  draw = function: p
  print = function: p
  screenshot = function: p
  off = function: p
  circle = function: p
  on = function: p
  load = function: p
  notify_box = function: p
  clear = function: p
  line = function: p
  rect = function: p
key = table:
  last = 0
  press = function: p
  wait = function: p
menu = table:
  visible = false
  set = function: p
  new = function: p
  get = function: p
  close = function: p
  block = 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 = 21
  ms_clock = 22024
  prefix = "IMG_"
  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 = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  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 = 4096
    drive_letter = "A"
    file_number = 2409
    folder_number = 109
    free_space = 1198336
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2409
    folder_number = 109
    free_space = 1198336
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  date = table:
    min = 14
    isdst = false
    hour = 20
    year = 2019
    wday = 2
    month = 4
    sec = 45
    yday = 1
    day = 18
  remove = function: p
  directory = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'api_tests'task = table:
  yield = function: p
  create = 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 50D (50D) 1.0.9
Lens      : 17-50mm
Shoot mode: 3
Shutter   : ,160 (raw 115, 0.006024s, 6ms, apex 7.375)
Aperture  : 3.2 (raw 35, f/3.2, apex 3.375)
Av range  : 2.8..32 (raw 32..88, f/2.799999..f/32, apex 3...10)
ISO       : 200 (raw 80, 200, apex 6.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Error: shutter set to raw=97, got 0.03125s, expected 0.028656s
Error: shutter set to raw=97, got 31ms, expected 29ms
Error: shutter set to raw=97, got Tv5, expected Tv5.125
Error: shutter set to raw=97, got 96, expected 97 (raw)


This unified Jul 03-18:


===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-18 22:40:29
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 83
    apex = 3.375
    ms = 96
    value = 0.096388
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.799999
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 88
      apex = 10
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 152
  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:
  clear = function: p
  write = function: p
  show = function: p
  hide = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  start = function: p
  stop = function: p
  resume = function: p
  pause = function: p
  wait = function: p
  info = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  print = function: p
  clear = function: p
  on = function: p
  pixel = function: p
  rect = function: p
  line = function: p
  draw = function: p
  load = function: p
  circle = function: p
  notify_box = function: p
  screenshot = function: p
  off = function: p
key = table:
  last = 0
  press = function: p
  wait = function: p
menu = table:
  visible = false
  set = function: p
  block = function: p
  close = function: p
  open = function: p
  get = function: p
  new = 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 = 25
  ms_clock = 25387
  prefix = "IMG_"
  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 = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  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 = 4096
    drive_letter = "A"
    file_number = 2411
    folder_number = 109
    free_space = 1196608
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2411
    folder_number = 109
    free_space = 1196608
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  date = table:
    yday = 1
    wday = 2
    year = 2019
    month = 4
    isdst = false
    day = 18
    hour = 22
    sec = 31
    min = 40
  directory = function: p
  remove = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'globals.api_tests'task = table:
  yield = function: p
  create = function: p
property = table:
Generic tests completed.

Module tests...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-18 22:50:09
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 147
    apex = 11.375
    ms = 0
    value = 0.000376
  aperture = table:
    raw = 0
    apex = 0
    value = 0
    min = table:
      raw = 0
      apex = 0
      value = 0
    max = table:
      raw = 0
      apex = 0
      value = 0
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 152
  state = 0
  shoot = function: p
  reboot = 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:
  clear = function: p
  show = function: p
  write = function: p
  hide = function: p
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  stop = function: p
  info = function: p
  pause = function: p
  wait = function: p
  resume = function: p
  start = function: p
lens = table:
  name = ""
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = false
  af_mode = 3
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  load = function: p
  clear = function: p
  on = function: p
  pixel = function: p
  screenshot = function: p
  rect = function: p
  line = function: p
  draw = function: p
  notify_box = function: p
  print = function: p
  circle = function: p
  off = function: p
key = table:
  last = 0
  wait = function: p
  press = function: p
menu = table:
  visible = false
  open = function: p
  close = function: p
  set = function: p
  new = function: p
  block = function: p
  get = 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
  stop = function: p
  start = function: p
dryos = table:
  clock = 70
  ms_clock = 71064
  prefix = "IMG_"
  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 = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  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 = 4096
    drive_letter = "A"
    file_number = 2411
    folder_number = 109
    free_space = 1196608
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2411
    folder_number = 109
    free_space = 1196608
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  date = table:
    year = 2019
    wday = 2
    yday = 1
    min = 50
    month = 4
    hour = 22
    sec = 11
    day = 18
    isdst = false
  directory = function: p
  remove = function: p
  call = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'globals.api_tests'task = table:
  yield = function: p
  create = 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 50D (50D) 1.0.9
Lens      :
Shoot mode: 3
Shutter   : ,2500 (raw 147, 0.000376s, 0ms, apex 11.375)
Aperture  : 0.0 (raw 0, f/0, apex 0)
Av range  : 0.0..0.0 (raw 0..0, f/0..f/0, apex 0..0)
ISO       : 200 (raw 80, 200, apex 6.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 19, 2019, 03:13:07 PM
To narrow down:
- comment out test_lens_focus (expecting the API tests to pass)
- run only the first half of test_lens_focus (before the calls to lens.focus)
- try a large delay in lens.focus (4th argument, which is optional); for example, 100 or 500 ms

BTW, is the 50D able to shut down cleanly with the latest lua_fix build? The 5D2 is not (it locks up with both LEDs turned on).
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on April 19, 2019, 05:48:24 PM
Quote from: a1ex on April 19, 2019, 03:13:07 PM
BTW, is the 50D able to shut down cleanly with the latest lua_fix build? The 5D2 is not (it locks up with both LEDs turned on).
What do you do exacly? If I use the build normally, it doesn't looks like it need a battery pull.
Camera freezes as described before if I run api_test.lua untouched and need to take battery out to power down camera.

Here are more detailed tests using lua_fix 20-03-19:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 16:55:05
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 88
    apex = 4.
    ms = 63
    value = 0.0625
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 88
      apex = 10.
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 149
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  shoot = function: 0x9f1194
  bulb = function: 0x9f13c8
  reboot = function: 0x9f1168
  burst = function: 0x9f1448
  wait = function: 0x9f00c0
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:
  show = function: 0x9eea54
  write = function: 0x9eeae8
  hide = function: 0x9eea44
  clear = function: 0x9eea34
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  stop = function: 0x9f15e0
  resume = function: 0x9f1c68
  info = function: 0x9f1974
  start = function: 0x9f15d0
  pause = function: 0x9f1c78
  wait = function: 0x9f2038
lens = table:
  name = "17-50mm"
  focal_length = 17
  focus_distance = 0
  hyperfocal = 5466
  dof_near = 11139225
  dof_far = 1000000
  af = true
  af_mode = 0
  autofocus = function: 0x9f2b1c
  focus = function: 0x9f2ce4
display = table:
  idle = nil
  height = 480
  width = 720
  print = function: 0x9f4990
  load = function: 0x9f3854
  screenshot = function: 0x9f348c
  notify_box = function: 0x9f3624
  draw = function: 0x9f370c
  off = function: 0x9f3560
  on = function: 0x9f3570
  clear = function: 0x9f347c
  line = function: 0x9f44fc
  circle = function: 0x9f3ec8
  pixel = function: 0x9f47c4
  rect = function: 0x9f4198
key = table:
  last = 20
  press = function: 0x9f5168
  wait = function: 0x9f4ea0
menu = table:
  visible = false
  new = function: 0x9f7590
  get = function: 0x9f6934
  block = function: 0x9f56d0
  open = function: 0x9f54e0
  select = function: 0x9f6680
  set = function: 0x9f6754
  close = function: 0x9f54c8
movie = table:
  recording = false
  stop = function: 0x9f30e4
  start = function: 0x9f3178
dryos = table:
  clock = 15
  ms_clock = 15996
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0x9f88b4
    children = function: 0x9f873c
    files = function: 0x9f8620
    parent = table:
      exists = true
      create = function: 0x9f88b4
      children = function: 0x9f873c
      files = function: 0x9f8620
      parent = table:
        exists = true
        create = function: 0x9f88b4
        children = function: 0x9f873c
        files = function: 0x9f8620
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f88b4
      children = function: 0x9f873c
      files = function: 0x9f8620
      parent = table:
        exists = true
        create = function: 0x9f88b4
        children = function: 0x9f873c
        files = function: 0x9f8620
        parent = table:
          exists = true
          create = function: 0x9f88b4
          children = function: 0x9f873c
          files = function: 0x9f8620
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a90
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f88b4
      children = function: 0x9f873c
      files = function: 0x9f8620
      parent = table:
        exists = true
        create = function: 0x9f88b4
        children = function: 0x9f873c
        files = function: 0x9f8620
        parent = table:
          exists = true
          create = function: 0x9f88b4
          children = function: 0x9f873c
          files = function: 0x9f8620
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a90
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  cf_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f88b4
      children = function: 0x9f873c
      files = function: 0x9f8620
      parent = table:
        exists = true
        create = function: 0x9f88b4
        children = function: 0x9f873c
        files = function: 0x9f8620
        parent = table:
          exists = true
          create = function: 0x9f88b4
          children = function: 0x9f873c
          files = function: 0x9f8620
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a90
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  sd_card = nil
  date = table:
    sec = 7
    month = 4
    hour = 16
    day = 19
    isdst = false
    min = 55
    wday = 3
    year = 2019
    yday = 1
  remove = function: 0x9f8114
  rename = function: 0x9f8040
  directory = function: 0x9f8180
  call = function: 0x9f7e3c
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0x9f94d0
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1568: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunktask = table:
  yield = function: 0x9f9b38
  create = function: 0x9f9cb8
property = table:
Generic tests completed.

Module tests...
Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt

Camera Locks, battery pull required.

Running with test_io() disabled:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:02:29
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
arg = table:
  [0] = "API_TEST.LUA"
camera = table:
  shutter = table:
    raw = 88
    apex = 4.
    ms = 63
    value = 0.0625
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.8
    min = table:
      raw = 32
      apex = 3.
      value = 2.8
    max = table:
      raw = 88
      apex = 10.
      value = 32
  iso = table:
    raw = 80
    apex = 6.
    value = 200
  ec = table:
    raw = 0
    value = 0
  flash = true
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 3
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 149
  gui = table:
    menu = false
    play = false
    play_photo = false
    play_movie = false
    qr = false
    idle = true
  bulb = function: 0x9f1368
  shoot = function: 0x9f1134
  reboot = function: 0x9f1108
  wait = function: 0x9f0060
  burst = function: 0x9f13e8
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:
  hide = function: 0x9ee9e4
  show = function: 0x9ee9f4
  clear = function: 0x9ee9d4
  write = function: 0x9eea88
lv = table:
  enabled = false
  paused = false
  running = false
  zoom = 1
  overlays = false
  pause = function: 0x9f1c18
  info = function: 0x9f1914
  start = function: 0x9f1570
  wait = function: 0x9f1fd8
  resume = function: 0x9f1c08
  stop = function: 0x9f1580
lens = table:
  name = "17-50mm"
  focal_length = 32
  focus_distance = 0
  hyperfocal = 19312
  dof_near = -934934500
  dof_far = 1000000
  af = true
  af_mode = 0
  focus = function: 0x9f2c84
  autofocus = function: 0x9f2abc
display = table:
  idle = nil
  height = 480
  width = 720
  line = function: 0x9f449c
  off = function: 0x9f3500
  circle = function: 0x9f3e68
  on = function: 0x9f3510
  print = function: 0x9f4930
  notify_box = function: 0x9f35c4
  screenshot = function: 0x9f342c
  draw = function: 0x9f36ac
  pixel = function: 0x9f4764
  load = function: 0x9f37f4
  clear = function: 0x9f341c
  rect = function: 0x9f4138
key = table:
  last = 20
  wait = function: 0x9f4e40
  press = function: 0x9f5108
menu = table:
  visible = false
  new = function: 0x9f7530
  close = function: 0x9f5468
  get = function: 0x9f68d4
  select = function: 0x9f6620
  open = function: 0x9f5480
  block = function: 0x9f5670
  set = function: 0x9f66f4
movie = table:
  recording = false
  stop = function: 0x9f3084
  start = function: 0x9f3118
dryos = table:
  clock = 19
  ms_clock = 19920
  image_prefix = "IMG_"
  config_dir = table:
    exists = true
    create = function: 0x9f8854
    children = function: 0x9f86dc
    files = function: 0x9f85c0
    parent = table:
      exists = true
      create = function: 0x9f8854
      children = function: 0x9f86dc
      files = function: 0x9f85c0
      parent = table:
        exists = true
        create = function: 0x9f8854
        children = function: 0x9f86dc
        files = function: 0x9f85c0
        parent = nil
        path = "A:/"
      path = "ML/"
    path = "ML/SETTINGS/"
  ml_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f8854
      children = function: 0x9f86dc
      files = function: 0x9f85c0
      parent = table:
        exists = true
        create = function: 0x9f8854
        children = function: 0x9f86dc
        files = function: 0x9f85c0
        parent = table:
          exists = true
          create = function: 0x9f8854
          children = function: 0x9f86dc
          files = function: 0x9f85c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a30
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  shooting_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f8854
      children = function: 0x9f86dc
      files = function: 0x9f85c0
      parent = table:
        exists = true
        create = function: 0x9f8854
        children = function: 0x9f86dc
        files = function: 0x9f85c0
        parent = table:
          exists = true
          create = function: 0x9f8854
          children = function: 0x9f86dc
          files = function: 0x9f85c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a30
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  cf_card = table:
    drive_letter = "A"
    dcim_dir = table:
      exists = true
      create = function: 0x9f8854
      children = function: 0x9f86dc
      files = function: 0x9f85c0
      parent = table:
        exists = true
        create = function: 0x9f8854
        children = function: 0x9f86dc
        files = function: 0x9f85c0
        parent = table:
          exists = true
          create = function: 0x9f8854
          children = function: 0x9f86dc
          files = function: 0x9f85c0
          parent = nil
          path = "A:/"
        path = "A:/DCIM/"
      path = "A:/DCIM/109CANON/"
    file_number = 2411
    folder_number = 109
    free_space = 1168
    image_path = function: 0x9f8a30
    type = "CF"
    path = "A:/"
    _card_ptr = userdata
  sd_card = nil
  date = table:
    sec = 30
    year = 2019
    wday = 3
    day = 19
    hour = 17
    isdst = false
    min = 2
    yday = 1
    month = 4
  directory = function: 0x9f8120
  rename = function: 0x9f7fe0
  call = function: 0x9f7ddc
  remove = function: 0x9f80b4
interval = table:
  time = 10
  count = 0
  running = false
  stop = function: 0x9f9470
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:45: in function <ML/SCRIPTS/API_TEST.LUA:44>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:44: in function 'globals.print_table'
ML/SCRIPTS/API_TEST.LUA:90: in function 'globals.generic_tests'
ML/SCRIPTS/API_TEST.LUA:1568: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunktask = table:
  create = function: 0x9f9c58
  yield = function: 0x9f9ad8
property = table:
Generic tests completed.

Module tests...
Testing Canon GUI functions...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Start LiveView...
Pause LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Stop LiveView...
Start LiveView...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Enter MENU mode...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter PLAY mode...
Exit PLAY mode...
Enter MENU mode...
Exit MENU mode...
Pause LiveView...
Resume LiveView...
Enter PLAY mode...
Enter MENU mode...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Enter PLAY mode...
Exit PLAY mode...
Pause LiveView...
Canon GUI tests completed.

Testing ML menu API...
Menu tests completed.

Testing picture taking functions...
Snap simulation test...
Single picture...
A:/DCIM/109CANON/IMG_2412.CR2: 20937882
A:/DCIM/109CANON/IMG_2412.JPG not found.
Two burst pictures...
Ideally, the camera should be in some continuous shooting mode (not checked).
A:/DCIM/109CANON/ABC_2413.CR2: 21029918
A:/DCIM/109CANON/ABC_2413.JPG not found.
A:/DCIM/109CANON/ABC_2414.CR2: 21038890
A:/DCIM/109CANON/ABC_2414.JPG not found.
Bracketed pictures...
A:/DCIM/109CANON/IMG_2415.CR2: 18218930
A:/DCIM/109CANON/IMG_2415.JPG not found.
A:/DCIM/109CANON/IMG_2416.CR2: 20825360
A:/DCIM/109CANON/IMG_2416.JPG not found.
A:/DCIM/109CANON/IMG_2417.CR2: 21973768
A:/DCIM/109CANON/IMG_2417.JPG not found.
Bulb picture...
Elapsed time: 11847
A:/DCIM/109CANON/IMG_2418.CR2: 12013692
A:/DCIM/109CANON/IMG_2418.JPG not found.
Picture taking tests completed.

Testing multitasking...
Only one task allowed to interrupt...
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Main task yielding.
Task C started.
Task C finished.
Main task back.
Multitasking tests completed.

Testing half-shutter...
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
warning: last key not half-shutter, but 20
Half-shutter test OK.

Testing module 'lv'...
Starting LiveView...

ML/SCRIPTS/API_TEST.LUA:1246: assertion failed!
stack traceback:
[C]: in function 'globals.assert'
ML/SCRIPTS/API_TEST.LUA:1246: in function 'globals.test_lv'
ML/SCRIPTS/API_TEST.LUA:1578: in function <ML/SCRIPTS/API_TEST.LUA:1564>
[C]: in function 'globals.xpcall'
ML/SCRIPTS/API_TEST.LUA:1564: in function 'globals.api_tests'
ML/SCRIPTS/API_TEST.LUA:1603: in main chunk


Starting from test_lens_focus():

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:15:26
===============================================================================

Module tests...

Testing lens focus functionality...
Autofocus outside LiveView...
Focus distance: 0
Autofocus in LiveView...
Is there something to focus on?
29...28...27...26...Please trigger autofocus (half-shutter / AF-ON / * ).
59...58...57...56...55...54...53...52...51...50...49...48...Autofocus triggered.
Autofocus completed.
Focus distance: 0
Focusing backward...

Here autofocus can't be triggered with Half-Shutter, I used AF-ON.
Script was running in an infinite loop and Lens AF was stuck trying go over infinity

Only test_camera_exposure() and test_movie():

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:21:42
===============================================================================

Module tests...
Testing exposure settings...
Camera    : Canon EOS 50D (50D) 1.0.9
Lens      : 17-50mm
Shoot mode: 3
Shutter   : �5 (raw 75, 0.192776s, 193ms, apex 2.375)
Aperture  : �2.8 (raw 32, f/2.8, apex 3.)
Av range  : �2.8..�32 (raw 32..88, f/2.8..f/32, apex 3...10.)
ISO       : �1600 (raw 104, 1600, apex 9.)
EC        : 0.0 (raw 0, 0 EV)
Flash EC  : 0.0 (raw 0, 0 EV)
Setting shutter to random values...
Setting ISO to random values...
Setting aperture to random values...
Please switch to Av mode.
Setting EC to random values...
Setting Flash EC to random values...
Exposure tests completed.


Testing movie recording...
Please switch to Movie mode.

ML/SCRIPTS/API_TEST.LUA:1550: assertion failed!
stack traceback:
[C]: in function 'assert'
ML/SCRIPTS/API_TEST.LUA:1550: in function 'test_movie'
ML/SCRIPTS/API_TEST.LUA:1581: 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

Movie record (no raw and record key not set in ML menu) stopped automatically and then assertion was triggered.
Blue Led was ON but went OFF when switching back to photo mode and camera powered down normally.

Running test_lens_focus() in nightly Jul03-18:

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:45:18
===============================================================================

Module tests...
Focus distance: 0
Focusing backward...
Focus distance: 0
Focusing forward with step size 3, wait=true...
......................
Focus distance: 0
Focusing backward with step size 3, wait=true...
.....
Focus distance: 0
Focus range: 22 steps forward, 5 steps backward.
Focusing forward with step size 3, wait=false...
......
Focus distance: 0
Focusing backward with step size 3, wait=false...
.....
Focus distance: 0
Focus range: 6 steps forward, 5 steps backward.
Focusing forward with step size 2, wait=true...
...........................................
Focus distance: 0
Focusing backward with step size 2, wait=true...
.....
Focus distance: 0

Camera shutdown automatically after AF test went back and forth up to Soft Autofocus limits

All test up to  test_io():

===============================================================================
ML/SCRIPTS/API_TEST.LUA - 2019-4-19 17:57:11
===============================================================================

Strict mode tests...
Strict mode tests passed.

Generic tests...
camera = table:
  shutter = table:
    raw = 0
    apex = -7.
    ms = 0
    value = 0
  aperture = table:
    raw = 32
    apex = 3.
    value = 2.799999
    min = table:
      raw = 32
      apex = 3.
      value = 2.799999
    max = table:
      raw = 88
      apex = 10
      value = 32
  iso = table:
    raw = 104
    apex = 9
    value = 1600
  ec = table:
    raw = -3
    value = -0.375
  flash_ec = table:
    raw = 0
    value = 0
  kelvin = 5500
  mode = 2
  metering_mode = 3
  drive_mode = 0
  model = "Canon EOS 50D"
  model_short = "50D"
  firmware = "1.0.9"
  temperature = 158
  state = 0
  bulb = function: p
  shoot = 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 = false
  paused = false
  running = false
  zoom = 1
  stop = function: p
  pause = function: p
  wait = function: p
  info = function: p
  start = function: p
  resume = function: p
lens = table:
  name = "17-50mm"
  focal_length = 0
  focus_distance = 14080
  hyperfocal = 0
  dof_near = 0
  dof_far = 0
  af = true
  af_mode = 0
  focus = function: p
display = table:
  idle = true
  height = 480
  width = 720
  line = function: p
  clear = function: p
  circle = function: p
  on = function: p
  screenshot = function: p
  rect = function: p
  pixel = function: p
  notify_box = function: p
  draw = function: p
  print = function: p
  load = function: p
  off = function: p
key = table:
  last = 0
  press = function: p
  wait = function: p
menu = table:
  visible = false
  new = function: p
  set = function: p
  block = function: p
  close = function: p
  get = 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 = 18
  ms_clock = 18579
  prefix = "IMG_"
  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 = "A:/"
      path = "A:/DCIM/"
    path = "A:/DCIM/109CANON/"
  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 = 4096
    drive_letter = "A"
    file_number = 2419
    folder_number = 109
    free_space = 1052512
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  shooting_card = table:
    cluster_size = 4096
    drive_letter = "A"
    file_number = 2419
    folder_number = 109
    free_space = 1052512
    type = "CF"
    _card_ptr = userdata
    path = "A:/"
  date = table:
    wday = 3
    month = 4
    day = 19
    isdst = false
    min = 57
    hour = 17
    sec = 14
    yday = 1
    year = 2019
  directory = function: p
  call = function: p
  remove = function: p
interval = table:
  time = 10
  count = 0
  running = 0
  stop = function: p
battery = table:
function not available on this camera
stack traceback:
[C]: in ?
[C]: in for iterator 'for iterator'
ML/SCRIPTS/LIB/logger.lua:125: in function 'logger.serialize'
ML/SCRIPTS/API_TEST.LUA:30: in function <ML/SCRIPTS/API_TEST.LUA:29>
[C]: in function 'xpcall'
ML/SCRIPTS/API_TEST.LUA:29: in function 'print_table'
ML/SCRIPTS/API_TEST.LUA:75: in function 'generic_tests'
ML/SCRIPTS/API_TEST.LUA:634: in function 'api_tests'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
Done!
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 19, 2019, 06:11:00 PM
Quote from: aprofiti on April 19, 2019, 05:48:24 PM
What do you do exacly?

It freezes whenever I turn off the camera (no matter how - from power switch or from card/battery doors). Repeatable. Default settings, no modules loaded.

QuoteML/SCRIPTS/API_TEST.LUA:1550: assertion failed!

That line of code should not execute on 50D; maybe the test contains a typo or something? I did not test that change (388e84b, included in the December 23 build, reply #438).

Quote from: aprofiti on April 19, 2019, 05:48:24 PM
Camera Locks, battery pull required.

Running with test_io() disabled [...]

The I/O test appears to be working in QEMU...

Testing file I/O...
Copy test: autoexec.bin -> tmp.bin
Copy test OK
Append test: tmp.txt
Append test OK
Rename test: apple.txt -> banana.txt
Rename test OK
Rename test: apple.txt -> ML/banana.txt
Rename test OK
CF card (A:/) present
- free space: 212 MiB
- next image: A:/DCIM/100CANON/IMG_3429.CR2
- DCIM dir. : A:/DCIM/100CANON/
- A:/DCIM/
  - A:/DCIM/EOSMISC/
  - A:/DCIM/100CANON/
- A:/MISC/
- A:/ML/
  - A:/ML/MODULES/
...
- A:/AUTOEXEC.BIN
- A:/ML-SETUP.FIR
File I/O tests completed.


Quote
Script was running in an infinite loop and Lens AF was stuck trying go over infinity

Yes, this is what I was afraid it might happen, with the new heuristics.

This part of the test appeared to work, to some extent, in unified, so... it's a regression.

While it's stuck trying to focus over infinity, are there "Lens moving" messages on the console? These are not logged; they are just printed. If yes, can you show me a few values? (a screenshot would be fine)
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on April 19, 2019, 06:35:53 PM
Quote from: a1ex on April 19, 2019, 06:11:00 PM
It freezes whenever I turn off the camera (no matter how - from power switch or from card/battery doors). Repeatable. Default settings, no modules loaded.
No problems over here

Quote from: a1ex on April 19, 2019, 06:11:00 PM
That line of code should not execute on 50D; maybe the test contains a typo or something? I did not test that change (it was in the December 23 build, reply #438).
Yes is a typo. Test runs fine if I change the string.
From test logs:

camera = table:
  model = "Canon EOS 50D"
  model_short = "50D"


Quote from: a1ex on April 19, 2019, 06:11:00 PM
This part of the test appeared to work, to some extent, in unified, so... it's a regression.
Don't understand why camera shutdown immediatly during the test.
This appen also with an older unified build (Feb04-18), I don't remember if this was an issue with older build than these ones

Quote from: a1ex on April 19, 2019, 06:11:00 PM
While it's stuck trying to focus over infinity, are there "Lens moving" messages on the console? These are not logged; they are just printed. If yes, can you show me a few values? (a screenshot would be fine)
Yes a lot of them... Even if I manually move the autofocus ring in the opposite direction, some hits and then agin stuck.
Give me a few minutes to take the sceenshoot
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 19, 2019, 06:43:26 PM
Old cameras will shutdown if the delay between focus commands is "too small" (Canon knows what exactly is "too small"). Your test log shows some successful focus commands, though.

If the limit detection (on Canon's side) is relying solely on motor current, lens.focus() will keep trying as long as the motor encoder (lens.focus_pos) shows some movement. If the motor "keeps trying", that might result in some movement (back and forth) at the focus limits (either macro or infinity), but lens.focus() will think the lens is still moving. That's the edge case I wanted to check, and I know for sure the 50mm/1.8 II has no limit switches; it only looks at the motor current. If user would stop the focus ring forcefully, ML would show the same error, i.e. "Focus: soft limit reached".

If the "Lens moving" messages are showing numbers with sign changing all the time (i.e. showing the encoder going back and forth), I should update the heuristic to interpret that sign change as "focus limit reached".
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on April 19, 2019, 06:53:00 PM
Autofocusing works in the tfirst stage (before pressing AF-ON) and then first second of the second stage, then reach infinity and get stuck

(https://i.ibb.co/2hszwb4/VRAM30.jpg) (https://ibb.co/2hszwb4) (https://i.ibb.co/6Wj90tJ/VRAM31.jpg) (https://ibb.co/6Wj90tJ) (https://i.ibb.co/pQN5Bgj/VRAM32.jpg) (https://ibb.co/pQN5Bgj) (https://i.ibb.co/sVGtsd3/VRAM33.jpg) (https://ibb.co/sVGtsd3) (https://i.ibb.co/ymT0KxC/VRAM34.jpg) (https://ibb.co/ymT0KxC)
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 19, 2019, 06:59:11 PM
That 1000 (a status bit) is what I interpret as "error". The odd part is - why does it always show movement in the same (positive) direction?!

If you enable Follow Focus (without loading the Lua module) and try to move the focus with the joystick, does that work? Similar messages on the console?
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on April 19, 2019, 07:12:27 PM
Quote from: a1ex on April 19, 2019, 06:59:11 PM
If you enable Follow Focus (without loading the Lua module) and try to move the focus with the joystick, does that work? Similar messages on the console?
Yes similiar messages.

(https://i.ibb.co/mRTv9r6/VRAM36.jpg) (https://ibb.co/mRTv9r6) (https://i.ibb.co/5LbFhXt/VRAM37.jpg) (https://ibb.co/5LbFhXt)

Positive values with left direction (infinity) and negative in the opposite (macro); also 1000 pop off immediatly when limit is reached, but stuck message after some tryes
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 19, 2019, 07:16:00 PM
Interesting.

Is the motor still trying to move after reaching the limit? The first number (encoder delta) from the "Lens moving" message shows it might be. Or maybe the encoder value (as reported by this lens) is simply bogus?
Title: Re: Lua Scripting (lua.mo)
Post by: aprofiti on April 19, 2019, 07:21:43 PM
It still try to move over the limits, but first it goes back a little bit and then change again in the selected direction...
Also the motor make a different noise than normal
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on April 19, 2019, 07:24:41 PM
Understood. The lens firmware might be counting the encoder steps only when power is applied (i.e. when actively trying, not when it goes back after the motor stops).

BTW, this investigation was for solving this issue (https://bitbucket.org/hudson/magic-lantern/issues/2452/soft-focus-limit-incorrectly-reached-when). The current heuristics from lua_fix appear to do the trick, at the expense of working only with "new" lenses (my only AF lens is 24mm/2.8 STM).
Title: Re: Lua Scripting (lua.mo)
Post by: rabarar on November 01, 2019, 09:16:04 PM
Is there a LiveView lua script to prevent the LiveView from timing out on 5d2? I am trying to use an external HDMI recording and the timeout after a minute is less than optimal. I tried a simple Lua script mentioned in the forum but that left the script running in an infinite loop overlaying on the screen making the video useless. Thoughts?
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on December 07, 2019, 03:53:50 PM
Possibly asked and explained before but I can´t find any info.
Question around reboot and boot function in ml. Can it be controlled in lua in such a way that we can delay a reboot process? Reason being it would save up on battery.
Been messing with this lately https://www.magiclantern.fm/forum/index.php?topic=9741.msg223238#msg223238 and battery drains of course and if I would like to for example do a two day timelapse I have to have camera turned on for the whole job but what if reboot process could be delayed early in boot process?
In lua_camera.c:
/***
Restart the camera.
@function reboot
*/
static int luaCB_camera_reboot(lua_State * L)
{
    int reboot = 0;
    prop_request_change(PROP_REBOOT, &reboot, 4);
    return 0;

    /* shutdown is probably done in a similar way, but I had no success with nearby properties */
}

Reboot is called with this in lua camera.reboot() if I´m correct.

So before I try something shitty and soft brick my eosm for the third time I would simply know if it´s something to even consider  :D 8). Hopefully @a1ex or ©dmilligan checks in here or anyone else with some knowledge around this.

Full shut down not possible yet if this is correct?
/* shutdown is probably done in a similar way, but I had no success with nearby properties */
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on December 07, 2019, 05:06:41 PM
Not the answer you are looking for ...
- use an external power supply with sufficient capacity

I dream of making use of cam's internal watchdog timers ... but - as a1ex mentions frequently - we don't know that much about cam's DSP.
Title: Re: Lua Scripting (lua.mo)
Post by: a1ex on December 07, 2019, 05:12:49 PM
Not possible to program a timed reboot, to my knowledge. Assuming you are looking for something like the "deep sleep (https://randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide/)" mode in ESP8266.

The lowest-power mode, to my knowledge, is outside LiveView (e.g. in PLAY mode), with display turned off, and then: call("EnablePowerSave"). The last item, after you turn off the display, will probably cut the power draw in half, but not much more. With display on, it probably won't make much of a difference. Some numbers here (https://wiki.magiclantern.fm/faq#does_magic_lantern_consume_more_power_than_standard_canon_firmware) (measurements done several years ago).

In that power saving state, msleep is not going to work any more (it will sleep indefinitely afaik, or until the CPU wakes up for some reason). You could probably hope for some interrupt to wake up DryOS every now and then, and that's when you might be able to check the real-time clock. I didn't explore it, as it interferes with the regular intervalometer and all other ML functions that use polling. And since it didn't seem to make much of a difference (IMO), it was much easier to just turn off this kind of powersaving globally.

This might be a good use case for reprogramming the MPU (hard, possibly risky), or for a hardware mod that would wake up the camera every now and then (such as, once every 10 minutes or whatever). The idea of having enough battery power for a 24-hour timelapse is quite tempting, but these options are not exactly straightforward.

Another "simple" optimization: since LiveView itself draws much more power, compared to e.g. PLAY mode, so it might be worth trying to record one frame as soon possible after entering LiveView (possibly before the screen even turns on), and to close LiveView right away, before the frame is saved to card.

You may consider the "classic" full-res silent picture + regular intervalometer; that one operates outside LiveView, with display turned off whenever possible, but without the CPU powersaving. That should give you a rough idea of what to expect, regarding battery life. On cameras with LP-E6 batteries, you even get a real-time battery estimation during the timelapse, on top of the image review (if you enable it in Canon menu). Even so, one battery is not going to last 24 hours, at least not on DIGIC 4/5 cameras.

See also this topic (https://www.magiclantern.fm/forum/index.php?topic=23346.0) for an even longer answer.
Title: Re: Lua Scripting (lua.mo)
Post by: Danne on December 07, 2019, 05:54:37 PM
So no "prolonged" reboot hack that I missed  :P.
Useful information and since I approached this from movie mode(mainly for convenience reasons) I could now benefit from working the full res silent picture  angle. Might have some tinkering time again over xmas.
Thanks for sharing links and info.
Title: Re: Lua Scripting (lua.mo)
Post by: mrducksworth on March 17, 2021, 07:56:01 AM
I installed the lua_fix branch because I'm trying to stream on OBS and wanted the 30 minute timer fix for LiveView.

However I can't seem to be able to change ISO and Shutterspeed using my camera buttons or the menu. On the menu it changes, but the hdmi output doesn't change. I set ISO to a number instead of of AUTO. Do I need to turn off auto exposure somewhere else? Are button defaults different on the lua_fix branch? Hmm actually whilst writing this, liveview turned off and I turned it back on, and it would let me do ISO with the button, but I can see ML smooth exposure.
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on March 17, 2021, 10:25:15 AM
You are off-topic. This is "Scripting Corner" related to Lua scripting language.

By default ML doesn't change button defaults other than trashcan.
If you haven't found out how to handle your issue you might want to do a follow-up. Please mention your camera type.

30-minute timer setting: Prefs tab/screen -> PowerSave in LiveView -> 30-minute timer Disabled
Expo settings: Expo tab/screen -> ExpSim OFF
Title: Re: Lua Scripting (lua.mo)
Post by: FTP on April 05, 2021, 04:21:07 PM
Quote from: Walter Schulz on March 17, 2021, 10:25:15 AM
You are off-topic. This is "Scripting Corner" related to Lua scripting language.
Well... I can understand why he ended up here. Maybe you should update this link attached to Lua_fix builds in general or create a dedicated topic/space for Lua_fix builds discussion...  ::)


Latest Lua updates + fixes (please review)
Latest Lua updates (details).
Includes many other backend changes, e.g. focus, menu, Q button handling, fonts etc.
Therefore, it's important to give it a good try on all functions, not just Lua, so we can include it in the nightly builds.
Also includes lens.focus_pos and dynamic-my-menu.
-> Forum discussion (https://www.magiclantern.fm/forum/index.php?topic=14828.msg181836#msg181836)

https://builds.magiclantern.fm/experiments.html
Title: Re: Lua Scripting (lua.mo)
Post by: Walter Schulz on April 06, 2021, 12:28:38 PM
You got a point (I missed that link) but kind of preaching to the choir.
https://www.magiclantern.fm/forum/index.php?topic=25760.msg233723#msg233723
https://www.magiclantern.fm/forum/index.php?topic=25785.0

Drop a note if you want participate in making this area a better place!
Title: Re: Lua Scripting (lua.mo)
Post by: chris88 on October 29, 2021, 12:12:12 AM
Just wanna let you know (because there is the request to "report back" on the experimental page) the issues I discovered on my Canon 6D with the latest LUA Fix build (2020-12-28 18:15)

- Junkie Mode can not be activated by pressing "MENU" button
- DualIso LUA Module is not running. I constantly get "ISOless PH err(3)"
- In image review settings, the Quick erase via SET+Erase only works when there is a "Action type" defined in "play mode actions". If "Action type" is set to OFF but Quick Erase is still set, the quick erase does not work

Best regards,
Chris
Title: Re: Lua Scripting (lua.mo)
Post by: chris88 on October 29, 2021, 11:58:16 PM
Just for the records how I as an Canon 6D V1.1.6 owner was able to enable the "Junkie Menu" and fixed the dual-iso error message:

Enable Junkie Menu
I added the following code line at the very end of the file /magic-lantern/platform/6D.116/features.h
#define FEATURE_JUNKIE_MENU



Fix the dual-iso error "ISOless PH err(3)"
I modified the following code lines in /magic-lantern/modules/dual_iso/dual_iso.c

Original:
FRAME_CMOS_ISO_START = 0x40452196; // CMOS register 0003 - for LiveView, ISO 100 (check in movie mode, not photo!)
...
PHOTO_CMOS_ISO_START = 0x40450E08; // CMOS register 0003 - for photo mode, ISO 100

Fixed:
FRAME_CMOS_ISO_START = 0x404e6196; // CMOS register 0003 - for LiveView, ISO 100 (check in movie mode, not photo!)
...
PHOTO_CMOS_ISO_START = 0x404e4e08; // CMOS register 0003 - for photo mode, ISO 100


Both things I found out by digging in the source code of different branches and searching through various forum threads. As always, everything you are doing, you are doing on your own risk. Don't blame me!
Title: Re: Lua Scripting (lua.mo)
Post by: Ksanto on February 25, 2023, 10:38:58 PM
Hi chris,

thank you for your work, helped me alot. Can confirm that Junkie Menu now works on 6D and self compile from Lua branch. But I realised that when I apply your changes, Activating Lua  now does not add a Script Menu and let the camera crash occasionally. Did you experience the same or do you simply not use Lua Script? With the Lua Version from the downloadection Lua Scripts work, but of course not the Junkie Menu.


Regards
Ksanto