add UserDB display for OLED
To display UserDB on DMR mode, set Slot1=0 and Slot2=1 in [DMR Network] section.
This commit is contained in:
parent
d77d44fd4b
commit
e818d0f500
2 changed files with 60 additions and 16 deletions
73
OLED.cpp
73
OLED.cpp
|
@ -217,6 +217,7 @@ bool COLED::open()
|
||||||
}
|
}
|
||||||
|
|
||||||
// init done
|
// init done
|
||||||
|
m_display.setTextWrap(false); // disable text wrap as default
|
||||||
m_display.clearDisplay(); // clears the screen buffer
|
m_display.clearDisplay(); // clears the screen buffer
|
||||||
m_display.display(); // display it (clear display)
|
m_display.display(); // display it (clear display)
|
||||||
|
|
||||||
|
@ -271,8 +272,10 @@ void COLED::setErrorInt(const char* text)
|
||||||
m_display.clearDisplay();
|
m_display.clearDisplay();
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
|
|
||||||
|
m_display.setTextWrap(true); // text wrap temorally enable
|
||||||
m_display.setCursor(0,OLED_LINE1);
|
m_display.setCursor(0,OLED_LINE1);
|
||||||
m_display.printf("%s\n",text);
|
m_display.printf("%s\n",text);
|
||||||
|
m_display.setTextWrap(false);
|
||||||
|
|
||||||
m_display.display();
|
m_display.display();
|
||||||
}
|
}
|
||||||
|
@ -360,6 +363,16 @@ void COLED::clearDStarInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,const std::string& dst,const char* type)
|
void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,const std::string& dst,const char* type)
|
||||||
|
{
|
||||||
|
CUserDBentry tmp;
|
||||||
|
|
||||||
|
tmp.set(keyCALLSIGN, src);
|
||||||
|
writeDMRIntEx(slotNo, tmp, group, dst, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CALLandNAME(u) ((u).get(keyCALLSIGN) + " " + (u).get(keyFIRST_NAME))
|
||||||
|
|
||||||
|
int COLED::writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_mode != MODE_DMR) {
|
if (m_mode != MODE_DMR) {
|
||||||
|
@ -368,13 +381,13 @@ void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,co
|
||||||
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 2-3
|
||||||
if ( m_slot1Enabled && m_slot2Enabled ) {
|
if ( m_slot1Enabled && m_slot2Enabled ) {
|
||||||
|
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
m_display.fillRect(0,OLED_LINE2,m_display.width(),40,BLACK);
|
m_display.fillRect(0,OLED_LINE2,m_display.width(),40,BLACK);
|
||||||
m_display.setCursor(0,OLED_LINE2);
|
m_display.setCursor(0,OLED_LINE2);
|
||||||
m_display.printf("%s",src.c_str());
|
m_display.printf("%s",CALLandNAME(src).c_str());
|
||||||
m_display.setCursor(0,OLED_LINE3);
|
m_display.setCursor(0,OLED_LINE3);
|
||||||
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
||||||
}
|
}
|
||||||
|
@ -382,34 +395,41 @@ void COLED::writeDMRInt(unsigned int slotNo,const std::string& src,bool group,co
|
||||||
{
|
{
|
||||||
m_display.fillRect(0,OLED_LINE4,m_display.width(),40,BLACK);
|
m_display.fillRect(0,OLED_LINE4,m_display.width(),40,BLACK);
|
||||||
m_display.setCursor(0,OLED_LINE4);
|
m_display.setCursor(0,OLED_LINE4);
|
||||||
m_display.printf("%s",src.c_str());
|
m_display.printf("%s",CALLandNAME(src).c_str());
|
||||||
m_display.setCursor(0,OLED_LINE5);
|
m_display.setCursor(0,OLED_LINE5);
|
||||||
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_display.fillRect(0,OLED_LINE6,m_display.width(),20,BLACK);
|
||||||
|
m_display.setCursor(0,OLED_LINE6);
|
||||||
|
m_display.printf("%s",m_ipaddress.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_display.fillRect(0,OLED_LINE3,m_display.width(),20,BLACK);
|
m_display.fillRect(0,OLED_LINE2,m_display.width(),m_display.height(),BLACK);
|
||||||
|
m_display.setCursor(0,OLED_LINE2);
|
||||||
|
m_display.printf("%s",CALLandNAME(src).c_str());
|
||||||
m_display.setCursor(0,OLED_LINE3);
|
m_display.setCursor(0,OLED_LINE3);
|
||||||
m_display.printf("%s",src.c_str());
|
|
||||||
m_display.setCursor(0,OLED_LINE4);
|
|
||||||
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
m_display.printf("Slot: %i %s %s%s",slotNo,type,group ? "TG: " : "",dst.c_str());
|
||||||
|
m_display.setCursor(0,OLED_LINE4);
|
||||||
|
m_display.printf("%s",src.get(keyCITY).c_str());
|
||||||
|
m_display.setCursor(0,OLED_LINE5);
|
||||||
|
m_display.printf("%s",src.get(keySTATE).c_str());
|
||||||
|
m_display.setCursor(0,OLED_LINE6);
|
||||||
|
m_display.printf("%s",src.get(keyCOUNTRY).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_display.fillRect(0,OLED_LINE6,m_display.width(),20,BLACK);
|
|
||||||
m_display.setCursor(0,OLED_LINE6);
|
|
||||||
m_display.printf("%s",m_ipaddress.c_str());
|
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
m_display.display();
|
m_display.display();
|
||||||
|
|
||||||
|
// must be 0, to avoid calling writeDMRInt() from CDisplay::writeDMR()
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 2-3
|
||||||
if ( m_slot1Enabled && m_slot2Enabled ){
|
if ( m_slot1Enabled && m_slot2Enabled ){
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
m_display.fillRect(0, OLED_LINE3, m_display.width(), 40, BLACK);
|
m_display.fillRect(0, OLED_LINE3, m_display.width(), 40, BLACK);
|
||||||
|
@ -423,8 +443,8 @@ void COLED::clearDMRInt(unsigned int slotNo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_display.fillRect(0, OLED_LINE4, m_display.width(), 40, BLACK);
|
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
||||||
m_display.setCursor(0,OLED_LINE4);
|
m_display.setCursor(0,OLED_LINE3);
|
||||||
m_display.printf("Slot: %i Listening",slotNo);
|
m_display.printf("Slot: %i Listening",slotNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,28 +517,47 @@ void COLED::clearP25Int()
|
||||||
}
|
}
|
||||||
|
|
||||||
void COLED::writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type)
|
void COLED::writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type)
|
||||||
|
{
|
||||||
|
CUserDBentry tmp;
|
||||||
|
|
||||||
|
tmp.set(keyCALLSIGN, source);
|
||||||
|
writeNXDNIntEx(tmp, group, dest, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
int COLED::writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type)
|
||||||
{
|
{
|
||||||
m_mode = MODE_NXDN;
|
m_mode = MODE_NXDN;
|
||||||
|
|
||||||
m_display.clearDisplay();
|
m_display.clearDisplay();
|
||||||
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
||||||
|
|
||||||
|
m_display.setCursor(0,OLED_LINE2);
|
||||||
|
m_display.printf("%s %s", type, CALLandNAME(source).c_str());
|
||||||
|
|
||||||
m_display.setCursor(0,OLED_LINE3);
|
m_display.setCursor(0,OLED_LINE3);
|
||||||
m_display.printf("%s %.10s", type, source);
|
m_display.printf(" %s%u", group ? "TG" : "", dest);
|
||||||
|
|
||||||
|
m_display.setCursor(0,OLED_LINE4);
|
||||||
|
m_display.printf("%s",source.get(keyCITY).c_str());
|
||||||
|
|
||||||
m_display.setCursor(0,OLED_LINE5);
|
m_display.setCursor(0,OLED_LINE5);
|
||||||
m_display.printf(" %s%u", group ? "TG" : "", dest);
|
m_display.printf("%s",source.get(keySTATE).c_str());
|
||||||
|
|
||||||
|
m_display.setCursor(0,OLED_LINE6);
|
||||||
|
m_display.printf("%s",source.get(keyCOUNTRY).c_str());
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
m_display.display();
|
m_display.display();
|
||||||
|
|
||||||
|
// must be 0, to avoid calling writeNXDNInt() from CDisplay::writeNXDN()
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COLED::clearNXDNInt()
|
void COLED::clearNXDNInt()
|
||||||
{
|
{
|
||||||
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK);
|
||||||
|
|
||||||
m_display.setCursor(40,OLED_LINE4);
|
m_display.setCursor(40,OLED_LINE3);
|
||||||
m_display.print("Listening");
|
m_display.print("Listening");
|
||||||
|
|
||||||
m_display.setCursor(0,OLED_LINE6);
|
m_display.setCursor(0,OLED_LINE6);
|
||||||
|
@ -537,8 +576,10 @@ void COLED::writePOCSAGInt(uint32_t ric, const std::string& message)
|
||||||
m_display.setCursor(0,OLED_LINE3);
|
m_display.setCursor(0,OLED_LINE3);
|
||||||
m_display.printf("RIC: %u", ric);
|
m_display.printf("RIC: %u", ric);
|
||||||
|
|
||||||
|
m_display.setTextWrap(true); // text wrap temorally enable
|
||||||
m_display.setCursor(0,OLED_LINE5);
|
m_display.setCursor(0,OLED_LINE5);
|
||||||
m_display.printf("MSG: %s", message.c_str());
|
m_display.printf("MSG: %s", message.c_str());
|
||||||
|
m_display.setTextWrap(false);
|
||||||
|
|
||||||
OLED_statusbar();
|
OLED_statusbar();
|
||||||
m_display.display();
|
m_display.display();
|
||||||
|
|
3
OLED.h
3
OLED.h
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "Defines.h"
|
#include "Defines.h"
|
||||||
|
#include "UserDBentry.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ public:
|
||||||
virtual void clearDStarInt();
|
virtual void clearDStarInt();
|
||||||
|
|
||||||
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
||||||
|
virtual int writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type);
|
||||||
virtual void clearDMRInt(unsigned int slotNo);
|
virtual void clearDMRInt(unsigned int slotNo);
|
||||||
|
|
||||||
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
|
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
|
||||||
|
@ -65,6 +67,7 @@ public:
|
||||||
virtual void clearP25Int();
|
virtual void clearP25Int();
|
||||||
|
|
||||||
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 int writeNXDNIntEx(const class CUserDBentry& 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 writePOCSAGInt(uint32_t ric, const std::string& message);
|
||||||
|
|
Loading…
Reference in a new issue