Author Topic: Focus Infinity Module (foc_inf.mo)  (Read 38050 times)

fpena06

  • New to the forum
  • *
  • Posts: 42
  • 7D
Re: Focus Infinity Module
« Reply #25 on: September 10, 2013, 05:00:44 AM »
I think he's referring to getting the name of the lens and not the actual steps? So you don't have lens 1-9 ect.

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #26 on: September 10, 2013, 05:12:57 AM »
Just one question did you say that the previous speed setting was not a speed setting?  I find this intersting because in some cases by using this speed setting I was able to make some of my lenses work....  But before I say anything else I will check this module tomorrow and the report.

Yes exactly, the Speed was just Step I just named the menu option speed for a simpler name so new users might understand better, but I should of kept it Step Size because that is what its called in Follow Focus so it would help any user figure it out easier.

In the code, there is the
lens_focus(10, 2, 1, 200)
That is all that moves the focus ring.
10 or whatever = Amount of steps to the right.
if it was -10 then it would be steps to the left.

2 is the Step Size which as you see in follow focus is 1 - 3

1 is the Wait state between focus actions.

200 is the delay between each step amount.
I like 200ms for delay because if it is to short you might get 2 or 3 steps from when press of your keypad, so best to keep at 200 to give you a delay so when your counting in Follow Focus it does not skip a step, you can even set that longer if your finger is slow and it is skipping steps with one press of the Right Keypad.

So just cause I named it speed it was still step size just with a name change.

The mm is there for some way to recognize the lens cause your range  has to be at that certain range everytime for the steps to focus correctly, cause if you set your steps at full wide and it was say 10 to get to proper focus, it will be totally differ amount of steps to get to proper focus at full zoom, so the mm is very important and I have it beep to remind the user that it has to be zoomed to proper range before you use the Infinity.

As for follow focus, the only way to make it focus faster or slower in steps is up and down which is why I explain to only use Left and Right for getting step amount because Up and Down will be Step Size of 3 if you set the Focus Settings to a Step Size of 2 in the Focus Settings menu. And if you set it to 1, then up and down will be step size of 2 and left and right will be 1. So best to leave at Step Size 2 and only use left and right to match up with the Foc_Inf module settings.

But if need be, the new update includes the addition of the step size changing ability if it helps.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #27 on: September 10, 2013, 05:23:04 AM »
I think he's referring to getting the name of the lens and not the actual steps? So you don't have lens 1-9 ect.
Ok, even that would be impossible because theres no way for the Lens.info to know what lens option to progam to unless you manually program the code for every person in the world and all there lenses, so no way to make that publicly work. But as for the way to use that text input module that gg3g0 created, that is probably possible for sure, but that is beyond my knowledge.

I just wanted to make a module that I could just easily get a certain focus just by pressing a button, so I was able to make this simple module to do that, very simple and basic but gets the job done.

It would be cool to use the lens.info data but its just not going to be good publicly. Only good for someone that can compile it themselves for there lenses like I originally had this one set up with my 55mm and 300mm lens but that did no good for everyone else that did not just have a 300mm and 55mm lens.

Hope I explained that good, I know texting it like this its hard to get your exact meaning out, but best I can explain why the lens naming wont work for a public module.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #28 on: September 10, 2013, 05:40:41 AM »
Here is the code I have now, super super basic very long too, I am sure a real programmer can easily simplify what I have here if anyone wishes to that would be ok by me and maybe make use of the IME input module somehow.

Code: [Select]
#define CONFIG_CONSOLE

#include <module.h>
#include <dryos.h>
#include <property.h>
#include <bmp.h>
#include <menu.h>
#include <config.h>
#include "edmac.h"
#include "lens.h"


/*  focus data  */
//static int inf_focus = 0;
static unsigned CONFIG_INT("inf_range_a", inf_range_a, 18);
static unsigned CONFIG_INT("inf_range_b", inf_range_b, 18);
static unsigned CONFIG_INT("inf_range_c", inf_range_c, 18);
static unsigned CONFIG_INT("inf_range_a", inf_range_d, 18);
static unsigned CONFIG_INT("inf_range_b", inf_range_e, 18);
static unsigned CONFIG_INT("inf_range_c", inf_range_f, 18);
static unsigned CONFIG_INT("inf_range_a", inf_range_g, 18);
static unsigned CONFIG_INT("inf_range_b", inf_range_h, 18);
static unsigned CONFIG_INT("inf_range_c", inf_range_i, 18);

