From a703f88ac774b0f1f6c7e925e85cfc3a49ae93fc Mon Sep 17 00:00:00 2001 From: ShikOfTheRa Date: Fri, 27 Mar 2020 09:19:11 +0000 Subject: [PATCH] Alt display improvements / bugfix / memory savings 1 - Improved display GPS alt = ALT :: BARO alt = ALT: For accuracy / LIDAR, when below Hi Res cutoff BARO ALT = AGL : 2 - display bugfix GPS altitude could only be displayed if Baro altitude was displayed. How as anyone never raised this !!! 3 - Memeory saving 10 bytes --- MW_OSD/MW_OSD.ino | 6 ++++-- MW_OSD/Screen.ino | 13 +++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/MW_OSD/MW_OSD.ino b/MW_OSD/MW_OSD.ino index 3c59bab1..64b53f25 100644 --- a/MW_OSD/MW_OSD.ino +++ b/MW_OSD/MW_OSD.ino @@ -732,8 +732,10 @@ void loop() } #endif // SUBMERSIBLE - displayAltitude(((int32_t)GPS_altitude*10),MwGPSAltPosition,SYM_GPS_ALT); - displayAltitude(MwAltitude/10,MwAltitudePosition,SYM_ALT); + if (fieldIsVisible(MwGPSAltPosition)) + displayAltitude(((int32_t)GPS_altitude*10),MwGPSAltPosition,SYM_GPS_ALT); + if (fieldIsVisible(MwAltitudePosition)) + displayAltitude(MwAltitude/10,MwAltitudePosition,SYM_ALT); displayClimbRate(); displayVario(); displayNumberOfSat(); diff --git a/MW_OSD/Screen.ino b/MW_OSD/Screen.ino index aa8cb70a..10aa9a8e 100644 --- a/MW_OSD/Screen.ino +++ b/MW_OSD/Screen.ino @@ -869,6 +869,7 @@ void displayIntro(void) void displayAltitude(int32_t t_alt10, int16_t t_pos, uint8_t t_icon) { // alt sent as dm + uint8_t t_dp = 0; #if defined SUBMARINE t_alt10 = abs(t_alt10); #endif // SUBMARINE @@ -884,14 +885,22 @@ void displayAltitude(int32_t t_alt10, int16_t t_pos, uint8_t t_icon) { // alt se return; } } - if (!fieldIsVisible(MwAltitudePosition)) - return; + if (t_alt < Settings[S_ALTRESOLUTION]) { + t_dp = 1; + if (t_icon==SYM_ALT){ + t_icon = SYM_AGL; + } + } + displayItem(t_pos, t_alt, t_icon, UnitsIcon[Settings[S_UNITSYSTEM] + 0], t_dp ); + +/* if (t_alt < Settings[S_ALTRESOLUTION]) { displayItem(t_pos, t_alt10, SYM_AGL, UnitsIcon[Settings[S_UNITSYSTEM] + 0], 1 ); } else { displayItem(t_pos, t_alt, t_icon, UnitsIcon[Settings[S_UNITSYSTEM] + 0], 0 ); } +*/ }