Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUA: Add lens.continuous_af #122

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

wow0000
Copy link

@wow0000 wow0000 commented Dec 17, 2023

Changes

  • Added lua binding for the function is_continuous_af()

Why

This changes is useful to properly handle errors with the lens.focus() call. It avoids triggering an error and it enable proper error handling.

Testing

The code has been tested on a Canon 100D and does not generate any additional warnings or error. It should not impact current features or existing scripts.

@wow0000 wow0000 changed the title LUA: Added lens.continuous_af LUA: Add lens.continuous_af Dec 17, 2023
@reticulatedpines
Copy link
Owner

reticulatedpines commented Dec 19, 2023

This isn't an area of code I know well, so I need to ask some questions to determine what this change is supposed to do, and why it might be useful.

What error occurs on lens.focus() call without this change? What improvement in ML behaviour happens after the change?

This existing line suggests that continuous AF is not compatible with lens.focus():
if (is_continuous_af()) return luaL_error(L, "lens.focus() requires %s AF disabled.", is_movie_mode() ? "movie servo" : "continuous");

Is that true? Is it still true now, or does this change alter behaviour? If so, why?

Thanks

@reticulatedpines
Copy link
Owner

I've spent some time trying to understand this code and something looks wrong here. You're adding a "continuous_af" field to the "lua_lens_fields" struct, but "continuous_af" isn't a property of the lens, it's a camera state. So it definitely shouldn't live in a struct that records information about the lens.

See "autofocusing":

else if(!strcmp(key, "autofocusing")) lua_pushboolean(L, lv_focus_status == 3);

That's setting something based on camera state, and doesn't add it to the lens struct. Do you really need to add it there?

It would also help if you show me the Lua script you're having problems with. As is, I only have half the information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants