From aae5060f80f933e0b7fbfcc9b1ca1064775a3364 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 7 Apr 2016 13:11:22 +0200 Subject: [PATCH] Add callsign from config file to idle screen --- Display.h | 2 +- HD44780.cpp | 4 ++-- HD44780.h | 2 +- MMDVMHost.cpp | 3 ++- Nextion.cpp | 4 ++-- Nextion.h | 2 +- NullDisplay.cpp | 2 +- NullDisplay.h | 2 +- TFTSerial.cpp | 4 ++-- TFTSerial.h | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Display.h b/Display.h index f831af9..76d59f2 100644 --- a/Display.h +++ b/Display.h @@ -28,7 +28,7 @@ public: virtual bool open() = 0; - virtual void setIdle() = 0; + virtual void setIdle(const char* callsign) = 0; virtual void setLockout() = 0; virtual void setError(const char* text) = 0; diff --git a/HD44780.cpp b/HD44780.cpp index 0a4aa52..55eccea 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -63,12 +63,12 @@ bool CHD44780::open() return true; } -void CHD44780::setIdle() +void CHD44780::setIdle(const char* callsign) { ::lcdClear(m_fd); ::lcdPosition(m_fd, 0, 0); - ::lcdPuts(m_fd, "MMDVM"); + ::lcdPrintf(m_fd, "MMDVM %s", callsign); ::lcdPosition(m_fd, 0, 1); ::lcdPuts(m_fd, "Idle"); diff --git a/HD44780.h b/HD44780.h index 07d3564..187b998 100644 --- a/HD44780.h +++ b/HD44780.h @@ -32,7 +32,7 @@ public: virtual bool open(); - virtual void setIdle(); + virtual void setIdle(const char* callsign); virtual void setError(const char* text); virtual void setLockout(); diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 1d8ae76..a5b8fc2 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -692,7 +692,8 @@ void CMMDVMHost::setMode(unsigned char mode, bool logging) if (m_mode == MODE_DMR && m_duplex) m_modem->writeDMRStart(false); m_modem->setMode(MODE_IDLE); - m_display->setIdle(); + std::string callsign = m_conf.getCallsign(); + m_display->setIdle(callsign.c_str()); m_mode = MODE_IDLE; m_modeTimer.stop(); break; diff --git a/Nextion.cpp b/Nextion.cpp index 2f2012c..8f51f5d 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -48,12 +48,12 @@ bool CNextion::open() ::sprintf(command, "dim=%u", m_brightness); sendCommand(command); - setIdle(); + setIdle(""); return true; } -void CNextion::setIdle() +void CNextion::setIdle(const char* callsign) { sendCommand("page MMDVM"); diff --git a/Nextion.h b/Nextion.h index ad60f95..42772ae 100644 --- a/Nextion.h +++ b/Nextion.h @@ -32,7 +32,7 @@ public: virtual bool open(); - virtual void setIdle(); + virtual void setIdle(const char* callsign); virtual void setError(const char* text); virtual void setLockout(); diff --git a/NullDisplay.cpp b/NullDisplay.cpp index 59b45ef..2a3ac1e 100644 --- a/NullDisplay.cpp +++ b/NullDisplay.cpp @@ -31,7 +31,7 @@ bool CNullDisplay::open() return true; } -void CNullDisplay::setIdle() +void CNullDisplay::setIdle(const char* callsign) { } diff --git a/NullDisplay.h b/NullDisplay.h index abcfa6e..b4e99f4 100644 --- a/NullDisplay.h +++ b/NullDisplay.h @@ -31,7 +31,7 @@ public: virtual bool open(); - virtual void setIdle(); + virtual void setIdle(const char* callsign); virtual void setError(const char* text); virtual void setLockout(); diff --git a/TFTSerial.cpp b/TFTSerial.cpp index 8901f6e..4b0bbf9 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -71,12 +71,12 @@ bool CTFTSerial::open() setForeground(COLOUR_BLACK); - setIdle(); + setIdle(""); return true; } -void CTFTSerial::setIdle() +void CTFTSerial::setIdle(const char* callsign) { // Clear the screen clearScreen(); diff --git a/TFTSerial.h b/TFTSerial.h index 6378379..0f6d64b 100644 --- a/TFTSerial.h +++ b/TFTSerial.h @@ -32,7 +32,7 @@ public: virtual bool open(); - virtual void setIdle(); + virtual void setIdle(const char* callsign); virtual void setError(const char* text); virtual void setLockout();