From d29da6ba58ce6e9fe62629ec4fb8b0f51a9c1c33 Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 18 Apr 2016 08:43:17 +0200 Subject: [PATCH] Added output for 4x16 HD44780 LCDs --- HD44780.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/HD44780.cpp b/HD44780.cpp index aabcea2..f87f5be 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -146,6 +146,19 @@ void CHD44780::writeDStar(const char* my1, const char* my2, const char* your, co ::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 == 16U) { + char buffer[16U]; + ::sprintf(buffer, "%s %.8s/%.4s", type, my1, my2); + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); + + if (strcmp(reflector, " ") == 0) { + ::sprintf(buffer, "%.8s", your); + } else { + ::sprintf(buffer, "%.8s <- %.8s", your, reflector); + } + ::lcdPosition(m_fd, 0, 2); + ::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); @@ -178,6 +191,12 @@ void CHD44780::clearDStar() if (m_rows == 2U && m_cols == 16U) { ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); + } else if (m_rows == 4U && m_cols == 16U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); + + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "%.*s", m_cols, " "); } else if (m_rows == 4U && m_cols == 20U) { ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); @@ -207,6 +226,16 @@ void CHD44780::writeDMR(unsigned int slotNo, const char* src, bool group, const ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); } + } else if (m_rows == 4U && m_cols == 16U) { + ::lcdPosition(m_fd, 0, 0); + ::lcdPuts(m_fd, "DMR"); + if (slotNo == 1U) { + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); + } else { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + } } else if (m_rows == 4U && m_cols == 20U) { ::lcdPosition(m_fd, 0, 0); ::lcdPuts(m_fd, "DMR"); @@ -239,6 +268,17 @@ void CHD44780::writeDMR(unsigned int slotNo, const char* src, bool group, const ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); } + } else if (m_rows == 4U && m_cols == 16U) { + char buffer[16U]; + if (slotNo == 1U) { + ::sprintf(buffer, "%s %s > %s%s", type, src, group ? "TG" : "", dst); + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer); + } else { + ::sprintf(buffer, "%s %s > %s%s", type, src, group ? "TG" : "", dst); + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); + } } else if (m_rows == 4U && m_cols == 20U) { char buffer[20U]; if (slotNo == 1U) { @@ -276,6 +316,14 @@ void CHD44780::clearDMR(unsigned int slotNo) ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); } + } else if (m_rows == 4U && m_cols == 16U) { + if (slotNo == 1U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + } else { + ::lcdPosition(m_fd, 0, 2); + ::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); @@ -310,6 +358,15 @@ void CHD44780::writeFusion(const char* source, const char* dest) ::sprintf(buffer, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); + } else if (m_rows == 4U && m_cols == 16U) { + char buffer[16U]; + ::sprintf(buffer, "%.10s >", source); + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); + + ::sprintf(buffer, "%.10s", dest); + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); } else if (m_rows == 4U && m_cols == 20U) { char buffer[20U]; ::sprintf(buffer, "%.10s >", source); @@ -335,6 +392,12 @@ void CHD44780::clearFusion() if (m_rows == 2U && m_cols == 16U) { ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); + } else if (m_rows == 4U && m_cols == 16U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); + + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "%.*s", m_cols, " "); } else if (m_rows == 4U && m_cols == 20U) { ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);