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 writeNXDNRSSIInt(unsigned char rssi);
virtual void clearNXDNInt(); 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 clearPOCSAGInt();
virtual void writeCWInt(); virtual void writeCWInt();

340
OLED.cpp
View file

@ -106,45 +106,66 @@ const unsigned char logo_fusion_bmp [] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
//Logo P25 128x16px //Logo P25 128x16px
const unsigned char logo_P25_bmp [] = const unsigned char logo_P25_bmp [] =
{ {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xf8, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x7f,
0xf8, 0x00, 0x00, 0x00, 0x03, 0xff, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00, 0x03, 0xff, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x7f,
0xf8, 0x00, 0xe0, 0x00, 0x00, 0xff, 0x00, 0x07, 0xc0, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0xe0, 0x00, 0x00, 0xff, 0x00, 0x07, 0xc0, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0xff,
0xf0, 0x01, 0xff, 0xfc, 0x00, 0x7e, 0x00, 0x3f, 0xf8, 0x00, 0xff, 0xe0, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0x01, 0xff, 0xfc, 0x00, 0x7e, 0x00, 0x3f, 0xf8, 0x00, 0xff, 0xe0, 0x0f, 0xff, 0xff, 0xff,
0xf0, 0x01, 0xff, 0xfe, 0x00, 0x7c, 0x00, 0x7f, 0xfc, 0x00, 0x7f, 0xe0, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0x01, 0xff, 0xfe, 0x00, 0x7c, 0x00, 0x7f, 0xfc, 0x00, 0x7f, 0xe0, 0x0f, 0xff, 0xff, 0xff,
0xf0, 0x01, 0xff, 0xfe, 0x00, 0x7e, 0x00, 0x7f, 0xf8, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x01, 0xff, 0xf0, 0x01, 0xff, 0xfe, 0x00, 0x7e, 0x00, 0x7f, 0xf8, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x01, 0xff,
0xf0, 0x01, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x01, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xe0, 0x01, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x1f,
0xf0, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff, 0x9f, 0xff, 0x80, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff, 0x9f, 0xff, 0x80, 0x07,
0xf0, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xf8, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xf8, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x03,
0xf0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x03, 0xf0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x03,
0xf0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0x03, 0xf0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0x03,
0xf0, 0x01, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0xff, 0xfe, 0x00, 0x0f, 0xfe, 0x00, 0x0f, 0xf0, 0x01, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0xff, 0xfe, 0x00, 0x0f, 0xfe, 0x00, 0x0f,
0xf0, 0x01, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x3f, 0xf0, 0x01, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x3f,
0xf0, 0x01, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x03, 0xff, 0xf0, 0x01, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x03, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
}; };
// Logo NXDN_sm, 128x16px // Logo NXDN_sm, 128x16px
const unsigned char logo_NXDN_bmp [] = const unsigned char logo_NXDN_bmp [] =
{ {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xf0, 0x1f, 0xf8, 0x0f, 0x00, 0xff, 0x80, 0x7c, 0x00, 0x0f, 0xff, 0x80, 0x7f, 0xe0, 0x7f, 0xff, 0xf0, 0x1f, 0xf8, 0x0f, 0x00, 0xff, 0x80, 0x7c, 0x00, 0x0f, 0xff, 0x80, 0x7f, 0xe0, 0x7f,
0xff, 0xe0, 0x0f, 0xf0, 0x1f, 0x80, 0x7e, 0x01, 0xf8, 0x00, 0x00, 0x7f, 0x00, 0x3f, 0xc0, 0x7f, 0xff, 0xe0, 0x0f, 0xf0, 0x1f, 0x80, 0x7e, 0x01, 0xf8, 0x00, 0x00, 0x7f, 0x00, 0x3f, 0xc0, 0x7f,
0xff, 0xc0, 0x07, 0xe0, 0x3f, 0x80, 0x38, 0x07, 0xf0, 0x00, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0xff, 0xff, 0xc0, 0x07, 0xe0, 0x3f, 0x80, 0x38, 0x07, 0xf0, 0x00, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0xff,
0xff, 0x80, 0x03, 0xc0, 0x3f, 0xc0, 0x00, 0x3f, 0xe0, 0x1f, 0x80, 0x3e, 0x00, 0x1f, 0x01, 0xff, 0xff, 0x80, 0x03, 0xc0, 0x3f, 0xc0, 0x00, 0x3f, 0xe0, 0x1f, 0x80, 0x3e, 0x00, 0x1f, 0x01, 0xff,
0xff, 0x00, 0x03, 0x80, 0x7f, 0xe0, 0x00, 0xff, 0xc0, 0x3f, 0x80, 0x3c, 0x00, 0x0e, 0x03, 0xff, 0xff, 0x00, 0x03, 0x80, 0x7f, 0xe0, 0x00, 0xff, 0xc0, 0x3f, 0x80, 0x3c, 0x00, 0x0e, 0x03, 0xff,
0xfe, 0x00, 0x01, 0x00, 0xff, 0xe0, 0x03, 0xff, 0x80, 0x7f, 0x80, 0x78, 0x08, 0x04, 0x03, 0xff, 0xfe, 0x00, 0x01, 0x00, 0xff, 0xe0, 0x03, 0xff, 0x80, 0x7f, 0x80, 0x78, 0x08, 0x04, 0x03, 0xff,
0xfc, 0x03, 0x00, 0x01, 0xff, 0x80, 0x01, 0xff, 0x00, 0xff, 0x00, 0xf0, 0x1c, 0x00, 0x07, 0xff, 0xfc, 0x03, 0x00, 0x01, 0xff, 0x80, 0x01, 0xff, 0x00, 0xff, 0x00, 0xf0, 0x1c, 0x00, 0x07, 0xff,
0xfc, 0x07, 0x80, 0x03, 0xfc, 0x00, 0x01, 0xfe, 0x01, 0xfc, 0x01, 0xe0, 0x1e, 0x00, 0x0f, 0xff, 0xfc, 0x07, 0x80, 0x03, 0xfc, 0x00, 0x01, 0xfe, 0x01, 0xfc, 0x01, 0xe0, 0x1e, 0x00, 0x0f, 0xff,
0xf8, 0x0f, 0xc0, 0x07, 0xf0, 0x0e, 0x00, 0xfc, 0x00, 0x00, 0x07, 0xc0, 0x3f, 0x00, 0x1f, 0xff, 0xf8, 0x0f, 0xc0, 0x07, 0xf0, 0x0e, 0x00, 0xfc, 0x00, 0x00, 0x07, 0xc0, 0x3f, 0x00, 0x1f, 0xff,
0xf0, 0x1f, 0xe0, 0x0f, 0x80, 0x3f, 0x00, 0x7c, 0x00, 0x00, 0x3f, 0xc0, 0x7f, 0x80, 0x3f, 0xff, 0xf0, 0x1f, 0xe0, 0x0f, 0x80, 0x3f, 0x00, 0x7c, 0x00, 0x00, 0x3f, 0xc0, 0x7f, 0x80, 0x3f, 0xff,
0xe0, 0x3f, 0xf0, 0x0e, 0x01, 0xff, 0x80, 0x38, 0x00, 0x07, 0xff, 0x80, 0xff, 0x80, 0x7f, 0xff, 0xe0, 0x3f, 0xf0, 0x0e, 0x01, 0xff, 0x80, 0x38, 0x00, 0x07, 0xff, 0x80, 0xff, 0x80, 0x7f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
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 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
}; };
@ -176,10 +197,10 @@ bool COLED::open()
{ {
// I2C change parameters to fit to your LCD // I2C change parameters to fit to your LCD
if ( !display.init(OLED_I2C_RESET, m_displayType) ) if ( !display.init(OLED_I2C_RESET, m_displayType) )
return false; return false;
} }
display.begin(); display.begin();
display.invertDisplay(m_displayInvert ? 1 : 0); display.invertDisplay(m_displayInvert ? 1 : 0);
@ -200,7 +221,7 @@ bool COLED::open()
void COLED::setIdleInt() void COLED::setIdleInt()
{ {
m_mode = MODE_IDLE; m_mode = MODE_IDLE;
display.clearDisplay(); display.clearDisplay();
OLED_statusbar(); OLED_statusbar();
@ -212,26 +233,26 @@ void COLED::setIdleInt()
// display.setTextSize(1); // display.setTextSize(1);
display.startscrolldiagright(0x00,0x0f); //the MMDVM logo scrolls the whole screen display.startscrolldiagright(0x00,0x0f); //the MMDVM logo scrolls the whole screen
display.display(); display.display();
unsigned char info[100U]; unsigned char info[100U];
CNetworkInfo* m_network; CNetworkInfo* m_network;
passCounter ++; passCounter ++;
if (passCounter > 253U) if (passCounter > 253U)
networkInfoInitialized = false; networkInfoInitialized = false;
if (! networkInfoInitialized) { if (! networkInfoInitialized) {
//LogMessage("Initialize CNetworkInfo"); //LogMessage("Initialize CNetworkInfo");
info[0]=0; info[0]=0;
m_network = new CNetworkInfo; m_network = new CNetworkInfo;
m_network->getNetworkInterface(info); m_network->getNetworkInterface(info);
m_ipaddress = (char*)info; m_ipaddress = (char*)info;
delete m_network; delete m_network;
networkInfoInitialized = true; networkInfoInitialized = true;
passCounter = 0; passCounter = 0;
} }
} }
void COLED::setErrorInt(const char* text) void COLED::setErrorInt(const char* text)
@ -277,9 +298,9 @@ void COLED::writeDStarInt(const char* my1, const char* my2, const char* your, co
display.setCursor(0,OLED_LINE5); display.setCursor(0,OLED_LINE5);
display.printf("via %.8s",reflector); display.printf("via %.8s",reflector);
display.setCursor(0,OLED_LINE6); display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str()); display.printf("%s",m_ipaddress.c_str());
OLED_statusbar(); OLED_statusbar();
display.display(); display.display();
@ -291,9 +312,9 @@ void COLED::clearDStarInt()
display.setCursor(40,OLED_LINE3); display.setCursor(40,OLED_LINE3);
display.print("Listening"); display.print("Listening");
display.setCursor(0,OLED_LINE5); display.setCursor(0,OLED_LINE5);
display.printf("%s",m_ipaddress.c_str()); display.printf("%s",m_ipaddress.c_str());
display.display(); display.display();
} }
@ -302,77 +323,74 @@ void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,co
{ {
if (m_mode != MODE_DMR) { if (m_mode != MODE_DMR) {
display.clearDisplay(); display.clearDisplay();
m_mode = MODE_DMR; m_mode = MODE_DMR;
clearDMRInt(slotNo); clearDMRInt(slotNo);
} }
// if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2 // if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2
// if single slot, use lines 3-4 // if single slot, use lines 3-4
if ( m_slot1Enabled && m_slot2Enabled ) { if ( m_slot1Enabled && m_slot2Enabled ) {
if (slotNo == 1U) { if (slotNo == 1U) {
display.fillRect(0,OLED_LINE2,display.width(),40,BLACK); display.fillRect(0,OLED_LINE2,display.width(),40,BLACK);
display.setCursor(0,OLED_LINE2); display.setCursor(0,OLED_LINE2);
display.printf("%s",src.c_str()); display.printf("%s",src.c_str());
display.setCursor(0,OLED_LINE3); display.setCursor(0,OLED_LINE3);
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str()); display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
} }
else else
{ {
display.fillRect(0,OLED_LINE4,display.width(),40,BLACK); display.fillRect(0,OLED_LINE4,display.width(),40,BLACK);
display.setCursor(0,OLED_LINE4); display.setCursor(0,OLED_LINE4);
display.printf("%s",src.c_str()); display.printf("%s",src.c_str());
display.setCursor(0,OLED_LINE5); display.setCursor(0,OLED_LINE5);
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str()); display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
} }
} }
else else
{ {
display.fillRect(0,OLED_LINE3,display.width(),20,BLACK); display.fillRect(0,OLED_LINE3,display.width(),20,BLACK);
display.setCursor(0,OLED_LINE3); display.setCursor(0,OLED_LINE3);
display.printf("%s",src.c_str()); display.printf("%s",src.c_str());
display.setCursor(0,OLED_LINE4); display.setCursor(0,OLED_LINE4);
display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str()); display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
} }
display.fillRect(0,OLED_LINE6,display.width(),20,BLACK);
display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str());
display.fillRect(0,OLED_LINE6,display.width(),20,BLACK);
display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str());
OLED_statusbar(); OLED_statusbar();
display.display(); display.display();
} }
void COLED::clearDMRInt(unsigned int slotNo) void COLED::clearDMRInt(unsigned int slotNo)
{ {
// if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2 // if both slots, use lines 2-3 for slot 1, lines 4-5 for slot 2
// if single slot, use lines 3-4 // if single slot, use lines 3-4
if ( m_slot1Enabled && m_slot2Enabled ){ if ( m_slot1Enabled && m_slot2Enabled ){
if (slotNo == 1U) if (slotNo == 1U) {
{ display.fillRect(0, OLED_LINE3, display.width(), 40, BLACK);
display.fillRect(0, OLED_LINE3, display.width(), 40, BLACK); display.setCursor(0,OLED_LINE3);
display.setCursor(0,OLED_LINE3); display.print("Slot: 1 Listening");
display.print("Slot: 1 Listening"); }
} else {
else display.fillRect(0, OLED_LINE5, display.width(), 40, BLACK);
{ display.setCursor(0, OLED_LINE5);
display.fillRect(0, OLED_LINE5, display.width(), 40, BLACK); display.print("Slot: 2 Listening");
display.setCursor(0, OLED_LINE5); }
display.print("Slot: 2 Listening"); }
} else {
} display.fillRect(0, OLED_LINE4, display.width(), 40, BLACK);
else { display.setCursor(0,OLED_LINE4);
display.fillRect(0, OLED_LINE4, display.width(), 40, BLACK); display.printf("Slot: %i Listening",slotNo);
display.setCursor(0,OLED_LINE4); }
display.printf("Slot: %i Listening",slotNo);
}
display.fillRect(0, OLED_LINE6, display.width(), 20, BLACK);
display.fillRect(0, OLED_LINE6, display.width(), 20, BLACK); display.setCursor(0,OLED_LINE6);
display.setCursor(0,OLED_LINE6); display.printf("%s",m_ipaddress.c_str());
display.printf("%s",m_ipaddress.c_str());
display.display(); display.display();
} }
@ -400,9 +418,9 @@ void COLED::clearFusionInt()
display.setCursor(40,OLED_LINE4); display.setCursor(40,OLED_LINE4);
display.print("Listening"); display.print("Listening");
display.setCursor(0,OLED_LINE6); display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str()); display.printf("%s",m_ipaddress.c_str());
display.display(); display.display();
} }
@ -430,9 +448,9 @@ void COLED::clearP25Int()
display.setCursor(40,OLED_LINE4); display.setCursor(40,OLED_LINE4);
display.print("Listening"); display.print("Listening");
display.setCursor(0,OLED_LINE6); display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str()); display.printf("%s",m_ipaddress.c_str());
display.display(); display.display();
} }
@ -460,9 +478,39 @@ void COLED::clearNXDNInt()
display.setCursor(40,OLED_LINE4); display.setCursor(40,OLED_LINE4);
display.print("Listening"); display.print("Listening");
display.setCursor(0,OLED_LINE6); display.setCursor(0,OLED_LINE6);
display.printf("%s",m_ipaddress.c_str()); display.printf("%s",m_ipaddress.c_str());
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(); display.display();
} }
@ -496,13 +544,13 @@ void COLED::clearCWInt()
void COLED::close() void COLED::close()
{ {
display.clearDisplay(); display.clearDisplay();
display.fillRect(0, 0, display.width(), 16, BLACK); display.fillRect(0, 0, display.width(), 16, BLACK);
display.startscrollright(0x00,0x01); display.startscrollright(0x00,0x01);
display.setCursor(0,00); display.setCursor(0,00);
display.setTextSize(2); display.setTextSize(2);
display.print("-CLOSE-"); display.print("-CLOSE-");
display.display(); display.display();
display.close(); display.close();
} }
@ -514,18 +562,20 @@ void COLED::OLED_statusbar()
display.setCursor(0,0); display.setCursor(0,0);
if (m_mode == MODE_DMR) if (m_mode == MODE_DMR)
display.drawBitmap(0, 0, logo_dmr_bmp, 128, 16, WHITE); display.drawBitmap(0, 0, logo_dmr_bmp, 128, 16, WHITE);
else if (m_mode == MODE_DSTAR) else if (m_mode == MODE_DSTAR)
display.drawBitmap(0, 0, logo_dstar_bmp, 128, 16, WHITE); display.drawBitmap(0, 0, logo_dstar_bmp, 128, 16, WHITE);
else if (m_mode == MODE_YSF) else if (m_mode == MODE_YSF)
display.drawBitmap(0, 0, logo_fusion_bmp, 128, 16, WHITE); display.drawBitmap(0, 0, logo_fusion_bmp, 128, 16, WHITE);
else if (m_mode == MODE_P25) else if (m_mode == MODE_P25)
display.drawBitmap(0, 0, logo_P25_bmp, 128, 16, WHITE); display.drawBitmap(0, 0, logo_P25_bmp, 128, 16, WHITE);
else if (m_mode == MODE_NXDN) else if (m_mode == MODE_NXDN)
display.drawBitmap(0, 0, logo_NXDN_bmp, 128, 16, WHITE); 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 else
display.drawBitmap(0, 0, logo_glcd_bmp, 128, 16, WHITE); display.drawBitmap(0, 0, logo_glcd_bmp, 128, 16, WHITE);
if (m_displayScroll) if (m_displayScroll)
display.startscrollright(0x00,0x02); display.startscrollright(0x00,0x02);
} }

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 writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
virtual void clearNXDNInt(); virtual void clearNXDNInt();
virtual void writePOCSAGInt(uint32_t ric, const std::string& message);
virtual void clearPOCSAGInt();
virtual void writeCWInt(); virtual void writeCWInt();
virtual void clearCWInt(); virtual void clearCWInt();