Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Scripting Q&A => Topic started by: garry23 on July 27, 2016, 07:45:28 AM

Title: KEY.PRESS & EOSM
Post by: garry23 on July 27, 2016, 07:45:28 AM
@David (if you are watching)

Forgive me if you answered this before, however, it appears that the KEY.RIGHT etc doesn't get picked up by the EOSM Lua.

I used this simple script to confirm the codes:

event.keypress = function(key)

--   print("You pressed a key: "..key)
if key ~= 0 then display.notify_box (key,3000) end
    return true
end


Keys such as PLAY and INFO return the key press constants as expected.

KEY.LEFT returns 1 and 2 when pressed on and off.

The other KEY directions, eg KEY.RIGHT etc, return nothing.

Is it that the direction KEYS simply don't work on the EOSM?

Cheers

Garry
Title: Re: KEY.PRESS & EOSM
Post by: garry23 on July 27, 2016, 08:14:26 AM
OK: I'm in my stupid mode again  >:(

This script is meant to show the key and NOT process the key's original function, ie return = FALSE

event.keypress = function(key)
if key ~= 0 then display.notify_box (key,3000) end
    return false
end


But on my EOSM, the key gets functioned as normal.

Can anyone spot what's going on?
Title: Re: KEY.PRESS & EOSM
Post by: garry23 on July 27, 2016, 08:18:39 PM
OK. My mistake  >:(

Code is OK...namelyevent.keypress = function(key)
if key ~= 0 then display.notify_box (key,3000) end
    return false
end


Further testing on the EOSM shows the following strangeness.

In ML mode (top/bottom bars on) the wheel-toggles down, right don't work and wheel-toggle left return 1 and 2.

In non-ML mode, eg Q menu etc wheel returns the correct key codes.

Something going on here  ???

Title: Re: KEY.PRESS & EOSM
Post by: a1ex on July 27, 2016, 09:00:17 PM
In shooting mode, the scrollwheels are used to adjust exposure settings (shutter, aperture), so they can't be used by ML (that's a limitation from Canon code).

In menus, they are used for navigation, so they send regular button-like events. That's the reason you see some Canon menu visible for a split-second when you open ML menu (that Canon menu sits behind ML menu and enables the scrollwheel events, the unpress event for SET, and it's usually well-behaved enough to let ML code draw over it).
Title: Re: KEY.PRESS & EOSM
Post by: garry23 on July 27, 2016, 09:07:32 PM
@Alex

Thanks for the insight.

Pity I can't use the toggle wheel in shooting mode, as on the EOSM we have limited buttons to use.

Once again, thanks for the education.

Cheers

Garry