mirror of https://github.com/g4klx/MMDVMHost
Merge pull request #601 from jg1uaa/master
change ScreenLayout definition for Nextion
This commit is contained in:
commit
7c95e231e2
|
|
@ -566,7 +566,7 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SERIAL_SPEED baudrate = SERIAL_9600;
|
SERIAL_SPEED baudrate = SERIAL_9600;
|
||||||
if (screenLayout==4U)
|
if (screenLayout&0x0cU)
|
||||||
baudrate = SERIAL_115200;
|
baudrate = SERIAL_115200;
|
||||||
|
|
||||||
LogInfo(" Display baudrate: %u ",baudrate);
|
LogInfo(" Display baudrate: %u ",baudrate);
|
||||||
|
|
|
||||||
80
Nextion.cpp
80
Nextion.cpp
|
|
@ -38,6 +38,16 @@ const unsigned int P25_BER_COUNT = 7U; // 7 * 180ms = 1260ms
|
||||||
const unsigned int NXDN_RSSI_COUNT = 28U; // 28 * 40ms = 1120ms
|
const unsigned int NXDN_RSSI_COUNT = 28U; // 28 * 40ms = 1120ms
|
||||||
const unsigned int NXDN_BER_COUNT = 28U; // 28 * 40ms = 1120ms
|
const unsigned int NXDN_BER_COUNT = 28U; // 28 * 40ms = 1120ms
|
||||||
|
|
||||||
|
#define LAYOUT_COMPAT_MASK (7 << 0) // compatibility for old setting
|
||||||
|
#define LAYOUT_TA_ENABLE (1 << 4) // enable Talker Alias (TA) display
|
||||||
|
#define LAYOUT_TA_COLOUR (1 << 5) // TA display with font colour change
|
||||||
|
#define LAYOUT_TA_FONTSIZE (1 << 6) // TA display with font size change
|
||||||
|
#define LAYOUT_DIY (1 << 7) // use ON7LDS-DIY layout
|
||||||
|
|
||||||
|
// bit[3:2] is used in Display.cpp to set connection speed for LCD panel.
|
||||||
|
// 00:low, others:high-speed. bit[2] is overlapped with LAYOUT_COMPAT_MASK.
|
||||||
|
#define LAYOUT_HIGHSPEED (3 << 2)
|
||||||
|
|
||||||
CNextion::CNextion(const std::string& callsign, unsigned int dmrid, ISerialPort* serial, unsigned int brightness, bool displayClock, bool utc, unsigned int idleBrightness, unsigned int screenLayout, unsigned int txFrequency, unsigned int rxFrequency, bool displayTempInF, const std::string& location) :
|
CNextion::CNextion(const std::string& callsign, unsigned int dmrid, ISerialPort* serial, unsigned int brightness, bool displayClock, bool utc, unsigned int idleBrightness, unsigned int screenLayout, unsigned int txFrequency, unsigned int rxFrequency, bool displayTempInF, const std::string& location) :
|
||||||
CDisplay(),
|
CDisplay(),
|
||||||
m_callsign(callsign),
|
m_callsign(callsign),
|
||||||
|
|
@ -49,7 +59,7 @@ m_mode(MODE_IDLE),
|
||||||
m_displayClock(displayClock),
|
m_displayClock(displayClock),
|
||||||
m_utc(utc),
|
m_utc(utc),
|
||||||
m_idleBrightness(idleBrightness),
|
m_idleBrightness(idleBrightness),
|
||||||
m_screenLayout(screenLayout),
|
m_screenLayout(0),
|
||||||
m_clockDisplayTimer(1000U, 0U, 400U),
|
m_clockDisplayTimer(1000U, 0U, 400U),
|
||||||
m_rssiAccum1(0U),
|
m_rssiAccum1(0U),
|
||||||
m_rssiAccum2(0U),
|
m_rssiAccum2(0U),
|
||||||
|
|
@ -68,6 +78,23 @@ m_location(location)
|
||||||
{
|
{
|
||||||
assert(serial != NULL);
|
assert(serial != NULL);
|
||||||
assert(brightness >= 0U && brightness <= 100U);
|
assert(brightness >= 0U && brightness <= 100U);
|
||||||
|
|
||||||
|
static const unsigned int feature_set[] = {
|
||||||
|
0, // 0: G4KLX
|
||||||
|
0, // 1: (reserved, low speed)
|
||||||
|
// 2: ON7LDS
|
||||||
|
LAYOUT_TA_ENABLE | LAYOUT_TA_COLOUR | LAYOUT_TA_FONTSIZE,
|
||||||
|
LAYOUT_TA_ENABLE | LAYOUT_DIY, // 3: ON7LDS-DIY
|
||||||
|
LAYOUT_TA_ENABLE | LAYOUT_DIY, // 4: ON7LDS-DIY (high speed)
|
||||||
|
0, // 5: (reserved, high speed)
|
||||||
|
0, // 6: (reserved, high speed)
|
||||||
|
0, // 7: (reserved, high speed)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (screenLayout & ~LAYOUT_COMPAT_MASK)
|
||||||
|
m_screenLayout = screenLayout & ~LAYOUT_COMPAT_MASK;
|
||||||
|
else
|
||||||
|
m_screenLayout = feature_set[screenLayout];
|
||||||
}
|
}
|
||||||
|
|
||||||
CNextion::~CNextion()
|
CNextion::~CNextion()
|
||||||
|
|
@ -118,7 +145,7 @@ void CNextion::setIdleInt()
|
||||||
::sprintf(command, "t0.txt=\"%s/%u\"", m_callsign.c_str(), m_dmrid);
|
::sprintf(command, "t0.txt=\"%s/%u\"", m_callsign.c_str(), m_dmrid);
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
|
|
||||||
if (m_screenLayout > 2U) {
|
if (m_screenLayout & LAYOUT_DIY) {
|
||||||
::sprintf(command, "t4.txt=\"%s\"", m_callsign.c_str());
|
::sprintf(command, "t4.txt=\"%s\"", m_callsign.c_str());
|
||||||
sendCommand(command);
|
sendCommand(command);
|
||||||
::sprintf(command, "t5.txt=\"%u\"", m_dmrid);
|
::sprintf(command, "t5.txt=\"%u\"", m_dmrid);
|
||||||
|
|
@ -350,16 +377,20 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro
|
||||||
|
|
||||||
|
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
if (m_screenLayout == 2U) {
|
if (m_screenLayout & LAYOUT_TA_ENABLE) {
|
||||||
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
sendCommand("t2.pco=0");
|
sendCommand("t2.pco=0");
|
||||||
|
if (m_screenLayout & LAYOUT_TA_FONTSIZE)
|
||||||
sendCommand("t2.font=4");
|
sendCommand("t2.font=4");
|
||||||
}
|
}
|
||||||
|
|
||||||
sendCommand("t2.txt=\"2 Listening\"");
|
sendCommand("t2.txt=\"2 Listening\"");
|
||||||
sendCommandAction(69U);
|
sendCommandAction(69U);
|
||||||
} else {
|
} else {
|
||||||
if (m_screenLayout == 2U) {
|
if (m_screenLayout & LAYOUT_TA_ENABLE) {
|
||||||
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
sendCommand("t0.pco=0");
|
sendCommand("t0.pco=0");
|
||||||
|
if (m_screenLayout & LAYOUT_TA_FONTSIZE)
|
||||||
sendCommand("t0.font=4");
|
sendCommand("t0.font=4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,8 +408,10 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
::sprintf(text, "t0.txt=\"1 %s %s\"", type, src.c_str());
|
::sprintf(text, "t0.txt=\"1 %s %s\"", type, src.c_str());
|
||||||
|
|
||||||
if (m_screenLayout == 2U) {
|
if (m_screenLayout & LAYOUT_TA_ENABLE) {
|
||||||
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
sendCommand("t0.pco=0");
|
sendCommand("t0.pco=0");
|
||||||
|
if (m_screenLayout & LAYOUT_TA_FONTSIZE)
|
||||||
sendCommand("t0.font=4");
|
sendCommand("t0.font=4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,8 +424,10 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro
|
||||||
} else {
|
} else {
|
||||||
::sprintf(text, "t2.txt=\"2 %s %s\"", type, src.c_str());
|
::sprintf(text, "t2.txt=\"2 %s %s\"", type, src.c_str());
|
||||||
|
|
||||||
if (m_screenLayout == 2U) {
|
if (m_screenLayout & LAYOUT_TA_ENABLE) {
|
||||||
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
sendCommand("t2.pco=0");
|
sendCommand("t2.pco=0");
|
||||||
|
if (m_screenLayout & LAYOUT_TA_FONTSIZE)
|
||||||
sendCommand("t2.font=4");
|
sendCommand("t2.font=4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -448,15 +483,17 @@ void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi)
|
||||||
|
|
||||||
void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, const char* type)
|
void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, const char* type)
|
||||||
{
|
{
|
||||||
if (m_screenLayout < 2U)
|
if (!(m_screenLayout & LAYOUT_TA_ENABLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (type[0] == ' ') {
|
if (type[0] == ' ') {
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
if (m_screenLayout == 2U) sendCommand("t0.pco=33808");
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
|
sendCommand("t0.pco=33808");
|
||||||
sendCommandAction(64U);
|
sendCommandAction(64U);
|
||||||
} else {
|
} else {
|
||||||
if (m_screenLayout == 2U) sendCommand("t2.pco=33808");
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
|
sendCommand("t2.pco=33808");
|
||||||
sendCommandAction(72U);
|
sendCommandAction(72U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -467,33 +504,36 @@ void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, co
|
||||||
char text[50U];
|
char text[50U];
|
||||||
::sprintf(text, "t0.txt=\"1 %s %s\"", type, talkerAlias);
|
::sprintf(text, "t0.txt=\"1 %s %s\"", type, talkerAlias);
|
||||||
|
|
||||||
if (m_screenLayout == 2U) {
|
if (m_screenLayout & LAYOUT_TA_FONTSIZE) {
|
||||||
if (::strlen((char*)talkerAlias) > (16U-4U))
|
if (::strlen((char*)talkerAlias) > (16U-4U))
|
||||||
sendCommand("t0.font=3");
|
sendCommand("t0.font=3");
|
||||||
if (::strlen((char*)talkerAlias) > (20U-4U))
|
if (::strlen((char*)talkerAlias) > (20U-4U))
|
||||||
sendCommand("t0.font=2");
|
sendCommand("t0.font=2");
|
||||||
if (::strlen((char*)talkerAlias) > (24U-4U))
|
if (::strlen((char*)talkerAlias) > (24U-4U))
|
||||||
sendCommand("t0.font=1");
|
sendCommand("t0.font=1");
|
||||||
|
|
||||||
sendCommand("t0.pco=1024");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
|
sendCommand("t0.pco=1024");
|
||||||
|
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(63U);
|
sendCommandAction(63U);
|
||||||
} else {
|
} else {
|
||||||
char text[50U];
|
char text[50U];
|
||||||
::sprintf(text, "t2.txt=\"2 %s %s\"", type, talkerAlias);
|
::sprintf(text, "t2.txt=\"2 %s %s\"", type, talkerAlias);
|
||||||
|
|
||||||
if (m_screenLayout == 2U) {
|
if (m_screenLayout & LAYOUT_TA_FONTSIZE) {
|
||||||
if (::strlen((char*)talkerAlias) > (16U-4U))
|
if (::strlen((char*)talkerAlias) > (16U-4U))
|
||||||
sendCommand("t2.font=3");
|
sendCommand("t2.font=3");
|
||||||
if (::strlen((char*)talkerAlias) > (20U-4U))
|
if (::strlen((char*)talkerAlias) > (20U-4U))
|
||||||
sendCommand("t2.font=2");
|
sendCommand("t2.font=2");
|
||||||
if (::strlen((char*)talkerAlias) > (24U-4U))
|
if (::strlen((char*)talkerAlias) > (24U-4U))
|
||||||
sendCommand("t2.font=1");
|
sendCommand("t2.font=1");
|
||||||
|
|
||||||
sendCommand("t2.pco=1024");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
|
sendCommand("t2.pco=1024");
|
||||||
|
|
||||||
sendCommand(text);
|
sendCommand(text);
|
||||||
sendCommandAction(71U);
|
sendCommandAction(71U);
|
||||||
}
|
}
|
||||||
|
|
@ -535,8 +575,10 @@ void CNextion::clearDMRInt(unsigned int slotNo)
|
||||||
sendCommand("t0.txt=\"1 Listening\"");
|
sendCommand("t0.txt=\"1 Listening\"");
|
||||||
sendCommandAction(61U);
|
sendCommandAction(61U);
|
||||||
|
|
||||||
if (m_screenLayout == 2U) {
|
if (m_screenLayout & LAYOUT_TA_ENABLE) {
|
||||||
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
sendCommand("t0.pco=0");
|
sendCommand("t0.pco=0");
|
||||||
|
if (m_screenLayout & LAYOUT_TA_FONTSIZE)
|
||||||
sendCommand("t0.font=4");
|
sendCommand("t0.font=4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -547,8 +589,10 @@ void CNextion::clearDMRInt(unsigned int slotNo)
|
||||||
sendCommand("t2.txt=\"2 Listening\"");
|
sendCommand("t2.txt=\"2 Listening\"");
|
||||||
sendCommandAction(69U);
|
sendCommandAction(69U);
|
||||||
|
|
||||||
if (m_screenLayout == 2U) {
|
if (m_screenLayout & LAYOUT_TA_ENABLE) {
|
||||||
|
if (m_screenLayout & LAYOUT_TA_COLOUR)
|
||||||
sendCommand("t2.pco=0");
|
sendCommand("t2.pco=0");
|
||||||
|
if (m_screenLayout & LAYOUT_TA_FONTSIZE)
|
||||||
sendCommand("t2.font=4");
|
sendCommand("t2.font=4");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -862,7 +906,7 @@ void CNextion::close()
|
||||||
|
|
||||||
void CNextion::sendCommandAction(unsigned int status)
|
void CNextion::sendCommandAction(unsigned int status)
|
||||||
{
|
{
|
||||||
if (m_screenLayout<3U)
|
if (!(m_screenLayout & LAYOUT_DIY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char text[30U];
|
char text[30U];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue