diff --git a/Conf.cpp b/Conf.cpp index ec69a27..7a78d57 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -592,6 +592,8 @@ bool CConf::read() m_lcdprocDisplayClock = ::atoi(value) == 1; else if (::strcmp(key, "UTC") == 0) m_lcdprocUTC = ::atoi(value) == 1; + else if (::strcmp(key, "DimOnIdle") == 0) + m_lcdprocDimOnIdle = ::atoi(value) == 1; } } @@ -1199,3 +1201,8 @@ bool CConf::getLCDprocUTC() const { return m_lcdprocUTC; } + +bool CConf::getLCDprocDimOnIdle() const +{ + return m_lcdprocDimOnIdle; +} diff --git a/Conf.h b/Conf.h index 22c905a..4bf739d 100644 --- a/Conf.h +++ b/Conf.h @@ -187,6 +187,7 @@ public: unsigned int getLCDprocLocalPort() const; bool getLCDprocDisplayClock() const; bool getLCDprocUTC() const; + bool getLCDprocDimOnIdle() const; private: std::string m_file; @@ -328,6 +329,7 @@ private: unsigned int m_lcdprocLocalPort; bool m_lcdprocDisplayClock; bool m_lcdprocUTC; + bool m_lcdprocDimOnIdle; }; #endif diff --git a/LCDproc.cpp b/LCDproc.cpp index e288ff3..e2165e8 100644 --- a/LCDproc.cpp +++ b/LCDproc.cpp @@ -51,7 +51,7 @@ bool m_connected(false); char m_buffer1[BUFFER_MAX_LEN]; char m_buffer2[BUFFER_MAX_LEN]; -CLCDproc::CLCDproc(std::string address, unsigned int port, unsigned int localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex) : +CLCDproc::CLCDproc(std::string address, unsigned int port, unsigned int localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex, bool dimOnIdle) : CDisplay(), m_address(address), m_port(port), @@ -62,6 +62,7 @@ m_displayClock(displayClock), m_utc(utc), m_duplex(duplex), //m_duplex(true), // uncomment to force duplex display for testing! +m_dimOnIdle(dimOnIdle), m_dmr(false), m_clockDisplayTimer(1000U, 0U, 250U) // Update the clock display every 250ms { @@ -539,7 +540,7 @@ int CLCDproc::socketPrintf(int fd, const char *format, ...) } } - return 1; + return 0; } void CLCDproc::defineScreens() @@ -547,7 +548,7 @@ void CLCDproc::defineScreens() // The Status Screen socketPrintf(m_socketfd, "screen_add Status"); - socketPrintf(m_socketfd, "screen_set Status -name Status -heartbeat on -priority info -backlight off"); + socketPrintf(m_socketfd, "screen_set Status -name Status -heartbeat on -priority info -backlight %s", m_dimOnIdle ? "off" : "on"); socketPrintf(m_socketfd, "widget_add Status Callsign string"); socketPrintf(m_socketfd, "widget_add Status DMRNumber string"); diff --git a/LCDproc.h b/LCDproc.h index 2be7515..e2a215b 100644 --- a/LCDproc.h +++ b/LCDproc.h @@ -28,7 +28,7 @@ class CLCDproc : public CDisplay { public: - CLCDproc(std::string address, unsigned int port, unsigned int localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex); + CLCDproc(std::string address, unsigned int port, unsigned int localPort, const std::string& callsign, unsigned int dmrid, bool displayClock, bool utc, bool duplex, bool dimOnIdle); virtual ~CLCDproc(); virtual bool open(); @@ -70,6 +70,7 @@ private: bool m_displayClock; bool m_utc; bool m_duplex; + bool m_dimOnIdle; bool m_dmr; CTimer m_clockDisplayTimer; }; diff --git a/MMDVM.ini b/MMDVM.ini index de82b79..7df7948 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -170,5 +170,6 @@ Invert=0 Address=localhost Port=13666 #LocalPort=13667 +DimOnIdle=0 DisplayClock=1 UTC=0 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index b7fbfbc..dcf4c31 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -1037,6 +1037,7 @@ void CMMDVMHost::createDisplay() unsigned int localPort = m_conf.getLCDprocLocalPort(); bool displayClock = m_conf.getLCDprocDisplayClock(); bool utc = m_conf.getLCDprocUTC(); + bool dimOnIdle = m_conf.getLCDprocDimOnIdle(); LogInfo(" Address: %s", address.c_str()); LogInfo(" Port: %u", port); @@ -1046,11 +1047,13 @@ void CMMDVMHost::createDisplay() else LogInfo(" Local Port: %u", localPort); + LogInfo(" Dim Display on Idle: %s", dimOnIdle ? "yes" : "no"); LogInfo(" Clock Display: %s", displayClock ? "yes" : "no"); + if (displayClock) LogInfo(" Display UTC: %s", utc ? "yes" : "no"); - m_display = new CLCDproc(address.c_str(), port, localPort, m_callsign, dmrid, displayClock, utc, m_duplex); + m_display = new CLCDproc(address.c_str(), port, localPort, m_callsign, dmrid, displayClock, utc, m_duplex, dimOnIdle); #if defined(HD44780) } else if (type == "HD44780") { unsigned int rows = m_conf.getHD44780Rows();