change cfl algorithm

This commit is contained in:
Zichao Lin 2022-07-10 21:38:44 +08:00
parent 364fd43810
commit f67fed9e09

@ -29,11 +29,10 @@ 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 / 10;
maalt /= 100; if (maalt > 0)
if (maalt > 0 && maalt != int(FlightPlan.GetFinalAltitude() * 0.3048) / 100 && maalt <= 149)
{ {
itoa(maalt * 10, tmpstr, 10); itoa(maalt, tmpstr, 10);
sprintf(sItemString, "%04s", tmpstr); sprintf(sItemString, "%04s", tmpstr);
} }
else else
@ -42,8 +41,7 @@ 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 / 10;
mcalt /= 10;
itoa(mcalt, tmpstr, 10); itoa(mcalt, tmpstr, 10);
sprintf(sItemString, "%04s", tmpstr); sprintf(sItemString, "%04s", tmpstr);
break; break;