Skip to content

Commit

Permalink
Merge pull request #83 from g0wfv/develop
Browse files Browse the repository at this point in the history
Attempt to fix scrolling issues reported on 20x4 LCD
  • Loading branch information
g4klx committed Jun 5, 2016
2 parents 123b0f2 + 52dbea6 commit 8875887
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ void CHD44780::adafruitLCDColour(ADAFRUIT_COLOUR colour)

void CHD44780::setIdleInt()
{
m_scrollTimer1.stop(); // Stop the scroll timer on slot 1
m_scrollTimer2.stop(); // Stop the scroll timer on slot 2
m_clockDisplayTimer.start(); // Start the clock display in IDLE only
::lcdClear(m_fd);

Expand Down Expand Up @@ -516,13 +518,16 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro
}

if (slotNo == 1U) {
m_scrollTimer2.stop();
::lcdPosition(m_fd, 0, (m_rows / 2));
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
} else {
m_scrollTimer1.stop();
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
}
} else {
m_scrollTimer2.stop();
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
::sprintf(m_buffer1, "%s%s", "DMR", DEADSPACE);
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1);
Expand Down Expand Up @@ -598,23 +603,24 @@ void CHD44780::clearDMRInt(unsigned int slotNo)
#endif

m_clockDisplayTimer.stop(); // Stop the clock display
m_scrollTimer1.stop(); // Stop the scroll timer on slot 1
m_scrollTimer2.stop(); // Stop the scroll timer on slot 2

if (m_duplex) {
if (slotNo == 1U) {
m_scrollTimer1.stop(); // Stop the scroll timer on slot 1
::lcdPosition(m_fd, 0, 0);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
} else {
m_scrollTimer2.stop(); // Stop the scroll timer on slot 2
::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
}
} else {
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
::sprintf(m_buffer2, "%s%s", "DMR", DEADSPACE);
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer2);
::lcdPosition(m_fd, 0, (m_rows / 2));
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
m_scrollTimer2.stop(); // Stop the scroll timer on slot 2
::lcdPosition(m_fd, 0, (m_rows / 2) - 1);
::sprintf(m_buffer2, "%s%s", "DMR", DEADSPACE);
::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer2);
::lcdPosition(m_fd, 0, (m_rows / 2));
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
}
}

Expand Down

0 comments on commit 8875887

Please sign in to comment.