LCDproc: Make dimming the status screen optional

If you run another LCDproc client that doesn't dim the display when it displays its info, the display will effectively flash on and off (or dim/bright depending on your LCDd configuration) as it switches screens between MMDVMHost and the other client(s).

Making the dimming optional and turning it off in the host stops this "annoyance".
This commit is contained in:
Tony Corbett G0WFV 2016-10-29 20:00:32 +01:00
parent 3ff711f3ea
commit 44e8f6717a
6 changed files with 20 additions and 5 deletions

View file

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

2
Conf.h
View file

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

View file

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

View file

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

View file

@ -170,5 +170,6 @@ Invert=0
Address=localhost
Port=13666
#LocalPort=13667
DimOnIdle=0
DisplayClock=1
UTC=0

View file

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