Focus Infinity Module (foc_inf.mo)

Started by mk11174, July 19, 2013, 12:47:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mk11174

I created an experimental module that focuses to Infinity after you customize it for your lens.

It is working fine with my 18-55mm kit lens and 75mm-300mm Telephoto for my 550D.

If you were looking for a way to get your lens to infinity without have to go through the whole zoom 10x and all that, maybe this will work for you too. I can't be sure if it will work for any other cameras or lenses but it is working for mine so I figured why not share it just in case it does work for more then mine. So please no bad words if you have no luck with it, I am just sharing.

Ok, here is how to set it up!

The option Infinity will be in the Focus Menu, you will pres Q to get into its Sub Menu to change its settings, you will see it is very similar to the Follow Focus settings.

First find the settings for your lens by using Follow Focus. Set Focus Settings to:
Step Size    2
Step Delay 200ms
Step Wait   ON
Left/Right dir + / -

1. Zoom lens to max range.

2. Switch Lens to MF and turn Focus Ring all the way to the Infinity side, if your holding the cam looking at LCD grab ring and twist all the way to Left.

3. Switch back to AF.

4. Now zoom 10x on something you can use as your Infinity Object.

5. With Follow Focus on, use your Right Key to do one press at a time counting in your head till it is in Focus.
note:Remember the number of steps. DO NOT USE UP AND DOWN KEYS!

Now you can turn off Follow Focus.

Setting up Infinity Feature.

1. Turn lens to greatest zoom range if not already.

2. Switch Lens to MF and turn Focus Ring all the way to Left again.

3. Switch lens back to AF.

4. In the Infinity Sub Menu set to Custom, I doubt my 2 lenses will work for yours.

5. Set other settings like this:

Step Right = How many right key presses it took you to achieve focus.
Speed  =  The step size used when getting your settings with Follow Focus, in this case it was 2.
Delay = The delay used in when getting your settings with Follow Focus, in this case it was 200 for 200ms
Range = The zoom range you are at right now, Example: 18-55mm would be 55 of coarse. Cause we are taking are setting Full Zoom.

6. Once those settings are dialed in, they will save even after restart.

So to achieve Infinity focus from now on just:

Twist Lens to full zoom range.
Switch Lens to MF and turn Focus Ring all the way to Left on Infinity side.
Switch lens back to AF
Now run Infinity feature.
Switch lens back to MF
Your focus should be in focus if right where you manually configured it and you can freely zoom in and out and not lose focus to infinity as long as you don't touch the focus ring.

This is really probably only useful for those people who are picky about there Infinity being set the way they want it and they don't want to have to go through zooming in 10x all the time and finding something to aim at far away and manually messing with the Focus Ring. Or maybe the people who shoot night lightning like me and don't have any distant objects to check focus on, and for lightning it has to right on or the lightning will look soft.

This is my main reason for creating the module, for night lightning set up and to save set up time during day lightning plus focusing by hand doing the trick all the way to Infinity and back a bit never gives me sharp bolts.

Please let me know if you have any success with it. And sorry my 2 presets are in there, maybe if you have a 550D and the kits lens, maybe it will work for you on the 55mm or if you have 550D with 75-300mm but I doubt it will be exact same setting.

All this module is doing is the same thing you manually do with Follow Focus as long as your settings in Infinity match the Setting in Focus Settings, you can use differ settings in Focus Settings submenu but make sure you match them in the Infinity Feature settings. And when your using follow focus, go low, one press at a time so you don't skip at all, it may do 2 steps without realizing it, then it wont match up in the Infinity Module.

Also the neat thing is, even if you try it and it dont work, maybe your just a step off, so go ahead and tweak the steps 1 at a time in the Infinity Module till its correct, but if you can achieve focus with 5 steps to the right from all the way to Left, then you should be able to have Infinity do it for you auto.

It is very important to always reset focus to the left, it takes to long to let the motor do it using Infinity, I have it go back a for 500ms just to make sure its all the way, so you will see Soft Focus Reached at the start.

Oh also, if you hear 3 beeps, that means your Lens Zoom range does not match the Range you set in the Infinity module, and 1 beep at the end means it is Done so you can switch Lens back to MF so you don't ruin your focus.

https://bitbucket.org/mk11174/magic-lantern/downloads/foc_inf.mo

