mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 06:55:52 +08:00
Add more dynamic variables and fix command manging
Add variables for TX Freq (t30), RX Freq (t32), CPU Temp (t20), and Location (t31) to Base MMDVM page. These variables are available with Layout ON7LDS L3 or higher. This allows more dynamic info to be displayed without having to use the optional NextionDriver. Note, this doesn't add touch support. For that, use the NextionDriver. Fixed command mangling occuring during serial writes to Nextion due to no ready-state monitoring of display readiness. Added simple thread sleep to pace the commands as they are sent. Allows the display a chance to process the command before another one is blasted in. Prevents mangling of commands sent before display is ready to accept them. Hardwired to 10 msec--let's see if that's enough. Added setting in mmdvm conf file, Section: [Nextion] Setting: DisplayTempInFahrenheit Value= 0 (default) for C. 1=Fahrenheit This controls the value sent to t20.
This commit is contained in:
21
Display.cpp
21
Display.cpp
@@ -458,6 +458,7 @@ void CDisplay::writeNXDNRSSIInt(unsigned char rssi)
|
||||
void CDisplay::writeNXDNBERInt(float ber)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* Factory method extracted from MMDVMHost.cpp - BG5HHP */
|
||||
CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)
|
||||
@@ -491,6 +492,9 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)
|
||||
bool utc = conf.getNextionUTC();
|
||||
unsigned int idleBrightness = conf.getNextionIdleBrightness();
|
||||
unsigned int screenLayout = conf.getNextionScreenLayout();
|
||||
unsigned int txFrequency = conf.getTXFrequency();
|
||||
unsigned int rxFrequency = conf.getRXFrequency();
|
||||
bool displayTempInF = conf.getNextionTempInFahrenheit();
|
||||
|
||||
LogInfo(" Port: %s", port.c_str());
|
||||
LogInfo(" Brightness: %u", brightness);
|
||||
@@ -498,7 +502,8 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)
|
||||
if (displayClock)
|
||||
LogInfo(" Display UTC: %s", utc ? "yes" : "no");
|
||||
LogInfo(" Idle Brightness: %u", idleBrightness);
|
||||
|
||||
LogInfo(" Temperature in Fahrenheit: %s ", displayTempInF ? "yes" : "no");
|
||||
|
||||
switch (screenLayout) {
|
||||
case 0U:
|
||||
LogInfo(" Screen Layout: G4KLX (Default)");
|
||||
@@ -519,18 +524,22 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem)
|
||||
|
||||
if (port == "modem") {
|
||||
ISerialPort* serial = new CModemSerialPort(modem);
|
||||
display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout);
|
||||
display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF, conf.getLocation());
|
||||
} else if (port == "ump") {
|
||||
if (ump != NULL)
|
||||
display = new CNextion(conf.getCallsign(), dmrid, ump, brightness, displayClock, utc, idleBrightness, screenLayout);
|
||||
else
|
||||
if (ump != NULL) {
|
||||
display = new CNextion(conf.getCallsign(), dmrid, ump, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF, conf.getLocation());
|
||||
} else {
|
||||
LogInfo(" NullDisplay loaded");
|
||||
display = new CNullDisplay;
|
||||
}
|
||||
} else {
|
||||
SERIAL_SPEED baudrate = SERIAL_9600;
|
||||
if (screenLayout==4U)
|
||||
baudrate = SERIAL_115200;
|
||||
|
||||
LogInfo(" Display baudrate: %u ",baudrate);
|
||||
ISerialPort* serial = new CSerialController(port, baudrate);
|
||||
display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout);
|
||||
display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF, conf.getLocation());
|
||||
}
|
||||
} else if (type == "LCDproc") {
|
||||
std::string address = conf.getLCDprocAddress();
|
||||
|
||||
Reference in New Issue
Block a user