diff --git a/src/main/drivers/max7456_symbols.h b/src/main/drivers/max7456_symbols.h index 27ab161239..f519e776c1 100644 --- a/src/main/drivers/max7456_symbols.h +++ b/src/main/drivers/max7456_symbols.h @@ -33,6 +33,7 @@ #define SYM_TEMPERATURE 0x7A #define SYM_LAT 0x89 #define SYM_LON 0x98 +#define SYM_ALTITUDE 0x7F // RSSI #define SYM_RSSI 0x01 @@ -119,7 +120,7 @@ #define SYM_BATT_1 0x95 #define SYM_BATT_EMPTY 0x96 -// Batt Icon“s +// Batt Icons #define SYM_MAIN_BATT 0x97 // Voltage and amperage diff --git a/src/main/osd/osd_elements.c b/src/main/osd/osd_elements.c index 8a4b6fb918..4fc29359bc 100644 --- a/src/main/osd/osd_elements.c +++ b/src/main/osd/osd_elements.c @@ -210,9 +210,9 @@ static void osdFormatAltitudeString(char * buff, int32_t altitudeCm) { const int alt = osdGetMetersToSelectedUnit(altitudeCm) / 10; - tfp_sprintf(buff, "%5d %c", alt, osdGetMetersToSelectedUnitSymbol()); - buff[5] = buff[4]; - buff[4] = '.'; + tfp_sprintf(buff, "%c%5d %c", SYM_ALTITUDE, alt, osdGetMetersToSelectedUnitSymbol()); + buff[6] = buff[5]; + buff[5] = '.'; } #ifdef USE_GPS diff --git a/src/test/unit/osd_unittest.cc b/src/test/unit/osd_unittest.cc index 93ea2c3ab4..a4bf30cfee 100644 --- a/src/test/unit/osd_unittest.cc +++ b/src/test/unit/osd_unittest.cc @@ -520,7 +520,7 @@ TEST(OsdTest, TestAlarms) displayPortTestBufferSubstring(12, 1, "%c16.8%c", SYM_BATT_FULL, SYM_VOLT); displayPortTestBufferSubstring(1, 1, "%c00:", SYM_FLY_M); // only test the minute part of the timer displayPortTestBufferSubstring(20, 1, "%c01:", SYM_ON_M); // only test the minute part of the timer - displayPortTestBufferSubstring(23, 7, " .0%c", SYM_M); + displayPortTestBufferSubstring(23, 7, "%c .0%c", SYM_ALTITUDE, SYM_M); } // when @@ -549,7 +549,7 @@ TEST(OsdTest, TestAlarms) displayPortTestBufferSubstring(12, 1, "%c13.5%c", SYM_MAIN_BATT, SYM_VOLT); displayPortTestBufferSubstring(1, 1, "%c01:", SYM_FLY_M); // only test the minute part of the timer displayPortTestBufferSubstring(20, 1, "%c02:", SYM_ON_M); // only test the minute part of the timer - displayPortTestBufferSubstring(23, 7, " 120.0%c", SYM_M); + displayPortTestBufferSubstring(23, 7, "%c 120.0%c", SYM_ALTITUDE, SYM_M); } else { displayPortTestBufferIsEmpty(); } @@ -770,7 +770,7 @@ TEST(OsdTest, TestElementAltitude) osdRefresh(simulationTime); // then - displayPortTestBufferSubstring(23, 7, " .0%c", SYM_M); + displayPortTestBufferSubstring(23, 7, "%c .0%c", SYM_ALTITUDE, SYM_M); // when simulationAltitude = 247; @@ -778,7 +778,7 @@ TEST(OsdTest, TestElementAltitude) osdRefresh(simulationTime); // then - displayPortTestBufferSubstring(23, 7, " 2.4%c", SYM_M); + displayPortTestBufferSubstring(23, 7, "%c 2.4%c", SYM_ALTITUDE, SYM_M); // when simulationAltitude = 4247; @@ -786,7 +786,7 @@ TEST(OsdTest, TestElementAltitude) osdRefresh(simulationTime); // then - displayPortTestBufferSubstring(23, 7, " 42.4%c", SYM_M); + displayPortTestBufferSubstring(23, 7, "%c 42.4%c", SYM_ALTITUDE, SYM_M); // when simulationAltitude = -247; @@ -794,7 +794,7 @@ TEST(OsdTest, TestElementAltitude) osdRefresh(simulationTime); // then - displayPortTestBufferSubstring(23, 7, " -2.4%c", SYM_M); + displayPortTestBufferSubstring(23, 7, "%c -2.4%c", SYM_ALTITUDE, SYM_M); // when simulationAltitude = -70; @@ -802,7 +802,7 @@ TEST(OsdTest, TestElementAltitude) osdRefresh(simulationTime); // then - displayPortTestBufferSubstring(23, 7, " -.7%c", SYM_M); + displayPortTestBufferSubstring(23, 7, "%c -.7%c", SYM_ALTITUDE, SYM_M); } /*