diff --git a/Conf.cpp b/Conf.cpp index 74f8e88..fcb9fd1 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -357,7 +357,7 @@ bool CConf::read() else if (::strcmp(key, "PWMDim") == 0) m_hd44780PWMDim = (unsigned int)::atoi(value); else if (::strcmp(key, "DVMegaDisplay") == 0) - m_hd44780DVMegaDisplay = (unsigned int)::atoi(value); + m_hd44780DVMegaDisplay = ::atoi(value) == 1; else if (::strcmp(key, "Pins") == 0) { char* p = ::strtok(value, ",\r\n"); while (p != NULL) { diff --git a/HD44780.cpp b/HD44780.cpp index 1e95d20..d4937c2 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -341,16 +341,20 @@ void CHD44780::writeDMR(unsigned int slotNo, const std::string& src, bool group, } if (m_rows == 2U && m_cols == 16U) { - if (slotNo == 1U) { - ::lcdPosition(m_fd, 0, 1); - ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); + if (!m_dvmegaDisplay) { + if (slotNo == 1U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); + } else { + ::lcdPosition(m_fd, 0, 0); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + } } else { ::lcdPosition(m_fd, 0, 0); - if (m_dvmegaDisplay) { - ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); - else - ::lcdPuts(m_fd, "DMR"); - } + ::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) { ::lcdPosition(m_fd, 0, 0); @@ -401,11 +405,16 @@ void CHD44780::writeDMR(unsigned int slotNo, const std::string& src, bool group, ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); } - else { + } else { + ::sprintf(buffer, "From: %s", src.c_str()); ::lcdPosition(m_fd, 0, 0); - ::lcdPrintf(m_fd, "From: %s", src.c_str()); - ::lcdPosition(m_fd, 0, 0); - ::lcdPrintf(m_fd, "To : %s%s", group ? "TG" : "", dst.c_str()); +// ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); + ::lcdPrintf(m_fd, "%-16s", buffer); + + ::sprintf(buffer, "To : %s", dst.c_str()); + ::lcdPosition(m_fd, 0, 1); +// ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); + ::lcdPrintf(m_fd, "%-16s", buffer); } } else if (m_rows == 4U && m_cols == 16U) { #ifdef ADAFRUIT_DISPLAY @@ -464,12 +473,20 @@ void CHD44780::clearDMR(unsigned int slotNo) #endif if (m_rows == 2U && m_cols == 16U) { - if (slotNo == 1U) { - ::lcdPosition(m_fd, 0, 0); - ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + if (!m_dvmegaDisplay) { + if (slotNo == 1U) { + ::lcdPosition(m_fd, 0, 0); + ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); + } else { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); + } } else { + ::lcdPosition(m_fd, 0, 0); + ::lcdPuts(m_fd, "DMR "); ::lcdPosition(m_fd, 0, 1); - ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); +// ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); + ::lcdPrintf(m_fd, "%-16s", "Listening..."); } } else if (m_rows == 4U && m_cols == 16U) { if (slotNo == 1U) { diff --git a/HD44780.h b/HD44780.h index 59519b3..5b9805b 100644 --- a/HD44780.h +++ b/HD44780.h @@ -51,7 +51,7 @@ enum ADAFRUIT_COLOUR { class CHD44780 : public IDisplay { public: - CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool DVMegaDisplay); + CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool dvmegaDisplay); virtual ~CHD44780(); virtual bool open(); diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index d95ee6a..1c6611e 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -706,7 +706,7 @@ void CMMDVMHost::createDisplay() } if (dvmegaDisplay) - LogInfo("Using DVMega display output on 16x2 HD44780"); + LogInfo("Using DVMega display output on HD44780"); m_display = new CHD44780(rows, columns, callsign, dmrid, pins, pwm, pwmPin, pwmBright, pwmDim, dvmegaDisplay); }