Just in case anyone wants the src code or has better way of writing it cause it is very basic since I am not a programmer at all, any tips would be welcome!

#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;
unsigned CONFIG_INT("inf_delay", inf_delay, 200);
unsigned CONFIG_INT("inf_speed", inf_speed, 2);
unsigned CONFIG_INT("inf_steps", inf_steps, 1);
unsigned CONFIG_INT("inf_range", inf_range, 18);
unsigned CONFIG_INT("inf_custom", inf_custom, 2);

/*   Focus Infinity  */

static MENU_SELECT_FUNC(inf_focus_toggle)
{
if (inf_custom == 1 && lens_info.focal_len == 55)
{
lens_focus_start(-3);
msleep(200);
lens_focus_stop();
msleep(200);
lens_focus(4, 2, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 2 && lens_info.focal_len == 300)
{
lens_focus_start(-3);
msleep(200);
lens_focus_stop();
msleep(200);
lens_focus(9, 2, 1, 20);
msleep(200);
beep();
}
else
{
if (inf_custom == 0 && lens_info.focal_len == inf_range)
{
lens_focus_start(-3);
msleep(200);
lens_focus_stop();
msleep(200);
lens_focus(inf_steps, inf_speed, 1, inf_delay);
msleep(200);
beep();
}
else
{
msleep(200);
beep();
msleep(200);
beep();
msleep(200);
beep();
msleep(200);
return;
}
}
}
}

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

