June 28, 200619 yr Thanks everyone on this forum for being so helpful. I finally have control over my external device from within a gauge.My next task is to "hijack" my F16 model to simulate an auto-evasion of a surface-to-air missile. I was wondering if I could do this from within the gauge if I were to incorportate FSUIPC (or without, if possible). I just want to move the plane quickly to something like a 45 degree pitch and 85 degree bank, for instance. Would this scenario work?Thanks for any help.
June 29, 200619 yr Thanks for your reply! I just tried it out using FSUIPC_Open2 and tried writing to pitch (offset 0x0578) with a size of 4 and a value of 45 (degrees down). I wrote and processed the request after 55 seconds of flight(1000 with FS timer). It did not seem to have an effect. Do you know of any examples I could look at where these kind of values are written to? Thanks for any help.
June 29, 200619 yr Remember, the value stored at 0x578 is ( degrees / 360 * 65536 * 65536 ).To write a value of 45 degrees down, you need something like:SINT32 Pitch_Value;Pitch_Value = 45 * 65536 * 65536 / 360;FSUIPC_Write ( 0x0578, 4, &Pitch_Value, &Result );FSUIPC_Process ( &Result );Also, check the FSUIPC log file (in the Modules folder). It will give you an idea as to what is going on with your access through FSUIPC.Doug
June 29, 200619 yr I'm still having problems with my auto-evasion. I must not be coding correctly. I tried putting the values directly into the function too. Could you check it out? //SINT32 Pitch_Value = 45 * 65536 * 65536 / 360; - Gives warningFLOAT64 Pitch_Value = 45 * 65536 * 65536 / 360;DWORD Result;--------------------------------------if (init == 0) { //vest.SetTactorIndex (myConv, 64); //conversion table //vest.Init (); //initialize vest BOOL FSUIPC_Open2(DWORD dwFSReq, DWORD *pdwResult, BYTE *pMem, DWORD dwSize); vdata = fopen("c:vdata2.txt","w"); init = 1;if (elapsedTime >= 1000) { fprintf(vdata, "%f %f %f %f n", pitch, bank, elapsedTime, timeEnd); //Pitch_Value = (45 * 65536 * 65536 / 360); //BOOL FSUIPC_Write(DWORD dwOffset, DWORD dwSize, void *pSrce, DWORD *pdwResult); FSUIPC_Write ( 0x0578, 4, &Pitch_Value, &Result ); //BOOL FSUIPC_Process(DWORD *pdwResult); FSUIPC_Process ( &Result ); //timeEnd = timeStart; lookup_var(&time1); timeStart = time1.var_value.n;I also attached my FSUIPC log. Thanks again for the help - I hate to be a pain.
June 29, 200619 yr Oops - I attached a wrong FSUIPC log on the last one. Didn't realize that FSLook logged there too.
June 29, 200619 yr Have you turned on the logging of FSUIPC writes (in the logging options of FSUIPC)? I don't want to make assumptions here - is the LagoF16.gau your gauge, or is it simply another gauge installed on the panel? Put another way, is your gauge making contact with FSUIPC?0x578 is a 4 byte integer offset - you cannot use a 64 bit float as the source variable. Don't worry about the warning when you declare Pitch_Value as SINT32. You could try DWORD instead, although I think they amount to the same thing.Doug
June 29, 200619 yr Thanks for your patience. I turned on the error logging and have no idea what these errors are (attached). I cut off the bottom half because it's so long and the rest are the same. Does FSUIPC continue trying after a failure? The write to pitch should have happened only once after I adjusted the timing.My gauge is actually an invisible one adapted from the attitude gauge of the Panels SDK and called Sample.gau. It doesn't look like it's being recognized, but the FSUIPC code is embedded in it. My other code that is working is also in this section along with the FSUIPC stuff (the PANEL_SERVICE_PRE_UPDATE section).Could you tell me what is going to happen if it works? Will it lag and then place the aircraft at that unusual attitude? Thanks for everything.
June 30, 200619 yr Yep - It's registration button is disabled and reads that FSUIPC is registered. Do you think I'm not waiting long enough to open the link? I did try a long delay earlier, but that didn't seem to work either. Thanks for the help!
June 30, 200619 yr How does this compare to what you have?BYTE Mem[300];DWORD Size = 300;DWORD FSReq = SIM_ANY;DWORD Result_Open;PANEL_SERVICE_PRE_INSTALL:FSUIPC_Open2(FSReq, &Result_Open, Mem, Size);break;You shouldn't need to put any kind of delay in before you issue the FSUIPC_Open2 command. I've never seen it have any kind of problems. To be on the safe side, however, I usually do something like this:PANEL_SERVICE_PRE_UPDATE: if ( ipc_open == 0 ) { FSUIPC_Open2(FSReq, &Result_Open, Mem, Size); FSUIPC_Write(0x8001, sizeof("KJSPC7LFRHG6dsd_xml2ipc.gau"), "KJSPC7LFRHG6dsd_xml2ipc.gau", &Result_Open); FSUIPC_Process(&Result_Open); if (Result_Open == 0 ) ipc_open = 1; }...break;Doug
June 30, 200619 yr Thank you very much! I'm embarrased to say, but I wasn't allocating memory for these processes. I just used your parameters - don't know if they are the most efficient for my purpose, but they work! I guess I don't have a full understanding of allocating memory for FSUIPC. I'm suprised at how quickly the transition occurs in MSFS! Thanks again!
Create an account or sign in to comment