Skip to content

Commit

Permalink
Refresh the display handlers.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Oct 3, 2023
1 parent 3df5c60 commit 45821b1
Show file tree
Hide file tree
Showing 11 changed files with 680 additions and 677 deletions.
6 changes: 2 additions & 4 deletions CASTInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ void CCASTInfo::setIdleInt()
unsigned char info[100U];
CNetworkInfo* m_network;

passCounter ++;
passCounter++;
if (passCounter > 253U)
networkInfoInitialized = false;

if (! networkInfoInitialized) {
if (!networkInfoInitialized) {
//LogMessage("Initialize CNetworkInfo");
info[0]=0;
m_network = new CNetworkInfo;
Expand All @@ -60,8 +60,6 @@ void CCASTInfo::setIdleInt()
networkInfoInitialized = true;
passCounter = 0;
}


}

void CCASTInfo::setErrorInt(const char* text)
Expand Down
2 changes: 1 addition & 1 deletion CASTInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CCASTInfo : public CDisplay
virtual void setErrorInt(const char* text);
virtual void setLockoutInt();
virtual void setQuitInt();
virtual void setFMInt();
virtual void setFMInt();

virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector);
virtual void clearDStarInt();
Expand Down
8 changes: 4 additions & 4 deletions Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class CDisplay
void clearDStar();

void writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
void writeDMR(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type);
void writeDMR(unsigned int slotNo, const CUserDBentry& src, bool group, const std::string& dst, const char* type);
void writeDMRRSSI(unsigned int slotNo, unsigned char rssi);
void writeDMRBER(unsigned int slotNo, float ber);
void writeDMRTA(unsigned int slotNo, const unsigned char* talkerAlias, const char* type);
Expand All @@ -67,7 +67,7 @@ class CDisplay
void clearP25();

void writeNXDN(const char* source, bool group, unsigned int dest, const char* type);
void writeNXDN(const class CUserDBentry& source, bool group, unsigned int dest, const char* type);
void writeNXDN(const CUserDBentry& source, bool group, unsigned int dest, const char* type);
void writeNXDNRSSI(unsigned char rssi);
void writeNXDNBER(float ber);
void clearNXDN();
Expand Down Expand Up @@ -101,7 +101,7 @@ class CDisplay
virtual void clearDStarInt() = 0;

virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type) = 0;
virtual int writeDMRIntEx(unsigned int slotNo, const class CUserDBentry& src, bool group, const std::string& dst, const char* type);
virtual int writeDMRIntEx(unsigned int slotNo, const CUserDBentry& src, bool group, const std::string& dst, const char* type);
virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi);
virtual void writeDMRTAInt(unsigned int slotNo, const unsigned char* talkerAlias, const char* type);
virtual void writeDMRBERInt(unsigned int slotNo, float ber);
Expand All @@ -118,7 +118,7 @@ class CDisplay
virtual void clearP25Int() = 0;

virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type) = 0;
virtual int writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type);
virtual int writeNXDNIntEx(const CUserDBentry& source, bool group, unsigned int dest, const char* type);
virtual void writeNXDNRSSIInt(unsigned char rssi);
virtual void writeNXDNBERInt(float ber);
virtual void clearNXDNInt() = 0;
Expand Down
64 changes: 32 additions & 32 deletions LCDproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,51 +28,51 @@
class CLCDproc : public CDisplay
{
public:
CLCDproc(std::string address, unsigned int port, unsigned short localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex, bool dimOnIdle);
virtual ~CLCDproc();
CLCDproc(std::string address, unsigned int port, unsigned short localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex, bool dimOnIdle);
virtual ~CLCDproc();

virtual bool open();
virtual bool open();

virtual void close();
virtual void close();

protected:
virtual void setIdleInt();
virtual void setErrorInt(const char* text);
virtual void setLockoutInt();
virtual void setQuitInt();
virtual void setFMInt();
virtual void setIdleInt();
virtual void setErrorInt(const char* text);
virtual void setLockoutInt();
virtual void setQuitInt();
virtual void setFMInt();

virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector);
virtual void writeDStarRSSIInt(unsigned char rssi);
virtual void clearDStarInt();
virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector);
virtual void writeDStarRSSIInt(unsigned char rssi);
virtual void clearDStarInt();

virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi);
virtual void clearDMRInt(unsigned int slotNo);
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi);
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 writeFusionRSSIInt(unsigned char rssi);
virtual void clearFusionInt();
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
virtual void writeFusionRSSIInt(unsigned char rssi);
virtual void clearFusionInt();

virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
virtual void writeP25RSSIInt(unsigned char rssi);
virtual void clearP25Int();
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
virtual void writeP25RSSIInt(unsigned char rssi);
virtual void clearP25Int();

virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
virtual void writeNXDNRSSIInt(unsigned char rssi);
virtual void clearNXDNInt();
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
virtual void writeNXDNRSSIInt(unsigned char rssi);
virtual void clearNXDNInt();

virtual void writeM17Int(const char* source, const char* dest, const char* type);
virtual void writeM17RSSIInt(unsigned char rssi);
virtual void clearM17Int();
virtual void writeM17Int(const char* source, const char* dest, const char* type);
virtual void writeM17RSSIInt(unsigned char rssi);
virtual void clearM17Int();

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

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

virtual void clockInt(unsigned int ms);
virtual void clockInt(unsigned int ms);

private:
std::string m_address;
Expand Down
39 changes: 21 additions & 18 deletions Nextion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void CNextion::setIdleInt()
sendCommand("page MMDVM");
sendCommandAction(1U);

if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(command, "dim=%u", m_idleBrightness);
sendCommand(command);
}
Expand Down Expand Up @@ -203,7 +203,7 @@ void CNextion::setErrorInt(const char* text)
sendCommandAction(1U);

char command[20];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(command, "dim=%u", m_brightness);
sendCommand(command);
}
Expand All @@ -226,7 +226,7 @@ void CNextion::setLockoutInt()
sendCommandAction(1U);

char command[20];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(command, "dim=%u", m_brightness);
sendCommand(command);
}
Expand All @@ -245,7 +245,7 @@ void CNextion::setQuitInt()
sendCommandAction(1U);

char command[100];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(command, "dim=%u", m_idleBrightness);
sendCommand(command);
}
Expand All @@ -268,7 +268,7 @@ void CNextion::setFMInt()
sendCommandAction(1U);

char command[20];
if (m_brightness > 0) {
if (m_brightness > 0U) {
::sprintf(command, "dim=%u", m_brightness);
sendCommand(command);
}
Expand All @@ -295,7 +295,7 @@ void CNextion::writeDStarInt(const char* my1, const char* my2, const char* your,
}

char text[50U];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(text, "dim=%u", m_brightness);
sendCommand(text);
}
Expand Down Expand Up @@ -396,7 +396,7 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro
}

char text[50U];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(text, "dim=%u", m_brightness);
sendCommand(text);
}
Expand Down Expand Up @@ -614,7 +614,7 @@ void CNextion::writeFusionInt(const char* source, const char* dest, unsigned cha


char text[30U];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(text, "dim=%u", m_brightness);
sendCommand(text);
}
Expand Down Expand Up @@ -693,7 +693,7 @@ void CNextion::writeP25Int(const char* source, bool group, unsigned int dest, co
}

char text[30U];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(text, "dim=%u", m_brightness);
sendCommand(text);
}
Expand Down Expand Up @@ -765,7 +765,7 @@ void CNextion::writeNXDNInt(const char* source, bool group, unsigned int dest, c
}

char text[30U];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(text, "dim=%u", m_brightness);
sendCommand(text);
}
Expand Down Expand Up @@ -838,7 +838,7 @@ void CNextion::writeM17Int(const char* source, const char* dest, const char* typ
}

char text[30U];
if (m_brightness > 0) {
if (m_brightness > 0U) {
::sprintf(text, "dim=%u", m_brightness);
sendCommand(text);
}
Expand Down Expand Up @@ -907,7 +907,7 @@ void CNextion::writePOCSAGInt(uint32_t ric, const std::string& message)
}

char text[200U];
if (m_brightness>0) {
if (m_brightness > 0U) {
::sprintf(text, "dim=%u", m_brightness);
sendCommand(text);
}
Expand Down Expand Up @@ -978,13 +978,14 @@ void CNextion::close()

void CNextion::sendCommandAction(unsigned int status)
{
if (!(m_screenLayout & LAYOUT_DIY))
if (!(m_screenLayout & LAYOUT_DIY))
return;

char text[30U];
::sprintf(text, "MMDVM.status.val=%d", status);
sendCommand(text);
sendCommand("click S0,1");
char text[30U];
::sprintf(text, "MMDVM.status.val=%d", status);
sendCommand(text);

sendCommand("click S0,1");
}

void CNextion::sendCommand(const char* command)
Expand All @@ -993,8 +994,10 @@ void CNextion::sendCommand(const char* command)

m_serial->write((unsigned char*)command, (unsigned int)::strlen(command));
m_serial->write((unsigned char*)"\xFF\xFF\xFF", 3U);

// Since we just firing commands at the display, and not listening for the response,
// we must add a bit of a delay to allow the display to process the commands, else some are getting mangled.
// 10 ms is just a guess, but seems to be sufficient.
CThread::sleep(10U);
CThread::sleep(10U);
}

Loading

0 comments on commit 45821b1

Please sign in to comment.