LUAMacros Get/SetVariable in XPlane11 doesn't work with Laminar Datarefs

Report any bugs or suspicious behaviour here
mcapp
Posts: 3
Joined: 07 Jul 2020, 17:38

Re: LUAMacros Get/SetVariable in XPlane11 doesn't work with Laminar Datarefs

Post by mcapp » 07 Jul 2020, 17:48

Hi,
I made a FMC keyboard and display that I use with Xplane 11.50b13 - Zibo (3.42.16).
To interface this hardware I use LuaMacros and WebFMC.
I add that checking with quickstart.lua I have all the keys ok and in the recent past this "FMC" worked ok with ZIBO, i.e. no problem with /LuaMAcro and related to keyboard.
Having said that, at present I have A, B, C, F, G, H keys not working with ZIBO, pls note that all others keys work correctly.
Here follows what I have done as first debug and what happens:
1) check with Dataref tool - all dataref involved were correct;
2) even if dataref were correct I have substituted the previous ones with the present ones;
3) A, B, C, F, G, H keys still not working with ZIBO.
I am attaching part of the file I use with LuaMacros.

-- assign logical name to macro keyboard FMC
lmc_assign_keyboard('MACROS');
-- define callback for whole device
lmc_set_handler('MACROS',function(button, direction)
if (direction == 1) then return end -- ignore down
if (button == 193) then lmc_xpl_command('laminar/B738/button/fmc1_period')
......
elseif (button == 35) then lmc_xpl_command('laminar/B738/button/fmc1_F')
elseif (button == 37) then lmc_xpl_command('laminar/B738/button/fmc1_G')
elseif (button == 36) then lmc_xpl_command('laminar/B738/button/fmc1_H')
......
elseif (button == 34) then lmc_xpl_command('laminar/B738/button/fmc1_A')
elseif (button == 39) then lmc_xpl_command('laminar/B738/button/fmc1_B')
elseif (button == 33) then lmc_xpl_command('laminar/B738/button/fmc1_C')
......
end
end)

Thank you in anticipation for your help!
Kind Regards
Marco

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

Re: LUAMacros Get/SetVariable in XPlane11 doesn't work with Laminar Datarefs

Post by admin » 08 Jul 2020, 07:48

I would do some debugging to see what doesn't work.
Is that if-branch called for your key? If you replace that lmc_xpl_command with some debug print - is it printed?
So you realize if the condition is problem (wrong key number) or the xpl command.
If xpl command is called but doesn't work, try to issue that command from single script - without any callbacks, just mark that code and hit run.
Still doesn't work - try the same command from different "source" - map it to joystick button, use xlua or some other tool that can fire xpl commands.
Petr Medek
LUAmacros author

mcapp
Posts: 3
Joined: 07 Jul 2020, 17:38

Re: LUAMacros Get/SetVariable in XPlane11 doesn't work with Laminar Datarefs

Post by mcapp » 08 Jul 2020, 18:12

Hi Petr,
thank you for your prompt reply.
I try to give you more information even if my knowledge about this programming language is far from your level.
1) as you can see from the list that follows I use a lot of "lmc_xpl_command" to address the related "laminar/B738/button/fmc1_ ...." keys;
2) all the keys work but A, B, C, F, G, H keys;
3) when I check the dataref I find that the ones related to A, B, C, F, G, H keys are correct;
4) if under luamacros I load the list hereafter and I press the luamacros execute button I can identify the second keyboard even if I press one of these trouble keys, I mean one of A, B, C, F, G, H keys;
5) if I load quickstart.lua I can positively check all the key, i.e. A, B, C, F, G, H keys too;
6) talking about WebFMC you know that with this software we can have a browser page showing only the FMC display or the FMC display plus the FMC keyboard too. When I choose the FMC display plus the FMC keyboard if I press one of the A, B, C, F, G, H keys it works correctly, I mean the related dataref is correctly called and I get the result in the FMC display.
Of course this is not the way I need to implement my FMC since I have a physical FMC with its keyboard and your LuaMAcros is perfect to this solution.
Hoping this can help your debugging I do thank you for your help!
Kind Regards
Marco






-- assign logical name to macro keyboard FMC
lmc_assign_keyboard('MACROS');


