From b32eb55083b7f60a93f7509a92304ca23d1d7c02 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 14 Apr 2016 23:09:00 +0200 Subject: [PATCH] Change clearDMR function to explicit display sizes --- HD44780.cpp | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/HD44780.cpp b/HD44780.cpp index e87ea30..9a60970 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -207,12 +207,39 @@ void CHD44780::writeDMR(unsigned int slotNo, const char* src, bool group, unsign void CHD44780::clearDMR(unsigned int slotNo) { - if (slotNo == 1U) { - ::lcdPosition(m_fd, 0, m_rows > 2U ? 1 : 0); - ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); - } else { - ::lcdPosition(m_fd, 0, m_rows > 2U ? 2 : 1); - ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); + if (m_rows == 2U && m_cols == 16U) { + if (slotNo == 1U) { + ::lcdPosition(m_fd, 0, 0); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + } else { + ::lcdPosition(m_fd, 0, 0); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); + } + } else if (m_rows == 4U && m_cols == 20U) { + if (slotNo == 1U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + } else { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); + } + } else if (m_rows == 2 && m_cols == 40U) { + if (slotNo == 1U) { + ::lcdPosition(m_fd, 0, 0); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + } else { + ::lcdPosition(m_fd, 0, 0); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); + } } }