llamaXc / winwing-ufc-addon

Allows custom data to be exported to the Winwing F18 UFC.
BSD 2-Clause "Simplified" License
13 stars 4 forks source link

Request: support for F-5E module; G-meter and fuel qty gauge #33

Open Bagger13 opened 1 year ago

Bagger13 commented 1 year ago

I want to develop support for the F-5E module. I managed to add a "profile" for the F-5E and get it working following the guidance provided.

I would like to display aircraft G, and fuel qty as shown in the cockpit gauge but totalized (L and R quantities added together, and shown in LBS).

Any advice on where to start? I have zero coding skills, but willing to learn enough lua to make this work.

llamaXc commented 1 year ago

Hey, message me on discord and happy to help more in-depth: @papiplanes on discord, I also have a discord channel you can find it at papiplanes.com and I can help in there as well!

If you have a working profile and are able to show the default text from the example, then this should help you make some progress, I have not ran this code so there might be errors, but in general it will look likt this.

local ufcUtils = require("ufcPatch\\utilities\\ufcPatchUtils")

ufcPatchCustomModuleExample = {}

function ufcPatchCustomModuleExample.generateUFCData()
    log.write("WWT", log.INFO, "Trying to load F-5E example")

    -- Good help file with examples
    -- https://wiki.hoggitworld.com/view/DCS_Export_Script

    -- This might be a percent in the F5, might be in KG, or in LBS, might need to do some testing
    local Fuelpercentage = "F" .. string.format("%03d", math.floor(LoGetEngineInfo().fuel_internal * 100))

    -- This in the G
    local GAcceleration = "G: "..LoGetAccelerationUnits().y

    return ufcUtils.buildSimAppProUFCPayload({
        option1=GAcceleration,
        option2=Fuelpercentage,
        option3="---",
        option4="---",
        option5="F-5E",
        scratchPadNumbers="",
        scratchPadString1="",
        scratchPadString2="",
        com1="",
        com2="",
        selectedWindows={}
    })
end

return ufcPatchCustomModuleExample