Add callsign/DMRid support to Nextion TFT displays

This commit is contained in:
phl0 2016-04-07 22:51:57 +02:00
parent 9fb57309a1
commit 72d081c158
3 changed files with 12 additions and 4 deletions

View file

@ -588,7 +588,7 @@ void CMMDVMHost::createDisplay()
LogInfo(" Port: %s", port.c_str());
LogInfo(" Brightness: %u", brightness);
m_display = new CNextion(port, brightness);
m_display = new CNextion(callsign.c_str(), dmrid, port, brightness);
#if defined(HD44780)
} else if (type == "HD44780") {
unsigned int rows = m_conf.getHD44780Rows();

View file

@ -23,7 +23,9 @@
#include <cassert>
#include <cstring>
CNextion::CNextion(const std::string& port, unsigned int brightness) :
CNextion::CNextion(const char* callsign, unsigned int dmrid, const std::string& port, unsigned int brightness) :
m_callsign(callsign),
m_dmrid(dmrid),
m_serial(port, SERIAL_9600),
m_brightness(brightness)
{
@ -57,7 +59,11 @@ void CNextion::setIdle()
{
sendCommand("page MMDVM");
sendCommand("t0.txt=\"IDLE\"");
char command[20];
::sprintf(command, "t0.txt=\"%-6s / %u\"", m_callsign, m_dmrid);
sendCommand(command);
sendCommand("t1.txt=\"MMDVM IDLE\"");
}
void CNextion::setError(const char* text)

View file

@ -27,7 +27,7 @@
class CNextion : public IDisplay
{
public:
CNextion(const std::string& port, unsigned int brightness);
CNextion(const char* callsign, unsigned int dmrid, const std::string& port, unsigned int brightness);
virtual ~CNextion();
virtual bool open();
@ -52,6 +52,8 @@ public:
virtual void close();
private:
const char* m_callsign;
unsigned int m_dmrid;
CSerialController m_serial;
unsigned int m_brightness;