AP_OSD: fixed CI build error

This commit is contained in:
Andrew Tridgell 2018-06-27 09:59:42 +10:00
parent aeaf695d83
commit a86c4d27e1
3 changed files with 6 additions and 13 deletions

View File

@ -126,7 +126,7 @@ void AP_OSD::update_current_screen()
}
int16_t channel_value = channel->get_radio_in();
for (int i=0; i<AP_OSD_NUM_SCREENS; i++) {
for (uint8_t i=0; i<AP_OSD_NUM_SCREENS; i++) {
if (screen[i].enabled && screen[i].channel_min <= channel_value && screen[i].channel_max > channel_value) {
current_screen = i;
break;

View File

@ -25,7 +25,7 @@ void AP_OSD_Backend::write(uint8_t x, uint8_t y, bool blink, const char *fmt, ..
va_list ap;
va_start(ap, fmt);
int res = hal.util->vsnprintf(buff, sizeof(buff), fmt, ap);
if (res < sizeof(buff)) {
if (res < int(sizeof(buff))) {
write(x, y, buff, blink? AP_OSD_Backend::BLINK : 0);
}
va_end(ap);

View File

@ -28,6 +28,7 @@
#include <AP_Math/AP_Math.h>
#include <AP_RSSI/AP_RSSI.h>
#include <AP_Notify/AP_Notify.h>
#include <ctype.h>
const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
@ -83,7 +84,7 @@ const AP_Param::GroupInfo AP_OSD_Screen::var_info[] = {
// @Group: MESSAGE
// @Path: AP_OSD_Setting.cpp
AP_SUBGROUPINFO(message, "MESSAGE", 11, AP_OSD_Screen, AP_OSD_Setting),
// @Group: GSPEED
// @Path: AP_OSD_Setting.cpp
AP_SUBGROUPINFO(gspeed, "GSPEED", 12, AP_OSD_Screen, AP_OSD_Setting),
@ -163,14 +164,6 @@ void AP_OSD_Screen::draw_batused(uint8_t x, uint8_t y)
backend->write(x,y, battery.has_failsafed(), "%c%4.0f", SYM_MAH, battery.consumed_mah());
}
char to_uppercase(char c)
{
if (c >= 'a' && c<= 'z') {
return c + 'A' - 'a';
}
return c;
}
void AP_OSD_Screen::draw_message(uint8_t x, uint8_t y)
{
AP_Notify * notify = AP_Notify::instance();
@ -181,8 +174,8 @@ void AP_OSD_Screen::draw_message(uint8_t x, uint8_t y)
//converted to uppercase,
//because we do not have small letter chars inside used font
strncpy(buffer, notify->get_text(), sizeof(buffer));
for (int i=0; i<sizeof(buffer); i++) {
buffer[i] = to_uppercase(buffer[i]);
for (uint8_t i=0; i<sizeof(buffer); i++) {
buffer[i] = toupper(buffer[i]);
}
backend->write(x, y, buffer);
}