Skip to content

Commit

Permalink
Alternate altitude display in meters and feet
Browse files Browse the repository at this point in the history
  • Loading branch information
pjalocha committed Sep 20, 2021
1 parent c0da476 commit 1ed0b5c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main/disp_oled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,13 @@ void OLED_DrawGPS(u8g2_t *OLED, GPS_Position *GPS) // GPS time, position, altit
Len=0;
Len+=Format_String(Line+Len, "Alt: ");
if(GPS && GPS->isValid())
{ Len+=Format_SignDec(Line+Len, GPS->Altitude, 4, 1);
Line[Len++]='m'; }
{ if(GPS->Sec&2) // display altitude in meters
{ Len+=Format_SignDec(Line+Len, GPS->Altitude, 4, 1);
Line[Len++]='m'; }
else // and alternate in feet
{ Len+=Format_SignDec(Line+Len, (GPS->Altitude*336+512)>>10, 5);
Line[Len++]='f'; Line[Len++]='t'; }
}
else Len+=Format_String(Line+Len, "-----.-");
Line[Len]=0;
u8g2_DrawStr(OLED, 0, 60, Line);
Expand Down

0 comments on commit 1ed0b5c

Please sign in to comment.