scott-vincent / instrument-panel

An instrument panel for Microsoft Flight Simulator 2020
170 stars 29 forks source link

Implementing a new Gauge #47

Open pakthan opened 2 years ago

pakthan commented 2 years ago

Hi! At first I would like to thank you very much for your work! It really helps me closing the gap between the MSFS possibilities and my actual needs...!

I am often flying the Diamond DA /DV20, wich uses an adjustable propeller. For this reason I would need a "manifold pressure gauge". The graphics and general settings in the panel.json shouldn't be such a hard problem to solve, but where do I get the variables included? How can I recieve the data from the MSFS?

I hope, you understand my question and excuse my bad english... Greetings from germany Arsene

scott-vincent commented 2 years ago

Hi,

All the variables are collected from FS2020 by instrument-data-link. The following two files are shared by instrument-data-link and instrument-panel:

simvarDefs.cpp simvarDefs.h

You can add new variables to collect more values from FS2020. The full list is defined in the FS2020 SDK documentation (which you can download in FS2020 Developer Mode). For example, there is a variable for engine manifold pressure in simvarDefs.cpp:

{ "Eng Manifold Pressure:1", "inches of mercury" },

and its equivalent variable in simvarDefs.h:

double engineManifoldPressure = 0;

You can modify or add to the values in these two files, then rebuild instrument-data-link, then copy the two files into instrument-panel and rebuild that too.

You can then access them in instrument panel, e.g.

simVars->engineManifoldPressure

Hope that helps a bit.

pakthan commented 2 years ago

Wow! Thank you for the extreme fast response/answer! This was very helpful and now I know my homework. I will give you a feedback in this issue. Maybe it can be helpful for othe SimPilots too.

karlagh21 commented 1 year ago

How did it go pakthan? Did you create a new gauge?

I'm trying to make a second RPM gauge for my Beech Baron panel but I can't understand exactly what's required. I've looked at creating a new bitmaps\rpm2.png file (easy) and adding new instruments\rpm2.cpp and -\rpm2.h files with edited line nos. 32, 242 and 245 (also quite easy) - but now I see we need to add new variables in simvarDefs.cpp and -.h. I'm not sure what other details I also need to change. Then I will have to build it in MS Visual Studio 2019 (not 2022 which didn't build for me) - and I don't think I can do it successfully.

So, what I'm asking: are you - or anyone else - willing to write a step-by-step procedure on the creation of a gauge? If this is done I'm sure that this powerful package will really be much more popular. I see many references to Air Manager around but no-one seems to be aware of Scott's instrument-panel.

karlagh21 commented 1 year ago

Rough outline of my approach to create a second engine RPM gauge to run under Windows 10, 64 bit:

  1. Graphics for one engine RPM exists, so duplicate and create RPM2.PNG in the ''... windows-x64\bitmaps' folder.
  2. Study '... windows-x64\instrument-panel.exe' in MS Visual Studio 2019 and see that 'simvars.h' 'stdio.h' 'stdlib.h' are referenced - so study them and possibly edit them in Notebook; no need edit the .exe file, that will come later.
  3. Study '... master\instrument.cpp' and possibly edit.
  4. " '... master\instrument.h' "
  5. " '... master\simvardefs.cpp' "
  6. " '... master\simvardefs.h' "
  7. " '... master\rpmpercent.cpp' "
  8. " '... master\rpmpercent.h' "
  9. Once editing is done re-build the '... master\instrument.sln' in MS Visual Studio 2019 to give new '... master\x64\debug\instrument-panel.exe' which can replace the one in '... windows-x64\instrument-panel.exe'
  10. Copy modified 'simvardefs.cpp' and 'simvardefs.h' to the '... data-link ...' folder.

It doesn't seem to make sense at the moment but I'll continue, on-and-off, for a while and report back.

karlagh21 commented 1 year ago

Another attempt to create a second RPM gauge:

Add new RPM2 lines in instrument-panel.json in Settings folder using Notebook. Add a new RPM2.PNG in Bitmaps folder. Add a new RPM2.H in Instruments folder; edit four lines with RPM to RPM2 using Notebook. Add a new RPM2.CPP in Instruments folder; edit seven lines with RPM to RPM2 using Notebook. Edit Instrument-Panel.CPP in MS Studio 2022 adding two new RPM2 lines under existing RPM. Run Build Solution.

Failed to work.

karlagh21 commented 1 year ago

Version 1.7.2 is a most welcome update to your very useful MSFS add-on. Just checking it out; belay all I've written above. Many thanks S-V.

scott-vincent commented 1 year ago

You're welcome. Enjoy!

scott-vincent commented 1 year ago

I've just remembered you guys were trying to add a 2nd RPM guage. So my solution is just to add the two engine rpm's together and divide by 2. So my RPM guage would now show 50% if you throttle up one engine and the aircraft has two engines.

karlagh21 commented 1 year ago

I have my MSFS Beech Baron set up (3x monitor external view, 1x monitor S-V panel, arduino switch panel, arduino radio stack)) showing no interior and exterior textures by commenting out two lines in my "D:\msfs\Official\OneStore\asobo-aircraft-baron-g58\SimObjects\Airplanes\Asobo_Baron_G58\model" "model.CFG" file. I therefore can't see the props on startup and would much prefer two engine RPM, oil T and P gauges to fly realistically. Thanks anyway, I'm very happy with what you offer now.