static struct menu_entry step_menu[] = {
            {
                .name = "Infinity",
                .priv = &inf_focus,
        .select = inf_focus_toggle,
.choices = CHOICES("Press SET"),
        .select_Q     = menu_open_submenu,
                .min = 0,
                .max = 1,
        .children =  (struct menu_entry[]) {
    {
                .name = "Custom Range",
                .priv = &inf_custom,
.choices = CHOICES("Custom", "55mm", "300mm"),
                .min = 0,
                .max = 2,
    },
            {
                .name = "Steps Right",
                .priv = &inf_steps,
.update = custom_display,
                .min = 1,
                .max = 1000,
            },
            {
                .name = "Speed",
                .priv = &inf_speed,
.update = custom_display,
                .min = 1,
                .max = 3,
            },
            {
                .name = "Delay",
                .priv = &inf_delay,
.update = custom_display,
                .min = 0,
                .max = 1000,
            },
            {
                .name = "Range mm",
                .priv = &inf_range,
.update = custom_display,
                .min = 10,
                .max = 900,
            },
            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_delay)
    MODULE_CONFIG(inf_steps)
    MODULE_CONFIG(inf_speed)
    MODULE_CONFIG(inf_range)
    MODULE_CONFIG(inf_custom)
MODULE_CONFIGS_END()
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Critical Point

600D & GH2 / PC.

mk11174

Quote from: Critical Point on July 24, 2013, 03:23:38 PM
Looks complicated.
No, it may look it but trust me, if I can code it, it is simple since I am not a programmer. I have presets for 55mm and 300mm of my lenses, so it just shows you that yes, you can make custom steps for each mm range. And you can find the ranges out by using the custom option and then checking each range. But the only way to use the steps in an accurate way is to always have same start point, that is why you always need to focus to one side which I have set for infinity side, this gives you a starting point and you count steps from there.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Ripcord

@mk11174 l am really interested in this as I am looking for photographing the milkyway,

How can i use this script? I am on Latest ML Nightly 2013-08-04
Canon EOS 60D

1%

This is good for setting infinity during the day and then having it at night.

Ripcord

Quote from: 1% on August 05, 2013, 04:23:41 PM
This is good for setting infinity during the day and then having it at night.

why do you say so? is it because of focusing it on a star during night times?

(asking out of curiosity)
Canon EOS 60D

Tichro

Hi mk11174,
is there any chance of getting this updated to work with the new 3.0 API ?

I found it very useful for doing astro shots.

RenatoPhoto

Quote from: Tichro on September 06, 2013, 08:52:31 PM
I found it very useful for doing astro shots.
Did you actually test this in night shots?  If so can you elaborate on the results?  What lens you used, what camera?
If this proves to be useful for astrophotography then I would be interested in testing this module as well!

I was on a trip during July so I never saw this module come up!
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

Tichro

Yes I used it quite successfully, just needed to set it up during day light and it worked perfectly.

The lens I used was just the kit 18-55, camera was 550D (T2i).

Sadly I cant post any results because while I was doing a recent clean up of my system I deleted them by mistake  :-[

But I can confirm it worked fine for me  8)

Next time I get a chance to get to a dark sky location, without any crappy artificial lights, I will post some results,,, unfortunately Autumn is coming and here in the UK clear skies are a rare thing at this time of year  :(

mk11174

Quote from: RenatoPhoto on September 06, 2013, 09:08:28 PM
Did you actually test this in night shots?  If so can you elaborate on the results?  What lens you used, what camera?
If this proves to be useful for astrophotography then I would be interested in testing this module as well!

I was on a trip during July so I never saw this module come up!
It is not fully automated or anything, it is sort of how a telescope gets setup, you go out in day time first to use the custom option to configure your focus steps like I explained at start of the thead and at night time using this feature will allow you to get the same focus you set up with during the day.

It is nothing fancy, you just adjust your focus all the way to the infinity side then when you use the module it will automatically step back the other way to the step amount you set up during the day.

Works everytime for me and you can just test it during the day to make sure its working correctly. If set up right it should work fine cause alls its doing is stepping back 1 step at a time to what you set it up for.

I use a 75mm - 300mm Canon lens and the 18mm - 55mm kit lens with my T2i and T3i and it works fine on both. Saves me so much time when trying to set up for night lightning. I also use it during day lightning as well cause its so much faster then using live view at 10x zoom to manually focus everytime, I dont trust autofocus cause to many trees around interfere with the true distant focus.

Tricky at first but once she realize what it does and do it 2 or 3 times you realize its pretty simple and a very basic module that is just doing the focus steps for you.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

RenatoPhoto

Wow!  Sounds great, I can imagine that any astrophotographer will love to have this module added to the list.  I use a 8mm, 14mm, 25mm, 50mm, 300mm, and 300+2X=600mm.  It would be required to save the settings for each lens so you just pop the lens, tune it and then later use it as needed.
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

Quote from: RenatoPhoto on September 06, 2013, 10:41:00 PM
Wow!  Sounds great, I can imagine that any astrophotographer will love to have this module added to the list.  I use a 8mm, 14mm, 25mm, 50mm, 300mm, and 300+2X=600mm.  It would be required to save the settings for each lens so you just pop the lens, tune it and then later use it as needed.
Wow! That is alot of lenses, I guess I should add more custom settings then for more then 1 lens, since I originally made the module for me, there is only the preset for my 2 lenses and a custom one, but for public I should get ride of my presets and add many custom menus for sure. At the time I was not sure if it would work for every camera, still don't know if it will be consistant on every cam and every type of lens. I have a friend who has a white pro series lens with 5D2 and he insists it does not work good for him, he says its not the module itself, he says his steps while just using follow focus to get the correct step amount is differ everytime. But I dont know if it is just him doing it wrong or his eyes are bad cause he is much older.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

RenatoPhoto

FYI, I rolled back to August 25th builds and was able to test with my 300+2x and it looks like it works!

Upon your information I will do some more testing when the weather conditions are such that a fair test can be done.

I would like to use the moon to do the infinity focus and then test for repeatable.  For my conditions it seemed to work but I dont know how accurately.

I tested on 5D3 + canon EF 300 f/4 + kenko 2x
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

Quote from: RenatoPhoto on September 06, 2013, 11:56:51 PM
FYI, I rolled back to August 25th builds and was able to test with my 300+2x and it looks like it works!

Upon your information I will do some more testing when the weather conditions are such that a fair test can be done.

I would like to use the moon to do the infinity focus and then test for repeatable.  For my conditions it seemed to work but I dont know how accurately.

I tested on 5D3 + canon EF 300 f/4 + kenko 2x
Thanks for the info, hope it works for you on all your lenses, glad to know it at least is working out ok on a differ camera at least then the T2i and T3i 8]
500D/T1i  550D/T2i  600D/T3i  700D/T5i

RenatoPhoto

Further Testing:

Almost all my lenses tested with excellent results during the day.  Except..

Problems with 28mm Sigma 1.8 EXDG f1.8.
1. Every other test it goes beyond by one step. 
2. This lens seems to be the most difficult of all, it does not report focus distance. 
3. I could not get it to move manually with the side-to-side stick and had to use the up-down stick motions to make the focusing move.

Problems with Sigma 8mm Fisheye EXDG  f3.5.
1. The menu setting in Focus Infinity Module only goes to 10mm so it will not work and beep twice when pressing set.

NOTE:  Original I had a few problems getting the system to work but after getting a better understanding of the menus I was able to make work very reliably.  I think it is very important to mention that the lens has to be put in manual mode when setting it back to infinity, followed by auto-mode, followed by the SET command to begin.

Here are some of the settings which I found to work for my lenses:

Canon EF 300mm f/4 L

Focus settings   
step size    1
Step delay    200
Step wait    on+
Left/Right     +/-
upd down     +/-
Rack Delay   2
   
Infinity (mo)   
Custom Range   
Steps Right  67
Speed 2
Delay 200   
Range mm 300



Canon EF 300mm f/4 L + 2X Kenko C-AF 2X Teleplus Pro = 600 mm f/8

Focus settings   
step size    1
Step delay    200
Step wait    on+
Left/Right     +/-
upd down     +/-
Rack Delay   2
      
Infinity (mo)   
Custom Range   
Steps Right    69
Speed  1
Delay 200
Range mm 600

Canon EFS 10-22mm (customized for full frame i.e. 12-22mm)
22mm                12mm   
Focus settings         Focus settings   
step size    1              step size    1
Step delay    200      Step delay    200
Step wait    on+      Step wait    on+
Left/Right     +/-      Left/Right     +/-
upd down     +/-      upd down     +/-
Rack Delay   2      Rack Delay   2
   
Infinity (mo)         Infinity (mo)   
Custom Range         Custom Range   
Steps Right   31       Steps Right    12
Speed 1                      Speed 1
Delay 200                      Delay 200
Range mm 22               Range mm 12

Canon EF 50 f1.8
Focus settings   
step size    1
Step delay    200
Step wait    on+
Left/Right     +/-
upd down     +/-
Rack Delay   2
   
Infinity (mo)   
Custom Range   
Steps Right    4
Speed   1
Delay   200
Range mm   50

Canon Macro EF 180mm 3.5 L
Focus settings   
step size    1
Step delay    200
Step wait    on+
Left/Right     +/-
upd down     +/-
Rack Delay   2
   
Infinity (mo)   
Custom Range   
Steps Right    14
Speed   2
Delay   200
Range mm   180

Tamron 17-50mm 2.8 XR Di II  SP
17mm                50mm   
Focus settings         Focus settings   
step size    1              step size    1
Step delay    200      Step delay    200
Step wait    on+      Step wait    on+
Left/Right     +/-      Left/Right     +/-
upd down     +/-      upd down     +/-
Rack Delay   2      Rack Delay   2
            
Infinity (mo)         Infinity (mo)   
Custom Range         Custom Range   
Steps Right    1      Steps Right    9
Speed   2             Speed   2
Delay   200              Delay   200
Range mm   17      Range mm   50
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

Quote from: RenatoPhoto on September 08, 2013, 05:49:15 PM
Further Testing:

Almost all my lenses tested with excellent results during the day.  Except..

Problems with 28mm Sigma 1.8 EXDG f1.8.
1. Every other test it goes beyond by one step. 
2. This lens seems to be the most difficult of all, it does not report focus distance. 
3. I could not get it to move manually with the side-to-side stick and had to use the up-down stick motions to make the focusing move.

Problems with Sigma 8mm Fisheye EXDG  f3.5.
1. The menu setting in Focus Infinity Module only goes to 10mm so it will not work and beep twice when pressing set.

Ha, I didnt even know they made a 8mm, when I wrote it out I was like hmm, Ill just put 10 as the lowest cant imagine anything lower then that, but I sure was wrong LOL!

I will add that change as well. And geez all those lenses even with more custom menus I hope you can keep track of which custom choice will be for what lens, sounds like you have some cool lenses there!

Thanks for all that info, good to know it does work at least, sorry bout the one lens though.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

RenatoPhoto

Just some ideas and questions:

1. Will you be able to update this module to the new format?  I sure hope so, because I am sure more people than you and I have good use for this.
2. I think if you have extra four customizable menus that can be stored with the lens name it would cover my needs.
3. I guess just make all (six) of them customizable menus with some starting settings.  To avoid text entry just take the range in mm and added to the "lens text" so each custom module name would read xxx lens, where xxx is the number entered in the range.

Well this is just my wishes and I hope you can make this happen.  Let me know if I can help with anything. ;)

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

Quote from: RenatoPhoto on September 09, 2013, 02:50:22 AM
Just some ideas and questions:

1. Will you be able to update this module to the new format?  I sure hope so, because I am sure more people than you and I have good use for this.

It will work fine with the new source, I always use the latest source before I send out a module, so no worries there.

I am making 9 choices, should be more then enough, I am not a programmer so took me a bit to figure out the best way to set it up, I just have a few tweaks and hopefully it will be ready.

It is really the best I can do with my super basic coding experience hopefully it will be good enough with your cool lenses you have.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

mk11174

Best I can do with my programming skills to make it so you can add 9 lenses to the list.

I will try to make it better if I can but for now this should work good. Very basic just get your step amount from Follow Focus using the focus settings I mention at start of this thread. Then set that step amount and range mm amount for a Lens choice 1 - 9.

Let me know if it works for you.

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

RenatoPhoto

Quote from: mk11174 on September 09, 2013, 09:55:02 AM
Let me know if it works for you.

Wow!  Your coding is fast, I barely understand what you did.  Thank you very much for taking the time and the effort to support this module.

I have loaded ok in the new module system.  The setup seems very good with only one problem, I cannot customize the step size and the speed for each lens.  In some cases I cannot optimize the module for each lens.

update:  It seems that speed has been fixed at 3 so all my calibrations are off.  I will have to check if can calibrate the lens at this speed...  Why is that speed influences like if it was step size?  I mean if you speed 3 then the steps are much larger and the lens moves way beyond the original set point.

For example in my previous setup I had the 300mm at step size 1 and speed 2 with 67 steps.  Now with step size 1 I need 10 clicks but the lens does not react properly and cannot get the focus, and with step size 2 I get 1 click.  Definitely the speed and the step size has to go in this module.

Thanks again

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

Quote from: RenatoPhoto on September 09, 2013, 01:54:32 PM
Wow!  Your coding is fast, I barely understand what you did.  Thank you very much for taking the time and the effort to support this module.

I have loaded ok in the new module system.  The setup seems very good with only one problem, I cannot customize the step size and the speed for each lens.  In some cases I cannot optimize the module for each lens.

update:  It seems that speed has been fixed at 3 so all my calibrations are off.  I will have to check if can calibrate the lens at this speed...  Why is that speed influences like if it was step size?  I mean if you speed 3 then the steps are much larger and the lens moves way beyond the original set point.

For example in my previous setup I had the 300mm at step size 1 and speed 2 with 67 steps.  Now with step size 1 I need 10 clicks but the lens does not react properly and cannot get the focus, and with step size 2 I get 1 click.  Definitely the speed and the step size has to go in this module.

Thanks again
Hmm, I set the module up so you just need to adjust the Step to the right amount and MM for each lens. I took out the other options because I figured they were not needed because they should always stay the same since these are the settings that you will be using to find your step to right amount with Follow Focus with the
Focus Settings
Step Size 2
Step Delay 200ms
Step Wait ON
Left/Right  + / -


So I set the module up to use those settings as well so if you find it is say 10 steps to right in Follow Focus it will be 10 steps as well with the module.

I also took the extra stuff out of menu cause it seemed like it was just to many things in a menu and the important one was the Step to right amount unless for some reason you are trying to find your Step to the right amount with differ Focus Settings with Follow Focus?

If you use the Focus Settings I mentioned above, and Step right with Follow Focus are you not able to get a good enough value of steps to focus?

Just trying to understand what is wrong before I add back things, the Speed option I had was the Step Size, I just named it speed in the module and I programed in 2 because 3 seems to big of a step so it misses the focus point sometimes, and 1 of coarse are to small of steps so it takes forever to get there.

Maybe your saying sometimes 2 is to small because it takes to long to get there on some of your lenses???

Just to note in case I misunderstand and you are not sure, the settings in Focus Settings menu do not reflect at all the Foc_Inf module, those are only for Follow Focus if you program your Focus Settings with those settings from above they will match how the Foc_Inf module acts and alls the module will be doing is basically press the right key the same amount of steps to the right that you found were good when stepping to right in Follow Focus.

Well first it will focus to the left first just to make sure its all the way to the left in case you forget to manually do it, then it will step to the right the amount of steps you programmed.

So before I do anything I will wait for your reply and we will go from there, just trying to make sure we are both on same page  :)

