AP_OSD: fixed packed dot

This commit is contained in:
Alexander Malishev 2018-07-04 20:15:07 +04:00 committed by Andrew Tridgell
parent b97fa4c978
commit 3fb034e350
2 changed files with 4 additions and 6 deletions

View File

@ -20,7 +20,8 @@
extern const AP_HAL::HAL& hal;
#define SYM_DIG_OFS 0x90
#define SYM_DIG_OFS_1 0x90
#define SYM_DIG_OFS_2 0xA0
void AP_OSD_Backend::write(uint8_t x, uint8_t y, bool blink, const char *fmt, ...)
{
@ -32,7 +33,8 @@ void AP_OSD_Backend::write(uint8_t x, uint8_t y, bool blink, const char *fmt, ..
// automatically use packed decimal characters
char *p = strchr(&buff[1],'.');
if (p && isdigit(p[1]) && isdigit(p[-1])) {
p[-1] += SYM_DIG_OFS;
p[-1] += SYM_DIG_OFS_1;
p[1] += SYM_DIG_OFS_2;
memmove(p, p+1, strlen(p+1)+1);
res--;
}

View File

@ -154,10 +154,6 @@ AP_OSD_Screen::AP_OSD_Screen()
}
//Symbols
#define SYM_BLANK 0x20
#define SYM_COLON 0x2D
#define SYM_ZERO_HALF_TRAILING_DOT 192
#define SYM_ZERO_HALF_LEADING_DOT 208
#define SYM_M 0xB9
#define SYM_KM 0xBA