LUA Module: Constants

Issue #2551 resolved
Garry George created an issue

The current LUA constant KEY.UNPRESS_UDLR appears to be coded as 20. I believe it should be 34.

Comments (9)

  1. David Milligan

    20 is correct, see module.h. The key codes are actually translated from camera specific codes from Canon firmware by ML core to "portable" ones (ones we defined ourselves) for modules. So if there is a problem, it is in the camera specific constants in ML core (platform/[cam]/const.h) for whatever particular camera you are talking about.

  2. Garry George reporter

    David I understand what you are saying, but I can confirm the following on my 5D3.

    I have noted the return codes when pressing the 5D3 toggle. All the codes, ie UP, DOWN, LEFT and RIGHT correspond/map to the CONSTANTS to the Lua constants KEY, except the UNPRESS.

    The LUA UNPRESS_UDLR returns 20, but if I look at the key press returned when I unpress on the 5D3 it is 34.

    If I use KEY.UNPRESS_UPDR in my Lua script, the script doesn't work, ie unpress not detected, but if I hard code 34 it does.



  3. Garry George reporter


    Looked at module.h. 34 maps to UNPRESS_DP.

    So maybe the 'education' for me is that I should use UNPRESS_DP to detect the canon toggle switch being unpressed and not UNPRESS_UDLR, which doesn't seem to work in my script.

  4. Garry George reporter

    Plus I have just compared 5D3 vs 50D.

    On the 50D the unpressing the multi function toggle returns a value of 20. On the 5D3 it returns 34, ie the value for UNPRESS_DP, not the value for UNPRESS_UDLR

  5. Alex

    Try commenting out BGMT_UNPRESS_DP in 5D3.113/gui.h (it's not used anywhere else, and it confuses the module key translation code, because both unpress codes are the same).

  6. Garry George reporter


    I got round the 'issue' in Lua by doing this: (key == KEY.UNPRESS_UDLR or key == KEY.UNPRESS_DP)

    I would need to recompile to comment out in 5D3.113/gui.h : not for me at the moment :-(

    BTW what should BGMT_UNPRESS_DP do?



  7. Log in to comment