From dd5e86a66d2bc268411ebd2806785fd372bc8772 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 5 May 2016 17:08:23 +0100 Subject: [PATCH] Use the duplex flag to indicate that a DVMega is being used. --- Conf.cpp | 8 -------- Conf.h | 2 -- HD44780.cpp | 10 +++++----- HD44780.h | 4 ++-- MMDVM.ini | 11 ++++------- MMDVMHost.cpp | 6 +----- 6 files changed, 12 insertions(+), 29 deletions(-) diff --git a/Conf.cpp b/Conf.cpp index fcb9fd1..7e7f6de 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -115,7 +115,6 @@ m_hd44780PWM(false), m_hd44780PWMPin(), m_hd44780PWMBright(), m_hd44780PWMDim(), -m_hd44780DVMegaDisplay(false), m_nextionSize("2.4"), m_nextionPort("/dev/ttyAMA0"), m_nextionBrightness(50U) @@ -356,8 +355,6 @@ bool CConf::read() m_hd44780PWMBright = (unsigned int)::atoi(value); else if (::strcmp(key, "PWMDim") == 0) m_hd44780PWMDim = (unsigned int)::atoi(value); - else if (::strcmp(key, "DVMegaDisplay") == 0) - m_hd44780DVMegaDisplay = ::atoi(value) == 1; else if (::strcmp(key, "Pins") == 0) { char* p = ::strtok(value, ",\r\n"); while (p != NULL) { @@ -726,11 +723,6 @@ unsigned int CConf::getHD44780PWMDim() const return m_hd44780PWMDim; } -bool CConf::getHD44780DVMegaDisplay() const -{ - return m_hd44780DVMegaDisplay; -} - std::string CConf::getNextionSize() const { return m_nextionSize; diff --git a/Conf.h b/Conf.h index a57ed29..2e3e177 100644 --- a/Conf.h +++ b/Conf.h @@ -122,7 +122,6 @@ public: unsigned int getHD44780PWMPin() const; unsigned int getHD44780PWMBright() const; unsigned int getHD44780PWMDim() const; - bool getHD44780DVMegaDisplay() const; // The Nextion section std::string getNextionSize() const; @@ -211,7 +210,6 @@ private: unsigned int m_hd44780PWMPin; unsigned int m_hd44780PWMBright; unsigned int m_hd44780PWMDim; - bool m_hd44780DVMegaDisplay; std::string m_nextionSize; std::string m_nextionPort; diff --git a/HD44780.cpp b/HD44780.cpp index 658f803..45ad997 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -29,7 +29,7 @@ const char* LISTENING = "Listening "; -CHD44780::CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool dvmegaDisplay) : +CHD44780::CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool duplex) : m_rows(rows), m_cols(cols), m_callsign(callsign), @@ -44,7 +44,7 @@ m_pwm(pwm), m_pwmPin(pwmPin), m_pwmBright(pwmBright), m_pwmDim(pwmDim), -m_dvmegaDisplay(dvmegaDisplay), +m_duplex(duplex), m_fd(-1), m_dmr(false) { @@ -341,7 +341,7 @@ void CHD44780::writeDMR(unsigned int slotNo, const std::string& src, bool group, } if (m_rows == 2U && m_cols == 16U) { - if (!m_dvmegaDisplay) { + if (m_duplex) { if (slotNo == 1U) { ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); @@ -395,7 +395,7 @@ void CHD44780::writeDMR(unsigned int slotNo, const std::string& src, bool group, #endif char buffer[16U]; - if (!m_dvmegaDisplay) { + if (m_duplex) { if (slotNo == 1U) { ::sprintf(buffer, "%s > %s%s", src.c_str(), group ? "TG" : "", dst.c_str()); ::lcdPosition(m_fd, 0, 0); @@ -473,7 +473,7 @@ void CHD44780::clearDMR(unsigned int slotNo) #endif if (m_rows == 2U && m_cols == 16U) { - if (!m_dvmegaDisplay) { + if (m_duplex) { if (slotNo == 1U) { ::lcdPosition(m_fd, 0, 0); ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); diff --git a/HD44780.h b/HD44780.h index 5b9805b..8ae98c7 100644 --- a/HD44780.h +++ b/HD44780.h @@ -51,7 +51,7 @@ enum ADAFRUIT_COLOUR { class CHD44780 : public IDisplay { public: - CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool dvmegaDisplay); + CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool duplex); virtual ~CHD44780(); virtual bool open(); @@ -87,7 +87,7 @@ private: unsigned int m_pwmPin; unsigned int m_pwmBright; unsigned int m_pwmDim; - bool m_dvmegaDisplay; + bool m_duplex; int m_fd; bool m_dmr; diff --git a/MMDVM.ini b/MMDVM.ini index 7ec4c56..2e4f311 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -86,7 +86,10 @@ Brightness=50 Rows=2 Columns=16 # rs, strb, d0, d1, d2, d3 -# Pins=11,10,0,1,2,3 +# For basic HD44780 displays +Pins=11,10,0,1,2,3 +# For Adafruit i2c HD44780 +# Pins=115,113,112,111,110,109 # PWM brightness control PWM=1 @@ -94,12 +97,6 @@ PWMPin=21 PWMBright=100 PWMDim=16 -# Adafruit i2c HD44780 -Pins=115,113,112,111,110,109 - -# Use redundant display real estate when connected to a DVMega -DVMegaDisplay=0 - [Nextion] Size=2.4 Port=/dev/ttyAMA0 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 1c6611e..e1d68ef 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -691,7 +691,6 @@ void CMMDVMHost::createDisplay() unsigned int pwmPin = m_conf.getHD44780PWMPin(); unsigned int pwmBright = m_conf.getHD44780PWMBright(); unsigned int pwmDim = m_conf.getHD44780PWMDim(); - bool dvmegaDisplay = m_conf.getHD44780DVMegaDisplay(); if (pins.size() == 6U) { LogInfo(" Rows: %u", rows); @@ -705,10 +704,7 @@ void CMMDVMHost::createDisplay() LogInfo(" PWM Dim: %u", pwmDim); } - if (dvmegaDisplay) - LogInfo("Using DVMega display output on HD44780"); - - m_display = new CHD44780(rows, columns, callsign, dmrid, pins, pwm, pwmPin, pwmBright, pwmDim, dvmegaDisplay); + m_display = new CHD44780(rows, columns, callsign, dmrid, pins, pwm, pwmPin, pwmBright, pwmDim, m_duplex); } #endif } else {