static unsigned CONFIG_INT("inf_steps_a", inf_steps_a, 0);
static unsigned CONFIG_INT("inf_steps_b", inf_steps_b, 0);
static unsigned CONFIG_INT("inf_steps_c", inf_steps_c, 0);
static unsigned CONFIG_INT("inf_steps_a", inf_steps_d, 0);
static unsigned CONFIG_INT("inf_steps_b", inf_steps_e, 0);
static unsigned CONFIG_INT("inf_steps_c", inf_steps_f, 0);
static unsigned CONFIG_INT("inf_steps_a", inf_steps_g, 0);
static unsigned CONFIG_INT("inf_steps_b", inf_steps_h, 0);
static unsigned CONFIG_INT("inf_steps_c", inf_steps_i, 0);

static unsigned CONFIG_INT("inf_size_a", inf_size_a, 2);
static unsigned CONFIG_INT("inf_size_b", inf_size_b, 2);
static unsigned CONFIG_INT("inf_size_c", inf_size_c, 2);
static unsigned CONFIG_INT("inf_size_a", inf_size_d, 2);
static unsigned CONFIG_INT("inf_size_b", inf_size_e, 2);
static unsigned CONFIG_INT("inf_size_c", inf_size_f, 2);
static unsigned CONFIG_INT("inf_size_a", inf_size_g, 2);
static unsigned CONFIG_INT("inf_size_b", inf_size_h, 2);
static unsigned CONFIG_INT("inf_size_c", inf_size_i, 2);

static unsigned CONFIG_INT("inf_custom", inf_custom, 1);

/*   Focus Infinity  */

static MENU_SELECT_FUNC(inf_focus_toggle)
{
if(is_manual_focus())
{
beep();
msleep(200);
beep();
msleep(200);
beep();
msleep(200);
return;
}
if (inf_custom == 1 && lens_info.focal_len == inf_range_a && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_a, inf_size_a, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 2 && lens_info.focal_len == inf_range_b && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_b, inf_size_b, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 3 && lens_info.focal_len == inf_range_c && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_c, inf_size_c, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 4 && lens_info.focal_len == inf_range_d && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_d, inf_size_d, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 5 && lens_info.focal_len == inf_range_e && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_e, inf_size_e, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 6 && lens_info.focal_len == inf_range_f && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_f, inf_size_f, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 7 && lens_info.focal_len == inf_range_g && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_g, inf_size_g, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 8 && lens_info.focal_len == inf_range_h && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_h, inf_size_h, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 9 && lens_info.focal_len == inf_range_i && !is_manual_focus())
{
lens_focus_start(-3);
msleep(1000);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps_i, inf_size_i, 1, 20);
msleep(200);
beep();
}
else
{
msleep(200);
beep();
msleep(200);
beep();
msleep(200);
beep();
msleep(200);
return;
}
}
}
}
}
}
}
}
}
}

static MENU_UPDATE_FUNC(custom_display_a)
{
if (inf_custom == 1)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}
}

static MENU_UPDATE_FUNC(custom_display_b)
{
if (inf_custom == 2)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}
}

static MENU_UPDATE_FUNC(custom_display_c)
{
if (inf_custom == 3)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}
}

static MENU_UPDATE_FUNC(custom_display_d)
{
if (inf_custom == 4)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}
}

static MENU_UPDATE_FUNC(custom_display_e)
{
if (inf_custom == 5)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}
}

static MENU_UPDATE_FUNC(custom_display_f)
{
if (inf_custom == 6)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}
}

static MENU_UPDATE_FUNC(custom_display_g)
{
if (inf_custom == 7)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}
}

static MENU_UPDATE_FUNC(custom_display_h)
{
if (inf_custom == 8)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}
}

