vranki / ExtPlane

Plugin for X-Plane flight simulator which allows reading and writing simulation properties
138 stars 44 forks source link

Second client cannot get datarefs #57

Open Djeez2 opened 4 years ago

Djeez2 commented 4 years ago

When a second client subscribes to a dataref that is already subscribed to, it does not get its value. Only when the dataref changes lateron, it will receive the value. There is no way for the second client to synchronize on connection, even the (undocumented) 'get' function does not provide the current dataref value.

vranki commented 4 years ago

Thanks for reporting. Needs to be studied & fixed.

vranki commented 4 years ago

Tested this:

On the get command I noticed it's indeed undocumented and didn't work on the second client. This is now fixed.

Could you try with latest build and write a easy to reproduce script for me to test this if the bug still happens?

Djeez2 commented 4 years ago

Sorry for getting back to you so late. The ExtPlane from Dec 2019 crashes on startup (XPlane 11.41, Windows 10) so I tested with the Nov 2019 version. This seems to work fine, although rigorous testing is difficult as I have two small IoT devices with limited debug capabilities. Now that I have more experience with XPlane plugins, it could be that my earlier observations were cluttered by the fact that I did not realize that you have to subscribe to the datarefs when switching aircraft, since not all datarefs are available for all aircraft. My strategy now is to subscribe to all datarefs I need whenever the aircraft ICAO code changes. Hopefully by then all required datarefs are available. Please advise if this is the wrong way to handle the datarefs. Thanks for all your efforts, I really like ExtPlane.

vranki commented 4 years ago

Hm, I haven't actually tested much what happens if you change aircraft. This might reveal a bug. If there is a repeatable crash, please let me know.

Djeez2 commented 4 years ago

I tested some scenarios. It is not related to aircraft change, nor to the startup. If I have X-Plane started with the default Cessna 172, with my instruments off, everything starts normal. If I then power on my instruments they will connect to ExtPlane and at that moment X-Plane crashes (consistently). I believe this is the same issue as #58. Note that this only occurs with the Dec 2019 version, the Nov 2019 version works fine.

sum1els commented 4 years ago

you will notice with Zibo too, there is a massive Lua script that create new datarefs when Zibo starts up. Obviously all those drefs are not there to begin with, so you have to subscribe after the plane loaded unfortunately. I ran into the same problem while developing ZHSI, so I subscribe to the ICAO and then when I noticed it is the Zibo, only then does it subscribe to the required datarefs.

btw, I have done a scaled down version of ExtPlane for ZHSI about a year ago when I was still doing it. It listens on port 52000, so it does not clash with ExtPlane if still installed. It can be found here: https://gitlab.com/sum1els737/zhsi-plugin and compiled versions are here: https://gitlab.com/sum1els737/zhsi-releases/-/tree/master/zhsi-plugin/64

Djeez2 commented 4 years ago

Indeed. I use a lot of custom Zibo datarefs as well so I have to subscribe to the datarefs whenever the Zibo plane is loaded.