-- define callback for whole device
lmc_set_handler('MACROS',function(button, direction)
if (direction == 1) then return end -- ignore down

-- riga 1 dal basso parto da sx
if (button == 193) then lmc_xpl_command('laminar/B738/button/fmc1_period')
elseif (button == 188) then lmc_xpl_command('laminar/B738/button/fmc1_0')
elseif (button == 117) then lmc_xpl_command('laminar/B738/button/fmc1_minus')
elseif (button == 75) then lmc_xpl_command('laminar/B738/button/fmc1_Z')
elseif (button == 187) then lmc_xpl_command('laminar/B738/button/fmc1_SP')
elseif (button == 73) then lmc_xpl_command('laminar/B738/button/fmc1_del')
elseif (button == 56) then lmc_xpl_command('laminar/B738/button/fmc1_slash')
elseif (button == 221) then lmc_xpl_command('laminar/B738/button/fmc1_clr')

-- riga 2 dal basso parto da sx
elseif (button == 189) then lmc_xpl_command('laminar/B738/button/fmc1_7')
elseif (button == 191) then lmc_xpl_command('laminar/B738/button/fmc1_8')
elseif (button == 222) then lmc_xpl_command('laminar/B738/button/fmc1_9')
elseif (button == 192) then lmc_xpl_command('laminar/B738/button/fmc1_U')
elseif (button == 186) then lmc_xpl_command('laminar/B738/button/fmc1_V')
elseif (button == 80) then lmc_xpl_command('laminar/B738/button/fmc1_W')
elseif (button == 48) then lmc_xpl_command('laminar/B738/button/fmc1_X')
elseif (button == 219) then lmc_xpl_command('laminar/B738/button/fmc1_Y')

-- riga 3 dal basso parto da sx
elseif (button == 32) then lmc_xpl_command('laminar/B738/button/fmc1_4')
elseif (button == 86) then lmc_xpl_command('laminar/B738/button/fmc1_5')
elseif (button == 116) then lmc_xpl_command('laminar/B738/button/fmc1_6')
elseif (button == 65) then lmc_xpl_command('laminar/B738/button/fmc1_P')
elseif (button == 8) then lmc_xpl_command('laminar/B738/button/fmc1_Q')
elseif (button == 81) then lmc_xpl_command('laminar/B738/button/fmc1_R')
elseif (button == 121) then lmc_xpl_command('laminar/B738/button/fmc1_S')
elseif (button == 120) then lmc_xpl_command('laminar/B738/button/fmc1_T')

-- riga 4 dal basso parto da sx
elseif (button == 235) then lmc_xpl_command('laminar/B738/button/fmc1_1')
elseif (button == 190) then lmc_xpl_command('laminar/B738/button/fmc1_2')
elseif (button == 27) then lmc_xpl_command('laminar/B738/button/fmc1_3')
elseif (button == 76) then lmc_xpl_command('laminar/B738/button/fmc1_K')
elseif (button == 118) then lmc_xpl_command('laminar/B738/button/fmc1_L')
elseif (button == 79) then lmc_xpl_command('laminar/B738/button/fmc1_M')
elseif (button == 57) then lmc_xpl_command('laminar/B738/button/fmc1_N')
elseif (button == 119) then lmc_xpl_command('laminar/B738/button/fmc1_O')

-- riga 5 dal basso parto da sx
elseif (button == 66) then lmc_xpl_command('laminar/B738/button/fmc1_prev_page')
elseif (button == 90) then lmc_xpl_command('laminar/B738/button/fmc1_next_page')
elseif (button == 35) then lmc_xpl_command('laminar/B738/button/fmc1_F')
elseif (button == 37) then lmc_xpl_command('laminar/B738/button/fmc1_G')
elseif (button == 36) then lmc_xpl_command('laminar/B738/button/fmc1_H')
elseif (button == 122) then lmc_xpl_command('laminar/B738/button/fmc1_I')
elseif (button == 220) then lmc_xpl_command('laminar/B738/button/fmc1_J')

-- riga 6 dal basso parto da sx
elseif (button == 109) then lmc_xpl_command('laminar/B738/button/fmc1_n1_lim')
elseif (button == 106) then lmc_xpl_command('laminar/B738/button/fmc1_fix')
elseif (button == 34) then lmc_xpl_command('laminar/B738/button/fmc1_A')
elseif (button == 39) then lmc_xpl_command('laminar/B738/button/fmc1_B')
elseif (button == 33) then lmc_xpl_command('laminar/B738/button/fmc1_C')
elseif (button == 49) then lmc_xpl_command('laminar/B738/button/fmc1_D')
elseif (button == 54) then lmc_xpl_command('laminar/B738/button/fmc1_E')

-- riga 7 dal basso parto da sx
elseif (button == 40) then lmc_xpl_command('laminar/B738/button/fmc1_menu')
elseif (button == 77) then lmc_xpl_command('laminar/B738/button/fmc1_legs')
elseif (button == 13) then lmc_xpl_command('laminar/B738/button/fmc1_dep_app')
elseif (button == 84) then lmc_xpl_command('laminar/B738/button/fmc1_hold')
elseif (button == 107) then lmc_xpl_command('laminar/B738/button/fmc1_prog')
elseif (button == 52) then lmc_xpl_command('laminar/B738/button/fmc1_exec')

-- riga 8 dal basso parto da sx
elseif (button == 18) then lmc_xpl_command('laminar/B738/button/fmc1_init_ref')
elseif (button == 111) then lmc_xpl_command('laminar/B738/button/fmc1_rte')
elseif (button == 70) then lmc_xpl_command('laminar/B738/button/fmc1_clb')
elseif (button == 12) then lmc_xpl_command('laminar/B738/button/fmc1_crz')
elseif (button == 38) then lmc_xpl_command('laminar/B738/button/fmc1_des')

-- colonna sx dal basso
elseif (button == 51) then lmc_xpl_command('laminar/B738/button/fmc1_6L')
elseif (button == 69) then lmc_xpl_command('laminar/B738/button/fmc1_5L')
elseif (button == 114) then lmc_xpl_command('laminar/B738/button/fmc1_4L')
elseif (button == 68) then lmc_xpl_command('laminar/B738/button/fmc1_3L')
elseif (button == 17) then lmc_xpl_command('laminar/B738/button/fmc1_2L')
elseif (button == 255) then lmc_xpl_command('laminar/B738/button/fmc1_1L')

-- colonna dx dal basso
elseif (button == 50) then lmc_xpl_command('laminar/B738/button/fmc1_6R')
elseif (button == 87) then lmc_xpl_command('laminar/B738/button/fmc1_5R')
elseif (button == 9) then lmc_xpl_command('laminar/B738/button/fmc1_4R')
elseif (button == 83) then lmc_xpl_command('laminar/B738/button/fmc1_3R')
elseif (button == 88) then lmc_xpl_command('laminar/B738/button/fmc1_2R')
elseif (button == 233) then lmc_xpl_command('laminar/B738/button/fmc1_1R')


end
end)

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

Re: LUAMacros Get/SetVariable in XPlane11 doesn't work with Laminar Datarefs

Post by admin » 09 Jul 2020, 07:52

Well I may try later myself if those commands work for me, otherwise I have nothing to add to my previous suggestions.
I don't think dataref editor helps here, commands and datarefs are two different things
Petr Medek
LUAmacros author

mcapp
Posts: 3
Joined: 07 Jul 2020, 17:38

Re: LUAMacros Get/SetVariable in XPlane11 doesn't work with Laminar Datarefs

Post by mcapp » 09 Jul 2020, 09:26

Hi Petr,
I made the check you suggested with print command.
I changed "lmc_xpl_command" with "print".
The result is: I obtain the msg "laminar/B738/button/fmc1_*" (where * is the character corresponding to the pressed key) for all the keys but A, B, C, F, G, H keys that print no msg.
At this point I made again a check to see if, for reasons not known to me, the wrong key number condition you suggested was the cause: yest it is.
Frankly speaking after no hardware change and at least one year of complete and right use of this keyboard I do not understand why this change but the wrong key number is definitely the cause.
I am going to correct these wrong key numbers to get all working right again.
Thank you and pls excuse me for this matter.
Kind Regards
Marco

Post Reply