Skip to content

7. Lighting Knobs

Andrew Gransden edited this page Feb 18, 2022 · 1 revision

It had been requested to have the lighing dimmers available for analog axes as in the real aircraft.

So i started investigating and found a solution that is quite flexible and using the MSFS vars as described in https://docs.flybywiresim.com/pilots-corner/a32nx-briefing/a32nx_api/?h=potentiometer#instrument-lighting-control-panel using the indexed Light Potentiometer:[index] MSFS variables.

The \LINDA\aircrafts\FBW A320\user.lua example

analogChangeEvents = {
    --[[
    {
        1st line = FSUIPC offset that is assigned to the axis. As the variable requires 4 bytes, increment by four to avoid problems
        2nd line = the calculator code as used in MSFS. Replace the value to be written with '{value}'
        3rd line = the calculation that should be performed with the value sent from FSUIPC before sending it in the calculator code
        4th line = the description to be shown in the FSUIPC7.log together with the offset the function was assigned to in case you have lua logging on.
    },
    --]]
    {
        0x66d0,
        "@ 10.23 / {value} max 100 min 88 (>K:2:LIGHT_POTENTIOMETER_SET) @ 10.23 / {value} max 100 min 89 (>K:2:LIGHT_POTENTIOMETER_SET)",
        "tostring(100 - round(({value} + 16384) / 327.68))",
        "PFD (88) + ND (89) brightness on the left side"
    },
    {
        0x66d4,
        "@ 10.23 / {value} max 100 min 8 (>K:2:LIGHT_POTENTIOMETER_SET)",
        "tostring(100 - round(({value} + 16384) / 327.68))",
        "CONSOLE/FLOOR Cpt. brightness (8)"
    },
    {
        0x66d8,
        "@ 10.23 / {value} max 100 min 92 (>K:2:LIGHT_POTENTIOMETER_SET)",
        "tostring(100 - round(({value} + 16384) / 327.68))",
        "Upper ECAM Display brightness (92)"
    },
    {
        0x66dc,
        "@ 10.23 / {value} max 100 min 93 (>K:2:LIGHT_POTENTIOMETER_SET)",
        "tostring(100 - round(({value} + 16384) / 327.68))",
        "Lower ECAM Display brightness (93)"
    }
}

-- Loop over the defined table and register for each of the defined offsets an change event where the setDimmer function is triggered.

for i = 1, #analogChangeEvents do
    _log("registered dimmer update event on offset '" .. tostring(analogChangeEvents[i][1]) .. "' for '" .. analogChangeEvents[i][4] .. "'")
    event.offset(analogChangeEvents[i][1], "SD", "setDimmer")
end

With this you can assign the offsets to axes in FSUIPC: The offsets are the ones you assigned in the user.lua in the "table".

In the above example these are:

  • Offset: 0x66d0 for 'PFD (88) + ND (89) brightness on the left side'
  • Offset: 0x66d4 for 'CONSOLE/FLOOR Cpt. brightness (8)'
  • Offset: 0x66d8 for 'Upper ECAM Display brightness (92)'
  • Offset: 0x66dc for 'Lower ECAM Display brightness (93)'

offset assignments in FSUIPC

Based on that it should be possible to assign all the indexed variables to the dimmers. You just need some potentiometers - unless you store several calculator codes (like in the example line 1. Then you can operate several dimmers synchronously.

But be careful: Currently the ExecuteCalculatorCodes are limited to 255 / 1024 characters. So don't put too many of them together, otherwise you will end up at https://forum.simflight.com/to...indComment&comment=571026.

Hope, it helps.

Clone this wiki locally