Nico3478 Posted March 27, 2021 Report Posted March 27, 2021 Hi, The Saitek Radio Panel switchs do not work if I use a LUA function with the new SR22 Integra aircraft There is no error in log.txt DO NOT WORK xsaitekpanels.ini ; *********** BAT. MASTER Switch ***************** ;Bat Master Switch enable = 0 disable | = 1 default | = 2 remapable command | = 3 remapable datareference | = 4 remapable float datareference Bat Master Switch enable = 2 bat_master_switch_on_cmd = FlyWithLua/NBETBM9/Switch_Bat_On SR22.lua function Switch_Bat_On() if (SR22_switches_bat1 == 0) then command_once("afm/sr/cmd/switches/bat1_Toggle") end if (SR22_switches_bat2 == 0) then command_once("afm/sr/cmd/switches/bat2_Toggle") end end create_command("FlyWithLua/NBESR22/Switch_Bat_On", "SWITCH BAT ON", "Switch_Bat_On()", "", "") WORK OK xsaitekpanels.ini ; *********** BAT. MASTER Switch ***************** ;Bat Master Switch enable = 0 disable | = 1 default | = 2 remapable command | = 3 remapable datareference | = 4 remapable float datareference Bat Master Switch enable = 2 bat_master_switch_on_cmd = afm/sr/cmd/switches/bat1_Toggle Thanks for your help Nicolas Quote
Coop Posted March 28, 2021 Report Posted March 28, 2021 I'm not sure what `SR22_switches_bat2` refers to in your code, but afm/sr/cmd/switches/bat1_Toggle and afm/sr/cmd/switches/bat2_Toggle are correct commands Quote
Pils Posted March 28, 2021 Report Posted March 28, 2021 (edited) 5 hours ago, Nico3478 said: create_command("FlyWithLua/NBESR22/Switch_Bat_On", "SWITCH BAT ON", "Switch_Bat_On()", "", "") @Nico3478 Have you considered that you named the command FlyWithLua/NBESR22/Switch_Bat_On but are calling it as FlyWithLua/NBETBM9/Switch_Bat_On? @Coop Are there non-toggle commands? I.e. One for each absolute switch position? E.g. bat1_On, bat1_Off, etc. This makes this kind of integration with hardware much easier as it doesn’t require testing the state of datarefs from Lua scripts. Edited March 28, 2021 by Pils Quote
Nico3478 Posted March 28, 2021 Author Report Posted March 28, 2021 Hi, Thanks a lot ! It's a copy/paste error made at 2 am It's ok now but i have a weird noise every time i run an order from a yoke, the bravo quadrant or the saitek switch panel the noise is very present and looks like a vibration Nicolas Quote
Coop Posted March 28, 2021 Report Posted March 28, 2021 11 hours ago, Pils said: @Coop Are there non-toggle commands? I.e. One for each absolute switch position? E.g. bat1_On, bat1_Off, etc. This makes this kind of integration with hardware much easier as it doesn’t require testing the state of datarefs from Lua scripts. Yes, every two-way switch should have toggle, on, and off commands. 1 Quote
Pils Posted March 31, 2021 Report Posted March 31, 2021 (edited) On 3/28/2021 at 6:29 AM, Nico3478 said: It's ok now but i have a weird noise every time i run an order from a yoke, the bravo quadrant or the saitek switch panel I also have a weird noise when using commands from the Saitek switch panel. It's like a creaking sound, very odd. Sound recording attached. ;command for battery master switch on command bat_master_switch_on_cmd = afm/sr/cmd/switches/bat1_On ;command for battery master switch off command bat_master_switch_off_cmd = afm/sr/cmd/switches/bat1_Off ;command for battery master switch on command2 bat2_master_switch_on_cmd = afm/sr/cmd/switches/bat2_On ;command for battery master switch off command2 bat2_master_switch_off_cmd = afm/sr/cmd/switches/bat2_Off The same sound will also play out for any switch on the Alpha (or probably anything) that's assigned to sim/none/none a.k.a Do nothing. Might be the regular switch sample repeated/distorted? Not sure, to be honest. P.S. Oddly the On/Off commands don't show up in DataRefTool which is maybe why OP didn't find them. Recording.m4a Edited March 31, 2021 by Pils Quote
Pils Posted March 31, 2021 Report Posted March 31, 2021 On 3/28/2021 at 6:29 AM, Nico3478 said: the noise is very present and looks like a vibration @Nico3478In the meantime I suggest using the datarefs for the switches, which are used by RealSimGear and are available for reference in CommandMapping.ini. One downside is they don't trigger the nice switch sounds. Hopefully something TorqueSim can look at. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.