Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

After failing to be able to use acceleration on my Heading rotary , I have tried to make it toggle between 1 deg steps and 10 deg steps by pressing the button on the rotary.

It's for the Aerosoft Airbus and there is a script for toggling the ALT but not the HDG.  Therefore I copied the ALT script and adjusted to toggle the HDG  but  can't get it to toggle.

Here is the relevant section...  much obliged if someone can help...

AB_HDGSTEP_set

function AB_HDG_Step_tog ()
         var = ipc.readLvar("AB_HDGSTEP_set")
    if var == 1 then
        AB_HDG_Step_1 ()
    else
        AB_HDG_Step_10 ()
    end
end

function AB_HDG_Step_1 ()
         LVarSet = ("AB_HDGSTEP_set")
         ipc.writeLvar(LVarSet, 0)
    Anim = ("AB_AP_HDG_Knob_Ani")
    ipc.writeLvar(Anim, 1)
    ipc.sleep(30)
    ipc.writeLvar(Anim, 0)
end

function AB_HDG_Step_10 ()
         LVarSet = ("AB_HDGSTEP_set")
         ipc.writeLvar(LVarSet, 1)
    Anim = ("AB_AP_HDG_Knob_Ani")
    ipc.writeLvar(Anim, -1)
    ipc.sleep(30)
    ipc.writeLvar(Anim, 0)
end

eb01db8b96357d10cd27f7116b416bf6.png

....and the log

598dc7e21a4b75e47e56dce62fd04383.png

 

The button animation doesn't toggle either (as an indication) but does work both ways in/out if set manually in the script.

 

AB_Triple_HDG.lua

Everything else works great...   press Twice for heading set mode  and press longer for heading managed mode

Edited by aerostar

                        mustang_banner_newstar2777.png

 


 
 
 
 
  • Author

Apologies for messing the Log was trying different things then editing my post... 

I have stripped out the unnecessary parts and this is the part that's not toggling/switching...  I have posted the corresponding Log

where it can be seen that on    button flag 4    it always stays at    ' AB_HDG_Step_10'

I have also included the full  Lua file attached...   not very big.

 

e3bbb65b29f00767f3896fa2a0df13f3.png

 

9206489cbe7cce08adbe5dbaa4a13c87.png

 

Here is the Lua file -              AB_Triple_HDG.lua

 

Ian

                        mustang_banner_newstar2777.png

 


 
 
 
 

Are you sure about this LVar name, AB_HDGSTEP_set ? I took a quick look at the LINDA file for the Airbus and the ALT functions you seem to have replicated address an LVar called AB_AP_ALTSTEP. If you are sure, then I would try checking for var ~= 0 in place of var == 1.

MarkH

https://www.youtube.com/@AlmostAviation
AMD Ryzen 7 9800X3D / 64Gb DDR5 / Zotac RTX 5070 Ti / 2560 x 1440 display

  • Author

Hi Mark,  thank you thank you...   I have replaced the   AB_HDGSTEP_set    with the     AB_AP_ALTSTEP     LVar  and now it toggles  and works good...   now the only thing is when I toggle the  HDG step  it also toggles the ALT step   as they are now sharing the same LVar...     I think  that means that I need to properly define the  AB_HDGSTEP_set   LVar as it's probably not being recognised,   I created it.   I thought by naming it and giving it a value outside the Function that would define it.   

I also changed the   ==    to    ~=      

Can I ask how I should define the LVar   AB_HDGSTEP_set    so that it is recognised and usable   ?

Thanks again, 

Ian

                        mustang_banner_newstar2777.png

 


 
 
 
 
9 hours ago, aerostar said:

Can I ask how I should define the LVar   AB_HDGSTEP_set    so that it is recognised and usable   ?

Oh I see, you are defining this variable yourself. If you were using LINDA, you could create persistent local Lua variables like you have done here. That's because a LINDA Lua program stays running so all its module-level variables are persistent. But if you're just using plain old FSUIPC Lua, each Lua file is a separate program that runs and terminates when you bind it to a key or event. This means its local variable don't persist. But you can create persistent variables with the ipc.set() library function and read them from other Lua programs with ipc.get(). These aren't the same as LVars, which are variables defined inside of XML gauges.

MarkH

https://www.youtube.com/@AlmostAviation
AMD Ryzen 7 9800X3D / 64Gb DDR5 / Zotac RTX 5070 Ti / 2560 x 1440 display

  • Author

Whoopee...   thanks again Mark,  using    ipc.get    and   .set   works a treat,  it's now all working...   can't figure how the   AB_AP_ALTSTEP    worked though as it is using    readLvar   and   writeLvar  ...

Now I may try and figure a way to get some kind of    Rotary Acceleration   working and then I wouldn't even need the button toggle which would free up another button...    do you use    Rotary Acceleration   and if so, what method do you use...

I hope I'm not over stepping with my questions...   

once again though ,  thank you Mark for your help...

Ian

 

                        mustang_banner_newstar2777.png

 


 
 
 
 
40 minutes ago, aerostar said:

do you use    Rotary Acceleration   and if so, what method do you use...

No, I use pretty much the same method as you. The only difference is I set my toggle variable on and off in the button down and button up events for the rotary control's push button. So the push button acts like a SHIFT key. Now I can have slow increments if I just turn the knob, but fast increments if I push and turn it at the same time. Something like this (each of these functions will need to be a separate Lua file):

function Rotary_Shift_ON()  -- Call from the button-down event of the push switch
    ipc.set("RotaryShiftActive", 1)
end

function Rotary_Shift_OFF()  -- Call from the button-up event of the push switch
    ipc.set("RotaryShiftActive", 0)
end

function HDG_Bug_Inc()
    if ipc.get("RotaryShiftActive") == 1 then
        for n = 1, 10 do
            ipc.control(65879)  -- Increment the HDG bug
        end
    else
        ipc.control(65879)
    end
end

function HDG_Bug_Dec()
    if ipc.get("RotaryShiftActive") == 1 then
        for n = 1, 10 do
            ipc.control(65880)  -- Decrement the HDG bug
        end
    else
        ipc.control(65880)
    end
end

 

MarkH

https://www.youtube.com/@AlmostAviation
AMD Ryzen 7 9800X3D / 64Gb DDR5 / Zotac RTX 5070 Ti / 2560 x 1440 display

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.