From ad1b30341d96441c8a44fba26873380c0bb82438 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 11 Apr 2016 10:55:20 +0100 Subject: [PATCH] Add the callsign and DMR Id to the TFT Serial. --- MMDVMHost.cpp | 4 ++-- Nextion.h | 4 ++-- TFTSerial.cpp | 12 ++++++++++-- TFTSerial.h | 8 +++++--- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 61328d6..2f2a018 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -566,7 +566,7 @@ void CMMDVMHost::readParams() void CMMDVMHost::createDisplay() { - std::string type = m_conf.getDisplay(); + std::string type = m_conf.getDisplay(); std::string callsign = m_conf.getCallsign(); unsigned int dmrid = m_conf.getDMRId(); @@ -580,7 +580,7 @@ void CMMDVMHost::createDisplay() LogInfo(" Port: %s", port.c_str()); LogInfo(" Brightness: %u", brightness); - m_display = new CTFTSerial(port, brightness); + m_display = new CTFTSerial(callsign.c_str(), dmrid, port, brightness); } else if (type == "Nextion") { std::string port = m_conf.getNextionPort(); unsigned int brightness = m_conf.getNextionBrightness(); diff --git a/Nextion.h b/Nextion.h index 57d3a61..ff8bd46 100644 --- a/Nextion.h +++ b/Nextion.h @@ -52,8 +52,8 @@ public: virtual void close(); private: - const char* m_callsign; - unsigned int m_dmrid; + const char* m_callsign; + unsigned int m_dmrid; CSerialController m_serial; unsigned int m_brightness; diff --git a/TFTSerial.cpp b/TFTSerial.cpp index 8901f6e..2ff36d7 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -44,7 +44,9 @@ const unsigned char FONT_LARGE = 3U; // x = 0 to 159, y = 0 to 127 - Landscape // x = 0 to 127, y = 0 to 159 - Portrait -CTFTSerial::CTFTSerial(const std::string& port, unsigned int brightness) : +CTFTSerial::CTFTSerial(const char* callsign, unsigned int dmrid, const std::string& port, unsigned int brightness) : +m_callsign(callsign), +m_dmrid(dmrid), m_serial(port, SERIAL_9600), m_brightness(brightness) { @@ -86,7 +88,13 @@ void CTFTSerial::setIdle() // Draw MMDVM logo displayBitmap(0U, 0U, "MMDVM_sm.bmp"); - gotoPosPixel(45U, 60U); + char text[30]; + ::sprintf(text, "%-6s / %u", m_callsign, m_dmrid); + + gotoPosPixel(18U, 55U); + displayText(text); + + gotoPosPixel(45U, 90U); displayText("IDLE"); } diff --git a/TFTSerial.h b/TFTSerial.h index 6378379..3db1912 100644 --- a/TFTSerial.h +++ b/TFTSerial.h @@ -27,7 +27,7 @@ class CTFTSerial : public IDisplay { public: - CTFTSerial(const std::string& port, unsigned int brightness); + CTFTSerial(const char* callsign, unsigned int dmrid, const std::string& port, unsigned int brightness); virtual ~CTFTSerial(); virtual bool open(); @@ -52,8 +52,10 @@ public: virtual void close(); private: - CSerialController m_serial; - unsigned int m_brightness; + const char* m_callsign; + unsigned int m_dmrid; + CSerialController m_serial; + unsigned int m_brightness; void clearScreen(); void setBackground(unsigned char colour);