fix current altitude accuracy

This commit is contained in:
Zichao Lin 2022-05-08 11:00:45 +08:00
parent 85e3e82777
commit 2554e22f66

@ -30,12 +30,12 @@ void TinyEurocat::OnGetTagItem( CFlightPlan FlightPlan,
char tmpstr[15]; 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)
{ {
maalt /= 100; maalt /= 100;
if(maalt % 3 == 1) if (maalt % 3 == 1)
maalt -= 1; maalt -= 1;
else if(maalt % 3 == 2) else if (maalt % 3 == 2)
maalt += 1; maalt += 1;
itoa(maalt * 10, tmpstr, 10); itoa(maalt * 10, tmpstr, 10);
@ -48,12 +48,13 @@ void TinyEurocat::OnGetTagItem( CFlightPlan FlightPlan,
break; break;
case TAG_ITEM_MET_CURR_ALT: case TAG_ITEM_MET_CURR_ALT:
mcalt = RadarTarget.GetPosition().GetPressureAltitude() * 0.3048; mcalt = RadarTarget.GetPosition().GetPressureAltitude() * 0.3048;
mcalt /= 100; mcalt /= 10;
itoa(mcalt * 10, tmpstr, 10); itoa(mcalt, tmpstr, 10);
sprintf(sItemString, "%04s", tmpstr); 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;
mcspd /= 10;
itoa(mcspd, tmpstr, 10); itoa(mcspd, tmpstr, 10);
sprintf(sItemString, "%03s", tmpstr); sprintf(sItemString, "%03s", tmpstr);
break; break;