AP_OSD: normalize whitespace symbols

This fixes garbage on the screen (\n and \r symbols are not mapped
inside used fonts).
Thanks to @atshort for reporting the issue.
This commit is contained in:
Alexander Malishev 2019-01-22 01:57:19 +04:00 committed by Andrew Tridgell
parent 8d75ce6671
commit 15db7a6b97

View File

@ -497,10 +497,14 @@ void AP_OSD_Screen::draw_message(uint8_t x, uint8_t y)
strncpy(buffer, notify->get_text(), sizeof(buffer));
int16_t len = strnlen(buffer, sizeof(buffer));
//converted to uppercase,
//because we do not have small letter chars inside used font
for (int16_t i=0; i<len; i++) {
//converted to uppercase,
//because we do not have small letter chars inside used font
buffer[i] = toupper(buffer[i]);
//normalize whitespace
if (isspace(buffer[i])) {
buffer[i] = ' ';
}
}
int16_t start_position = 0;