DCS.Common.DCSBallRotation - HeliosVirtualCockpit/Helios GitHub Wiki

DCSBallRotation

This is a function which is used for combining an X, Y & Z rotation in DCS, and passing the result to Helios as a single export item. This is beneficial because it can reduce the numbers of render operations performed by Helios which can help performance.

Creating a new combined export item

There are two files to change in order to create a Binding for "ADI Ball Rotation" within the aircraft interface.

Exports

In the file DCS.????.hif.lua for your aircraft, the following line needs to be inserted into the function function driver.processHighImportance(mainPanelDevice).

Simple Two Value Example (Most ADIs)

    -- Send ADI Ball Values
    local lArgId = 2050	 -- the value needs to be a unique argument number ie one which is unused by DCS and the interface.
    local lPitch = 17    -- this is the argument number for pitch which can often be found in the corresponding interface JSON file.
    local lBank = 18     -- this is the argument number for bank which can often be found in the corresponding interface JSON file.
	helios.send(lArgId, string.format("%0.4f;0.0;%0.4f", mainPanelDevice:get_argument_value(lPitch), mainPanelDevice:get_argument_value(lBank)))

Three Value Example

    -- Send ADI Ball Values
    local lArgId = 2050	 -- the value needs to be a unique argument number ie one which is unused by DCS and the interface.
    local lPitch = 17    -- this is the argument number for pitch which can often be found in the corresponding interface JSON file.
    local lHeading = 19  -- If needed, this is the argument number for heading which can often be found in the corresponding interface JSON file.
    local lBank = 18     -- this is the argument number for bank which can often be found in the corresponding interface JSON file.
	helios.send(lArgId, string.format("%0.4f;%0.4f;%0.4f", mainPanelDevice:get_argument_value(lPitch), mainPanelDevice:get_argument_value(lHeading), mainPanelDevice:get_argument_value(lBank)))

The Interface JSON

In the file DCS.????.hif.json for your aircraft, the following needs to be inserted into the functions array.

[!note] The "id" needs to match the id which appears in the helios.send lArgId variable above.

    {
      "heliosType": "DCS.Common.DCSBallRotation",
      "device": "ADI",
      "name": "ADI Ball Rotation",
      "description": "Single value containing X, Y & Z movement of the ADI Ball.",
      "exports": [
        {
          "id": "2050"
        }
      ],
      "calibration x": {
        "points": [
          {
            "value": -1.0,
            "mappedValue": -90.0
          },
          {
            "value": 1.0,
            "mappedValue": 90.0
          }
        ],
        "precision": 1
      },
      "calibration y": {
        "points": [
          {
            "value": 0.0,
            "mappedValue": 0.0
          },
          {
            "value": 1.0,
            "mappedValue": 1.0
          }
        ],
        "precision": 1
      },
      "calibration z": {
        "points": [
          {
            "value": -1.0,
            "mappedValue": -180.0
          },
          {
            "value": 1.0,
            "mappedValue": 180.0
          }
        ],
        "precision": 1
      }
    },