From 9fb57309a1f11212f2f28150a1e0784e37751c75 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 7 Apr 2016 22:20:44 +0200 Subject: [PATCH] Add output of callsign/DMRid on LCD idle screen --- HD44780.cpp | 8 +++++--- HD44780.h | 4 +++- MMDVMHost.cpp | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/HD44780.cpp b/HD44780.cpp index 0a4aa52..8eb86af 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -27,9 +27,11 @@ const char* LISTENING = "Listening "; -CHD44780::CHD44780(unsigned int rows, unsigned int cols, const std::vector& pins) : +CHD44780::CHD44780(unsigned int rows, unsigned int cols, const char* callsign, unsigned int dmrid, const std::vector& pins) : m_rows(rows), m_cols(cols), +m_callsign(callsign), +m_dmrid(dmrid), m_rb(pins.at(0U)), m_strb(pins.at(1U)), m_d0(pins.at(2U)), @@ -68,10 +70,10 @@ void CHD44780::setIdle() ::lcdClear(m_fd); ::lcdPosition(m_fd, 0, 0); - ::lcdPuts(m_fd, "MMDVM"); + ::lcdPrintf(m_fd, "%-6s / %u", m_callsign, m_dmrid); ::lcdPosition(m_fd, 0, 1); - ::lcdPuts(m_fd, "Idle"); + ::lcdPuts(m_fd, "MMDVM Idle"); } void CHD44780::setError(const char* text) diff --git a/HD44780.h b/HD44780.h index 07d3564..bf95bd2 100644 --- a/HD44780.h +++ b/HD44780.h @@ -27,7 +27,7 @@ class CHD44780 : public IDisplay { public: - CHD44780(unsigned int rows, unsigned int cols, const std::vector& pins); + CHD44780(unsigned int rows, unsigned int cols, const char* callsign, unsigned int dmrid, const std::vector& pins); virtual ~CHD44780(); virtual bool open(); @@ -54,6 +54,8 @@ public: private: unsigned int m_rows; unsigned int m_cols; + const char* m_callsign; + unsigned int m_dmrid; unsigned int m_rb; unsigned int m_strb; unsigned int m_d0; diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 1d8ae76..e576d3b 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -567,6 +567,8 @@ void CMMDVMHost::readParams() void CMMDVMHost::createDisplay() { std::string type = m_conf.getDisplay(); + std::string callsign = m_conf.getCallsign(); + unsigned int dmrid = m_conf.getDMRId(); LogInfo("Display Parameters"); LogInfo(" Type: %s", type.c_str()); @@ -598,7 +600,7 @@ void CMMDVMHost::createDisplay() LogInfo(" Columns: %u", columns); LogInfo(" Pins: %u,%u,%u,%u,%u,%u", pins.at(0U), pins.at(1U), pins.at(2U), pins.at(3U), pins.at(4U), pins.at(5U)); - m_display = new CHD44780(rows, columns, pins); + m_display = new CHD44780(rows, columns, callsign.c_str(), dmrid, pins); } #endif } else {