Author Topic: "Manual" or "Bad" focus warning  (Read 4510 times)

Windowsfreak

  • New to the forum
  • *
  • Posts: 2
"Manual" or "Bad" focus warning
« on: May 27, 2015, 08:43:18 PM »
A few days ago, I took a group picture of a few hundred people. I wasn't aware that I accidentally turned my lens to MF, relied on the autofocus, and - bang, it was out of focus. I was checking for everything but the sharpness of the resulting image.

There's a nice feature in ML, to enable warning messages for certain camera settings, such as mode, white balance, grayscale, etc. I'd like to have:
  • Another warning message / sound for when the camera is in MF mode
  • An optical or acoustic beep / warning sound, when a picture was taken that, after saving, seems to be entirely out of focus

Is that possible to be created as a module, or is that something that has to be developed in a ML firmware?

Andreasb242

  • New to the forum
  • *
  • Posts: 10
Re: "Manual" or "Bad" focus warning
« Reply #1 on: October 04, 2015, 09:45:30 PM »
I didn't any development on magic lantern yet, but I think there are a few options which should be added to the Warning menu.

I looked at the code, all is implemented in src/tweaks.c

The method who checks if the settings are correct is:
static void warn_step()

Here the display message is built
static char* get_warn_msg(char* separator)

A Property has to be declared:
static CONFIG_INT("warn.wb", warn_wb, 0);

This is the list of the Menu entries:
static struct menu_entry tweak_menus[]

And to check for Manual focus it should be:
is_manual_focus()


I have first to set up my development environment, I had a linker error and therefore didn't start yet with development...


Andreas

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: "Manual" or "Bad" focus warning
« Reply #2 on: October 04, 2015, 11:04:35 PM »
This would be a good use case for lua scripting: http://www.magiclantern.fm/forum/index.php?topic=14828

Andreasb242

  • New to the forum
  • *
  • Posts: 10
Re: "Manual" or "Bad" focus warning
« Reply #3 on: October 07, 2015, 09:00:49 PM »
Hi, I created a patch, which allows to warn if you are not on AF or not on MF.

I'll post it here.

Is this the right place? Or where do I have to post patches?

Code: [Select]
diff -r df63de51f4c3 src/tweaks.c
--- a/src/tweaks.c Wed Sep 30 21:12:12 2015 +0300
+++ b/src/tweaks.c Wed Oct 07 20:55:23 2015 +0200
@@ -1909,6 +1909,7 @@
 static CONFIG_INT("warn.picq", warn_picq, 0);
 static CONFIG_INT("warn.alo", warn_alo, 0);
 static CONFIG_INT("warn.wb", warn_wb, 0);
+static CONFIG_INT("warn.mf", warn_mf, 0);
 
 static int warn_code = 0;
 static char* get_warn_msg(char* separator)
@@ -1922,6 +1923,8 @@
     if (warn_code & 2) { STR_APPEND(msg, "Pic quality is not RAW%s", separator); }
     if (warn_code & 4) { STR_APPEND(msg, "ALO is enabled%s", separator); }
     if (warn_code & 8) { STR_APPEND(msg, "WB isn't set to auto%s", separator); }
+    if (warn_code & 16 && warn_mf == 1) { STR_APPEND(msg, "Focus is not auto%s", separator); }
+    if (warn_code & 16 && warn_mf == 2) { STR_APPEND(msg, "Focus is not manual%s", separator); }
     return msg;
 }
 
@@ -1993,7 +1996,13 @@
 
     if (warn_wb && lens_info.wb_mode)
         warn_code |= 8;
-   
+
+    if (warn_mf == 1 && is_manual_focus())
+        warn_code |= 16;
+       
+    if (warn_mf == 2 && !is_manual_focus())
+        warn_code |= 16;
+
     warn_action(warn_code);
 }
 
@@ -2205,6 +2214,13 @@
                 .choices = (const char *[]) {"OFF", "other than AWB"},
                 .help = "Warn if you disable AWB by mistake.",
             },
+            {
+                .name = "AF/MF warning",
+                .priv = &warn_mf,
+                .max = 2,
+                .choices = (const char *[]) {"OFF", "other than AF", "other than MF"},
+                .help = "Warn on Manual / Automatic Focus",
+            },
             MENU_EOL,
         },
     },

Edit: I created an account on bitbucket and created a pull request.
https://bitbucket.org/hudson/magic-lantern/pull-requests/662/allow-warning-on-auto-focus-manual-focus/diff

Andreas