Jump to content

Recommended Posts

Posted

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   

Posted

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

Posted (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 by Pils
Posted

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 :o

the noise is very present and looks like a vibration

Nicolas

Posted
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.

  • Like 1
Posted (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 :o

 

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 by Pils
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...