From a2413f30db6140a6c8578dc992a7a5b1967748c6 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 21 Apr 2016 12:09:54 +0200 Subject: [PATCH] Changed type of callsign variable for TFTSerial --- MMDVMHost.cpp | 2 +- TFTSerial.cpp | 6 +++--- TFTSerial.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index bd4a47b..c93c1eb 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -582,7 +582,7 @@ void CMMDVMHost::createDisplay() LogInfo(" Port: %s", port.c_str()); LogInfo(" Brightness: %u", brightness); - m_display = new CTFTSerial(callsign.c_str(), dmrid, port, brightness); + m_display = new CTFTSerial(callsign, dmrid, port, brightness); } else if (type == "Nextion") { std::string port = m_conf.getNextionPort(); unsigned int brightness = m_conf.getNextionBrightness(); diff --git a/TFTSerial.cpp b/TFTSerial.cpp index b6e608e..055a3df 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -44,14 +44,14 @@ 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 char* callsign, unsigned int dmrid, const std::string& port, unsigned int brightness) : +CTFTSerial::CTFTSerial(const std::string& 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), m_mode(MODE_IDLE) { - assert(callsign != NULL); + assert(callsign.c_str() != NULL); assert(brightness >= 0U && brightness <= 100U); } @@ -91,7 +91,7 @@ void CTFTSerial::setIdle() displayBitmap(0U, 0U, "MMDVM_sm.bmp"); char text[30]; - ::sprintf(text, "%-6s / %u", m_callsign, m_dmrid); + ::sprintf(text, "%-6s / %u", m_callsign.c_str(), m_dmrid); gotoPosPixel(18U, 55U); displayText(text); diff --git a/TFTSerial.h b/TFTSerial.h index 53f6479..cbc5fad 100644 --- a/TFTSerial.h +++ b/TFTSerial.h @@ -28,7 +28,7 @@ class CTFTSerial : public IDisplay { public: - CTFTSerial(const char* callsign, unsigned int dmrid, const std::string& port, unsigned int brightness); + CTFTSerial(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness); virtual ~CTFTSerial(); virtual bool open(); @@ -50,7 +50,7 @@ public: virtual void close(); private: - const char* m_callsign; + std::string m_callsign; unsigned int m_dmrid; CSerialController m_serial; unsigned int m_brightness;