From bcdc2fc1c458bb3bbf720c43e2b57ec79e5e8b31 Mon Sep 17 00:00:00 2001 From: Tony Corbett Date: Wed, 11 May 2016 09:10:48 +0100 Subject: [PATCH] Add more custom chars for type (rf or ip) and use them --- HD44780.cpp | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/HD44780.cpp b/HD44780.cpp index 2f4afb6..2f5609b 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -113,6 +113,30 @@ unsigned char vChar[8] = 0b11111 }; +unsigned char rfChar[8] = +{ + 0b11100, + 0b10100, + 0b11000, + 0b10100, + 0b00111, + 0b00100, + 0b00110, + 0b00100 +}; + +unsigned char ipChar[8] = +{ + 0b01000, + 0b01000, + 0b01000, + 0b01000, + 0b00110, + 0b00101, + 0b00110, + 0b00100 +}; + CHD44780::~CHD44780() { } @@ -149,6 +173,8 @@ bool CHD44780::open() ::lcdCharDef(m_fd, 2, mChar); ::lcdCharDef(m_fd, 3, dChar); ::lcdCharDef(m_fd, 4, vChar); + ::lcdCharDef(m_fd, 5, rfChar); + ::lcdCharDef(m_fd, 6, ipChar); return true; } @@ -237,7 +263,6 @@ void CHD44780::setIdleInt() ::lcdPrintf(m_fd, "%-6s / %u", m_callsign.c_str(), m_dmrid); ::lcdPosition(m_fd, 0, 1); -// ::lcdPuts(m_fd, "MMDVM Idle"); ::lcdPutchar(m_fd, 2); ::lcdPutchar(m_fd, 2); ::lcdPutchar(m_fd, 3); @@ -266,7 +291,6 @@ void CHD44780::setErrorInt(const char* text) } ::lcdPosition(m_fd, 0, 0); -// ::lcdPuts(m_fd, "MMDVM"); ::lcdPutchar(m_fd, 2); ::lcdPutchar(m_fd, 2); ::lcdPutchar(m_fd, 3); @@ -295,7 +319,6 @@ void CHD44780::setLockoutInt() } ::lcdPosition(m_fd, 0, 0); -// ::lcdPuts(m_fd, "MMDVM"); ::lcdPutchar(m_fd, 2); ::lcdPutchar(m_fd, 2); ::lcdPutchar(m_fd, 3); @@ -435,7 +458,6 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPosition(m_fd, 0, 0); ::lcdPuts(m_fd, "DMR "); ::lcdPosition(m_fd, 0, 1); -// ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); ::lcdPrintf(m_fd, "%-16s", "Listening"); } } else if (m_rows == 4U && m_cols == 16U) { @@ -471,11 +493,12 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro } } - if (m_rows == 2U && m_cols == 16U) { + #ifdef ADAFRUIT_DISPLAY adafruitLCDColour(AC_RED); #endif + if (m_rows == 2U && m_cols == 16U) { char buffer[16U]; if (m_duplex) { if (slotNo == 1U) { @@ -492,17 +515,15 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPutchar(m_fd, 0); ::sprintf(buffer, " %s", src.c_str()); ::lcdPrintf(m_fd, "%-14s", buffer); + ::lcdPutchar(m_fd, strcmp(type, "R") == 0 ? 5 : 6); ::lcdPosition(m_fd, 0, 1); ::lcdPutchar(m_fd, 1); ::sprintf(buffer, " %s%s", group ? "TG" : "", dst.c_str()); ::lcdPrintf(m_fd, "%-14s", buffer); + ::lcdPutchar(m_fd, strcmp(type, "R") == 0 ? 5 : 6); } } else if (m_rows == 4U && m_cols == 16U) { -#ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); -#endif - char buffer[16U]; if (slotNo == 1U) { ::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str()); @@ -514,10 +535,6 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); } } else if (m_rows == 4U && m_cols == 20U) { -#ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); -#endif - char buffer[20U]; if (slotNo == 1U) { ::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str()); @@ -529,10 +546,6 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); } } else if (m_rows == 2U && m_cols == 40U) { -#ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); -#endif - char buffer[40U]; if (slotNo == 1U) { ::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());