The module is hardcoded with
Step Size 2
Step Delay 200ms
Step Wait ON

Oh, one other thing, try not to pay attention to what the Follow Focus step amount says in ML just go by how many Right presses it takes you with follow focus, that is the amount you will program in the module, sometimes the value shown in ML menu is off because it does not reset back to 0. So just manually focus to the left and use follow focus one right pres at a time counting in your head how many presses it takes till focus then put that amount in the module.

Update: One more thing, at the top of the list is where you select which Lens setting the module will use when you press SET use the top option to choose which Custom setting to activate theres no way for the module to know what lens is attached so you have to use the top Lens Choice to activate one of your custom setting which will make the numbers turn white, only those values will be the ones used when pressing SET on the Parent Infinity Menu.

There is no way to set it up to know the lens especially because every lens seems to be differ, I have 2 18-55mm kit lenses and both have differ step to right values, so it would do no good trying to make the module recognize the lens by name because it would be useless as a Public module since one setting wont work with another lens even if it is the same name.

It would be nice to be able to let the User program a name in on camera, but since that is not an option, the only universal way is just to keep them names Lens 1 - Lens 9.

500D/T1i  550D/T2i  600D/T3i  700D/T5i

mk11174

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
500D/T1i  550D/T2i  600D/T3i  700D/T5i

