AP_Notify: Correct the display area clear of the text message.

This commit is contained in:
murata 2017-03-15 23:08:05 +09:00 committed by Francisco Ferreira
parent c0238be345
commit 1a781f44cc
2 changed files with 5 additions and 5 deletions

View File

@ -536,15 +536,15 @@ void Display::update_text_empty(uint8_t r)
{ {
char msg [DISPLAY_MESSAGE_SIZE] = {}; char msg [DISPLAY_MESSAGE_SIZE] = {};
memset(msg, ' ', sizeof(msg)-1); memset(msg, ' ', sizeof(msg)-1);
_movedelay = 0; _movedelay = 4;
_mstartpos = 0; _mstartpos = 0;
draw_text(COLUMN(0), ROW(r), msg); draw_text(COLUMN(0), ROW(r), msg);
} }
void Display::update_text(uint8_t r) void Display::update_text(uint8_t r)
{ {
char msg [DISPLAY_MESSAGE_SIZE]; char msg [DISPLAY_MESSAGE_SIZE] = {0};
char txt [NOTIFY_TEXT_BUFFER_SIZE]; char txt [NOTIFY_TEXT_BUFFER_SIZE] = {0};
const bool text_is_valid = AP_HAL::millis() - pNotify->_send_text_updated_millis < _send_text_valid_millis; const bool text_is_valid = AP_HAL::millis() - pNotify->_send_text_updated_millis < _send_text_valid_millis;
if (!text_is_valid) { if (!text_is_valid) {
@ -554,7 +554,7 @@ void Display::update_text(uint8_t r)
snprintf(txt, NOTIFY_TEXT_BUFFER_SIZE, "%s", pNotify->get_text()); snprintf(txt, NOTIFY_TEXT_BUFFER_SIZE, "%s", pNotify->get_text());
_mstartpos++; _mstartpos++;
for (uint8_t i = 0; i < sizeof(msg); i++) { for (uint8_t i = 0; i < (sizeof(msg) - 1); i++) {
if (txt[i + _mstartpos - 1] != 0) { if (txt[i + _mstartpos - 1] != 0) {
msg[i] = txt[i + _mstartpos - 1]; msg[i] = txt[i + _mstartpos - 1];
} else { } else {

View File

@ -5,7 +5,7 @@
#define ROW(Y) ((Y * 10) + 6) #define ROW(Y) ((Y * 10) + 6)
#define COLUMN(X) ((X * 7) + 0) #define COLUMN(X) ((X * 7) + 0)
#define DISPLAY_MESSAGE_SIZE 18 #define DISPLAY_MESSAGE_SIZE 19
class Display_Backend; class Display_Backend;