static MENU_UPDATE_FUNC(custom_display_i)
{
if (inf_custom == 9)
{
   MENU_SET_ENABLED(1);
}
else
{
   MENU_SET_ENABLED(0);
}


static struct menu_entry step_menu[] = {
            {
                .name = "Infinity",
        .select = inf_focus_toggle,
.choices = CHOICES("Press SET"),
        .select_Q     = menu_open_submenu,
        .children =  (struct menu_entry[]) {
    {
                .name = "Activate",
                .priv = &inf_custom,
.choices = CHOICES("Lens 1", "Lens 2", "Lens 3", "Lens 4", "Lens 5", "Lens 6", "Lens 7", "Lens 8", "Lens 9"),
                .min = 1,
                .max = 9,
    },
    {
    },
            {
                .name = "Lens 1 mm",
                .priv = &inf_range_a,
.update = custom_display_a,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_a,
.update = custom_display_a,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_a,
.update = custom_display_a,
                .min = 1,
                .max = 3,
            },
    {
    },
            {
                .name = "Lens 2 mm",
                .priv = &inf_range_b,
.update = custom_display_b,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_b,
.update = custom_display_b,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_b,
.update = custom_display_b,
                .min = 1,
                .max = 3,
            },
    {
    },
            {
                .name = "Lens 3 mm",
                .priv = &inf_range_c,
.update = custom_display_c,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_c,
.update = custom_display_c,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_c,
.update = custom_display_c,
                .min = 1,
                .max = 3,
            },
    {
    },
            {
                .name = "Lens 4 mm",
                .priv = &inf_range_d,
.update = custom_display_d,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_d,
.update = custom_display_d,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_d,
.update = custom_display_d,
                .min = 1,
                .max = 3,
            },
    {
    },
            {
                .name = "Lens 5 mm",
                .priv = &inf_range_e,
.update = custom_display_e,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_e,
.update = custom_display_e,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_e,
.update = custom_display_e,
                .min = 1,
                .max = 3,
            },
    {
    },
            {
                .name = "Lens 6 mm",
                .priv = &inf_range_f,
.update = custom_display_f,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_f,
.update = custom_display_f,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_f,
.update = custom_display_f,
                .min = 1,
                .max = 3,
            },
    {
    },
            {
                .name = "Lens 7 mm",
                .priv = &inf_range_g,
.update = custom_display_g,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_g,
.update = custom_display_g,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_g,
.update = custom_display_g,
                .min = 1,
                .max = 3,
            },
    {
    },
            {
                .name = "Lens 8 mm",
                .priv = &inf_range_h,
.update = custom_display_h,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_h,
.update = custom_display_h,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_h,
.update = custom_display_h,
                .min = 1,
                .max = 3,
            },
    {
    },
            {
                .name = "Lens 9 mm",
                .priv = &inf_range_i,
.update = custom_display_i,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_i,
.update = custom_display_i,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_i,
.update = custom_display_i,
                .min = 1,
                .max = 3,
            },
    {
    },
            MENU_EOL
},

},

};

static unsigned int foc_inf_init()
{
    menu_add( "Focus", step_menu, COUNT(step_menu) );
    return 0;
}

static unsigned int foc_inf_deinit()
{
    return 0;
}

MODULE_INFO_START()
    MODULE_INIT(foc_inf_init)
    MODULE_DEINIT(foc_inf_deinit)
MODULE_INFO_END()

MODULE_CONFIGS_START()
    MODULE_CONFIG(inf_range_a)
    MODULE_CONFIG(inf_range_b)
    MODULE_CONFIG(inf_range_c)
    MODULE_CONFIG(inf_range_d)
    MODULE_CONFIG(inf_range_e)
    MODULE_CONFIG(inf_range_f)
    MODULE_CONFIG(inf_range_g)
    MODULE_CONFIG(inf_range_h)
    MODULE_CONFIG(inf_range_i)

    MODULE_CONFIG(inf_steps_a)
    MODULE_CONFIG(inf_steps_b)
    MODULE_CONFIG(inf_steps_c)
    MODULE_CONFIG(inf_steps_d)
    MODULE_CONFIG(inf_steps_e)
    MODULE_CONFIG(inf_steps_f)
    MODULE_CONFIG(inf_steps_g)
    MODULE_CONFIG(inf_steps_h)
    MODULE_CONFIG(inf_steps_i)

    MODULE_CONFIG(inf_size_a)
    MODULE_CONFIG(inf_size_b)
    MODULE_CONFIG(inf_size_c)
    MODULE_CONFIG(inf_size_d)
    MODULE_CONFIG(inf_size_e)
    MODULE_CONFIG(inf_size_f)
    MODULE_CONFIG(inf_size_g)
    MODULE_CONFIG(inf_size_h)
    MODULE_CONFIG(inf_size_i)

    MODULE_CONFIG(inf_custom)
MODULE_CONFIGS_END()
500D/T1i  550D/T2i  600D/T3i  700D/T5i

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Focus Infinity Module
« Reply #29 on: September 10, 2013, 06:21:31 PM »
Here is an update of the module with the Step Size added back for customizing in case you still feel it is needed even after reading my last message.

http://www.mediafire.com/download/yxe43hac1adlbjo/foc_inf_sep_9th_2013_update01.zip

Ok if have tested the updated and found the following issues:

1. The lens information disappears as soon as the camera is shut off.  It is not stored!

2. The step size in the module should also be stored in the "Focus Settings" so when you adjust with follow focus you are counting the matching steps.  For example if the Focus settings is at 1 and your lens is at 2; when you adjust with Follow Focus you are adjusting with step size 2, and therefore the counts of Follow focus do not match the counts in the Steps Right in the lens.  For me it is no big deal but for someone who does not understand this they will feel that there is no correspondence between number of steps in follow focus and the number of steps in the Lens.

3. In some lens I use step size 1 and when I want to program 103 steps the modules only allows 100 or 105.  This 5 step increment above 100 is too much.

That is all for now. 

Thanks for the module and your great work.
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

Pelican

  • Senior
  • ****
  • Posts: 406
Re: Focus Infinity Module
« Reply #30 on: September 10, 2013, 06:57:58 PM »
the problem is even if you do use the lens.info each lens will be a tad differ so it wont help for public purposes because for example one Caonon 1855mm IS lens will not have same as another, so sure it will see the name and no the lens but will not work for every lens with that name.
Where is the problem? How many people use more than one of the same lens (e.g two 18-55 IS)?

I think he's referring to getting the name of the lens and not the actual steps? So you don't have lens 1-9 ect.
Yes, exactly.

At first you get the lens' name and the zoom position, create an entry for that, and save the steps for that entry.
When you want to focus to infinity just get the lens name and zoom position again, look for the entry and use the stored steps for focus to infinity.
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #31 on: September 10, 2013, 10:15:42 PM »
Ok if have tested the updated and found the following issues:

1. The lens information disappears as soon as the camera is shut off.  It is not stored!

2. The step size in the module should also be stored in the "Focus Settings" so when you adjust with follow focus you are counting the matching steps.  For example if the Focus settings is at 1 and your lens is at 2; when you adjust with Follow Focus you are adjusting with step size 2, and therefore the counts of Follow focus do not match the counts in the Steps Right in the lens.  For me it is no big deal but for someone who does not understand this they will feel that there is no correspondence between number of steps in follow focus and the number of steps in the Lens.

3. In some lens I use step size 1 and when I want to program 103 steps the modules only allows 100 or 105.  This 5 step increment above 100 is too much.

That is all for now. 

Thanks for the module and your great work.
Hmm, all the config info is coded, on my camera all settings I set are stored,  and are there when i restart camera, very strange not same thing on your camera, Im stumped on that one.

And as for step size, at the start of the thread I have the settings you should set in Focus settings which controls the Follow Focus, I explain to set Focus settings to Step Size 2 because 1 is to slow and takes to long to get there at least for my lenses.

But anyways, in the latest update I posted yesterday I added the ability to adjust step size in the module so now you can tweak each lens with its own step size.

Thanks for all the testing, I will look over the module again but everything is saving for me so I am not sure about that.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #32 on: September 10, 2013, 10:20:55 PM »
Where is the problem? How many people use more than one of the same lens (e.g two 18-55 IS)?
Yes, exactly.

At first you get the lens' name and the zoom position, create an entry for that, and save the steps for that entry.
When you want to focus to infinity just get the lens name and zoom position again, look for the entry and use the stored steps for focus to infinity.
Thanks for the info but I posted the code I have so far if you want to work on the code with lens info your more then welcome to, I already tried to using lens.info with no success but I am not a program, never went to school for it, just taught myself just looking at other codes in ML trying to figure out how they work, so this is probably as far as I can take it, it works great for me I am only hoping it works well for others but I am still accepting any advice on tweaking it of course but as I said before I am limited on my code knowledge, so sorry I can't add all the features you would like, wish I could, but I can't.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Pelican

  • Senior
  • ****
  • Posts: 406
Re: Focus Infinity Module
« Reply #33 on: September 10, 2013, 10:34:20 PM »
Thanks for the info but I posted the code I have so far if you want to work on the code with lens info your more then welcome to, I already tried to using lens.info with no success but I am not a program, never went to school for it, just taught myself just looking at other codes in ML trying to figure out how they work, so this is probably as far as I can take it, it works great for me I am only hoping it works well for others but I am still accepting any advice on tweaking it of course but as I said before I am limited on my code knowledge, so sorry I can't add all the features you would like, wish I could, but I can't.
Sorry I'm not demanding or asking any feature or improvement I just want to tell you how your module could be better and point to that fact that the lens info would be useful if you figure out how to use it from the module. Thank you for sharing your code! 
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Focus Infinity Module
« Reply #34 on: September 10, 2013, 10:46:48 PM »
Hmm, all the config info is coded, on my camera all settings I set are stored,  and are there when i restart camera, very strange not same thing on your camera, Im stumped on that one.

And as for step size, at the start of the thread I have the settings you should set in Focus settings which controls the Follow Focus, I explain to set Focus settings to Step Size 2 because 1 is to slow and takes to long to get there at least for my lenses.

But anyways, in the latest update I posted yesterday I added the ability to adjust step size in the module so now you can tweak each lens with its own step size.

Thanks for all the testing, I will look over the module again but everything is saving for me so I am not sure about that.

Update:

Problem 1 was fixed.  I had to delete the settings file (MAGIC.CFG) and then it started saving the lens info!

Also I tested on 7D and the module works!
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #35 on: September 10, 2013, 10:49:55 PM »
Sorry I'm not demanding or asking any feature or improvement I just want to tell you how your module could be better and point to that fact that the lens info would be useful if you figure out how to use it from the module. Thank you for sharing your code!
Oh, I know your not demanding and trust me I wish I could do the naming of the lens but when I tried it did not work out for me, maybe because of my limited knowledge  :-[

But yes, I understand your just trying to help, its all good, no worries, just wanted to make it clear I am not a developer and I was lucky to even make up a module in the first place that actually did something, LOL!!
500D/T1i  550D/T2i  600D/T3i  700D/T5i

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Focus Infinity Module
« Reply #36 on: September 20, 2013, 02:28:16 PM »
Bad news, the module is now not compatible.  Hopefully you will find the time to fix it.
I used it last night with an old build to get some pictures of the moon, and I am very satisfied.

5D3 + Focus Infinity module + ETTR  ;)
Canon EF 300mm f/4 + 2X kenko = 600mm f/8
ISO 100 at 1/25 at f/8


http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

Pelican

  • Senior
  • ****
  • Posts: 406
Re: Focus Infinity Module
« Reply #37 on: September 21, 2013, 01:16:39 AM »
Bad news, the module is now not compatible.  Hopefully you will find the time to fix it.
This compiles but I haven't tried...

Code: [Select]
#define CONFIG_CONSOLE

#include <module.h>
#include <dryos.h>
#include <property.h>
#include <bmp.h>
#include <menu.h>
#include <config.h>
#include "edmac.h"
#include "lens.h"


/*  focus data  */
//static int inf_focus = 0;
static unsigned CONFIG_INT("inf_range_a", inf_range_a, 18);
static unsigned CONFIG_INT("inf_range_b", inf_range_b, 18);
static unsigned CONFIG_INT("inf_range_c", inf_range_c, 18);
static unsigned CONFIG_INT("inf_range_d", inf_range_d, 18);
static unsigned CONFIG_INT("inf_range_e", inf_range_e, 18);
static unsigned CONFIG_INT("inf_range_f", inf_range_f, 18);
static unsigned CONFIG_INT("inf_range_g", inf_range_g, 18);
static unsigned CONFIG_INT("inf_range_h", inf_range_h, 18);
static unsigned CONFIG_INT("inf_range_i", inf_range_i, 18);

static unsigned CONFIG_INT("inf_steps_a", inf_steps_a, 0);
static unsigned CONFIG_INT("inf_steps_b", inf_steps_b, 0);
static unsigned CONFIG_INT("inf_steps_c", inf_steps_c, 0);
static unsigned CONFIG_INT("inf_steps_d", inf_steps_d, 0);
static unsigned CONFIG_INT("inf_steps_e", inf_steps_e, 0);
static unsigned CONFIG_INT("inf_steps_f", inf_steps_f, 0);
static unsigned CONFIG_INT("inf_steps_g", inf_steps_g, 0);
static unsigned CONFIG_INT("inf_steps_h", inf_steps_h, 0);
static unsigned CONFIG_INT("inf_steps_i", inf_steps_i, 0);

static unsigned CONFIG_INT("inf_size_a", inf_size_a, 2);
static unsigned CONFIG_INT("inf_size_b", inf_size_b, 2);
static unsigned CONFIG_INT("inf_size_c", inf_size_c, 2);
static unsigned CONFIG_INT("inf_size_d", inf_size_d, 2);
static unsigned CONFIG_INT("inf_size_e", inf_size_e, 2);
static unsigned CONFIG_INT("inf_size_f", inf_size_f, 2);
static unsigned CONFIG_INT("inf_size_g", inf_size_g, 2);
static unsigned CONFIG_INT("inf_size_h", inf_size_h, 2);
static unsigned CONFIG_INT("inf_size_i", inf_size_i, 2);

static unsigned CONFIG_INT("inf_custom", inf_custom, 1);

/*   Focus Infinity  */

static void setinfinity(int steps, int size)
{
    lens_focus_start(-3);
    msleep(1000);
    lens_focus_stop();
    msleep(200);
    lens_focus(steps, size, 1, 20);
    msleep(200);
    beep();
}

static MENU_SELECT_FUNC(inf_focus_toggle)
{
    if(is_manual_focus())
    {
        beep();
        msleep(200);
        beep();
        msleep(200);
        beep();
        msleep(200);
        return;
    }
    else
    {
        if (inf_custom == 1 && lens_info.focal_len == inf_range_a)
        {
            setinfinity(inf_steps_a, inf_size_a);
        }
        else if (inf_custom == 2 && lens_info.focal_len == inf_range_b)
        {
            setinfinity(inf_steps_b, inf_size_b);
        }
        else if (inf_custom == 3 && lens_info.focal_len == inf_range_c)
        {
            setinfinity(inf_steps_c, inf_size_c);
        }
        else if (inf_custom == 4 && lens_info.focal_len == inf_range_d)
        {
            setinfinity(inf_steps_d, inf_size_d);
        }
        else if (inf_custom == 5 && lens_info.focal_len == inf_range_e)
        {
            setinfinity(inf_steps_e, inf_size_e);
        }
        else if (inf_custom == 6 && lens_info.focal_len == inf_range_f)
        {
            setinfinity(inf_steps_f, inf_size_f);
        }
        else if (inf_custom == 7 && lens_info.focal_len == inf_range_g)
        {
            setinfinity(inf_steps_g, inf_size_g);
        }
        else if (inf_custom == 8 && lens_info.focal_len == inf_range_h)
        {
            setinfinity(inf_steps_h, inf_size_h);
        }
        else if (inf_custom == 9 && lens_info.focal_len == inf_range_i)
        {
            setinfinity(inf_steps_i, inf_size_i);
        }
    }
}

static MENU_UPDATE_FUNC(custom_display_a)
{
 if (inf_custom == 1)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static MENU_UPDATE_FUNC(custom_display_b)
{
 if (inf_custom == 2)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static MENU_UPDATE_FUNC(custom_display_c)
{
 if (inf_custom == 3)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static MENU_UPDATE_FUNC(custom_display_d)
{
 if (inf_custom == 4)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static MENU_UPDATE_FUNC(custom_display_e)
{
 if (inf_custom == 5)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static MENU_UPDATE_FUNC(custom_display_f)
{
 if (inf_custom == 6)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static MENU_UPDATE_FUNC(custom_display_g)
{
 if (inf_custom == 7)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static MENU_UPDATE_FUNC(custom_display_h)
{
 if (inf_custom == 8)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static MENU_UPDATE_FUNC(custom_display_i)
{
 if (inf_custom == 9)
 {
    MENU_SET_ENABLED(1);
 }
 else
 {
    MENU_SET_ENABLED(0);
 }
}

static struct menu_entry step_menu[] = {
    {
        .name = "Infinity",
        .select = inf_focus_toggle,
        .choices = CHOICES("Press SET"),
        .select_Q     = menu_open_submenu,
        .children =  (struct menu_entry[]) {
     {
                .name = "Activate",
                .priv = &inf_custom,
                .choices = CHOICES("Lens 1", "Lens 2", "Lens 3", "Lens 4", "Lens 5", "Lens 6", "Lens 7", "Lens 8", "Lens 9"),
                .min = 1,
                .max = 9,
     },
     {
     },
            {
                .name = "Lens 1 mm",
                .priv = &inf_range_a,
                .update = custom_display_a,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_a,
                .update = custom_display_a,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_a,
                .update = custom_display_a,
                .min = 1,
                .max = 3,
            },
     {
     },
            {
                .name = "Lens 2 mm",
                .priv = &inf_range_b,
                .update = custom_display_b,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_b,
                .update = custom_display_b,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_b,
                .update = custom_display_b,
                .min = 1,
                .max = 3,
            },
     {
     },
            {
                .name = "Lens 3 mm",
                .priv = &inf_range_c,
                .update = custom_display_c,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_c,
                .update = custom_display_c,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_c,
                .update = custom_display_c,
                .min = 1,
                .max = 3,
            },
     {
     },
            {
                .name = "Lens 4 mm",
                .priv = &inf_range_d,
                .update = custom_display_d,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_d,
                .update = custom_display_d,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_d,
                .update = custom_display_d,
                .min = 1,
                .max = 3,
            },
     {
     },
            {
                .name = "Lens 5 mm",
                .priv = &inf_range_e,
                .update = custom_display_e,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_e,
                .update = custom_display_e,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_e,
                .update = custom_display_e,
                .min = 1,
                .max = 3,
            },
     {
     },
            {
                .name = "Lens 6 mm",
                .priv = &inf_range_f,
                .update = custom_display_f,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_f,
                .update = custom_display_f,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_f,
                .update = custom_display_f,
                .min = 1,
                .max = 3,
            },
     {
     },
            {
                .name = "Lens 7 mm",
                .priv = &inf_range_g,
                .update = custom_display_g,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_g,
                .update = custom_display_g,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_g,
                .update = custom_display_g,
                .min = 1,
                .max = 3,
            },
     {
     },
            {
                .name = "Lens 8 mm",
                .priv = &inf_range_h,
                .update = custom_display_h,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_h,
                .update = custom_display_h,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_h,
                .update = custom_display_h,
                .min = 1,
                .max = 3,
            },
     {
     },
            {
                .name = "Lens 9 mm",
                .priv = &inf_range_i,
                .update = custom_display_i,
                .min = 4,
                .max = 900,
            },
            {
                .name = "Steps Right",
                .priv = &inf_steps_i,
                .update = custom_display_i,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Step Size",
                .priv = &inf_size_i,
                .update = custom_display_i,
                .min = 1,
                .max = 3,
            },
     {
     },
             MENU_EOL
  },

 },

};

static unsigned int foc_inf_init()
{
    menu_add( "Focus", step_menu, COUNT(step_menu) );
    return 0;
}

static unsigned int foc_inf_deinit()
{
    return 0;
}

MODULE_INFO_START()
    MODULE_INIT(foc_inf_init)
    MODULE_DEINIT(foc_inf_deinit)
MODULE_INFO_END()

MODULE_CONFIGS_START()
    MODULE_CONFIG(inf_range_a)
    MODULE_CONFIG(inf_range_b)
    MODULE_CONFIG(inf_range_c)
    MODULE_CONFIG(inf_range_d)
    MODULE_CONFIG(inf_range_e)
    MODULE_CONFIG(inf_range_f)
    MODULE_CONFIG(inf_range_g)
    MODULE_CONFIG(inf_range_h)
    MODULE_CONFIG(inf_range_i)

    MODULE_CONFIG(inf_steps_a)
    MODULE_CONFIG(inf_steps_b)
    MODULE_CONFIG(inf_steps_c)
    MODULE_CONFIG(inf_steps_d)
    MODULE_CONFIG(inf_steps_e)
    MODULE_CONFIG(inf_steps_f)
    MODULE_CONFIG(inf_steps_g)
    MODULE_CONFIG(inf_steps_h)
    MODULE_CONFIG(inf_steps_i)

    MODULE_CONFIG(inf_size_a)
    MODULE_CONFIG(inf_size_b)
    MODULE_CONFIG(inf_size_c)
    MODULE_CONFIG(inf_size_d)
    MODULE_CONFIG(inf_size_e)
    MODULE_CONFIG(inf_size_f)
    MODULE_CONFIG(inf_size_g)
    MODULE_CONFIG(inf_size_h)
    MODULE_CONFIG(inf_size_i)

    MODULE_CONFIG(inf_custom)
MODULE_CONFIGS_END()

Nice moon!
EOS 7D Mark II, EOS 7D, EOS 5, EOS 100 + lenses (10mm to 300mm), 600EX, 550EX, YN600EX x 3
EOScard, EOS DSLR firmwares, ARMu, NiControl, etc.: http://pel.hu/down

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #38 on: September 21, 2013, 05:05:33 AM »
Bad news, the module is now not compatible.  Hopefully you will find the time to fix it.

Dang!! Nice shot, and it is still compatible just needs to be recompiled with the the new version, works fine still, I can upload module if you cant compile yourself.

Here is the module and also the folder you need if you want to compile yourself 8] Up to date with latest builds.

http://www.mediafire.com/download/dlr42gtx7qqhf8l/foc_inf.zip
500D/T1i  550D/T2i  600D/T3i  700D/T5i

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Focus Infinity Module
« Reply #39 on: September 21, 2013, 07:07:02 PM »
Here is the module and also the folder you need if you want to compile yourself 8] Up to date with latest builds.

Thank you very much.  I appreciate your work to make my photos better..

There are a couple of issues in the build:
1. The settings form the first three lenses are copied to the rest, easy to fix... Pelican has fixed it.
2. Every time the camera shuts off lens 1 gets reset.... Pelican has fixed it!

So I was able to create a module with my personal lens settings based on Pelincans c code and it is really good. 

I checked the differences between your code and Pelicans, and to me it looks like a minor tweak.

Thanks!
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

RenatoPhoto

  • Moderators
  • Hero Member
  • *****
  • Posts: 1509
  • 5DM3 / 7D
Re: Focus Infinity Module
« Reply #40 on: September 21, 2013, 07:08:56 PM »
This compiles but I haven't tried...

Fantastic.  I used your code and customized it for my lens settings.  So far so good!

Thanks for your help!
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #41 on: September 21, 2013, 07:49:16 PM »
I checked the differences between your code and Pelicans, and to me it looks like a minor tweak.

Thanks!
Oh, I didn't know he changed anything, lol, I don't have any issues with lens settings resetting so they all worked, but I will look at the code he posted and see what he tweaked, at first glance I saw no change, I thought he just re posted the code I posted because he never said he tweaked anything.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module
« Reply #42 on: September 21, 2013, 08:02:58 PM »
This compiles but I haven't tried...

Thanks for the update in code, good lesson for me to learn ways to shorten the code, sorry I did not look careful enough before to see if you changed anything in it, thanks!
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Hey

  • New to the forum
  • *
  • Posts: 28
Re: Focus Infinity Module (foc_inf.mo)
« Reply #43 on: May 17, 2014, 11:17:32 PM »
Hey mk, as expected the module is not compatible anymore. As I really don't know anything about compiling could you update the module ? It'll be very useful for my astrophotos. Thank you.

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module (foc_inf.mo)
« Reply #44 on: May 18, 2014, 02:36:15 AM »
Hey mk, as expected the module is not compatible anymore. As I really don't know anything about compiling could you update the module ? It'll be very useful for my astrophotos. Thank you.
Ok, I will look into it first this in morning.

Update: Here is the module recompiled to work with latest nightly as of May 18 2014
https://bitbucket.org/mk11174/magic-lantern/downloads/foc_inf.mo
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Hey

  • New to the forum
  • *
  • Posts: 28
Re: Focus Infinity Module (foc_inf.mo)
« Reply #45 on: May 18, 2014, 02:38:50 PM »
Quote
Update: Here is the module recompiled to work with latest nightly as of May 18 2014
https://bitbucket.org/mk11174/magic-lantern/downloads/foc_inf.mo

Just tested it on my 500D, works like charm, exactly as expected. Maybe you should update the original post ?
Thanks.

mk11174

  • Hero Member
  • *****
  • Posts: 809
Re: Focus Infinity Module (foc_inf.mo)
« Reply #46 on: May 18, 2014, 09:03:34 PM »
Just tested it on my 500D, works like charm, exactly as expected. Maybe you should update the original post ?
Thanks.
Good idea! Updated as you suggested  :)
500D/T1i  550D/T2i  600D/T3i  700D/T5i

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 11838
  • 5D Mark Free
Re: Focus Infinity Module (foc_inf.mo)
« Reply #47 on: May 18, 2014, 09:15:35 PM »
This one should fit perfectly as a script... once the scripting engine will be back.

golem

  • New to the forum
  • *
  • Posts: 8
Re: Focus Infinity Module (foc_inf.mo)
« Reply #48 on: August 05, 2014, 09:54:46 PM »
Hi mk11174

The module does not work with the current nightly. (old API)

I watched your beginners guide video and was able to compile the FullRes-SilentPic module but had no luck with this one.

Code: [Select]
[email protected]:~/magic-lantern/modules/foc_inf$ make
[ CC       ]   foc_inf.o
foc_inf.c: In function 'setinfinity':
foc_inf.c:51:5: error: implicit declaration of function 'lens_focus_start' [-Werror=implicit-function-declaration]
foc_inf.c:53:5: error: implicit declaration of function 'lens_focus_stop' [-Werror=implicit-function-declaration]
foc_inf.c:57:5: error: implicit declaration of function 'beep' [-Werror=implicit-function-declaration]
foc_inf.c: In function 'inf_focus_toggle':
foc_inf.c:62:5: error: implicit declaration of function 'is_manual_focus' [-Werror=implicit-function-declaration]
In file included from ../../src/module.h:344:0,
                 from foc_inf.c:3:
foc_inf.c: At top level:
./module_strings.h:1:13: warning: '__module_string_a_name' defined but not used [-Wunused-variable]
./module_strings.h:2:13: warning: '__module_string_a_value' defined but not used [-Wunused-variable]
./module_strings.h:3:13: warning: '__module_string_b_name' defined but not used [-Wunused-variable]
./module_strings.h:4:13: warning: '__module_string_b_value' defined but not used [-Wunused-variable]
./module_strings.h:5:13: warning: '__module_string_c_name' defined but not used [-Wunused-variable]
./module_strings.h:6:13: warning: '__module_string_c_value' defined but not used [-Wunused-variable]
./module_strings.h:7:13: warning: '__module_string_d_name' defined but not used [-Wunused-variable]
./module_strings.h:8:13: warning: '__module_string_d_value' defined but not used [-Wunused-variable]
cc1: some warnings being treated as errors
make: *** [foc_inf.o] Error 1

I am not sure if it is my setup or something has be changed in your module...
I hope you find the time to take a look at it because I find the module very useful

thnx


edit:
ok - It looks like some includes are missing ...
I added
Code: [Select]
#include <beep.h>
#include <focus.h>
and now it seems to work again.  8)

I took PelicanĀ“s code and updated it to hopefully work with the latest nightly - not sure if this is the newest version of the module  ::)

https://www.dropbox.com/s/vhiu3zu1y9ifbki/foc_inf.mo?dl=1
Canon EOS 60D