Use the duplex flag to indicate that a DVMega is being used.

This commit is contained in:
Jonathan Naylor 2016-05-05 17:08:23 +01:00
parent 925f29a982
commit dd5e86a66d
6 changed files with 12 additions and 29 deletions

View file

@ -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;

2
Conf.h
View file

@ -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;

View file

@ -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<unsigned int>& 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<unsigned int>& 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);

View file

@ -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<unsigned int>& 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<unsigned int>& 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;

View file

@ -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

View file

@ -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 {