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.

FSUIPC and rotary encoder "speed"

Featured Replies

Hi all-

 

Just bought FSUIPC as I'm building some small controllers.

 

One is a rotary encoder with a pushbutton set up to turn the heading bug on my HSI.

 

It works, but turns s l o w l y.

 

I can set it up to turn fast, but it jumps 10 degrees or so when I do that.

 

Is there a way I can tell FSUIPC to increase the speed based on how fast I'm turning the encoder?

 

Alternately... is there a way I can use the pushbutton to toggle between fast/slow (fine/course) tuning?

 

thanks!

Andrew

Here's how I do it with LINDA. Basically you set/reset a global variable on the push-switch UP and DOWN events. Then you check this in the events for rotating the knob left and right so you know whether to do a fast or slow operation. If you do this with the UP and DOWN events (rather than toggling the variable on the DOWN event) you can get fine adjustment when you just rotate the knob and coarse adjustment when you push and turn at the same time.

 

I use this for all my rotary controls and it works great. (LINDA has its own SHIFT functions, BTW, so you could do this without the global variable, but historically this didn't work very well so I did it myself.) You can see all my code by visiting my forum and downloading the Almost Aviation library. This is Lua code, so you can use it without LINDA with a few changes. (Mainly you will need to use FSUIPC's library functions to maintain the global 'SHIFT' variable.)

AAL_RotaryShiftActive = 0  -- This is public, so other modules can use the SHIFT
local BUG_MULTIPLIER = 10  -- Determines how fast to do coarse rotary knob adjustments

function AAL_Rotary_Shift_ON()
    AAL_RotaryShiftActive = 1
end

function AAL_Rotary_Shift_OFF()
    AAL_RotaryShiftActive = 0
end

function AAL_Heading_Bug_Left()
    local nSteps = 1
 
    if AAL_RotaryShiftActive == 1 then
        nSteps = BUG_MULTIPLIER
    end
 
    for n = 1, nSteps do
        _HEADING_BUG_DEC()
    end
end
 
function AAL_Heading_Bug_Right()
    local nSteps = 1
 
    if AAL_RotaryShiftActive == 1 then
        nSteps = BUG_MULTIPLIER
    end
 
    for n = 1, nSteps do
        _HEADING_BUG_INC()
    end
end

MarkH

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

  • 2 years later...

Hi... I have doubts that FSUIPC's button polling rates and Lua load-compile-test rates would be adequate for a dial instead of a button being pushed by a finger. I'd recommend looking at the new HID facilities for joysticks, just released today. FSUIPC 4.704 or 3.992 feature these (and WideClient 6.88). Download (from "Download Links" subforum) the latest Lua plug-ins documents and examples and see the "HidDemo" lua plug-in. That does a lot more than you'd need. You'd only need to read certain "axes", those corresponding to your dials. The rest could be left to normal methods.

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.