Simulated Q Button for EOSM

Started by garry23, January 05, 2017, 09:27:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

Although the EOSM is rather limited in the number of buttons, many say this is made up for via the touch screen.

Maybe: but if you have 'fat fingers' or just like using buttons (like me), you may like to try this small helper script.

All it does is convert one of the EOSM buttons into a Q button: I use [INFO].

To use, simply put in the script folder, make sure Lua module is running and the script is in autorun mode.

The [INFO] is only switched to be a simulated [Q] when the ML menu is active: at all other times [INFO] acts like [INFO].

You can easily change KEY.INFO to, say, KEY.PLAY if you wish - your choice :)

With the script running, it is very easy to move through the ML menu on the EOSM simply using the main wheel and the [INFO/Q] button.

Usual caveats: works for me and I provide no guarantees  ;)

Cheers

Garry

q_pressed = false

function sim(arg)
if q_pressed == true and menu.visible then
key.press(KEY.Q)
q_pressed = false
return false
else
return true
end
end

function test4Q(key)
    if key == KEY.INFO and menu.visible then
q_pressed = true
return false
else
return true
end
end

event.keypress = test4Q
event.shoot_task = sim

DeafEyeJedi

Hell yeah @garry23 this one is smoking hot!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

Licaon_Kter

I find Q ok, but nice LUA script reference. Thanks

garry23

@Licaon_Kter

I agree the EOSM [Q] button gets you into the ML menus OK, but because on the EOSM the [Q] is also the [SET], you can't use that button to go backwards/out of the ML menus.

By simulating the Q on, say, the [INFO], you can go in/out of the ML menus.

The 'beauty' of the script is that this functionality only works when you need it, ie at all other times you have [INFO] or another button to sim [Q], operating as normal.

I must say, being able to move around the ML menu with the simulated [Q] greatly speeds up my access/control of the ML menus on the EOSM. Previously I found I was often missing the touch-Q, eg fat/cold fingers.

Cheers

Garry

a1ex

Reformatted the script a bit:


-- Open ML submenus with INFO
-- This script remaps the INFO button to [Q] when ML menu is active.

function remap_info_to_q(key)
  if key == KEY.INFO and menu.visible then
    key.press(KEY.Q)
    return false
  else
    return true
  end
end

event.keypress = remap_info_to_q


Changes:
- first comment line is what appears in menu
- second line appears in menu as help text (description)
- use spaces for indentation (tabs width may be different in other editors)
- renamed the event handler
- removed the shoot_task hook (discussed here)


garry23

@A1ex

Once again: many thanks for your time.

I had noticed the indent 'problem' and will use spaces in future if I can. I'm currently using Visual Studio Code as my editor.

Now I know I can use key.press inside an event.keypress function (up until now I thought I couldn't as I thought it might create a 'recursive' situation), I will fix that in my other scripts.

Bottom line: I really appreciate you and others spending time mentoring/coaching us 'newbies'.

a1ex

Quote from: garry23 on January 13, 2017, 09:59:44 AM
Now I know I can use key.press inside an event.keypress function (up until now I thought I couldn't as I thought it might create a 'recursive' situation), I will fix that in my other scripts.

Canon's GUI code (where this event is placed) uses a message queue. Calling key.press will put a new message (a key event) in the queue, so the keypress hook will be called again, after the first one exits.

FGP

Hello guys, I tried to use this script but it does not seem to work with the last build :/
I tried both versions, the second versions is bring an error in LUA script.

Also, using the LUA script makes it a bit slower to start the EOS-M, so I think I will finally pass on that.
Too bad this is not implemented in the build fore EOS-M though.

Just reporting ;)

a1ex

Quote from: FGP on February 23, 2018, 02:37:20 PM
Too bad this is not implemented in the build for EOS-M though.

Please try the experimental lua_fix build (it uses a long SET/Q press to open submenus), and report back if you want this feature in mainline (since I need to know how well it works in order to include it).

garry23

@FPG

As @a1ex says, try the latest experimental build, the long press works well  :)

Also, the original script was written for the EOSM back then and did work, but the Lua module evolves and scripts can become 'broken'.

I have suggested that there be a Lua version data field, that script writers can access, ie to ensure older builds are not used. But with all the other development needs, this is hardly a priority item for the developers.


Jip-Hop

I was wondering about the Q button and if there's still the need for this script in Dannes builds for the EOS M.
But it's a bit tricky searching the thread for Q button when "Each word must be at least two characters long".
With the play button I can enter and exit submenu's in ML menu.

Walter Schulz

Enter this in google:
"eos m" "q button" site:magiclantern.fm/forum
"" = match string
site: = restrict to given location (and sub URLs)

Jip-Hop

Clever!
Found this thread https://www.magiclantern.fm/forum/index.php?topic=15681.new#new

I understand now where my confusion comes from. I kept seeing the Q button (which is also the SET button) in the ML interface but now I understand it's remapped to the play button while in ML menu.

a1ex

Indeed, the EOS M could use a different icon, as PLAY is now the primary way of opening submenus on this camera. See e.g. here for how it was done on other models without a Q button.

This change (PLAY button for submenus) was done with EOS M in mind, but it was applied to all models (alongside the real Q button, where present).

Jip-Hop


ichthys

Quote from: a1ex on January 13, 2017, 09:43:59 AM
Reformatted the script a bit:


-- Open ML submenus with INFO
-- This script remaps the INFO button to [Q] when ML menu is active.

function remap_info_to_q(key)
  if key == KEY.INFO and menu.visible then
    key.press(KEY.Q)
    return false
  else
    return true
  end
end

event.keypress = remap_info_to_q


Changes:
- first comment line is what appears in menu
- second line appears in menu as help text (description)
- use spaces for indentation (tabs width may be different in other editors)
- renamed the event handler
- removed the shoot_task hook (discussed here)

Fixed a bug with your code. You are using 'key' as the function parameter to remap_info_to_q which overloads the global 'key' module.


-- Open ML submenus with INFO
-- This script remaps the INFO button to [Q] when ML menu is active.

function remap_info_to_q(pressed_key)
  if pressed_key == KEY.INFO and menu.visible then
    key.press(KEY.Q)
    return false
  else
    return true
  end
end

event.keypress = remap_info_to_q

garry23

@ichthys

As that post was originated by me, but tweaked by @a1ex I'll restrict my comment to within my ignorance.

I thought variables listed in a function call were defined as local.

But, I'm most probably wrong, as my ignorance continues to grow as a learn more about Lua 😀

ichthys

@garry23

Variables are local. The problem is that by defining a local variable/parameter 'key' you then cannot refer to the global 'key' to do: key.press(KEY.Q).

By doing key.press(KEY.Q) you are trying to refer to the local variable 'key' and call the method .press() which doesn't exist for that local parameter.

garry23

@ichthys

I think I see what you are saying and, of course, that post is old.

I personally would now not call key.press inside the key event handler.

Instead I would set a flag and call key.press in, say, the shoot_task event handler, as I do in my MUSIC script, https://gist.github.com/pigeonhill/7b02d3dcadddbc703940778d74cd7af2?ts=4