Pelican

Quote from: mk11174 on September 09, 2013, 09:04:11 PM
It would be nice to be able to let the User program a name in on camera, but since that is not an option, the only universal way is just to keep them names Lens 1 - Lens 9.
You can use ime_base and ime_std modules for text input.
Also I didn't check but hard to believe if no way to get the lens name from a module.
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

Quote from: mk11174 on September 10, 2013, 01:34:12 AM
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
Thank you, I read your note but have been away all day.  I will test the new module and report back.

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.

I think the lens selection scheme is good.  My idea above was to take the range in mm and added to the lens so the lens menu would read Lens 1 300mm, Lens 2 100mm, Lens 3 00mm.  this would mean that I have my first lens set to 300mm, the second lens 100mm, the third lens is empty.

But so far the module is looking great.
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

mk11174

Quote from: Pelican on September 10, 2013, 03:34:03 AM
You can use ime_base and ime_std modules for text input.
Also I didn't check but hard to believe if no way to get the lens name from a module.
You can get the lens name that is not the problem, 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.
500D/T1i  550D/T2i  600D/T3i  700D/T5i

fpena06

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

Quote from: RenatoPhoto on September 10, 2013, 03:42:09 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

Quote from: fpena06 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.
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

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.

#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

Quote from: mk11174 on September 10, 2013, 01:34:12 AM
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

Quote from: mk11174 on September 10, 2013, 04:50:39 AM
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)?

Quote from: fpena06 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.
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

Quote from: RenatoPhoto on September 10, 2013, 06:21:31 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

Quote from: Pelican on September 10, 2013, 06:57:58 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

Quote from: mk11174 on September 10, 2013, 10:20:55 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

Quote from: mk11174 on September 10, 2013, 10:15:42 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

Quote from: Pelican on September 10, 2013, 10:34:20 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

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

Quote from: RenatoPhoto 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.
This compiles but I haven't tried...

#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

Quote from: RenatoPhoto 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.

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

Quote from: mk11174 on September 21, 2013, 05:05:33 AM
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

Quote from: Pelican on September 21, 2013, 01:16:39 AM
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

Quote from: RenatoPhoto on September 21, 2013, 07:07:02 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

Quote from: Pelican on September 21, 2013, 01:16:39 AM
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

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

Quote from: Hey 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.
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

QuoteUpdate: 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

Quote from: Hey on May 18, 2014, 02:38:50 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

This one should fit perfectly as a script... once the scripting engine will be back.

golem

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.


magiclantern@magiclantern-VirtualBox:~/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

#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