EvenAR / node-simconnect

A cross platform SimConnect client library for Node.JS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plane data not correct

parlock opened this issue · comments

The plane data I get back is not correct, the lat/long don't match where I am at or based on GPS coordinates. The head and altitude are off as well. I am close this airport KSAN. "latitude_deg":"32.7336006165","longitude_deg":"-117.190002441"

node v15
electron v12

but I get the following. not even close.

{
'PLANE LATITUDE': 0.5713108235067251,
'PLANE LONGITUDE': -2.045507739457583,
'PLANE ALTITUDE': 5.963584736748746,
'PLANE HEADING DEGREES MAGNETIC': 2.393217942901961
}

And here is my test code:

    var success = simConnect.open("FlyMap", 
        (name, version) => {
            console.log("Connected to: " + name + "\nSimConnect version: " + version);
            // Safe to start interacting with SimConnect here (request data, etc)

            var navInfoDefId = simConnect.createDataDefinition([
                ["PLANE LATITUDE", "Degrees"],
                ["PLANE LONGITUDE", "Degrees"],
                ["PLANE ALTITUDE", "Feet"],
                ["PLANE HEADING DEGREES MAGNETIC", "Degrees"]
            ]);

            setInterval(() => {
                simConnect.requestDataOnSimObjectType(navInfoDefId, (data) => {
                    console.log(data);
                }, 0, 
                    simConnect.simobjectType.USER,
                    simConnect.period.SIM_FRAME,
                    simConnect.dataRequestFlag.CHANGED
                )
            },100)

        }, () => {
            console.log("Simulator exited by user");
        }, (exception) => {
            console.log("SimConnect exception: " + exception.name + " (" + exception.dwException + ", " + exception.dwSendID + ", " + exception.dwIndex + ", " + exception.cbData + ")");
        }, (error) => {
            console.log("Undexpected disconnect/error: " + error); // Look up error code in ntstatus.h for details
    });

The refactor version works. But it hangs on app quit if I use simconnect..

Ok, not sure what is going on. Even the master version hangs on the end of the application. And calls to simConnect.close() hang too...

I can confirm the hang on call to close(). Any idea what it can be?

This has likely been fixed after node-simconnect v3.x.