Skip to content

Commit

Permalink
Merge pull request #714 from pd9mwo/patch-1
Browse files Browse the repository at this point in the history
Update HD44780.cpp with POCSAG
  • Loading branch information
g4klx authored Sep 27, 2021
2 parents 433cb44 + 4b0e016 commit ed54188
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,13 +1052,13 @@ void CHD44780::clearNXDNInt()

void CHD44780::writePOCSAGInt(uint32_t ric, const std::string& message)
{
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
::lcdPosition(m_fd, m_cols - 9, m_rows - 1);
::lcdPuts(m_fd, "POCSAG TX");
}

void CHD44780::clearPOCSAGInt()
{
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
::lcdPosition(m_fd, m_cols - 9, m_rows - 1);
::lcdPuts(m_fd, " Idle");
}

Expand Down

2 comments on commit ed54188

@KE7FNS
Copy link
Contributor

@KE7FNS KE7FNS commented on ed54188 Oct 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@g4klx

This is a very poor implementation by PD9MWO that causes two new issues.

  1. The word " Idle" is no longer right justified and aligned with the right edge of the display when clearPOCSAGInt() is called because its starting position is m_cols - 9 characters and not m_cols - (the length of the string " Idle").
  2. Only writing 5 characters leaves old characters on the display in locations m_col - 1, m_col -2, m_col -3, and m_col -4, so you can end up with the display showing " IdleG TX"

The reason this happens is because of the library call lcdPuts(). It overwrites 9 characters in writePOCSAGInt(), but only 5 in clearPOCSAGInt(). It does not clear the line.

Here is an example of what can happen when using the two functions, and writing 9 characters and only overwriting 5.

error

I suggest either the code be reverted back to m_cols - 5 in both functions, and "POCSAG TX" be replaced with something that only has 5 characters to maintain the 5 character system that was previously implemented.

or

clearPOCSAGInt needs to write 9 characters to match writePOCSAGInt() to make sure any previously written text is completely overwritten.

Thanks,
KE7FNS

@g4klx
Copy link
Owner Author

@g4klx g4klx commented on ed54188 Oct 5, 2021 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.