Merge pull request #428 from phl0/pocsag_dev

Add some OLED display stuff for POCSAG
This commit is contained in:
Jonathan Naylor 2018-06-13 13:14:17 +01:00 committed by GitHub
commit b22d1404cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 199 additions and 146 deletions

View File

@ -121,7 +121,7 @@ protected:
virtual void writeNXDNRSSIInt(unsigned char rssi);
virtual void clearNXDNInt();
virtual void writePOCSAG(uint32_t ric, const std::string& message);
virtual void writePOCSAGInt(uint32_t ric, const std::string& message);
virtual void clearPOCSAGInt();
virtual void writeCWInt();

View File

@ -148,6 +148,27 @@ const unsigned char logo_NXDN_bmp [] =
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// Logo POCASG/DAPNET, 128x16px
const unsigned char logo_POCSAG_bmp [] =
{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xf8, 0x7f, 0xfe, 0x03, 0xfe, 0xfe, 0x03, 0xdf, 0xf6, 0x00, 0x00, 0x1f, 0xff,
0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xfc, 0xfc, 0xfe, 0xfc, 0xcf, 0xf6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xfe, 0x7d, 0x7e, 0xfe, 0xc7, 0xf6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfb, 0x7a, 0x7e, 0xff, 0x79, 0x7e, 0xfe, 0xd3, 0xf6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xf7, 0xbe, 0xff, 0x7b, 0xbe, 0xfe, 0xdb, 0xf6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xbe, 0xff, 0xbb, 0xbe, 0xfe, 0xdd, 0xf6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xf9, 0xff, 0xbe, 0xff, 0xb7, 0xde, 0xfe, 0xde, 0xf6, 0x01, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xee, 0x77, 0xbe, 0xff, 0xb7, 0xde, 0x81, 0xde, 0x76, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xdf, 0xb7, 0x7e, 0xff, 0xa0, 0x1e, 0xff, 0xdf, 0x36, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xdf, 0xbc, 0xfe, 0xff, 0x6f, 0xee, 0xff, 0xdf, 0xb6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xdf, 0xbf, 0xfe, 0xff, 0x6f, 0xee, 0xff, 0xdf, 0xd6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xdf, 0xbf, 0xfe, 0xfe, 0xdf, 0xf6, 0xff, 0xdf, 0xe6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xdf, 0x7f, 0xfe, 0xf9, 0xdf, 0xf6, 0xff, 0xdf, 0xe6, 0xff, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xe6, 0x7f, 0xfe, 0x07, 0xff, 0xf6, 0xff, 0xdf, 0xf6, 0x00, 0xfb, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool slot1Enabled, bool slot2Enabled) :
m_displayType(displayType),
m_displayBrightness(displayBrightness),
@ -350,14 +371,12 @@ void COLED::clearDMRInt(unsigned int slotNo)
// if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2
// if single slot, use lines 3-4
if ( m_slot1Enabled && m_slot2Enabled ){
if (slotNo == 1U)
{
if (slotNo == 1U) {
display.fillRect(0, OLED_LINE3, display.width(), 40, BLACK);
display.setCursor(0,OLED_LINE3);
display.print("Slot: 1 Listening");
}
else
{
else {
display.fillRect(0, OLED_LINE5, display.width(), 40, BLACK);
display.setCursor(0, OLED_LINE5);
display.print("Slot: 2 Listening");
@ -369,7 +388,6 @@ void COLED::clearDMRInt(unsigned int slotNo)
display.printf("Slot: %i Listening",slotNo);
}
display.fillRect(0, OLED_LINE6, display.width(), 20, BLACK);
display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str());
@ -467,6 +485,36 @@ void COLED::clearNXDNInt()
display.display();
}
void COLED::writePOCSAGInt(uint32_t ric, const std::string& message)
{
m_mode = MODE_POCSAG;
display.clearDisplay();
display.fillRect(0, OLED_LINE1, display.width(), display.height(), BLACK);
display.setCursor(0,OLED_LINE3);
display.printf("RIC: %u", ric);
display.setCursor(0,OLED_LINE5);
display.printf("MSG: %s", message.c_str());
OLED_statusbar();
display.display();
}
void COLED::clearPOCSAGInt()
{
display.fillRect(0, OLED_LINE1, display.width(), display.height(), BLACK);
display.setCursor(40,OLED_LINE4);
display.print("Listening");
display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str());
display.display();
}
void COLED::writeCWInt()
{
display.clearDisplay();
@ -523,6 +571,8 @@ void COLED::OLED_statusbar()
display.drawBitmap(0, 0, logo_P25_bmp, 128, 16, WHITE);
else if (m_mode == MODE_NXDN)
display.drawBitmap(0, 0, logo_NXDN_bmp, 128, 16, WHITE);
else if (m_mode == MODE_POCSAG)
display.drawBitmap(0, 0, logo_POCSAG_bmp, 128, 16, WHITE);
else
display.drawBitmap(0, 0, logo_glcd_bmp, 128, 16, WHITE);

3
OLED.h
View File

@ -65,6 +65,9 @@ public:
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();