Author Topic: Assign lens focal length and name for non cpu lenses  (Read 39123 times)

dfort

  • Hero Member
  • *****
  • Posts: 2522
Re: Assign lens focal length and name for non cpu lenses
« Reply #250 on: October 10, 2017, 12:22:17 AM »
The 6D isn't ready for crop_rec_4k. Grab the Non-CPU lens info or the Latest Lua updates + fixes for the 6D (experiments download page) and put the new lens.lua file in the scripts directory. Make sure you read the script, comment out the test lines and uncomment (or add) the lenses your are using.
5D3.* 7D.* 700D.115 EOSM.* EOSM2.103

NunoCaldeira

  • New to the forum
  • *
  • Posts: 41
Re: Assign lens focal length and name for non cpu lenses
« Reply #251 on: October 15, 2017, 03:25:43 PM »
Ok I just tried building for the 6D but I got some errors.
no worries Lars. was just trying to get it working with the latest nightly. cheers

Lars Steenhoff

  • Senior
  • ****
  • Posts: 322
Re: Assign lens focal length and name for non cpu lenses
« Reply #252 on: October 15, 2017, 05:49:59 PM »
and did you get it to work with any version you downloaded at all?
perhaps the lua fixes one as thats more recent

NunoCaldeira

  • New to the forum
  • *
  • Posts: 41
Re: Assign lens focal length and name for non cpu lenses
« Reply #253 on: October 15, 2017, 07:56:01 PM »
and did you get it to work with any version you downloaded at all?
perhaps the lua fixes one as thats more recent
didnt manage it to work,only with the April one

dfort

  • Hero Member
  • *****
  • Posts: 2522
Re: Assign lens focal length and name for non cpu lenses
« Reply #254 on: October 16, 2017, 01:07:27 AM »
@NunoCaldeira

The lens.lua script doesn't work on the unified branch (Nightly builds) but maybe we can get this working on the latest experimental build?

http://www.magiclantern.fm/forum/index.php?topic=15088.msg191691;topicseen#msg191691

Need some help from 6D users.
5D3.* 7D.* 700D.115 EOSM.* EOSM2.103

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #255 on: December 16, 2017, 04:06:17 PM »
I managed to make the script works with manual lens with AF confirm Chip.
Also possibly found a way to avoid selecting lens everytime shoot mode is changed (this also avoid getting errors when changing more mode at a time without selecting lens from menu) but it need more testing.

Right now my main interest is to get the metadata into an mlv file.
then when the dngs are generated in post this metadata will be put inside the dng files.

My knowledge of how the metadata is written in mlv video is limited.

Anyone know how its written in the mlv?

for stills it would be nice to have it in the cr2 but this might be more difficult. then the xmp route might be best for stills.

I have found a way to get Lens Info to work with Manual Lenses and consequently Lens Name and Focal Length (maybe also Aperture value) get written in Mlv file generated by Silent Pictures. Don't know if it also works for raw video files.

I can push changes to the repository (if someone find this interesting) after testing a cleaner way to get values and finished to optimize the script

Lars Steenhoff

  • Senior
  • ****
  • Posts: 322
Re: Assign lens focal length and name for non cpu lenses
« Reply #256 on: December 16, 2017, 09:12:36 PM »
Yes very intersting!

dfort

  • Hero Member
  • *****
  • Posts: 2522
Re: Assign lens focal length and name for non cpu lenses
« Reply #257 on: December 16, 2017, 10:32:51 PM »
Nice!

It would be great if you can make a pull request for this.
5D3.* 7D.* 700D.115 EOSM.* EOSM2.103

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #258 on: December 17, 2017, 06:17:22 AM »
Nice!

It would be great if you can make a pull request for this.

Here is the PR, take a look please.

I had to remove the check for switching shoot mode as sometimes it was responsible for breaking lens name value in Lens Info, but I didn't checked if values were saved correctly in MLV metadata.
I noticed a strange behavior in the handler's execution... For some reason it reached the end of the function only after a second call occured, maybe it can be the problem or I am missing some information on how lua property works.

Here is the script i was using if you want to try:
Code: [Select]
-- Manual Lens Information V2
-- Supplies lens information for manual lenses
-- Whenever there is a non-chipped lens detected, we prompt the user to select the attached manual lens from a list

