Skip to content

Commit

Permalink
Add POCSAG processing and display code.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Jun 11, 2018
1 parent 27c7342 commit b398bba
Show file tree
Hide file tree
Showing 33 changed files with 355 additions and 15 deletions.
24 changes: 24 additions & 0 deletions Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,25 @@ void CDisplay::clearNXDN()
}
}

void CDisplay::writePOCSAG(uint32_t ric, const std::string& message)
{
m_timer1.start();
m_mode1 = MODE_POCSAG;

writePOCSAGInt(ric, message);
}

void CDisplay::clearPOCSAG()
{
if (m_timer1.hasExpired()) {
clearPOCSAGInt();
m_timer1.stop();
m_mode1 = MODE_IDLE;
} else {
m_mode1 = MODE_POCSAG;
}
}

void CDisplay::writeCW()
{
m_timer1.start();
Expand Down Expand Up @@ -336,6 +355,11 @@ void CDisplay::clock(unsigned int ms)
m_mode1 = MODE_IDLE;
m_timer1.stop();
break;
case MODE_POCSAG:
clearPOCSAGInt();
m_mode1 = MODE_IDLE;
m_timer1.stop();
break;
case MODE_CW:
clearCWInt();
m_mode1 = MODE_IDLE;
Expand Down
9 changes: 8 additions & 1 deletion Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <string>

#include <cstdint>

class CDisplay
{
public:
Expand Down Expand Up @@ -61,8 +63,10 @@ class CDisplay
void writeNXDNBER(float ber);
void clearNXDN();

void writePOCSAG(uint32_t ric, const std::string& message);
void clearPOCSAG();

void writeCW();
void clearCW();

virtual void close() = 0;

Expand Down Expand Up @@ -99,6 +103,9 @@ class CDisplay
virtual void writeNXDNBERInt(float ber);
virtual void clearNXDNInt() = 0;

virtual void writePOCSAGInt(uint32_t ric, const std::string& message) = 0;
virtual void clearPOCSAGInt() = 0;

virtual void writeCWInt() = 0;
virtual void clearCWInt() = 0;

Expand Down
12 changes: 12 additions & 0 deletions HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,18 @@ void CHD44780::clearNXDNInt()
}
}

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

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

void CHD44780::writeCWInt()
{
::lcdPosition(m_fd, m_cols - 5, m_rows - 1);
Expand Down
3 changes: 3 additions & 0 deletions HD44780.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ class CHD44780 : public CDisplay
virtual void writeNXDNRSSIInt(unsigned char rssi);
virtual void clearNXDNInt();

virtual void writePOCSAG(uint32_t ric, const std::string& message);
virtual void clearPOCSAGInt();

virtual void writeCWInt();
virtual void clearCWInt();

Expand Down
Binary file added Images/POCSAG.bmp
Binary file not shown.
8 changes: 8 additions & 0 deletions LCDproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,14 @@ void CLCDproc::clearNXDNInt()
socketPrintf(m_socketfd, "output 16"); // Set LED5 color green
}

void CLCDproc::writePOCSAGInt(uint32_t ric, const std::string& message)
{
}

void CLCDproc::clearPOCSAGInt()
{
}

void CLCDproc::writeCWInt()
{
}
Expand Down
3 changes: 3 additions & 0 deletions LCDproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class CLCDproc : public CDisplay
virtual void writeNXDNRSSIInt(unsigned char rssi);
virtual void clearNXDNInt();

virtual void writePOCSAGInt(uint32_t ric, const std::string& message);
virtual void clearPOCSAGInt();

virtual void writeCWInt();
virtual void clearCWInt();

Expand Down
32 changes: 31 additions & 1 deletion Nextion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ void CNextion::writeNXDNInt(const char* source, bool group, unsigned int dest, c

if (m_mode != MODE_NXDN) {
sendCommand("page NXDN");
sendCommandAction(6U);
sendCommandAction(7U);
}

char text[30U];
Expand Down Expand Up @@ -679,6 +679,36 @@ void CNextion::clearNXDNInt()
sendCommand("t3.txt=\"\"");
}

