diff --git a/Conf.cpp b/Conf.cpp index 7bb03c9..a24769c 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -110,6 +110,7 @@ m_tftSerialBrightness(50U), m_hd44780Rows(2U), m_hd44780Columns(16U), m_hd44780Pins(), +m_nextionSize(), m_nextionPort(), m_nextionBrightness(50U) { @@ -348,7 +349,9 @@ bool CConf::read() } } } else if (section == SECTION_NEXTION) { - if (::strcmp(key, "Port") == 0) + if (::strcmp(key, "Size") == 0) + m_nextionSize = value; + else if (::strcmp(key, "Port") == 0) m_nextionPort = value; else if (::strcmp(key, "Brightness") == 0) m_nextionBrightness = (unsigned int)::atoi(value); @@ -680,6 +683,11 @@ std::vector CConf::getHD44780Pins() const return m_hd44780Pins; } +std::string CConf::getNextionSize() const +{ + return m_nextionSize; +} + std::string CConf::getNextionPort() const { return m_nextionPort; diff --git a/Conf.h b/Conf.h index d797583..509794e 100644 --- a/Conf.h +++ b/Conf.h @@ -119,6 +119,7 @@ public: std::vector getHD44780Pins() const; // The Nextion section + std::string getNextionSize() const; std::string getNextionPort() const; unsigned int getNextionBrightness() const; @@ -200,6 +201,7 @@ private: unsigned int m_hd44780Columns; std::vector m_hd44780Pins; + std::string m_nextionSize; std::string m_nextionPort; unsigned int m_nextionBrightness; }; diff --git a/MMDVM.ini b/MMDVM.ini index 929fdba..12a738d 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -90,5 +90,6 @@ Columns=16 Pins=115,113,112,111,110,109 [Nextion] +Size=2.4 Port=/dev/ttyAMA0 Brightness=50 diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index c93c1eb..43927c5 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -584,13 +584,15 @@ void CMMDVMHost::createDisplay() m_display = new CTFTSerial(callsign, dmrid, port, brightness); } else if (type == "Nextion") { + std::string size = m_conf.getNextionSize(); std::string port = m_conf.getNextionPort(); unsigned int brightness = m_conf.getNextionBrightness(); + LogInfo(" Size: %s\"", size.c_str()); LogInfo(" Port: %s", port.c_str()); LogInfo(" Brightness: %u", brightness); - m_display = new CNextion(callsign, dmrid, port, brightness); + m_display = new CNextion(callsign, dmrid, size, port, brightness); #if defined(HD44780) } else if (type == "HD44780") { unsigned int rows = m_conf.getHD44780Rows(); diff --git a/Nextion.cpp b/Nextion.cpp index 290606b..ee642b9 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -23,9 +23,10 @@ #include #include -CNextion::CNextion(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness) : +CNextion::CNextion(const std::string& callsign, unsigned int dmrid, const std::string& size, const std::string& port, unsigned int brightness) : m_callsign(callsign), m_dmrid(dmrid), +m_size(size), m_serial(port, SERIAL_9600), m_brightness(brightness), m_mode(MODE_IDLE) @@ -108,12 +109,28 @@ void CNextion::writeDStar(const char* my1, const char* my2, const char* your, co ::sprintf(text, "t0.txt=\"%s %.8s/%4.4s\"", type, my1, my2); sendCommand(text); - if (strcmp(reflector, " ") == 0) { + if (strcmp(m_size.c_str(), "2.4") == 0) { ::sprintf(text, "t1.txt=\"%.8s\"", your); - } else { - ::sprintf(text, "t1.txt=\"%.8s <- %-8s\"", your, reflector); + sendCommand(text); + if (strcmp(reflector, " ") != 0) { + ::sprintf(text, "t2.txt=\"via %.8s\"", reflector); + sendCommand(text); + } + } else if (strcmp(m_size.c_str(), "3.2") == 0) { + ::sprintf(text, "t1.txt=\"%.8s\"", your); + sendCommand(text); + if (strcmp(reflector, " ") != 0) { + ::sprintf(text, "t2.txt=\"via %.8s\"", reflector); + sendCommand(text); + } + } else if (strcmp(m_size.c_str(), "3.5") == 0) { + if (strcmp(reflector, " ") == 0) { + ::sprintf(text, "t1.txt=\"%.8s\"", your); + } else { + ::sprintf(text, "t1.txt=\"%.8s <- %-8s\"", your, reflector); + } + sendCommand(text); } - sendCommand(text); m_mode = MODE_DSTAR; } @@ -122,6 +139,11 @@ void CNextion::clearDStar() { sendCommand("t0.txt=\"Listening\""); sendCommand("t1.txt=\"\""); + if (strcmp(m_size.c_str(), "2.4") == 0) { + sendCommand("t2.txt=\"\""); + } else if (strcmp(m_size.c_str(), "3.2") == 0) { + sendCommand("t2.txt=\"\""); + } } void CNextion::writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type) diff --git a/Nextion.h b/Nextion.h index d19b26a..b07c7ca 100644 --- a/Nextion.h +++ b/Nextion.h @@ -28,7 +28,7 @@ class CNextion : public IDisplay { public: - CNextion(const std::string& callsign, unsigned int dmrid, const std::string& port, unsigned int brightness); + CNextion(const std::string& callsign, unsigned int dmrid, const std::string& size, const std::string& port, unsigned int brightness); virtual ~CNextion(); virtual bool open(); @@ -52,6 +52,7 @@ public: private: std::string m_callsign; unsigned int m_dmrid; + std::string m_size; CSerialController m_serial; unsigned int m_brightness; unsigned char m_mode; diff --git a/Nextion/MMDVM_2.4.HMI b/Nextion/MMDVM_2.4.HMI index 25c4756..8b7772e 100644 Binary files a/Nextion/MMDVM_2.4.HMI and b/Nextion/MMDVM_2.4.HMI differ diff --git a/Nextion/MMDVM_2.4.tft b/Nextion/MMDVM_2.4.tft index 27e9192..9816c51 100644 Binary files a/Nextion/MMDVM_2.4.tft and b/Nextion/MMDVM_2.4.tft differ diff --git a/Nextion/MMDVM_3.2.HMI b/Nextion/MMDVM_3.2.HMI new file mode 100644 index 0000000..d71e020 Binary files /dev/null and b/Nextion/MMDVM_3.2.HMI differ diff --git a/Nextion/MMDVM_3.2.tft b/Nextion/MMDVM_3.2.tft new file mode 100644 index 0000000..f38fc20 Binary files /dev/null and b/Nextion/MMDVM_3.2.tft differ