mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 08:05:49 +08:00
Add config option for Nextion display sizes
This commit is contained in:
10
Conf.cpp
10
Conf.cpp
@@ -110,6 +110,7 @@ m_tftSerialBrightness(50U),
|
|||||||
m_hd44780Rows(2U),
|
m_hd44780Rows(2U),
|
||||||
m_hd44780Columns(16U),
|
m_hd44780Columns(16U),
|
||||||
m_hd44780Pins(),
|
m_hd44780Pins(),
|
||||||
|
m_nextionSize(),
|
||||||
m_nextionPort(),
|
m_nextionPort(),
|
||||||
m_nextionBrightness(50U)
|
m_nextionBrightness(50U)
|
||||||
{
|
{
|
||||||
@@ -348,7 +349,9 @@ bool CConf::read()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (section == SECTION_NEXTION) {
|
} 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;
|
m_nextionPort = value;
|
||||||
else if (::strcmp(key, "Brightness") == 0)
|
else if (::strcmp(key, "Brightness") == 0)
|
||||||
m_nextionBrightness = (unsigned int)::atoi(value);
|
m_nextionBrightness = (unsigned int)::atoi(value);
|
||||||
@@ -680,6 +683,11 @@ std::vector<unsigned int> CConf::getHD44780Pins() const
|
|||||||
return m_hd44780Pins;
|
return m_hd44780Pins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CConf::getNextionSize() const
|
||||||
|
{
|
||||||
|
return m_nextionSize;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CConf::getNextionPort() const
|
std::string CConf::getNextionPort() const
|
||||||
{
|
{
|
||||||
return m_nextionPort;
|
return m_nextionPort;
|
||||||
|
|||||||
2
Conf.h
2
Conf.h
@@ -119,6 +119,7 @@ public:
|
|||||||
std::vector<unsigned int> getHD44780Pins() const;
|
std::vector<unsigned int> getHD44780Pins() const;
|
||||||
|
|
||||||
// The Nextion section
|
// The Nextion section
|
||||||
|
std::string getNextionSize() const;
|
||||||
std::string getNextionPort() const;
|
std::string getNextionPort() const;
|
||||||
unsigned int getNextionBrightness() const;
|
unsigned int getNextionBrightness() const;
|
||||||
|
|
||||||
@@ -200,6 +201,7 @@ private:
|
|||||||
unsigned int m_hd44780Columns;
|
unsigned int m_hd44780Columns;
|
||||||
std::vector<unsigned int> m_hd44780Pins;
|
std::vector<unsigned int> m_hd44780Pins;
|
||||||
|
|
||||||
|
std::string m_nextionSize;
|
||||||
std::string m_nextionPort;
|
std::string m_nextionPort;
|
||||||
unsigned int m_nextionBrightness;
|
unsigned int m_nextionBrightness;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -92,3 +92,4 @@ Pins=115,113,112,111,110,109
|
|||||||
[Nextion]
|
[Nextion]
|
||||||
Port=/dev/ttyAMA0
|
Port=/dev/ttyAMA0
|
||||||
Brightness=50
|
Brightness=50
|
||||||
|
Size=2.4
|
||||||
|
|||||||
@@ -584,13 +584,15 @@ void CMMDVMHost::createDisplay()
|
|||||||
|
|
||||||
m_display = new CTFTSerial(callsign, dmrid, port, brightness);
|
m_display = new CTFTSerial(callsign, dmrid, port, brightness);
|
||||||
} else if (type == "Nextion") {
|
} else if (type == "Nextion") {
|
||||||
|
std::string size = m_conf.getNextionSize();
|
||||||
std::string port = m_conf.getNextionPort();
|
std::string port = m_conf.getNextionPort();
|
||||||
unsigned int brightness = m_conf.getNextionBrightness();
|
unsigned int brightness = m_conf.getNextionBrightness();
|
||||||
|
|
||||||
|
LogInfo(" Size: %s", size.c_str());
|
||||||
LogInfo(" Port: %s", port.c_str());
|
LogInfo(" Port: %s", port.c_str());
|
||||||
LogInfo(" Brightness: %u", brightness);
|
LogInfo(" Brightness: %u", brightness);
|
||||||
|
|
||||||
m_display = new CNextion(callsign, dmrid, port, brightness);
|
m_display = new CNextion(callsign, dmrid, size, port, brightness);
|
||||||
#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();
|
||||||
|
|||||||
@@ -23,9 +23,10 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
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_callsign(callsign),
|
||||||
m_dmrid(dmrid),
|
m_dmrid(dmrid),
|
||||||
|
m_size(size),
|
||||||
m_serial(port, SERIAL_9600),
|
m_serial(port, SERIAL_9600),
|
||||||
m_brightness(brightness),
|
m_brightness(brightness),
|
||||||
m_mode(MODE_IDLE)
|
m_mode(MODE_IDLE)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
class CNextion : public IDisplay
|
class CNextion : public IDisplay
|
||||||
{
|
{
|
||||||
public:
|
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 ~CNextion();
|
||||||
|
|
||||||
virtual bool open();
|
virtual bool open();
|
||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::string m_callsign;
|
std::string m_callsign;
|
||||||
unsigned int m_dmrid;
|
unsigned int m_dmrid;
|
||||||
|
std::string m_size;
|
||||||
CSerialController m_serial;
|
CSerialController m_serial;
|
||||||
unsigned int m_brightness;
|
unsigned int m_brightness;
|
||||||
unsigned char m_mode;
|
unsigned char m_mode;
|
||||||
|
|||||||
Reference in New Issue
Block a user