BlueLiquidCell
-
Posts
13 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by BlueLiquidCell
-
-
No. I means that you should request all the data you want in one regular Process call. It doesn't matter where or how many or how often you do FSUIPC_Read and FSUIPC_Write calls. It's only the Process call which is switching control from your program to FS and back. Doing that for every little bit of individual data is insanely inefficient.
Regards
Pete
Hey Pete
Sorry but I don't really understand.
I need a Process call after a Read Call before I can display the data oder do whatever. Is that correct?
Now when I need the airspeed for example. I do a Read Call for airspeed and then a Process Call. And when I need the Altitude I do a Read Call for altitude and then a Process Call. Sure I could do both Read calls and after both of them 1 Process Call but then I would need to save the data until I really need it?!
Right now I have a function ReadAirspeed and ReadAltitude which return the Value and exported them into a dll.
Christoph
-
But perhaps you mean you have lots of asynchronous "FSUIPC_Process" calls, each only requesting one or two items of data? If so, that is a very inefficient, way of doing things. You should be accumulating all reads and writes into one regular batch which is sent at regular intervals (and only needing one timer). That's why the "Process" call is separated from the "Read" and "Write" calls. The latter two merely build up a request package. The request package sent by the FSUIPC_Process routine should be regular.
Hey
Yes I have many asynchronous "FSUIPC_Process" calls, because I "exported" all procedures reading or writing from fsx into a dll to get the source code out of my programm. I really need a lot of items and don't know if i can realize that all in one FSUIPC_Process routine. But maybe I'll try. Is there any other possible way?
I would need own variables for every fsuipc item and update them every 50ms or how ever often i need it. Is that what you mean?
Thanks
Christoph
-
Hey Pete
I found the "Problem": FPCuser.pas Lines 245 ff
// send the request (allow up to 9 tries) while (i < 10) and ((SendMessageTimeout( m_hWnd, // FS6 window handle m_msg, // our registered message id m_atom, // wParam: name of file-mapping object 0, // lParam: offset of request into file-mapping obj SMTO_BLOCK, // halt this thread until we get a response 2000, // time out interval dwError)) = 0) do begin // return value Inc(i); Sleep(100); // Allow for things to happen end; if (i >= 10) then begin // Failed all tries if GetLastError = 0 then dwResult := FSUIPC_ERR_TIMEOUT else dwResult := FSUIPC_ERR_SENDMSG; Result := FALSE; Exit; end;
The Programm didn't freeze, but I had so many Request that it seemed so. With a sleep time of 100ms and 10 retries every failed request makes up 1 sec.
I modified these lines a little but and my programm too.
I had many timers requesting data every 500ms or so. With many timers that "freeze time" add up pretty quick. Now I check at the beginning of each timer and exit the function if not connected any more.
I changed the lines mentioned above to the following:
// send the request (allow up to 9 tries) while (i < 1) and ((SendMessageTimeout( m_hWnd, // FS6 window handle m_msg, // our registered message id m_atom, // wParam: name of file-mapping object 0, // lParam: offset of request into file-mapping obj SMTO_BLOCK, // halt this thread until we get a response 50, // time out interval dwError)) = 0) do begin // return value Inc(i); end; if (i >= 1) then begin // Failed all tries if GetLastError = 0 then dwResult := FSUIPC_ERR_TIMEOUT else dwResult := FSUIPC_ERR_SENDMSG; Result := FALSE; Exit; end;
Do you think that could be a problem? I didn't find any problems while testing it.
Hope others having same problems can solve them too!
Thanks again
Christoph
-
Sounds like you aren't handling the error conditions? The SendMessageTimeOut sent to FSUIPC should time out or fail when FS closes. Have you tried using the Delphi debugger to see where it is hanging?
I didn't write the Delphi interface program, but as far as I know all the source is there so you should be able to figure it out. Programs like FSInterrogate are written in Delphi, and manage to detect when FS closes and rejoin when it restarts.
Regards
Pete
Hey Pete,
thanks I'll take a closer look at it!
Sorry for posting twice, please delete one of the topics.
Christoph
-
Hello Pete and everyone else,
I have a Problem with my Programm which I write in Delphi (don't know if that matters)
I start FSX, then the Programm and everything works fine.
But when I close FSX before closing the programm, the programm just feezes completely when running on the same PC.
When I run it on another PC via WideFS it slows down quit a bit but at least it doesn't freeze completely. Probably has something to do with WideFS saving the last data it got from the FS.
Is there anyway to work around that? I tried to stop all Read or Writes to/from FS when it isn't responding but that doesn't work when the programm feezes completely.
Thanks
Christoph
-
Hey Pete
Works Great! Thanks for the effort!!!
Great Program!
Christoph
-
Hi Pete
Ok that'll be great!
Hope you can recover all of your data! And I hope you still had a nice holiday :-)
Christoph
-
Hey Pete
Thanks for the answer! Would be great if you could change that byte in the future! That way users could find out if there is no connection or FS has stopped (meaning they could find out witch of those)
I'm using Offset 337E right now to check, couldn't find a big difference between that and 3374. If there is please let me know.
Meanwhile I wrote some code to read out the Title Bar of WideFS and to check for the connection. If anyone interested in that let me know and I'll post that.
Chris
-
Hey Guys
I want to check if Wide FS has a connection or not. I tried using offset 333C
WideFS flags: those used so far are:2^0 1 =if TCP is being used, 0 if SPX
2^1 1 if connected at all, 0 is waiting for connections
See offset 3322 for WideFS version number, which also confirms that WideServer is registered and running.
It works fine the first time, when WideFS is open and connected it shows "3" which is ok, but when I stop the connection (by plugging out the LAN Cable) its still "3" even though the WideFS Titel Bar shows "waiting for a connection"
Any one an idea?
Or is there a better way to check the WideFS status?
Thought about reading the Title bar of the Wide FS window, but that wouldn't be nice ;-)
PS: Maybe a Moderator can add something like "Check FS Status" to the Topic Title, forgot that, sorry!
-
Hey
Putting all in the external dll worked.
Thanks for the help!
Great programm by the way ;-)
Christoph
-
Hey Pete
Thanks for the fast reply.
I'll try to make it a little bit clearer.
I have a large main programm, which starts the FSUIPC Link on startup. I wanted to organize the programm and all the functions. Therefore I wantet to put all functions writing or reading from the FSUIPC Link in an external dll.
So I just have to open functions from the main programm and get values from the FS.
For example a function called "WriteCom" It gets a 5 digit frequency, converts it to the bdcfreq used in FS and writes it into the FSUIPC Offset.
The function works fine execpt for the FSUIPC_Write and FSUIPC_Process parts. :-(
Hope it gets a little bit clearer now.
-
Hey Guys
I'm making a programm in Delphi and want to have some function in an dll.
In that case the programm should write an frequency to Com1. Something like "WriteCom(12345);"
The function includes FSUIPC_Write and FSUIPC_Process.
When I have the function in the main programm everything works fine.
But when I put it in an dll the FSUIPC_Write returns the Error: "Call cannot execute, link not Open"
Anyone who knows the problem and can help me?
Thanks
Programm Freeze is FSX shutdown first
in FSUIPC Support Pete Dowson Modules
Posted
Hey Pete
Thanks for your answer. Performance is allways important ;-) I'll take a look at it, and probably going to re-design it if it isn't too much work.
Thanks again!
Christoph