Fragtality / PilotsDeck

Directly control the FlightSim from your StreamDeck!
Other
92 stars 6 forks source link

Multivariable display #68

Closed markhlam closed 1 week ago

markhlam commented 3 months ago

Hi again!

I'm trying to make a panel for the KAP140 autopilot. I've managed to map all action buttons, but now I'm trying to map displays. As HDG/NAV/ROL indicators as well as ALT/VS should be shown in together in a single key (two keys in this case) I would like to combine their single indicators in one value (i.e. HDG_ind 4 + NAV_ind 2 + ROL_ind) and then use the resulting value to select a specific image in a Dynamic Button.

But how could I made that aggregation? Using a LUA (and how could I read an output value in that case?)? Is it possible to express a variable using an RPN expression?

Fragtality commented 3 months ago

Well, with current Release Version this is not possible.

With the current Development Version (https://github.com/Fragtality/PilotsDeck/blob/master/Install-PilotsDeck-latest.exe) it could be possible (not sure if I understood the Use-Case directly):

Since it is in Development the Readme does not yet reflect these new Features - check the other open Issues for some Explanations. After that, use this Issue for your further Questions.

markhlam commented 3 months ago

Thank you for your prompt response.

Yes, those were my ideas in principle, but I didn't know how to use them, as for commands I can choose from different types (MACRO, SCRIPT, CONTROL, LVAR,...), but for displays I have just a TextBox labelled as Address, how could I tell the plugin it has to call a LUA Function or calculate an RPN expression?

If it helps to answer the question I will try to better explain my use case:

To get AP active mode I access different boolean offsets:

KAP140 shows all these modes with two indicators:

Indicator 1: Can have the values ROL, NAV, HDG or none Indicator 2: Can have the values ALT, VS or none

So what I would like is to transform the single boolean values into custom Enumerated values, so I can assign an image to each of the values and show them in just two SD keys

Transformation is quite simple, but I don't know how to make the plugin to execute LUA/RPN and get the result to show

Fragtality commented 3 months ago

how could I tell the plugin it has to call a LUA Function or calculate an RPN expression?

I already told you: Check the other open Issues and after reading them (!), ask further Questions. I just don't have any better Documentation at the Moment ;)

Fragtality commented 3 months ago

Especially considering one of the Issues where I explained something about Scripts (and how they are used as Values) is an Issue from you 🤔

But I remembered falsely that there was already an Example for Lua as Image Source, so here my Test-Script for the Fenix Fire PushButtons:

MapImage("Images/FIRE_open.png", 0)
MapImage("Images/FIRE_open_up_off.png", 1)
MapImage("Images/FIRE_on_open_down.png", 2)
MapImage("Images/FIRE_on_open_up.png", 3)
SimVar("L:S_OH_FIRE_ENG1_BUTTON")
SimVar("L:S_OH_FIRE_ENG2_BUTTON")
SimVar("L:S_OH_FIRE_APU_BUTTON")

function GetMappedImage(currentValue, funcParam)
    Log("Param "..funcParam)
    local btnState = SimRead("L:S_OH_FIRE_"..funcParam.."_BUTTON")
    Log("BtnState "..btnState.."    currentValue "..currentValue)
    if currentValue == 0 then --no fire indication
        if btnState == 0 then
            return 0
        else
            return 1
        end
    else
        if btnState == 0 then
            return 2
        else
            return 3
        end
    end
end

Important Things to catch:

Fragtality commented 2 months ago

FYI, I have finished the Rewrite of the Plugin and pushed it to the Repository: https://github.com/Fragtality/PilotsDeck/blob/master/Install-PilotsDeck-latest.exe I would appreciate some help with Testing to get some Feedback if everything is working properly. Making a Export/Backup of your Profiles is highly recommended! The Intention is that everything just continues to work and I had not seen any Showstoppers with my Setup - but it is better to be safe than sorry 😉

On your initial Issue / further Questions: You might want to check out the new Composite Action, since it allows you freely configure what to show where. On the Fenix for Example I could design every FCU Display without any line of Lua Code involved. Also the Readme was updated with all new Stuff (like Lua Scripts and this new Action). So it would also good to know if the Readme does it Job of giving useful Information 😅