The online racing simulator
CInsim Outgauge Flags
(5 posts, started )
CInsim Outgauge Flags
Hi,

I am using CInsim to get Outgauge data in my c/c++-application. The connection is working and I can get data from the game about speed, RPM etc, but the Outgauge->Flags is not updating for me.

I tried using code as:

if (pOutgauge->Flags | OG_HANDBRAKE)
{
printf("Handbrake");
}

This will give me that the handbrake light is always on. If i check the flags (of type word) variable this never changes any values when pressing handbrake, headlights etc. Is there any setup needed for these to work?

I also wonder if LFS contain implementation of signal left and right. I can't find any controller for it, but the flags contain them.

Regard,
Petter Gustavsson
I'm not familiar with CInSim but my guess is it's slightly outdated. The OutGauge structure was recently changed to hold dashboard lights in a separate bit field labled ShowLights.
// OutGauge - EXTERNAL DASHBOARD SUPPORT
// ========

// The user's car in multiplayer or the viewed car in single player or
// single player replay can output information to a dashboard system
// while viewed from an internal view.

// This can be controlled by 5 lines in the cfg.txt file :

// OutGauge Mode 0 :0-off 1-driving 2-driving+replay
// OutGauge Delay 1 :minimum delay between packets (100ths of a sec)
// OutGauge IP 0.0.0.0 :IP address to send the UDP packet
// OutGauge Port 0 :IP port
// OutGauge ID 0 :if not zero, adds an identifier to the packet

// Each update sends the following UDP packet :

struct OutGaugePack
{
unsigned Time; // time in milliseconds (to check order)

char Car[4]; // Car name
word Flags; // Info (see OG_x below)
byte Gear; // Reverse:0, Neutral:1, First:2...
byte SpareB;
float Speed; // M/S
float RPM; // RPM
float Turbo; // BAR
float EngTemp; // C
float Fuel; // 0 to 1
float OilPressure; // BAR
float OilTemp; // C
unsigned DashLights; // Dash lights available (see DL_x below)
unsigned ShowLights; // Dash lights currently switched on
float Throttle; // 0 to 1
float Brake; // 0 to 1
float Clutch; // 0 to 1
char Display1[16]; // Usually Fuel
char Display2[16]; // Usually Settings

int ID; // optional - only if OutGauge ID is specified
};

// OG_x - bits for OutGaugePack Flags

#define OG_TURBO 8192 // show turbo gauge
#define OG_KM 16384 // if not set - user prefers MILES
#define OG_BAR 32768 // if not set - user prefers PSI

// DL_x - bits for OutGaugePack DashLights and ShowLights

enum
{
DL_SHIFT, // bit 0 - shift light
DL_FULLBEAM, // bit 1 - full beam
DL_HANDBRAKE, // bit 2 - handbrake
DL_PITSPEED, // bit 3 - pit speed limiter
DL_TC, // bit 4 - TC active or switched off
DL_SIGNAL_L, // bit 5 - left turn signal
DL_SIGNAL_R, // bit 6 - right turn signal
DL_SIGNAL_ANY, // bit 7 - shared turn signal
DL_OILWARN, // bit 8 - oil pressure warning
DL_BATTERY, // bit 9 - battery warning
DL_ABS, // bit 10 - ABS active or switched off
DL_SPARE, // bit 11
DL_NUM
};

As for using the indicators, use the keys 7 (left), 8(right) or 9(both, hazard warning) to turn them on and 0 to turn them off again.
Very helpful, both tips worked perfectly! Thank you!
Is this actually my CInsim library??? I don't know anything about outgauge and didn't know that it could be used with my lib Anyway, I haven't touched it since 2008 so the main update I guess is to grab the newest insim.txt in the docs folder and rename it to insim.h and use that for the header file of my lib.

Also you have to look for the line that sets the size of buttons text and remove the comment in it so you can write text into buttons (you have to specify the size of the C string to up to 240 chars).
Quote from MaKaKaZo :Is this actually my CInsim library??? I don't know anything about outgauge and didn't know that it could be used with my lib Anyway, I haven't touched it since 2008 so the main update I guess is to grab the newest insim.txt in the docs folder and rename it to insim.h and use that for the header file of my lib.

Also you have to look for the line that sets the size of buttons text and remove the comment in it so you can write text into buttons (you have to specify the size of the C string to up to 240 chars).

Haha, yes it's your lib. It's possible by using the udp_get_packet and OutGaugePack from insim.h.

Your lib is working very nice i must say
-
(Napalm Candy) DELETED by Napalm Candy

CInsim Outgauge Flags
(5 posts, started )
FGED GREDG RDFGDR GSFDG