The online racing simulator
Problem with Outgauge packets
(16 posts, started )
Problem with Outgauge packets
Hi, i was wondering if anyone else had experienced any problems with the Fuel and Engine temp info coming from LFS. Leo over at Beta Innovations has written a plugin for Plasma-lite users to have LCD's, gauges and the like displaying info from LFS. The problem is, the fuel & engine temp info doesn't come from LFS properly, the Fuel figure always seems to be something random and the engine temp just sits at '0'. All the other info is coming out just fine.
So, anyone else have any problems or know what may be wrong?
Engine temperature isnt yet modelled (therefore no value), and the fuel figure; can you elaborate on "random"? What sort of data does he get? It should only be a float (4 bytes) which ranges from 0 to 1 (meaning *100 gives the actual current fuel percentage).
Quote :Engine temperature isnt yet modelled (therefore no value),

That explains that one then


Quote :can you elaborate on "random"?

Well, if you check out this picture ->http://homepage.ntlworld.com/gfresh82/misc/LFSScShot2.jpg,
You can see the raw output in the bottom left, LINE 4 says Fuel 11.8 81.4L. Now the 11.8 looks right to me, but the 81.4L is usually a different figure every time it comes up and only appears every now and again. Any ideas what it is.
Without seeing part of the code it's difficult to comment. The first obvious suggestion would be to ensure the struct is correctly defined, and a memset / ZeroMemory is performed on the temporary buffer.
Ok, this is what Leo had to say;

Quote :I don't use the FUEL value, but what’s stored in the

"char Display1[16]; // Usually Fuel" <- in insim.txt file.

which is an array of characters and provides preformatted text on the fuel level in liters I guess. This array sometimes contains garbage which is coming from the sim. I’ve tracked the problem down to LFS is not always adding a NULL character (i.e. a zero) at the end of the line stored in the array so without this NULL char, my program has no way of knowing where to stop reading and prints all 16 char some of which are garbage.

So, does anyone know if this 'null character' problem is easily fixed? or is it something that needs sorting in a future LFS update?
Stop reading the line at the letter L if no char[zero] is found perhaps ?
I agree with Karl, if a buffer is getting re-used make sure it's cleared to all zeroes before using it again. Depending on what programming language it's written in, you may have to zero it out right from the start.
Ok, thanks guys & gals
maybe that number tells you something about how many laps are doable? Just an idea...
Quote :
maybe that number tells you something about how many laps are doable? Just an idea...

You know, i've been trying to think what that figure is for and couldn't come up with anything, but you may just have hit the nail on the head, it seems so obvious now.
OK, I've just investigated this and it seems fine, so I'll remove it from my bug sheet, unless you tell me there really is a problem.

It's true there are sometimes spaces after the fuel amount and before a teminating zero, and sometimes no terminating zero, in the case when it states the number of laps remaining. But that's because I'm squeezing the characters into a 16 character buffer. The real BMW Sauber display has 16 characters, not 15 and a NULL terminator. So that's why it is the way it is.

One way to make it safe and null-terminated would be :

- allocate a 20 character buffer
- memset it to 20 zeros
- read in the 16 chars from outguage

That's it, you now have a safe 16 character buffer with a null terminator (possibly in the 17th char)
Just to be a lazy, pain in the arse, any chance you are considering increasing the size of the char array in an incompatible version of Outgauge?
No, why would I?

I'm very busy, got a lot to do right now.

So if you really need to make requests, please do explain what they are for so I don't need to waste time replying.
Quite frankly it isn't important as it's simple to work around, so just forget I'd even asked.

I didn't mean to imply that it was an important change, nor did I mean to infer that I was demanding it. It was a humble request. I appreciate that it was somewhat unfair to ask for as well, and I fully understand that you're a very busy person.
yea dude scawen is a busy man he needs to finish his marathon race to bring another beta that is gonna kill our pc lol j/k.

Problem with Outgauge packets
(16 posts, started )
FGED GREDG RDFGDR GSFDG