Jump to content
Sign in to follow this  
C2615

Q: How to implant and fine tune rotary acceleration?

Recommended Posts

I had a home made MCP with Rotary encoder as 2 button for flight, But with most LINDA module I've used (QW787\AS320), to set a HDG say some 100 away is painful.

In real aircraft, the MCP knobs will auto accelerate, allow much quicker setting when you rotate the knob fast, While PMDG did that inside their portion(I conncted PMDG with FSUIPC control so no LINDA invoved), they are tuned as real aircraft use a 36click pre loop encoder, while mine only had 20clicks per loop, so it's still need some fine tune.

Meanwhile, the FS/P3D's  own "acceleration" could stuck you in interval 10 forever, or just jump to 10 way too fast even when using with mousewheel.

 

I really didn't know much about lua, is there someone could came up a genius code that could detect the speed of rotation and make the interval change accordingly, with parameters to fine tune with? Thanks!

Share this post


Link to post
Share on other sites

Unfortunately, LINDA is not designed to work with rotary encoders as it needs discrete button-like actions (press/release) that can be detected by FSUIPC and passed to LINDA. The VRi MCP panels actually output a slow (+ or -) or fast (++ or --) signal that allows the _inc/_dec or _incfast/decfast functions to be actioned directly.

If you are detecting clicks/presses when the knob is rotated there may be a way of determining a single or multiple click to increase the rate of rotation. You would need to determine within the queue handler (in events.lua) whether you have a single click within a cycle or whether there are more than one click in the cycle and call the _inc or _incfast functions.

I hope this helps.


Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Share this post


Link to post
Share on other sites

Sorry this is late but here is what I programmed in the PMDG module for rotary speed. This is my heading rotary:

This is also assuming your rotary encoder is set up as a button press for increase and a button press for decrease.

 

Added Variables:

//////////////////////////////////////////////

local hdg_inc = 0
local hdg_dec = 0

 

 

 

functions:

//////////////////////////////////////

function HDG_INC()
 
    HDG_INC_TIME = ipc.elapsedtime()
    if mcp_hdg_mode == 1 then
 
        if (HDG_INC_TIME - hdg_inc) < 175 then
            local i
            for i = 1, 4 do ipc.control(PMDGBaseVar+390, PMDG_inc) end
         else
            ipc.control(PMDGBaseVar+390, PMDG_inc)
        end
 
     else
        NGX_AP_BANK_inc()
     end
 
   NGX_AP_HDG_show()
   hdg_inc = HDG_INC_TIME
 
end


function HDG_DEC()
 
    HDG_DEC_TIME = ipc.elapsedtime()
    if mcp_hdg_mode == 1 then
 
        if (HDG_DEC_TIME - hdg_dec) < 175 then
            local i
            for i = 1, 4 do ipc.control(PMDGBaseVar+390, PMDG_dec) end
        else
            ipc.control(PMDGBaseVar+390, PMDG_dec)
        end
 
    else
        NGX_AP_BANK_dec()
    end
 
    NGX_AP_HDG_show()
    hdg_dec = HDG_DEC_TIME
 
end

 

Hope this sends you in right direction,

Chris

 

 

Edited by Swamech
  • Like 1

Share this post


Link to post
Share on other sites
On 7/23/2020 at 12:42 PM, Swamech said:

Sorry this is late but here is what I programmed in the PMDG module for rotary speed. This is my heading rotary:

This is also assuming your rotary encoder is set up as a button press for increase and a button press for decrease.

///////////////////////

 

Hope this sends you in right direction,

Chris

 

 

So basicly the magic is " ipc.elapsedtime() ", am I right?

Thanks for the help

Share this post


Link to post
Share on other sites
On 7/25/2020 at 8:50 PM, C2615 said:

So basicly the magic is " ipc.elapsedtime() ", am I right?

Thanks for the help

Yes, you rotary speed has to compare the turning speed to something. You can adjust that of course by adjusting the 175 in the line   if (HDG_INC_TIME - hdg_inc) < 175 then

And no problem!

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...