mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Change writeDStar function to explicit sizes
This commit is contained in:
13
HD44780.cpp
13
HD44780.cpp
@@ -119,9 +119,13 @@ void CHD44780::writeDStar(const char* my1, const char* my2, const char* your, co
|
|||||||
::lcdPosition(m_fd, 0, 0);
|
::lcdPosition(m_fd, 0, 0);
|
||||||
::lcdPuts(m_fd, "D-Star");
|
::lcdPuts(m_fd, "D-Star");
|
||||||
|
|
||||||
if (m_rows > 2U) {
|
if (m_rows == 2U && m_cols == 16U) {
|
||||||
char buffer[40U];
|
char buffer[16U];
|
||||||
|
::sprintf(buffer, "%s %.8s/%.4s", type, my1, my2);
|
||||||
|
::lcdPosition(m_fd, 0, 1);
|
||||||
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
||||||
|
} else if (m_rows == 4U && m_cols == 20U) {
|
||||||
|
char buffer[20U];
|
||||||
::sprintf(buffer, "%s %.8s/%.4s >", type, my1, my2);
|
::sprintf(buffer, "%s %.8s/%.4s >", type, my1, my2);
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
||||||
@@ -129,10 +133,9 @@ void CHD44780::writeDStar(const char* my1, const char* my2, const char* your, co
|
|||||||
::sprintf(buffer, "%.8s", your);
|
::sprintf(buffer, "%.8s", your);
|
||||||
::lcdPosition(m_fd, 0, 2);
|
::lcdPosition(m_fd, 0, 2);
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
||||||
} else {
|
} else if (m_rows == 2 && m_cols == 40U) {
|
||||||
char buffer[40U];
|
char buffer[40U];
|
||||||
::sprintf(buffer, "%s %.8s/%.4s > %.8s", type, my1, my2, your);
|
::sprintf(buffer, "%s %.8s/%.4s > %.8s", type, my1, my2, your);
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user