mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:27:09 +08:00
Simplify writeDStarInt / clearDStarInt and add custom icons for HD44780
This commit is contained in:
82
HD44780.cpp
82
HD44780.cpp
@@ -219,10 +219,10 @@ bool CHD44780::open()
|
|||||||
::lcdCharDef(m_fd, 4, vChar);
|
::lcdCharDef(m_fd, 4, vChar);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TG, private call, RF and network icons defined as needed - ran out of CGRAM locations
|
* TG, private call, RF and network icons defined as needed - ran out of CGRAM locations
|
||||||
on the HD44780! Theoretically, we now have infinite custom characters to play with,
|
* on the HD44780! Theoretically, we now have infinite custom characters to play with,
|
||||||
just be mindful of the slow speed of CGRAM hence the lcdPosition call to delay just
|
* just be mindful of the slow speed of CGRAM hence the lcdPosition call to delay just
|
||||||
long enough so the CGRAM can be written before we try to read it.
|
* long enough so the CGRAM can be written before we try to read it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -416,47 +416,25 @@ void CHD44780::writeDStarInt(const char* my1, const char* my2, const char* your,
|
|||||||
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 0);
|
if (m_rows > 2U) {
|
||||||
::lcdPuts(m_fd, "D-Star");
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 2);
|
||||||
|
::sprintf(m_buffer1, "%s%s", "D-Star", DEADSPACE);
|
||||||
if (m_rows == 2U && m_cols == 16U) {
|
|
||||||
::sprintf(m_buffer1, "%s %.8s/%.4s", type, my1, my2);
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
||||||
} else if (m_rows == 4U && m_cols == 16U) {
|
|
||||||
::sprintf(m_buffer1, "%s %.8s/%.4s", type, my1, my2);
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(reflector, " ") == 0)
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
||||||
::sprintf(m_buffer1, "%.8s", your);
|
::lcdPrintf(m_fd, "%.8s/%.4s", my1, my2);
|
||||||
else
|
|
||||||
::sprintf(m_buffer1, "%.8s<%.8s", your, reflector);
|
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 2);
|
::lcdCharDef(m_fd, 5, strcmp(type, "R") == 0 ? rfChar : ipChar);
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
::lcdPosition(m_fd, m_cols - 1, (m_rows / 2) - 1);
|
||||||
} else if (m_rows == 4U && m_cols == 20U) {
|
::lcdPutchar(m_fd, 5);
|
||||||
char m_buffer1[20U];
|
|
||||||
::sprintf(m_buffer1, "%s %.8s/%.4s >", type, my1, my2);
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
||||||
|
|
||||||
if (strcmp(reflector, " ") == 0)
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
||||||
::sprintf(m_buffer1, "%.8s", your);
|
::lcdPrintf(m_fd, "%.8s", your);
|
||||||
else
|
|
||||||
::sprintf(m_buffer1, "%.8s <- %.8s", your, reflector);
|
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 2);
|
if (strcmp(reflector, " ") != 0) {
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
::lcdPosition(m_fd, m_cols - 8, (m_rows / 2));
|
||||||
} else if (m_rows == 2 && m_cols == 40U) {
|
::lcdPrintf(m_fd, "%.8s", reflector);
|
||||||
char m_buffer1[40U];
|
|
||||||
if (strcmp(reflector, " ") == 0)
|
|
||||||
::sprintf(m_buffer1, "%s %.8s/%.4s > %.8s", type, my1, my2, your);
|
|
||||||
else
|
|
||||||
::sprintf(m_buffer1, "%s %.8s/%.4s > %.8s via %.8s", type, my1, my2, your, reflector);
|
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dmr = false;
|
m_dmr = false;
|
||||||
@@ -469,26 +447,13 @@ void CHD44780::clearDStarInt()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_clockDisplayTimer.stop(); // Stop the clock display
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
||||||
|
::lcdClear(m_fd);
|
||||||
|
|
||||||
if (m_rows == 2U && m_cols == 16U) {
|
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::sprintf(m_buffer2, "%s%s", "D-Star", DEADSPACE);
|
||||||
|
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer2);
|
||||||
|
::lcdPosition(m_fd, 0, (m_rows / 2));
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
::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);
|
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 2);
|
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
|
||||||
} else if (m_rows == 2 && m_cols == 40U) {
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
|
||||||
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
|
void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
|
||||||
@@ -603,6 +568,7 @@ void CHD44780::clearDMRInt(unsigned int slotNo)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_clockDisplayTimer.stop(); // Stop the clock display
|
m_clockDisplayTimer.stop(); // Stop the clock display
|
||||||
|
::lcdClear(m_fd);
|
||||||
|
|
||||||
if (m_duplex) {
|
if (m_duplex) {
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
|
|||||||
Reference in New Issue
Block a user