mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 15:09:23 +08:00
Better usage of display with DVMega
This commit is contained in:
2
Conf.cpp
2
Conf.cpp
@@ -357,7 +357,7 @@ bool CConf::read()
|
|||||||
else if (::strcmp(key, "PWMDim") == 0)
|
else if (::strcmp(key, "PWMDim") == 0)
|
||||||
m_hd44780PWMDim = (unsigned int)::atoi(value);
|
m_hd44780PWMDim = (unsigned int)::atoi(value);
|
||||||
else if (::strcmp(key, "DVMegaDisplay") == 0)
|
else if (::strcmp(key, "DVMegaDisplay") == 0)
|
||||||
m_hd44780DVMegaDisplay = (unsigned int)::atoi(value);
|
m_hd44780DVMegaDisplay = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "Pins") == 0) {
|
else if (::strcmp(key, "Pins") == 0) {
|
||||||
char* p = ::strtok(value, ",\r\n");
|
char* p = ::strtok(value, ",\r\n");
|
||||||
while (p != NULL) {
|
while (p != NULL) {
|
||||||
|
|||||||
31
HD44780.cpp
31
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 (m_rows == 2U && m_cols == 16U) {
|
||||||
|
if (!m_dvmegaDisplay) {
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
||||||
} else {
|
} else {
|
||||||
::lcdPosition(m_fd, 0, 0);
|
::lcdPosition(m_fd, 0, 0);
|
||||||
if (m_dvmegaDisplay) {
|
|
||||||
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
||||||
else
|
|
||||||
::lcdPuts(m_fd, "DMR");
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
::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) {
|
} else if (m_rows == 4U && m_cols == 16U) {
|
||||||
::lcdPosition(m_fd, 0, 0);
|
::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);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
|
::sprintf(buffer, "From: %s", src.c_str());
|
||||||
::lcdPosition(m_fd, 0, 0);
|
::lcdPosition(m_fd, 0, 0);
|
||||||
::lcdPrintf(m_fd, "From: %s", src.c_str());
|
// ::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
||||||
::lcdPosition(m_fd, 0, 0);
|
::lcdPrintf(m_fd, "%-16s", buffer);
|
||||||
::lcdPrintf(m_fd, "To : %s%s", group ? "TG" : "", dst.c_str());
|
|
||||||
|
::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) {
|
} else if (m_rows == 4U && m_cols == 16U) {
|
||||||
#ifdef ADAFRUIT_DISPLAY
|
#ifdef ADAFRUIT_DISPLAY
|
||||||
@@ -464,6 +473,7 @@ void CHD44780::clearDMR(unsigned int slotNo)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_rows == 2U && m_cols == 16U) {
|
if (m_rows == 2U && m_cols == 16U) {
|
||||||
|
if (!m_dvmegaDisplay) {
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
::lcdPosition(m_fd, 0, 0);
|
::lcdPosition(m_fd, 0, 0);
|
||||||
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
||||||
@@ -471,6 +481,13 @@ void CHD44780::clearDMR(unsigned int slotNo)
|
|||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
::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, "%.*s", m_cols, LISTENING);
|
||||||
|
::lcdPrintf(m_fd, "%-16s", "Listening...");
|
||||||
|
}
|
||||||
} else if (m_rows == 4U && m_cols == 16U) {
|
} else if (m_rows == 4U && m_cols == 16U) {
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ enum ADAFRUIT_COLOUR {
|
|||||||
class CHD44780 : public IDisplay
|
class CHD44780 : public IDisplay
|
||||||
{
|
{
|
||||||
public:
|
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 ~CHD44780();
|
||||||
|
|
||||||
virtual bool open();
|
virtual bool open();
|
||||||
|
|||||||
@@ -706,7 +706,7 @@ void CMMDVMHost::createDisplay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dvmegaDisplay)
|
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);
|
m_display = new CHD44780(rows, columns, callsign, dmrid, pins, pwm, pwmPin, pwmBright, pwmDim, dvmegaDisplay);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user