LFSLib woes
(4 posts, started )
LFSLib woes
Hey,

I'm using C# and LFSLib to get information out of LFS to display on an LCD display (speed, gears, fuel, etc), but the problem is when using Outgauge; the OutgaugeHandler event seems to be getting called with a 15 second-or-so delay.

In my OutgaugeHandler I call a method which basically formats some text and sends it to the LCD, and I can get around the above problem somewhat if I multithread the text writing operation using the BackgroundWorker object but I can only send data when the BackgroundWorker's IsBusy property is false. It means the application often misses one-shot events, such as the player crossing the start/finish line. If I wait for the busy flag to go low, obviously the app slows and affects the performance of LFS considerably. I've tried swapping out the BackgroundWorker and creating my own threads, but this has the same effect (in fact, there's a longer delay before Outgauge starts sending me event notifications).

I've also tried processing messages to be sent to the LCD in a queue (which is processed in a separate thread) but this doesn't help (I get the long delay).

I've had a look through the LFSLib source and can't see anything unusual with it's multithreading, so it's obviously my app. The problem feels like it's to do with threading priorities, but i'm not sure what else to do.

Anyone else come across something similar?
Try using your own thread and setting its priority to BelowNormal. That made the trick for me
Quote from BurnOut69 :Try using your own thread and setting its priority to BelowNormal. That made the trick for me

Hmm same problem. I think part of my problem is in the code which manages the LCD, I use Thread.Sleep() with an interval of 1ms after sending a command (which I need to, really). Is there any way around this? I wouldn't have thought a delay of 1ms would screw things up this much
Ok I've sorted my initial problem. I went back to using the BackgroundWorker, and created a separate system for so-called 'one shot messages', for things suchs as a player crossing the start/finish line, stuff like that.

I've come across another problem however. I'm tracking each player's lap times and split times during a race, but when I come to display it on the LCD, I'm only interested in displaying information for the car that the camera is currently looking at. Any ideas on how to retrieve the player id that the camera is currently showing? I've tried handling the RaceTrackPlayerCameraChange but this doesn't seem to work well.

LFSLib woes
(4 posts, started )
FGED GREDG RDFGDR GSFDG