Beginnings of DVMega Display

Use the HD44780 real estate where TS1 is irrelevant.
This commit is contained in:
Tony Corbett G0WFV
2016-05-05 14:29:46 +01:00
parent be120cf510
commit 9e6c7cff42
5 changed files with 37 additions and 12 deletions

View File

@@ -115,6 +115,7 @@ m_hd44780PWM(false),
m_hd44780PWMPin(), m_hd44780PWMPin(),
m_hd44780PWMBright(), m_hd44780PWMBright(),
m_hd44780PWMDim(), m_hd44780PWMDim(),
m_hd44780DVMegaDisplay(false),
m_nextionSize("2.4"), m_nextionSize("2.4"),
m_nextionPort("/dev/ttyAMA0"), m_nextionPort("/dev/ttyAMA0"),
m_nextionBrightness(50U) m_nextionBrightness(50U)
@@ -355,6 +356,8 @@ bool CConf::read()
m_hd44780PWMBright = (unsigned int)::atoi(value); m_hd44780PWMBright = (unsigned int)::atoi(value);
else if (::strcmp(key, "PWMDim") == 0) else if (::strcmp(key, "PWMDim") == 0)
m_hd44780PWMDim = (unsigned int)::atoi(value); m_hd44780PWMDim = (unsigned int)::atoi(value);
else if (::strcmp(key, "DVMegaDisplay") == 0)
m_hd44780DVMegaDisplay = (unsigned int)::atoi(value);
else if (::strcmp(key, "Pins") == 0) { else if (::strcmp(key, "Pins") == 0) {
char* p = ::strtok(value, ",\r\n"); char* p = ::strtok(value, ",\r\n");
while (p != NULL) { while (p != NULL) {
@@ -723,6 +726,11 @@ unsigned int CConf::getHD44780PWMDim() const
return m_hd44780PWMDim; return m_hd44780PWMDim;
} }
bool CConf::getHD44780DVMegaDisplay() const
{
return m_hd44780DVMegaDisplay;
}
std::string CConf::getNextionSize() const std::string CConf::getNextionSize() const
{ {
return m_nextionSize; return m_nextionSize;

2
Conf.h
View File

@@ -122,6 +122,7 @@ public:
unsigned int getHD44780PWMPin() const; unsigned int getHD44780PWMPin() const;
unsigned int getHD44780PWMBright() const; unsigned int getHD44780PWMBright() const;
unsigned int getHD44780PWMDim() const; unsigned int getHD44780PWMDim() const;
bool getHD44780DVMegaDisplay() const;
// The Nextion section // The Nextion section
std::string getNextionSize() const; std::string getNextionSize() const;
@@ -210,6 +211,7 @@ private:
unsigned int m_hd44780PWMPin; unsigned int m_hd44780PWMPin;
unsigned int m_hd44780PWMBright; unsigned int m_hd44780PWMBright;
unsigned int m_hd44780PWMDim; unsigned int m_hd44780PWMDim;
bool m_hd44780DVMegaDisplay;
std::string m_nextionSize; std::string m_nextionSize;
std::string m_nextionPort; std::string m_nextionPort;

View File

@@ -29,7 +29,7 @@
const char* LISTENING = "Listening "; 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) : 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) :
m_rows(rows), m_rows(rows),
m_cols(cols), m_cols(cols),
m_callsign(callsign), m_callsign(callsign),
@@ -44,6 +44,7 @@ m_pwm(pwm),
m_pwmPin(pwmPin), m_pwmPin(pwmPin),
m_pwmBright(pwmBright), m_pwmBright(pwmBright),
m_pwmDim(pwmDim), m_pwmDim(pwmDim),
m_dvmegaDisplay(dvmegaDisplay),
m_fd(-1), m_fd(-1),
m_dmr(false) m_dmr(false)
{ {
@@ -345,8 +346,11 @@ void CHD44780::writeDMR(unsigned int slotNo, const std::string& src, bool group,
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING); ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
} else { } else {
::lcdPosition(m_fd, 0, 0); ::lcdPosition(m_fd, 0, 0);
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING); if (m_dvmegaDisplay) {
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
else
::lcdPuts(m_fd, "DMR");
}
} }
} else if (m_rows == 4U && m_cols == 16U) { } else if (m_rows == 4U && m_cols == 16U) {
::lcdPosition(m_fd, 0, 0); ::lcdPosition(m_fd, 0, 0);
@@ -387,14 +391,21 @@ void CHD44780::writeDMR(unsigned int slotNo, const std::string& src, bool group,
#endif #endif
char buffer[16U]; char buffer[16U];
if (slotNo == 1U) { if (!m_dvmegaDisplay) {
::sprintf(buffer, "%s >%s%s", src.c_str(), group ? "TG" : "", dst.c_str()); if (slotNo == 1U) {
::lcdPosition(m_fd, 0, 0); ::sprintf(buffer, "%s >%s%s", src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer); ::lcdPosition(m_fd, 0, 0);
} else { ::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
::sprintf(buffer, "%s >%s%s", src.c_str(), group ? "TG" : "", dst.c_str()); } else {
::lcdPosition(m_fd, 0, 1); ::sprintf(buffer, "%s >%s%s", src.c_str(), group ? "TG" : "", dst.c_str());
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); ::lcdPosition(m_fd, 0, 1);
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
}
else {
::lcdPosition(m_fd, 0, 0);
::lcdPrintf(m_fd, "From: %s", src.c_str());
::lcdPosition(m_fd, 0, 0);
::lcdPrintf(m_fd, "To : %s%s", group ? "TG" : "", dst.c_str());
} }
} else if (m_rows == 4U && m_cols == 16U) { } else if (m_rows == 4U && m_cols == 16U) {
#ifdef ADAFRUIT_DISPLAY #ifdef ADAFRUIT_DISPLAY

View File

@@ -51,7 +51,7 @@ enum ADAFRUIT_COLOUR {
class CHD44780 : public IDisplay class CHD44780 : public IDisplay
{ {
public: 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); 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);
virtual ~CHD44780(); virtual ~CHD44780();
virtual bool open(); virtual bool open();
@@ -87,6 +87,7 @@ private:
unsigned int m_pwmPin; unsigned int m_pwmPin;
unsigned int m_pwmBright; unsigned int m_pwmBright;
unsigned int m_pwmDim; unsigned int m_pwmDim;
bool m_dvmegaDisplay;
int m_fd; int m_fd;
bool m_dmr; bool m_dmr;

View File

@@ -97,6 +97,9 @@ PWMDim=16
# Adafruit i2c HD44780 # Adafruit i2c HD44780
Pins=115,113,112,111,110,109 Pins=115,113,112,111,110,109
# Use redundant display real estate when connected to a DVMega
DVMegaDisplay=0
[Nextion] [Nextion]
Size=2.4 Size=2.4
Port=/dev/ttyAMA0 Port=/dev/ttyAMA0