DesertStorm
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by DesertStorm
-
-
Hi all! It's my first time in this forum, I'm Dani, aerospace engineer from Spain and a general aviation cockpit builder using IOcards. My apologies if my English is not good.
I'm trying to make a little data capturer written in C in order to gather some data from FSX and I'm having some issues with some offsets. I'm following the C example of the SDK, but I think not all the offsets works in the same way and is the cause I'm not getting the correct values.
If I try to get size 1 variables, for example "fuel pump", "pitot heat", etc, I get the correct values: no problems.
But if the sizes are greater than 1, I can't obtain any reasonable value. Normally I obtained a mix of positive and negative values. I will put an example of what I'm doing, if its helpful:
In this code I'm trying to get the "0 to 16383" range of flaps. But I obtained for the FSX cessna 172, the following values: 0, 85, -86, -1 for each of the 4 positions.
Same happens with the gear trim and for all of diferent than 1 byte size variables, All what I obtain is random values with no sense.
I suppose I'm doing something terribly wrong but I have tried not to get away a lot of the C example of the SDK, more or less is the same structure (I added the 25 times bucle).
#include <windows.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "FSUIPC_User.h" int main() { DWORD dwResult; if (FSUIPC_Open(SIM_ANY, &dwResult)) { char flaps[4]; BOOL allOk = TRUE; int n = 0; while (n<25) { if (!FSUIPC_Read(0x0BDC, 4, flaps, &dwResult) || !FSUIPC_Process(&dwResult)) { allOk = FALSE; } if (allOk) { printf("Flaps = %d\n", flaps[0]); } Sleep(100); n++; } } }
I have tried also to read using flaps [1], [2], and [3] but with worst results, because in the C example of the SDK you read [0] [1] and [2] to obtain hours minutes and seconds. Also I tried to use %s instead %d, and so many combinations.
Can you please provide any extra information of what I'm doing wrong to try to better understand the working of the C FSUIPC programming? My goal will be to obtain the values that comes on the offset status pdf, to after convert it to engineer values as I do in my work with ARINC protocols in real planes.
Thanks!
Dani
Question about C programming for FSX data capturer
in FSUIPC Support Pete Dowson Modules
Posted
Thankyou very much, I thought that fsuipc_read() only admitted char as a input, It works now!
Again thankyou!
Regards,
Dani