Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello,

The Duckworks DC-3 Mod uses custom LVARs to control Throttle and Mixture.

i'm trying to control the LVAR L:DUCKWORKS_THROTTLE1_SET, with a hardware Axis.

I've tried using a LVAROffset to write to Offset 0XA000
[LvarOffsets]
0=L:DUCKWORKS_THROTTLE1_SET=UB0xA000.

And then assigned an axis to the Offset. Problem is that that Axis generates values from 0 to 100. The LVAR used by Duckworks needs values from 0.00 to 1.00.
I've tried making a LUA script to convert the value send by /100, but had no success.

 

Edit:

I've tried assigning the LVAR directly to the Axis and then convert the output from the Axis. This works when converting to 0-100

3=LV,256,F,M25:2,0,0,0,*-0.0030518, +50    -{ TO SIM: Macro DC3: L:DUCKWORKS_THROTTLE2_SET set }-

but not when multiplying with 0.000030518.

3=LV,256,F,M25:2,0,0,0,*-3.0518e-05    -{ TO SIM: Macro DC3: L:DUCKWORKS_THROTTLE2_SET set }-

And the same when assigning an Offset.


Could anyone help me getting this to work?

Kind Regards,
Andre

 

Posted
On 6/23/2023 at 6:32 PM, Andre92 said:

've tried assigning the LVAR directly to the Axis and then convert the output from the Axis. This works when converting to 0-100

3=LV,256,F,M25:2,0,0,0,*-0.0030518, +50    -{ TO SIM: Macro DC3: L:DUCKWORKS_THROTTLE2_SET set }-

but not when multiplying with 0.000030518.

3=LV,256,F,M25:2,0,0,0,*-3.0518e-05    -{ TO SIM: Macro DC3: L:DUCKWORKS_THROTTLE2_SET set }-

Why do you want to multiply by -0.000030518, and why are you adding 50 if the lvar value is between 0 and 1?  This seems rather strange - why not just multiply by 0.01 (i.e. divide by100)?

The easiest way to assign an axis to control an lvar is by using a preset. Create a preset in your myevents.txt file (create this file if not present) and add the following lines
    DuckWorks DC-3 Throttle1#$Param 100.0 / (>DUCKWORKS_THROTTLE1_SET)
    DuckWorks DC-3 Throttle2#$Param 100.0 / (>DUCKWORKS_THROTTLE2_SET)
    DuckWorks DC-3 Throttle#$Param 100.0 / s0 (>DUCKWORKS_THROTTLE1_SET) l0 (>DUCKWORKS_THROTTLE2_SET)

Then, in the axis assignment panel, check 'Send Preset to FS' and then select the preset name from the drop down on left hand side of the axis assignment panel.

'$Param 100.0 /' is RPN syntax that will take the axis input value (which goes from 0 to 100) and divides by 100 to get a value between 0 and 1 to then apply to the lvar. You can adjust as needed.

John

Posted

Hello John,

Thank you, once again, for your help.

Copying the supplied code into myevents.txt didn't work initially, but i played around with it and came up with a working solution.
The lines in myevents.txt now look like this:

DuckWorks-DC3_Throttle1#$Param 32768.0 / 0.5 + (>L:DUCKWORKS_THROTTLE1_SET)
DuckWorks_DC3_Throttle2#$Param 32768.0 / 0.5 + (>L:DUCKWORKS_THROTTLE2_SET)
DuckWorks_DC3_Throttle#$Param 32768.0 / 0.5 + s0 (>L:DUCKWORKS_THROTTLE1_SET) l0 (>L:DUCKWORKS_THROTTLE2_SET) 
DuckWorks-DC3_Mixture1#$Param 32768.0 / 0.5 + (>L:DUCKWORKS_Mixture1_SET)
DuckWorks_DC3_Mixture2#$Param 32768.0 / 0.5 + (>L:DUCKWORKS_Mixture2_SET)
DuckWorks_DC3_Mixture#$Param 32768.0 / 0.5 + s0 (>L:DUCKWORKS_Mixture1_SET) l0 (>L:DUCKWORKS_Mixture2_SET) 

I use a Honeycomb throttle and it generates values from -16384 to +16384. So by dividing with 32768, it outputs values -0.5 to +0.5. The +0.5 converts to range 0-1.
This works for me.

Thank you very much for your help.

 

Kind Regards,
Andre

Posted
18 minutes ago, Andre92 said:

I use a Honeycomb throttle and it generates values from -16384 to +16384. So by dividing with 32768, it outputs values -0.5 to +0.5. The +0.5 converts to range 0-1.
This works for me.

Yes, that makes sense - I just divided by 100.0 as I thought your axis values went from 0-100 as you said "Problem is that that Axis generates values from 0 to 100". Axis range  -16384 to +16384 is standard, and I usually use:
    $Param 16384 + 32768.0 / ...
but '$Param 32768.0 / 0.5 +' is the same.

Cheers,

John

 

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.