scott-vincent / instrument-panel

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

Slow refresh rate when window is not in focus #40

Open f4l0 opened 3 years ago

f4l0 commented 3 years ago

I just tried the instrument panel on the same computer which runs MSFS. I noticed that the refresh rate is very slow when the window is not in focus. With slow I mean, it refreshes every few seconds... Have you ever encountered such issue?

f4l0 commented 3 years ago

CPU is somewhere between 30-50%. It's an I7 8700K running at 4.8GHz. Both screens have a 1440p resolution.

I just noticed something "interesting". When I switch MSFS to window mode and resize the window to roughly 1/4th, the needles in the gauges starts to move smoothly.

creaimmo commented 2 years ago

I too have about 1 second latency between what I have on MSFS 2020 and the dashboard. I tried the connection in ethernet and in wifi it is the same. where can she come from?

scott-vincent commented 2 years ago

Don't run instrument-panel on the same PC as FS2020. Run it on an old PC, a laptop or (my recommendation) a Raspberry Pi 4.

creaimmo commented 2 years ago

I'm on a raspberry pi 4, and I have a latency of about 1 second. Hence my question. Where can it come from? Because I tested in wired connection and in wireless connection and it is the same in the 2 cases.

scott-vincent commented 2 years ago

You didn't make that clear. So you are running the same setup as me. Instrument panel runs full screen on the Pi so when you say the window is not in focus that makes no sense.

creaimmo commented 2 years ago

Oh sorry ! my english is not perfect, it was when i saw the person talking about latency that i thought it was like my problem. Currently I have installed Dashboard on Rapberry pi 4 - 4GB RAM. the rotary or push button responds well on the Rasberry pi. On the other hand I have a latency between the raspberry pi and the computer where there is MSFS2020 when I make a left turn I will have 1 second later the devices which will start to move and give the information on the dashboard on the PI. Ditto if I go up or down I have this information lag between MSFS 2020 and the dashboard which is 1 second late. I tested with the 2 type of connection, wired or wireless but same situation in the 2 cases. I don't see where this 1 second of latency comes from. I would like to reduce it to milliseconds. and thus make the most of your super interesting tools. Thanks again for all the work you have done.

scott-vincent commented 2 years ago

No, I've not seen that before. You would have to do some investigation to work out whether the delay is between FS2020 and Data Link or between Data Link and Instrument Panel. If you can build Data Link on windows, add this line: printf("inHg: %f\n", simVars.altKollsman); just before this line: // For testing only - Leave commented out then run it and view the output. You should see the value immediately change when you change the altimeter setting. Do something similar in Instrument Panel which you will have to build on the Pi but print like this: sprintf(globals.error, "inHg: %f\n", simVars.altKollsman); The value of globals.error will immediately be displayed in the Annunciator window.

creaimmo commented 2 years ago

Sorry, I would have liked to help diagnose where this latency comes from, but I don't know how to compile your program with this command line that you put in your message above.