Jump to content
The simFlight Network Forums

TurbofanDude

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by TurbofanDude

  1. I figured it out - I don't know how it worked at all, honestly. I had to change the ZFW variable to unsigned int ZFW[/CODE] and the TWEIGHT variable to [CODE]double TWEIGHT[/CODE]. It's correct now. Thanks for the reply.
  2. When using FSX, the direct output of total weight, direct output of zero fuel weight, calculated zero fuel weight, and the weight of the fuel, respectively. In FS9 something is zero somewhere, as the fuel always ends up zero.
  3. Hello, I recently realized that I was using an FSX only value to calculate fuel in my ACARS, which obviously was creating issues with FS9 users. I've adjusted the code to use FS9 capable variables, and calculate the fuel by subtracting the zero fuel weight from the total weight. I'm fairly confident that my code is correct, seeing as though it does indeed record the appropriate value in FSX, however, is still doesn't record from FS9. Is there something else I'm missing? The relevant code is below: DWORD result; FSUIPC_Open(SIM_ANY, &result) //I'm using this as my connection open code //The actual code does indeed have more error checking than this, I just chose to copy it this way for simplicity. int ZFW; long long TWEIGHT; unsigned long result; FSUIPC_Read(0x3BFC,4,&ZFW,&result); FSUIPC_Read(0x30C0,8,&TWEIGHT,&result); double zero_fw = ZFW / 256; double fuel_w = TWEIGHT - zero_fw; p.fuelquantity = (int)fuel_w; [/CODE] I appreciate any assistance in advance.
  4. I'll answer my own question. The issue was reading the landing rate from raw sim data as apposed to the flight flags I set to record it. I apologize.
  5. Hello all, I am trying to write a bit of code to record the landing rate of a plane. I have a thread pulling data from the sim 10 times per second, and handling it accordingly. The second the aircraft the plane is on the ground it sets the data to the offset from FSUIPC (to avoid bounces, etc. from being logged as the final rate). That being said, the data that's coming out is completely inaccurate. I know I am at fault, I just do not know where. I have checked the offset within the sim, and it is the same base number my program is receiving (so it is coming out of the sim properly), but it is NOT being converned into feet per minute properly. My code for such is below: int TDRATE; FSUIPC_Read(0x030C,4,&TDRATE,&result); double landingrate = TDRATE; landingrate = landingrate*60*3.28084/256; p->landingrate = (int)landingrate; //p is an aircraft data struct, p->landingrate is an int. Even if I slam the airplane down, it reads between 70 and 160, and I've never seen any rate higher than that (even though I KNOW it is harder). Any ideas? Collin
  6. 'just multiply the fractional degrees by 60 to get minutes of course' - that seems to have been my problem. It slipped my mind that we are dealing with fractions of 60, not of 100, therefore, I was reading it as 42* 74'15, without multiplying to get minutes and seconds. Thank you for the help everyone, as it is working now. This should hopefully have been my last stupid question. -- Collin
  7. I did the above conversion, I got 42.741640579659617 when the in-sim latitude read N42*44.50' Is that normal? -- Collin
  8. I use long long because I need a 64 bit integer, where as long is 32, int is 16, etc. It's a whole mess in C++ that isn't needed in .Net. I got a decimal at least, but it's still wrong (using a method similar to yours). I'll have to review it in the morning.
  9. HI there, I am trying to read the latitude and longitude from FSX. I have gotten the raw, unformatted data from FSX, but I am having trouble converting it to a usable format. I have converted the unsigned long long to a float while applying the conversions, but I am either getting inaccurate data (i.e. 42.7445 when it should be 42.4542) or I get just even 42. Here is my code: (There is a call to FSUIPC_Process in there, I just haven't actually included it in the example). signed long long LAT; FSUIPC_Read(0x0560,8,&LAT,&result); float y = LAT; y *= 90; y /= 10001750; y /= 65536; y /= 65536; p->latitude = y; //p is a user defined an aircraft data struct[/CODE] Thanks in advance, -- Collin Biedenkapp
  10. I apologize, again, and I thank you for your help. I was using FSInterrogate some, but clearly not enough. Upon your help and further investigation of the variables, I am able to receive and process them properly. I appreciate the help, and I promise I will not post again until I have throughout researched the issue first. For the record, the PITCH variable was being used as I copied this code from another one I had written earlier, and I hadn't switched the variable name yet. I am storing them in a struct with their appropriate types and names now. -- Collin
  11. This is my current function. I have read through the guides and I cannot figure it out. I am now unable to get the data to read properly, and I am unaware of the way to apply the expression formula. unsigned short PITCH[2]; void launchfsuipc() { DWORD dwResult; if (FSUIPC_Open(SIM_ANY, &dwResult)) { DWORD result; FSUIPC_Read(0x842,2,PITCH, &result); DWORD result1; FSUIPC_Process(&result1); //Does PITCH[0] not contain the correct value? } else MessageBoxA(NULL, pszErrors[dwResult], "UIPChello: Failed to open link to FSUIPC", 0) ; FSUIPC_Close(); // Closing when it wasn't open is okay, so this is safe here }[/CODE]
  12. Wow, I really need to slow down. I'm not new, just rushing. I apologize and I appreciate your help. I'll take another look, and I won't ask again until I've read up first. Collin
  13. Ah, I was looking at the wrong example. I apologize, thanks! I have used a code exactly as in the example (except for MessageBoxA due to a different character set and a C++ compiler), and I am getting garbage data in the strings for FSX time. How can I get a length of actual data received in order to use a null terminator?
  14. Hi there, I am sorry if I sound silly asking, but I am trying to receive some critical info from FSUIPC (airspeed, etc.) through a C++ program. I have called FSUIPC_Open and then tried FSUIPC_Read, but the char is null. Is there any chance you can point me in the direction? This is the code: char speeds[3]; void launchfsuipc() { DWORD dwCLOSED; DWORD res; if(FSUIPC_Open(SIM_ANY,&dwCLOSED)) { //link ok FSUIPC_Read(0x238, 3, speeds,&res); stringstream ss; ss << speeds[1] << speeds[2] << speeds[3]; MessageBoxA(NULL, ss.str().c_str(), "", MB_OK); } else { //link failed MessageBoxA(NULL, "YO HOMIE I FAILED", "YO", MB_OK); } }[/CODE] Thanks, -- Collin Biedenkapp
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.