require("ui")
require("config")
require("xmp")

lenses =
{
--  The following is for testing purposes. Comment out the following lines then either uncomment only the lenses
--  that you want to use from the list or add your own lenses. Tip: Put your most used lenses at the top of the list.

    { name = "My Lens", focal_length = 50 },
    { name = "My Other Lens", focal_length = 25 },
    { name = "Yashica ML 50mm f1.9", focal_length = 50 },
    { name = "Pentax SMC 80-200mm f4,5", focal_length = 200, manual_aperture = 4.5 },

--  Zeiss ZF.2 manual lenses Nikon mount - these work with the lens profiles that ship with Adobe Camera Raw

--  { name = "Zeiss Distagon T* 2.8/15 ZF.2",        focal_length =  15, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 3.5/18 ZF.2",        focal_length =  18, manual_aperture = 3.5 },
--  { name = "Zeiss Distagon T* 2.8/21 ZF.2",        focal_length =  21, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 2.8/25 ZF.2",        focal_length =  25, manual_aperture = 2.8 },
--  { name = "Zeiss Distagon T* 2/25 ZF.2",          focal_length =  25, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 2/28 ZF.2",          focal_length =  28, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 2/35 ZF.2",          focal_length =  35, manual_aperture = 2   },
--  { name = "Zeiss Distagon T* 1.4/35 ZF.2",        focal_length =  35, manual_aperture = 1.4 },
--  { name = "Zeiss Makro-Planar T* 2/50 ZF.2",      focal_length =  50, manual_aperture = 2   },
--  { name = "Zeiss Planar T* 1.4/50 ZF.2",          focal_length =  50, manual_aperture = 1.4 },
--  { name = "Zeiss Planar T* 1.4/85 ZF.2",          focal_length =  85, manual_aperture = 1.4 },
--  { name = "Zeiss Makro-Planar T* 2/100 ZF.2",     focal_length = 100, manual_aperture = 2   },
--  { name = "Zeiss Apo Sonnar T* 2/135 ZF.2",       focal_length = 135, manual_aperture = 2   },

--  Nikon lenses
--  { name = "Nikon Zoom Ais ED 50-300",             focal_length = 300, manual_aperture = 4.5 },
--  { name = "Nikon AF NIKKOR 28mm f/1.4D",          focal_length =  28, manual_aperture = 1.4 },


--  Samyang manual lenses - also branded as Rokinon and Bower. Cine versions use the same lens profile.
--  The lens profiles for Samyang manual lenses that ship with Adobe Camera raw must be modified in order
--  for automatic lens detection to work.
--  More information here: http://www.magiclantern.fm/forum/index.php?topic=18083.msg176261#msg176261

--  { name = "Samyang 8mm f/2.8 UMC Fisheye",        focal_length =   8, manual_aperture = 2.8 },
--  { name = "Samyang 8mm f/2.8 UMC Fisheye II",     focal_length =   8, manual_aperture = 2.8 }, --   8mm T3.1 Cine
--  { name = "Samyang 8mm f/3.5 UMC Fish-Eye CS",    focal_length =   8, manual_aperture = 3.5 },
--  { name = "Samyang 8mm f/3.5 UMC Fish-Eye CS II", focal_length =   8, manual_aperture = 3.5 }, --   8mm T3.8 Cine
--  { name = "Samyang 10mm f/2.8 ED AS NCS CS",      focal_length =  10, manual_aperture = 2.8 }, --  10mm T3.1 Cine
--  { name = "Samyang 12mm f/2 NCS CS",              focal_length =  12, manual_aperture = 2   }, --  12mm T2.2 Cine
--  { name = "Samyang 12mm f/2.8 ED AS NCS Fisheye", focal_length =  12, manual_aperture = 2.8 }, --  12mm T3.1 Cine
--  { name = "Samyang 14mm f/2.8 ED AS IF UMC",      focal_length =  14, manual_aperture = 2.8 }, --  14mm T3.1 Cine
--  { name = "Samyang 16mm f/2 ED AS UMC CS",        focal_length =  16, manual_aperture = 2   }, --  16mm T2.2 Cine
--  { name = "Samyang 21mm f/1.4 ED AS UMC CS",      focal_length =  21, manual_aperture = 1.4 }, --  21mm T1.5 Cine
--  { name = "Samyang 24mm f/1.4 ED AS IF UMC",      focal_length =  24, manual_aperture = 1.4 }, --  24mm T1.5 Cine
--  { name = "Samyang 35mm f/1.4 AS IF UMC",         focal_length =  35, manual_aperture = 1.4 }, --  35mm T1.5 Cine
--  { name = "Samyang 50mm f/1.2 AS UMC CS",         focal_length =  50, manual_aperture = 1.2 },
--  { name = "Samyang 50mm f/1.4 AS UMC",            focal_length =  50, manual_aperture = 1.4 }, --  50mm T1.5 Cine
--  { name = "Samyang 85mm f/1.4 AS IF UMC",         focal_length =  85, manual_aperture = 1.4 }, --  85mm T1.5 Cine
--  { name = "Samyang 100mm f/2.8 ED UMC MACRO",     focal_length = 100, manual_aperture = 2.8 }, -- 100mm T3.1 Cine
--  { name = "Samyang 135mm f/2 ED UMC",             focal_length = 135, manual_aperture = 2   }, -- 135mm T2.2 Cine
--  { name = "Samyang 300mm f/6.3 ED UMC CS",        focal_length = 300, manual_aperture = 6.3 },


--  Lensbaby lenses

--  { name = "Lensbaby Sweet 35",                    focal_length =  35, manual_aperture = 2.5 },
--  { name = "Lensbaby Sweet 50",                    focal_length =  50, manual_aperture = 2.5 },
--  { name = "Lensbaby Twist 60",                    focal_length =  60, manual_aperture = 2.5 },
--  { name = "Lensbaby Edge 50",                     focal_length =  50, manual_aperture = 3.2 },
--  { name = "Lensbaby Edge 80",                     focal_length =  80, manual_aperture = 2.8 },
--  { name = "Lensbaby Circular Fisheye",            focal_length = 5.8, manual_aperture = 3.5 },
--  { name = "Lensbaby Soft Focus Optic",            focal_length =  50, manual_aperture = 2   },
--  { name = "Lensbaby Double Glass Optic",          focal_length =  50, manual_aperture = 2   },
--  { name = "Lensbaby Single Glass Optic",          focal_length =  50, manual_aperture = 2   },
--  { name = "Lensbaby Plastic Optic",               focal_length =  50, manual_aperture = 2   },
--  { name = "Lensbaby Pinhole Optic",               focal_length =  50, manual_aperture = 19  },
--  { name = "Lensbaby Fisheye Optic",               focal_length =  12, manual_aperture = 4   },
--  { name = "Lensbaby Velvet 56",                   focal_length =  56, manual_aperture = 1.6 },
--  { name = "Lensbaby Velvet 85",                   focal_length =  85, manual_aperture = 1.8 },
--  { name = "Lensbaby Creative Aperture",           focal_length =  50, manual_aperture = 2   },

}

selector_instance = selector.create("Select Manual Lens", lenses, function(l) return l.name end, 600)

lens_config = config.create({})

if lens_config.data ~= nil and lens_config.data.name ~= nil then
    for i,v in ipairs(lenses) do
        if v.name == lens_config.data.name then
            selector_instance.index = i
            break
        end
    end
end

-- Property to be written in .xmp file
xmp:add_property(xmp.lens_name, function() return lens.name end)
xmp:add_property(xmp.focal_length, function() return lens.focal_length end)
xmp:add_property(xmp.aperture, function() return math.floor(camera.aperture.value * 10) end)

-- Flag variable to avoid selecting lens when switching shott mode
lensSelected = 0

function is_manual_focus()
  console.write("In is_manual_focus()\n")
  console.write(lens.lens_id)
  console.write(lens.lens_exists)

  if (lens.lens_id == 0 or lens.lens_id == "(no lens)" or
      lens.name == "1-65535mm" or lens.focal_length == "1-65535mm") then
    console.write("In is_manual_focus() - TRUE\n")
    return true
  else
    console.write("In is_manual_focus() - FALSE\n")
    return false
  end
end

--  Handler for lens_name property
--  Get Called when:
--  Switching lens
--  Switching shoot mode
function property.LENS_NAME:handler(value)
    console.write("In Handler - LensSelected:\n")
    console.write(lensSelected)

    -- Check if lens has already been selected by menu
    if lensSelected == 0 then
      if is_manual_focus() then
          task.create(select_lens)
      else
        -- Not a manual Lens, no need to write sidecart file
        if selector_instance ~= nil then
            selector_instance.cancel = true
            console.write("Selector_instance is NULL")
        end
        -- Clear flag variable for next run
        lensSelected = 0
        console.write("XMP STOP")

        xmp:stop()
      end
    end

    console.write("Exiting from Handler\n")
end

function select_lens()
    if #lenses > 1 then
        local menu_already_open = menu.visible
        if not menu_already_open then
            menu.open()
            display.rect(0, 0, display.width, display.height, COLOR.BLACK, COLOR.BLACK)
        end
        if selector_instance:select() then
            update_lens()
        end
        if not menu_already_open then
            menu.close()
        end
    elseif #lenses == 1 then
        update_lens()
    end
end

-- Copy lens attribute from
function update_lens()
    console.write("In update_lens()\n")

    for k,v in pairs(lenses[selector_instance.index]) do
        lens[k] = v
    end
    lens_config.data = { name = lenses[selector_instance.index].name }
    xmp:start()

    -- Avoid to select lens again when switching shoot mode
    lensSelected = 1
    -- Enable to read values for Lens Info and MLV file
    lens.lens_exists = true
    console.write("Setting lens_exists to TRUE\n")
end

lens_menu = menu.new
{
    parent = "Lens Info Prefs",
    name = "Manual Lens V2",
    help = "Info to use for attached non-chipped lens",
    icon_type = ICON_TYPE.ACTION,
    select = function()
        if is_manual_focus() then
            task.create(select_lens)
        end
    end,
    rinfo = function()
        return lens.name
    end,
    warning = function()
        flag = is_manual_focus()
        if flag == false then
            return "Chipped lens is attached"
        end
    end
}

-- Check lens on start
if is_manual_focus() then
    task.create(select_lens)
end

Note: I get a compilation error for silent.o from manual_lens_info even without my changes, it need some investigation but I copied a compiled version to run the test

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #259 on: December 19, 2017, 05:44:59 PM »
I have pushed more changes to PR. Currently I am trying to save Serial Number in MLV File

This is what i get from MLV metadata:
Code: [Select]
Block: LENS
  Offset: 0x000001f0
    Size: 96
    Time: 9.048000 ms
     Name:        'Pentax SMC 80-200mm f4,5'
     Serial:      '0'
     Focal Len:   200 mm
     Focus Dist:  0 mm
     Aperture:    f/4.50
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x0000001B
     Flags:       0x00000000





This is what I modified in modules/mlv_rec/mlv.c:
Code: [Select]
 
void mlv_fill_lens(mlv_lens_hdr_t *hdr, uint64_t start_timestamp)
{
...
 
    strncpy((char *)hdr->lensName, lens_info.name, 32);
    //Changed this one with snprintf()
    //strncpy((char *)hdr->lensSerial, "", 32);
    snprintf((char *)hdr->lensSerial, 32, "%d", lens_info.lens_serial);

    //strncpy((char *)hdr->lensName, lens_info.lens_serial, 32); Doesn't works well, It print a weird string
   
...
}

Is this a valid way to copy value from lens_info struct?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10922
  • 5D Mark Free
Re: Assign lens focal length and name for non cpu lenses
« Reply #260 on: December 19, 2017, 05:56:51 PM »
I prefer snprintf also in the first case (which is actually scnprintf, btw); it guarantees a null-terminated string and won't write more than 32 characters. Since g3gg0 used strncpy, I assume the MLV spec does not require a null-terminated string (can't find it in the spec), but having one is desirable IMO (fewer surprises for C-based MLV converters).

Here, strncpy won't work because lens_serial is not a string; iirc it should be printed as hex though (%X).

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3068
Re: Assign lens focal length and name for non cpu lenses
« Reply #261 on: December 19, 2017, 10:57:30 PM »

Is this a valid way to copy value from lens_info struct?

can you try the latest patches, please?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #262 on: December 19, 2017, 11:39:02 PM »
can you try the latest patches, please?

It works! I have manually copied changes regarding Serial Number from your commits

Code: [Select]
Block: LENS
  Offset: 0x000001f0
    Size: 96
    Time: 8.662000 ms
     Name:        'Pentax SMC 80-200mm f4,5'
     Serial:      '0075BCD15'
     Focal Len:   200 mm
     Focus Dist:  0 mm
     Aperture:    f/4.50
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x00000000
     Flags:       0x00000000

Serial: 123456789 is saved as in Lens Info Menu format

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3068
Re: Assign lens focal length and name for non cpu lenses
« Reply #263 on: December 20, 2017, 01:17:06 AM »
can you also update mlv_dump? it should show you the serial as plain number.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #264 on: December 20, 2017, 12:46:36 PM »
can you also update mlv_dump? it should show you the serial as plain number.
How do I do to recompile it? I can’t find it in any ml folder

dfort

  • Hero Member
  • *****
  • Posts: 2522
Re: Assign lens focal length and name for non cpu lenses
« Reply #265 on: December 20, 2017, 03:35:58 PM »
@aprofiti -- mlv_dump is in modules/mlv_rec
5D3.* 7D.* 700D.115 EOSM.* EOSM2.103

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #266 on: December 20, 2017, 10:44:03 PM »
@aprofiti -- mlv_dump is in modules/mlv_rec

I get this: (OSX)

Code: [Select]
PCAlessandro:mlv_rec alex$ make mlv_dump
[ HOST_CC  ]   mlv_dump.host.o
clang: error: unknown argument: '-mno-ms-bitfields'
make: *** [mlv_dump.host.o] Error 1

Danne

  • Hero Member
  • *****
  • Posts: 3685
Re: Assign lens focal length and name for non cpu lenses
« Reply #267 on: December 21, 2017, 12:38:04 AM »
Try follow these steps
http://www.magiclantern.fm/forum/index.php?topic=16012.0

Your issue is related to clang and gcc.

dfort

  • Hero Member
  • *****
  • Posts: 2522
Re: Assign lens focal length and name for non cpu lenses
« Reply #268 on: December 21, 2017, 03:31:06 AM »
@aprofiti -- Cut to the chase (for Mac OSX):

...make a new file called Makefile.user and put in just these lines:

Code: [Select]
#
# Host compiler settings
#
HOST_CC=gcc-5
HOST_LD=gcc-5
HOST_AR=$(shell which ar)

Warning: DON'T EDIT Makefile.user.default -- Put the changes you want to make to Makefile.user.default in your Makefile.user file. Think of this as a way to customize the Magic Lantern build environment without modifying the code.
5D3.* 7D.* 700D.115 EOSM.* EOSM2.103

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #269 on: December 21, 2017, 05:01:45 AM »
Thank you Danne and dfort!

Here it is:
Code: [Select]
Block: LENS
  Offset: 0x000001f0
  Number: 7
    Size: 96
    Time: 8.662000 ms
     Name:        'Pentax SMC 80-200mm f4,5'
     Serial:      '0075BCD15' (123456789)
     Focal Len:   200 mm
     Focus Dist:  0 mm
     Aperture:    f/4.50
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x00000000
     Flags:       0x00000000

With no valid serial in mlv file:
Code: [Select]
Block: LENS
  Offset: 0x000001f0
  Number: 7
    Size: 96
    Time: 9.048000 ms
     Name:        'Pentax SMC 80-200mm f4,5'
     Serial:      '' (no valid S/N)
     Focal Len:   200 mm
     Focus Dist:  0 mm
     Aperture:    f/4.50
     IS Mode:     0
     AF Mode:     3
     Lens ID:     0x0000001B
     Flags:       0x00000000
Good work g3gg0!


Little sneak peek: I'm trying to add submenus to be able to change aperture and focal length when using the lens; at the moment it works but can't retrive value from lens.focal_len to set starting value in menu and bounds for min and max. Hope I have time to finish in next days

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #270 on: December 22, 2017, 03:00:57 PM »
Added possibility to change value while using lens:



Could be nice to have direct access to submenu on keypress for a fast change of aperture and focal

Lars Steenhoff

  • Senior
  • ****
  • Posts: 322
Re: Assign lens focal length and name for non cpu lenses
« Reply #271 on: December 22, 2017, 04:28:06 PM »
Yea easy access button would be good,
one way you could already do it is to add these manual lens scripts to "my menu"
 and let "my menu" be the fist menu that comes up when pressing menu.

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #272 on: December 23, 2017, 02:19:09 AM »
I'm checking last things to be able to close PR and I have found a problem when using f-number with a dot (ex. 2.8, 4.5 ...)
Value is written correctly in Lens Info, MLV and .xmp sidecar but not in Manual Lens submenu (but it works when setting value in submenu itself)... It set automatically aperture to 1.0 when menu is opened

After reading again ML Lua Documentation and digging deep in lua's source code, I have now understood how value for a submenu with attribute "choices" is set.

I believe the problem here is in function update_menu() when assigning aperture... It expect a String but when assigning from lenses[].manual_aperture it return a Number

Code: [Select]
lenses = {
     ....
    { name = "Portrait 85mm", focal_length = 85, manual_aperture = 2.8 },
    { name = "Portrait 105mm", focal_length = 105, focal_min = 105, focal_max = 105, manual_aperture = 4.5 },
}

-- f-number values in 1/2 Stop
Fnumbers = {"1.0","1.2","1.4","1.7","2","2.4","2.8","3.3","4","4.8","5.6","6.7","8","9.5","11","13","16","19","22","27","32"}

lens_menu = menu.new
{
    ...
    submenu =
    {
        ...
        {
            name    = "Aperture",
            help    = "Set Aperture to metadata",
            choices = Fnumbers,
            -- Update Aperture with selected value from submenu
            update = function(this)
                      if lensSelected == true then
                        lens.manual_aperture = tonumber(this.value)
                        update_xmp()
                      else
                        -- Reset menu value to the corrected one
                        this.value = lens.manual_aperture
                      end end,
            warning = function()
                        if lensSelected == false then
                          return "this value is not supported for non-manual lens"
                      end end,
        }
    },
    ...
}

-- Update the menu with values for Focal Length and Aperture from selected Lens
-- To be called when switching manual lens
function update_menu()
  ....
  lens_menu.submenu["Aperture"].value = lens.manual_aperture
end

I tried converting to string by using:
Code: [Select]
lens_menu.submenu["Aperture"].value = tostring(lens.manual_aperture)
Doesn't works... instead this works when aperture value chosen is in Fnumbers{}:
Code: [Select]
lens_menu.submenu["Aperture"].value = "2.8"
Someone can explain to me why can't get it working? I have also tried to merge into lua_fix to get latest fixes, but nothing usefull happened.

Question: Should I include also 1/3 stop values to Fnumbers? Currently if an aperture value of the lens isn't found in Fnumbers when opening Manual Lens submenu, it get set to first index (ex. aperture 4.5 not found -> set by script to 1.0)

[EDIT]
It's a problem of floating points rapresentation in lua:
Code: [Select]
1.4 -> 1.399999
2.8 -> 2.799999
4.5 -> 4.5 (ok)
5.6 -> 5.59999

aprofiti

  • New to the forum
  • *
  • Posts: 39
Re: Assign lens focal length and name for non cpu lenses
« Reply #273 on: December 29, 2017, 04:34:15 AM »
I have pushed pushed more changes to PR:
1. Values are automatically copied from lenses array when changing shooting mode (Need more testing. WIP: persist previusly selected aperture and focal length)
2. Added custom aperture value to choose from and auto lower bound for aperture
3. Fixed Focal length and aperture in LV

Know Issues:
1. [Solved] Lua's behavior has side effect on some decimal values, they can't be assigned in menu aperture field when script select lens. Values are saved correctly in metadata but they are overwritten when opening Manual Lens menu (see https://bitbucket.org/hudson/magic-lantern/issues/2824/wrong-rapresentation-of-decimal-numbes-in)
2. Apertute is changed to adapter's default value after pressing Shutter button in canon GUI when using lens with AF Chip

Can someone review it or better to test it on field? I have only one working AF adapter, so I need to know if others adapters return lens Name and focal length as script checks

Lars Steenhoff

  • Senior
  • ****
  • Posts: 322
Re: Assign lens focal length and name for non cpu lenses
« Reply #274 on: December 30, 2017, 12:47:54 AM »
Whats the AF confirm adapter you have?

I have to buy one, right now I have only passive adapters from novoflex.