Better usage of display with DVMega

This commit is contained in:
Tony Corbett 2016-05-05 16:13:06 +01:00
parent f31a8815cb
commit 5735209394
4 changed files with 36 additions and 19 deletions

View file

@ -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) {

View file

@ -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) {

View file

@ -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<unsigned int>& 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<unsigned int>& pins, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool dvmegaDisplay);
virtual ~CHD44780();
virtual bool open();

View file

@ -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);
}