Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding/removing flightplan waypoints in C/C++

Featured Replies

Hi!I'm trying to create a simple gauge that can modify (add/remove) flightplan. I started to test the SDK.FlightMap.c provided by FS2004 Panels SDK, but the implemented method (which one uses the GPS_INFO structure described in gsp_info.h) works only partially. It adds a new WP to the flightplan, but cannot fill in the WP's name regardless it's given or not. Also if I try to add/remove a WP with this method, it will clear the szName field (WP name) in all WPs.Could anyone help me what I do wrong?Here is the corresponding code section (the full source code can be found in FS2004 Panes SDK: SDK.FlightMap.c)UINT32 i = gpsrequest->lWpCounts++;gpsrequest->pWpData.dwSize = sizeof (GPS_WP_INFO);{ FLOAT64 fX = lX / SCALE_MAP_FACTOR; FLOAT64 fY = lY / SCALE_MAP_FACTOR; FLOAT64 fSin = sin (gpsinfo->dGroundHeading); FLOAT64 fCos = cos (gpsinfo->dGroundHeading); FLOAT64 fLOMeters = fX * fCos + fY * fSin; FLOAT64 fLAMeters = fX * fSin - fY * fCos; FLOAT64 fLatRad = LAT_METERS48_TO_RADIANS (gpsinfo->vPosition.lat); FLOAT64 fDeltaLonDeg = METERS_TO_LON_DEG_AT_LAT_RAD (fLOMeters, fLatRad ); ANGL48 anglDiff = DEGREES_TO_ANGL48 (fDeltaLonDeg); LATLONALT v; v.lon = ADD_ANGL48_ANGL48 (gpsinfo->vPosition.lon, anglDiff); v.lat = ADD_SIF48_SIF48 (gpsinfo->vPosition.lat, FLOAT64_TO_SIF48 (fLAMeters)); v.alt = FLOAT64_TO_SIF48 (gpsrequest->pWpData[i-1].dAltitude); gpsrequest->pWpData.vPosition = v;}gpsrequest->pWpData.dHeading = gpsrequest->pWpData[i-1].dHeading;gpsrequest->pWpData.dSpeed = gpsrequest->pWpData[i-1].dSpeed;gpsrequest->pWpData.dAltitude = gpsrequest->pWpData[i-1].dAltitude;strcpy (gpsrequest->pWpData.szName, "???");Thanks in advance,BSi

  • Author

I'm not an expert on this particular point, but typically shouldn't your line gpsrequest->pWpData.dHeading = gpsrequest->pWpData.dHeading;be something like:gpsrequest->pWpData.dHeading = gpsrequest->pWpData[i-1].dHeading;As in the SDK, or has the use of square brackets () changed it?EDIT: Yes it has!

Gerry Howard

  • 6 months later...
  • 3 years later...

I jump on this old topic to know if anyone found a solution to this problem of GPS flight plan edition.I made some tests and I discovered that the line:

gpsrequest->pWpData[i].dwSize = sizeof (GPS_WP_INFO);

is uselss. Changing this value to 0 had no impact on my tests.On the other hand, this line is important:

gpsrequest->dwSize = sizeof (GPS_INFO);

It seems that it indicates the amount of data that needs to be updated. With this line, the flight plan is correctly updated but the waypoint names are blanked.For testing, I tried this:

gpsrequest->dwSize = sizeof (GPS_INFO) - sizeof(char*);

to ignore the last part of the GPS_INFO structure, which is:

GPS_WP_INFO* pWpData;

It works... In this case, the names are not blanked, but the flight plan is not modified :( Does any of you know how to keep the waypoint names?If someone is good enough to disassemble the gps_export.dll, it may help. Sorry but I don't have the necessary knowledge to do this...Or maybe we should come to the conclusion that it definitely does not work this way and forget the code sample provided in the SDK...Thanks for any help !!Eric

  • Commercial Member

No, it doesn't work. It has never worked, ever since it was first introduced.You can not make any changes to the export DLL to make it work as it's actually a flaw elsewhere in FS.

Ed Wilson

Mindstar Aviation
My Playland - I69

Unfortunately, I believe you're right.I really don't understand how the ACES could release a code that never worked...Eric

  • Commercial Member

I wrote my own flightplan builder/parser/modifier for an INS system. Although the INS system doesn't contain waypoint names (only lat/lon co-ords), the flightplan worked perfectly when the aircraft was switched to 'Nav1 drives GPS'. Given that, you should be able to do the same but also be able to add in the bits I didn't need (waypoint names, waypoint types etc). -Dai

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.