void CNextion::writePOCSAGInt(uint32_t ric, const std::string& message)
{
if (m_mode != MODE_POCSAG) {
sendCommand("page POCSAG");
sendCommandAction(6U);
}

char text[30U];
::sprintf(text, "dim=%u", m_brightness);
sendCommand(text);

::sprintf(text, "t0.txt=\"RIC: %u\"", ric);
sendCommand(text);
sendCommandAction(132U);

::sprintf(text, "t1.txt=\"MSG: %s\"", message.c_str());
sendCommand(text);
sendCommandAction(133U);

m_clockDisplayTimer.stop();

m_mode = MODE_POCSAG;
}

void CNextion::clearPOCSAGInt()
{
sendCommand("t1.txt=\"MMDVM IDLE\"");
sendCommandAction(134U);
}

void CNextion::writeCWInt()
{
sendCommand("t1.txt=\"Sending CW Ident\"");
Expand Down
3 changes: 3 additions & 0 deletions Nextion.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class CNextion : public CDisplay
virtual void writeNXDNBERInt(float ber);
virtual void clearNXDNInt();

virtual void writePOCSAGInt(uint32_t ric, const std::string& message);
virtual void clearPOCSAGInt();

virtual void writeCWInt();
virtual void clearCWInt();

Expand Down
Binary file modified Nextion_G4KLX/NX3224K024.HMI
Binary file not shown.
Binary file modified Nextion_G4KLX/NX3224K024.tft
Binary file not shown.
Binary file modified Nextion_G4KLX/NX3224K028.HMI
Binary file not shown.
Binary file modified Nextion_G4KLX/NX3224K028.tft
Binary file not shown.
Binary file modified Nextion_G4KLX/NX3224T024.HMI
Binary file not shown.
Binary file modified Nextion_G4KLX/NX3224T024.tft
Binary file not shown.
Binary file modified Nextion_G4KLX/NX3224T028.HMI
Binary file not shown.
Binary file modified Nextion_G4KLX/NX3224T028.tft
Binary file not shown.
Binary file modified Nextion_G4KLX/NX4024K032.HMI
Binary file not shown.
Binary file modified Nextion_G4KLX/NX4024K032.tft
Binary file not shown.
Binary file modified Nextion_G4KLX/NX4024T032.HMI
Binary file not shown.
Binary file modified Nextion_G4KLX/NX4024T032.tft
Binary file not shown.
Binary file modified Nextion_G4KLX/NX4832K035.HMI
Binary file not shown.
Binary file modified Nextion_G4KLX/NX4832K035.tft
Binary file not shown.
Binary file modified Nextion_G4KLX/NX4832T035.HMI
Binary file not shown.
Binary file modified Nextion_G4KLX/NX4832T035.tft
Binary file not shown.
14 changes: 14 additions & 0 deletions NullDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,20 @@ void CNullDisplay::clearNXDNInt()
#endif
}

void CNullDisplay::writePOCSAGInt(uint32_t ric, const std::string& message)
{
#if defined(RASPBERRY_PI)
::digitalWrite(LED_STATUS, 1);
#endif
}

void CNullDisplay::clearPOCSAGInt()
{
#if defined(RASPBERRY_PI)
::digitalWrite(LED_STATUS, 0);
#endif
}

void CNullDisplay::writeCWInt()
{
}
Expand Down
3 changes: 3 additions & 0 deletions NullDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class CNullDisplay : public CDisplay
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
virtual void clearNXDNInt();

virtual void writePOCSAGInt(uint32_t ric, const std::string& message);
virtual void clearPOCSAGInt();

virtual void writeCWInt();
virtual void clearCWInt();

Expand Down
Loading

0 comments on commit b398bba

Please sign in to comment.