I use a simplistic approach via FSUIPC4 just using 2 switches for OFF and 50% .
First, from my C182.MCRO file, the L:Var you want to use is 66=L:PanelLightKnob=SET
That could also be CYCLIC when using a single switch.
To use an axis using SET, you will need to scale the axis input to cover that range.
A simple Lua script would suffice as is the case using LINDA.
The parameter expected is 0 to 100 for off to full on.
I don't use LINDA but instead prefer to ,use my own INI file edits and Lua scripts due to the
way I implement multiple "modes" for all my switches.
Here is a Lua script I use on the A2A 180 for controlling the
Mixture with an axis. This code could be used for the lighting knob
by simply changing the variable names as needed.
First, the axis is sent to an Offset in FSUIPC4. I use 0x66D0 below. It
is one of the user-defined offsets in the range of p0x66C0 to 0x66FF.
A change of the value in that location triggers the Lua function. The
input is read and scaled and sent to the L:variable. I also display the
value sent (0 to 100) for 1 second if the current value changes more than +/- 0.5 from
the previous value to prevent the display from happening when there is a
bit of 'noise' on the axis.
The 'round' function is included and is needed during the scaling process.
So, for this approach you would add the L:Var to yout C182.MCRO file (or whatever you named it)
and use the SET specification. Assign the axis to output to a user-defined offset,
and save the code below a C182.lua or whatever name you wish. Have this load/run when
the C182 is loaded via the FSUIPC4 "Auto" declaration in the INI file.
========================================================
function Mixture_Lever(control, Lever_in)
if Lever_Out_Last == nil then Lever_Out_Last = 0 end
Lever_Out = (round((Lever_in + 16383)/327.67))
if Lever_Out < 0 then Lever_Out = 0 end
ipc.writeLvar("L:Eng1_MixtureManualLever", Lever_Out)
if Lever_Out > Lever_Out_Last + 0.5 or Lever_Out < Lever_Out_Last - 0.5 then
ipc.display("Mixture = "..Lever_Out, 1) end
Lever_Out_Last = Lever_Out
end
-- rounds the integer
function round(num)
num = tonumber(num)
if num == nil then return 0 end
if num >= 0 then return math.floor(num+.5)
else return math.ceil(num-.5) end
end
event.offset(0x66D0,"SW","Mixture_Lever")
==================================================
Hope this helps.
Paul