Skip to content

Commit

Permalink
Merge pull request #1 from brettjenkins/feature-make-work-with-vizix
Browse files Browse the repository at this point in the history
Changes for VIZIX controller
  • Loading branch information
brettjenkins authored Sep 29, 2022
2 parents 2573707 + 20bd0c6 commit 575b845
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 60 deletions.
39 changes: 8 additions & 31 deletions PilotsDeck_FNX2PLD/ElementManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,14 @@ private void UpdateFCU(MemoryPattern fcu, bool isLightTest)
result = "8888\n888*";
else
{
if (isModeSpd)
result = "SPD\n";
else
result = "MACH\n";

if (isSpdManaged)
result += "---*";
result = "---*";
else
{
if (isModeSpd)
result += ((int)Math.Round(fcu.MemoryOffsets["fcuSpd"].GetValue())).ToString();
result = ((int)Math.Round(fcu.MemoryOffsets["fcuSpd"].GetValue())).ToString();
else
result += "." + ((int)Math.Round(fcu.MemoryOffsets["fcuSpd"].GetValue())).ToString();
result = "." + ((int)Math.Round(fcu.MemoryOffsets["fcuSpd"].GetValue())).ToString();
}
}
}
Expand All @@ -194,24 +189,19 @@ private void UpdateFCU(MemoryPattern fcu, bool isLightTest)
result = "888\n888*";
else
{
if (isModeHdgVs)
result = "HDG\n";
else
result = "TRK\n";

string hdgDisp = fcu.MemoryOffsets["fcuHdgDisplay"].GetValue()?.ToString("D3") ?? "000";
string hdgFma = fcu.MemoryOffsets["fcuHdgFma"].GetValue()?.ToString("D3") ?? "000";

if (isHdgManaged)
{
if (hdgDisp != "000")
result += hdgDisp + "*";
result = hdgDisp + "*";
else
result += "---*";
result = "---*";
}
else
{
result += hdgFma;
result = hdgFma;
}
}
}
Expand Down Expand Up @@ -242,19 +232,6 @@ private void UpdateFCU(MemoryPattern fcu, bool isLightTest)
result = "888\n+8888";
else
{
if (isModeHdgVs)
result = "V/S\n";
else
result = "FPA\n";

//int vs = 0;
//if (isAltVs)
// vs = fcu.MemoryOffsets["fcuVsFma"].GetValue() ?? 0;
//else
// vs = fcu.MemoryOffsets["fcuVsDisplay"].GetValue() ?? 0;

//if (!isAltVs)
// result += "-----";
int vs = fcu.MemoryOffsets["fcuVsDisplay"].GetValue() ?? 0;
bool sourceIsDisplay = vs != 0;
if (isAltVs)
Expand All @@ -267,15 +244,15 @@ private void UpdateFCU(MemoryPattern fcu, bool isLightTest)
if (vs >= 0)
result += "+";

result += vs.ToString("D4");
result = vs.ToString("D4");
}
else //fpa
{
float fpa = vs / 1000.0f;
if (fpa >= 0.0f)
result += "+";

result += fpa.ToString("F1", formatInfo);
result = fpa.ToString("F1", formatInfo);
}
lastValueVS = vs;
}
Expand Down
5 changes: 0 additions & 5 deletions PilotsDeck_FNX2PLD/PilotsDeck_FNX2PLD.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,4 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell -ExecutionPolicy Unrestricted -file &quot;$(ProjectDir)CopyToMSFS.ps1&quot; $(ConfigurationName)" />
</Target>

</Project>
33 changes: 9 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
# PilotsDeck_FNX
This Binary is used read out some (Quartz) Displays of the Fenix A320 and write their Data to FSUIPC Offsets. There PilotsDeck (or any other Application using FSUIPC basically) can pick it up to display it on the StreamDeck.<br/>
To make one Thing directly clear: it is a **HACK**. Literally: It accesses the Process Memory directly (read-only!) to get the Data. It will likely break with the next Update (until I'll managed to find the correct Spots again).<br/>Currently compatible with Fenix Version **1.0.3.128** and MSFS **SU10**.<br/>
# PilotsDeck_VIZIX

# Installation
Put the Folder/Binary generally anywhere you want, but *don't* use: Any Application's Folder (e.g. MSFS, Fenix, StreamDeck) or any of the User Folders (Documents, Downloads, etc).<br/>
You need at least FSUIPC7 Version **7.3.9** (current is 7.3.10)! Please make sure you install / update the WASM Module (its manifest.json should show 0.9.0).<br/>
This is a fork of the briliant https://github.com/Fragtality/PilotsDeck_FNX with modifications to make it work better with the VIZIX autopilot controller.

It is designed to be started by FSUIPC - add this to your ini File:
```
[Programs]
RunIf1=READY,KILL,X:\PATH\YOU\USED\PilotsDeck_FNX2PLD.exe
```
But you can also start it manually when MSFS/FSUIPC are loaded (Main Menu).
Read their readme for more details but simply:

# Usage
If you don't start it automatically, make sure to start it after MSFS is in the Main Menu (and FSUIPC7 is running).<br/>
When it is running (started either automatically or manually) just set up your Flight as you normally would. The Tool will wait in the Background until the Fenix becomes active.<br/>
It waits 25 Seconds after the Fenix Executables are loaded before scanning the Memory - just make sure you hit "Ready to Fly" before the Time runs out! Else some Memory Locations can't be found (most often the Com Displays won't work - in that Case stop/start the Executable manually). You can configure the Delay to match your Loading Times / Behaviour.<br/>
Note that this Application has no Window - you have to use Task Manager if you want to see if is running (it should close automatically after MSFS is closed).<br/>
The Memory Scan usually takes under one Second and the time it takes for an Update Cycle is arround 0,3ms on average (on my System).

# Configuration
You can configure some Parameters in the PilotsDeck_FNX2PLD.dll.config File:
- **offsetBase**: The first (FSUIPC) Offset Address to use (hexadecimal), defaults to 0x5408
- **updateIntervall**: The time between each Update in Milliseconds, defaults to 50
- **waitReady**: The time to wait before the User clicked "Ready to Fly" in Seconds, defaults to 25
1) Make sure you have the latest version of FSUIPC installed
2) Put this .exe say C:\pilotsdeck\
3) Run it (and FSUIPC) after MSFS has started
4) Load the Fenix A320 - PilotsDeck profile
5) Should magically work!

I'll try to keep this updated with the base repo, because as this is doing memory reading it's prone to breaking, but it works!

0 comments on commit 575b845

Please sign in to comment.