hello,
as the title says it all, i want to read the heading into my application (through C++)
i've tried everything that came to my mind to fix this, but i couldnt fix this
this is my code:
//this function normalizes the heading
uint32_t normalize_heading(int32_t h)
{
if(h>359)
{
h-=359;
}
else if(h<0)
{
h+=359;
}
return h;
}
unsigned int heading;
short mag_var;
if(FSUIPC_Read(0x0580, 4, &heading, &result)&&FSUIPC_Process(&result))
{
if(FSUIPC_Read(0x2A0, 2, &mag_var, &result)&&FSUIPC_Process(&result))
{
double hdg1=heading*360/65536;
double hdg2=mag_var*360/65536;
double hdg3=hdg1-hdg2;
hdg3=normalize_heading(hdg3);
show_heading(hdg3);
i've also tried this when calculating the heading:
unsigned int heading;
short mag_var;
if(FSUIPC_Read(0x0580, 4, &heading, &result)&&FSUIPC_Process(&result))
{
if(FSUIPC_Read(0x2A0, 2, &mag_var, &result)&&FSUIPC_Process(&result))
{
double hdg1=heading*360/(65536*65536);
double hdg2=mag_var*360/65536;
double hdg3=hdg1-hdg2;
hdg3=normalize_heading(hdg3);
but compiler gave warning about devide by zero then when i run this, it crashes my application
thanks in advance for your help peter