Transfer date separator settings to HD44780 code

This commit is contained in:
phl0
2016-06-22 12:09:56 +02:00
parent 0c468ffcd9
commit 0e36abafc3
3 changed files with 19 additions and 12 deletions

View File

@@ -36,7 +36,7 @@ char m_buffer2[128U];
char m_buffer3[128U]; char m_buffer3[128U];
char m_buffer4[128U]; char m_buffer4[128U];
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 displayClock, bool utc, bool duplex) : 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 displayClock, bool utc, bool duplex, const std::string& dateformat) :
CDisplay(), CDisplay(),
m_rows(rows), m_rows(rows),
m_cols(cols), m_cols(cols),
@@ -56,6 +56,7 @@ m_displayClock(displayClock),
m_utc(utc), m_utc(utc),
m_duplex(duplex), m_duplex(duplex),
//m_duplex(true), // uncomment to force duplex display for testing! //m_duplex(true), // uncomment to force duplex display for testing!
m_dateformat(dateformat),
m_fd(-1), m_fd(-1),
m_dmr(false), m_dmr(false),
m_clockDisplayTimer(1000U, 0U, 75U), // Update the clock display every 75ms m_clockDisplayTimer(1000U, 0U, 75U), // Update the clock display every 75ms
@@ -734,7 +735,11 @@ void CHD44780::clockInt(unsigned int ms)
if (m_cols != 16U && m_rows != 2U) { if (m_cols != 16U && m_rows != 2U) {
::lcdPosition(m_fd, (m_cols - 8) / 2, m_rows == 2 ? 0 : 1); ::lcdPosition(m_fd, (m_cols - 8) / 2, m_rows == 2 ? 0 : 1);
::lcdPrintf(m_fd, "%02d/%02d/%2d", Day, Month, Year%100); if (strcmp(m_dateformat.c_str(), "English") == 0) {
::lcdPrintf(m_fd, "%02d/%02d/%2d", Day, Month, Year%100);
} else if (strcmp(m_dateformat.c_str(), "German") == 0) {
::lcdPrintf(m_fd, "%02d.%02d.%2d", Day, Month, Year%100);
}
} }
m_clockDisplayTimer.start(); m_clockDisplayTimer.start();
} }

View File

@@ -53,7 +53,7 @@ enum ADAFRUIT_COLOUR {
class CHD44780 : public CDisplay class CHD44780 : public CDisplay
{ {
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, bool displayClock, bool utc, bool duplex); 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 displayClock, bool utc, bool duplex, const std::string& dateformat);
virtual ~CHD44780(); virtual ~CHD44780();
virtual bool open(); virtual bool open();
@@ -94,6 +94,7 @@ private:
bool m_displayClock; bool m_displayClock;
bool m_utc; bool m_utc;
bool m_duplex; bool m_duplex;
std::string m_dateformat;
int m_fd; int m_fd;
bool m_dmr; bool m_dmr;
CTimer m_clockDisplayTimer; CTimer m_clockDisplayTimer;

View File

@@ -844,15 +844,16 @@ void CMMDVMHost::createDisplay()
m_display = new CNextion(m_callsign, dmrid, port, brightness, displayClock, utc, dateformat); m_display = new CNextion(m_callsign, dmrid, port, brightness, displayClock, utc, dateformat);
#if defined(HD44780) #if defined(HD44780)
} else if (type == "HD44780") { } else if (type == "HD44780") {
unsigned int rows = m_conf.getHD44780Rows(); unsigned int rows = m_conf.getHD44780Rows();
unsigned int columns = m_conf.getHD44780Columns(); unsigned int columns = m_conf.getHD44780Columns();
std::vector<unsigned int> pins = m_conf.getHD44780Pins(); std::vector<unsigned int> pins = m_conf.getHD44780Pins();
bool pwm = m_conf.getHD44780PWM(); bool pwm = m_conf.getHD44780PWM();
unsigned int pwmPin = m_conf.getHD44780PWMPin(); unsigned int pwmPin = m_conf.getHD44780PWMPin();
unsigned int pwmBright = m_conf.getHD44780PWMBright(); unsigned int pwmBright = m_conf.getHD44780PWMBright();
unsigned int pwmDim = m_conf.getHD44780PWMDim(); unsigned int pwmDim = m_conf.getHD44780PWMDim();
bool displayClock = m_conf.getHD44780DisplayClock(); bool displayClock = m_conf.getHD44780DisplayClock();
bool utc = m_conf.getHD44780UTC(); bool utc = m_conf.getHD44780UTC();
std::string dateformat = m_conf.getHD44780DateFormat();
if (pins.size() == 6U) { if (pins.size() == 6U) {
LogInfo(" Rows: %u", rows); LogInfo(" Rows: %u", rows);
@@ -870,7 +871,7 @@ void CMMDVMHost::createDisplay()
if (displayClock) if (displayClock)
LogInfo(" Display UTC: %s", utc ? "yes" : "no"); LogInfo(" Display UTC: %s", utc ? "yes" : "no");
m_display = new CHD44780(rows, columns, m_callsign, dmrid, pins, pwm, pwmPin, pwmBright, pwmDim, displayClock, utc, m_duplex); m_display = new CHD44780(rows, columns, m_callsign, dmrid, pins, pwm, pwmPin, pwmBright, pwmDim, displayClock, utc, m_duplex, dateformat);
} }
#endif #endif
#if defined(OLED) #if defined(OLED)