Pete,
Here goes with C code extracts.
From Gauge Heading declarations:
GAUGE_HEADER_FS700(GAUGE_W, display_gauge_name, &display_list, \
display_mouse_rect, display_cb, 0, 0, 0);
char chTime[3];
BOOL FS_read_ok;
FLOAT64 AC_Lat;
FLOAT64 AC_Long;
Callback function
void FSAPI display_cb(PGAUGEHDR pgauge, int service_id, \
UINT32 extra_data)
{
UINT32 dwResult;
SINT64 AC_Lat_int, AC_Long_int;
switch(service_id)
{
case PANEL_SERVICE_PRE_INSTALL:
break;
case PANEL_SERVICE_POST_INSTALL:
FSUIPC_Open(SIM_ANY,&dwResult);
break;
case PANEL_SERVICE_PRE_INITIALIZE:
break;
case PANEL_SERVICE_PRE_UPDATE:
FS_read_ok = TRUE;
if (!FSUIPC_Read(0x238, 3, chTime, &dwResult) ||
!FSUIPC_Read(0x560, 8, &AC_Lat_int, &dwResult) ||
!FSUIPC_Read(0x568, 8, &AC_Long_int, &dwResult) ||
!FSUIPC_Process(&dwResult))
FS_read_ok = FALSE;
else
{
AC_Lat = AC_Lat_int * 90 /( 10001750.0 * 65536 * 65536 );
AC_Long = AC_Long_int * 360 / (65536.0 * 65536 * 65536 * 65536);
}
break;
case PANEL_SERVICE_PRE_DRAW:
break;
case PANEL_SERVICE_PRE_KILL:
FSUIPC_Close();
break;
}
}
Lat display callback (Works fine N or S Lat)
FLOAT64 FSAPI lat_string_cb( PELEMENT_STRING pelement )
{
UINT32 deg;
float min;
char n_s;
if (FS_read_ok)
{
if (AC_Lat >= 0) n_s = 'N'; else
{
n_s = 'S';
AC_Lat = - AC_Lat;
}
deg = floor(AC_Lat);
min = ( AC_Lat - deg) * 60;
sprintf(pelement->string, "%c%2d*%6.3f",n_s, deg, min);
}
return 1.0;
}
Long display callback
FLOAT64 FSAPI long_string_cb( PELEMENT_STRING pelement )
{
UINT32 deg;
float min;
char e_w;
if (FS_read_ok)
{
if (AC_Long >= 0) e_w = 'E';
else
{
e_w = 'W';
AC_Long = - AC_Long;
}
deg = floor(AC_Long);
min = ( AC_Long - deg) * 60;
sprintf(pelement->string, "%c%03d*%6.3f",e_w, deg, min);
}
return 1.0;
}
For Ohakea AFB NZ E175*23.42' (From FS9 readout)
displays E000*23.421
For Vance AFB OK W97*55.39'
displays E000* 4.609
System is running WinXPpro
compilation using Visual Studio 6 IDE (VC98)
Trevor