Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Jip-Hop

#1
Scripting Q&A / Double Press issues
July 11, 2019, 05:25:34 PM
This script should disable all keys, and log if there was a single or double keypress within 3 seconds.
When you run this script, I'd expect you'd be unable to navigate out of the menu.
Single presses are ignored.
But when you double press, it responds as a single press...
How's that possible with return false on all key events?

-- Double Press
-- Not working

key_counter = 0
function check_double_press()
    sleep(3)
    if(key_counter == 2) then
        -- Double press
        display.notify_box(tostring(key_counter))
    elseif(key_counter == 1) then
        -- Single press
        display.notify_box(tostring(key_counter))
    end
    key_counter = 0
    return false
end

event.keypress = function(k)

    key_counter = key_counter + 1
    if(key_counter == 1) then
        task.create(function()
            check_double_press()
        end)
    end   

    -- Don't respond to any keys
    return false

end
#2
Scripting Q&A / Slow to close ML menu
July 09, 2019, 01:31:12 PM
When I close the ML menu from a script, it flashes first, then closes but briefly shows a slider with "Darker" and "Brighter" on each end (I guess it's the exposure compensation slider) and then goes to Live View. It's quite slow, almost 2 seconds on my EOS M with Danne's crop_rec_4k_mlv_snd_isogain_1x3_presets_2019Jul01.EOSM202.

But when I'm in the ML menu, pressing the canon MENU button goes back to Live View instantly! How can I instantly quit the ML menu and go to Live View from a LUA script?

-- INFO key menu

event.keypress = function(k)
    -- Check if INFO key is pressed
    if k == KEY.INFO then
        menu.close();
        return false;
    end
end
#3
I'm trying to make a script which will allow me to manually focus all the time, or one shot autofocus by half pressing the shutter button.
It's for my EOS M with native EF-M lenses.

I thought I'd just set the camera to MF mode in Canon menu, and trigger a lens.autofocus() from LUA and it would autofocus.
But clearly calling lens.autofocus() in MF mode doesn't work.

So I'm stuck and see two ways out.
I could switch temporarily from MF to AF mode when half pressing the shutter, call lens.autofocus() and switch back to MF.
But in the API I don't see any way to switch these modes.
I did read there's a dangerous option to set Canon properties, but didn't find the API to do so (and frankly I don't know if I dare to risk soft bricking the camera xD).

Another option would be to detect turning the focus ring when staying AF mode.
And then implement manual focusing in LUA, but seems like more work and I'd rather rely on the Canon MF implementation.

I thought this was going to be an easy fix xD

By the way, there's the AF+MF mode.
But MF is only allowed after an autofocus operation while the half shutter is still pressed.
So that's not true MF if you ask me.
Perhaps I could trick the camera in staying in the post-AF state, which would allow MF, and start a new AF operation on half shutter press?

-- AF KEY in MF mode 

-- Half press shutter button to autofocus if in manual focus mode

function try_af()
    local focus_lock = lens.autofocus();
    if focus_lock == true then
        display.notify_box("LOCKED ON");
    else
        display.notify_box("NO LOCK");
    end
end

event.keypress = function(key)
    if key == KEY.HALFSHUTTER then

        -- TODO: check if there's no chipped lens
        -- In that case toggle magic zoom for manual focus
        -- Maybe use CHIPPED_LENS constant?

        -- Handle key as usual in AF mode
        if lens.af == true then
            return true;
        end

        task.create(try_af);

        return false;
    end
end