finish altitude in metric

This commit is contained in:
Zichao Lin 2022-05-08 01:54:37 +08:00
parent 8ce62c5cf4
commit de7aff5b12

@ -27,6 +27,7 @@ void TinyEurocat::OnGetTagItem( CFlightPlan FlightPlan,
int maalt, mcalt, mcspd; int maalt, mcalt, mcspd;
switch (ItemCode) switch (ItemCode)
{ {
char tmpstr[15];
case TAG_ITEM_MET_ASS_ALT: case TAG_ITEM_MET_ASS_ALT:
maalt = FlightPlan.GetClearedAltitude() * 0.3048; maalt = FlightPlan.GetClearedAltitude() * 0.3048;
if(maalt != 0) if(maalt != 0)
@ -36,7 +37,7 @@ void TinyEurocat::OnGetTagItem( CFlightPlan FlightPlan,
maalt -= 1; maalt -= 1;
else if(maalt % 3 == 2) else if(maalt % 3 == 2)
maalt += 1; maalt += 1;
char tmpstr[15];
itoa(maalt * 10, tmpstr, 10); itoa(maalt * 10, tmpstr, 10);
sprintf(sItemString, "%04s", tmpstr); sprintf(sItemString, "%04s", tmpstr);
} }
@ -46,12 +47,13 @@ void TinyEurocat::OnGetTagItem( CFlightPlan FlightPlan,
} }
break; break;
case TAG_ITEM_MET_CURR_ALT: case TAG_ITEM_MET_CURR_ALT:
mcalt = 1; mcalt = RadarTarget.GetPosition().GetPressureAltitude() * 0.3048;
itoa(mcalt, sItemString, 10); mcalt /= 100;
itoa(mcalt * 10, tmpstr, 10);
sprintf(sItemString, "%04s", tmpstr);
break; break;
case TAG_ITEM_MET_CURR_SPD: case TAG_ITEM_MET_CURR_SPD:
mcspd = RadarTarget.GetGS() * 1.852 / 10; mcspd = RadarTarget.GetGS() * 1.852 / 10;
char tmpstr[15];
itoa(mcspd, tmpstr, 10); itoa(mcspd, tmpstr, 10);
sprintf(sItemString, "%03s", tmpstr); sprintf(sItemString, "%03s", tmpstr);
break; break;