50 char limit for lmc_xpl_command?

Report any bugs or suspicious behaviour here
Post Reply
keithm
Posts: 4
Joined: 09 Jul 2020, 18:07

50 char limit for lmc_xpl_command?

Post by keithm » 09 Jul 2020, 18:30

Hi,

I'm having an issue with the commands with some buttons on the the zibo 737 not working.

My script is:

Code: Select all

gs_commands={}
gs_commands[112]='laminar/B738/EFIS_control/capt/map_mode_dn'   -- F1
gs_commands[113]='laminar/B738/EFIS_control/capt/map_mode_up'   -- F2
gs_commands[114]='laminar/B738/EFIS_control/capt/map_range_dn'   -- F3
gs_commands[115]='laminar/B738/EFIS_control/capt/map_range_up'   -- F4
gs_commands[116]='laminar/B738/EFIS_control/capt/push_button/tfc_press'   -- F5
gs_commands[117]='laminar/B738/EFIS_control/capt/push_button/wxr_press'   -- F6
gs_commands[118]='laminar/B738/EFIS_control/capt/push_button/sta_press'   -- F7
gs_commands[119]='laminar/B738/EFIS_control/capt/push_button/wpt_press'   -- F8
gs_commands[120]='laminar/B738/EFIS_control/capt/push_button/arpt_press'   -- F9
gs_commands[121]='laminar/B738/EFIS_control/capt/push_button/data_press'   -- F10
gs_commands[122]='laminar/B738/EFIS_control/capt/push_button/pos_press'   -- F11
gs_commands[123]='laminar/B738/EFIS_control/fo/push_button/terr_press'   -- F12

function gs_handler(button, direction, ts, flags, makecode)
    print('Callback for device: button ' .. button .. ', direction '..direction..', ts '..ts..', flags '..flags)
    if direction == 1 then
        com = gs_commands[button]
        if (com ~= nil) then
          print('Calling XPL command ' .. com)
          lmc_xpl_command(com)
        end
        return true  -- handled
    end
end
The commands work when I use the keyboard settings in X-Plane so I enabled logging and saw lines like these

Code: Select all

2020-07-09 17:45:58:254 [XPLLUMplugin 20220]: XPL doesn't know command laminar/B738/EFIS_control/capt/push_button/tfc_pre
2020-07-09 18:14:18:140 [XPLLUMplugin 20220]: XPL doesn't know command laminar/B738/EFIS_control/capt/push_button/arpt_pr
So I noticed the command string for buttons that don't work are being truncated. After checking a few other long commands I realised the last char for the command in the log file is the 50th.
Is this a deliberate limit or have I found a bug? I was going to open an issue on github but wanted to check first.

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: 50 char limit for lmc_xpl_command?

Post by admin » 10 Jul 2020, 07:47

Good catch, yes, open the issue, here's the limit: https://github.com/me2d13/luamacros/blo ... on.pas#L75
Petr Medek
LUAmacros author

keithm
Posts: 4
Joined: 09 Jul 2020, 18:07

Re: 50 char limit for lmc_xpl_command?

Post by keithm » 11 Jul 2020, 10:45

I've just created the issue
https://github.com/me2d13/luamacros/issues/44

btw, just want to say LuaMacros is a great program and interesting and cool (in a geeky way :) ) to see someone use pascal which I used to first learn programming!

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: 50 char limit for lmc_xpl_command?

Post by admin » 13 Jul 2020, 22:25

Download luamacros again, should be fixed.
Don't forget to update xpl plugin as well.
Petr Medek
LUAmacros author

keithm
Posts: 4
Joined: 09 Jul 2020, 18:07

Re: 50 char limit for lmc_xpl_command?

Post by keithm » 15 Jul 2020, 19:29

That works. Thanks!

Post Reply