From 23495209649c2c18a635ab1dc6115655862f43b6 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 27 Aug 2020 10:13:02 +0100 Subject: [PATCH] Remove the location information from the new config message. --- Conf.cpp | 8 -------- Conf.h | 2 -- DMRNetwork.cpp | 16 +++++++--------- DMRNetwork.h | 3 +-- Display.cpp | 6 +++--- MMDVM.ini | 1 - MMDVMHost.cpp | 4 +--- Nextion.cpp | 9 ++------- Nextion.h | 3 +-- Version.h | 2 +- 10 files changed, 16 insertions(+), 38 deletions(-) diff --git a/Conf.cpp b/Conf.cpp index 4410443e4..8b2578bf0 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -71,7 +71,6 @@ m_daemon(false), m_rxFrequency(0U), m_txFrequency(0U), m_power(0U), -m_location(), m_logDisplayLevel(0U), m_logFileLevel(0U), m_logFilePath(), @@ -421,8 +420,6 @@ bool CConf::read() m_rxFrequency = (unsigned int)::atoi(value); else if (::strcmp(key, "Power") == 0) m_power = (unsigned int)::atoi(value); - else if (::strcmp(key, "Location") == 0) - m_location = value; } else if (section == SECTION_LOG) { if (::strcmp(key, "FilePath") == 0) m_logFilePath = value; @@ -996,11 +993,6 @@ unsigned int CConf::getPower() const return m_power; } -std::string CConf::getLocation() const -{ - return m_location; -} - unsigned int CConf::getLogDisplayLevel() const { return m_logDisplayLevel; diff --git a/Conf.h b/Conf.h index 3e868ef5a..f75fdb4e5 100644 --- a/Conf.h +++ b/Conf.h @@ -42,7 +42,6 @@ class CConf unsigned int getRXFrequency() const; unsigned int getTXFrequency() const; unsigned int getPower() const; - std::string getLocation() const; // The Log section unsigned int getLogDisplayLevel() const; @@ -316,7 +315,6 @@ class CConf unsigned int m_rxFrequency; unsigned int m_txFrequency; unsigned int m_power; - std::string m_location; unsigned int m_logDisplayLevel; unsigned int m_logFileLevel; diff --git a/DMRNetwork.cpp b/DMRNetwork.cpp index d784e2165..3d29fb120 100644 --- a/DMRNetwork.cpp +++ b/DMRNetwork.cpp @@ -55,7 +55,6 @@ m_rxFrequency(0U), m_txFrequency(0U), m_power(0U), m_colorCode(0U), -m_location(), m_pingTimer(1000U, 10U) { assert(!address.empty()); @@ -89,14 +88,13 @@ CDMRNetwork::~CDMRNetwork() delete[] m_id; } -void CDMRNetwork::setConfig(const std::string & callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode, const std::string& location) +void CDMRNetwork::setConfig(const std::string & callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode) { m_callsign = callsign; m_rxFrequency = rxFrequency; m_txFrequency = txFrequency; m_power = power; m_colorCode = colorCode; - m_location = location; } bool CDMRNetwork::open() @@ -401,15 +399,15 @@ bool CDMRNetwork::writeConfig() if (power > 99U) power = 99U; - char buffer[200U]; + char buffer[150U]; ::memcpy(buffer + 0U, "DMRC", 4U); ::memcpy(buffer + 4U, m_id, 4U); - ::sprintf(buffer + 8U, "%-8.8s%09u%09u%02u%02u%-20.20s%c%-40.40s%-40.40s", - m_callsign.c_str(), m_rxFrequency, m_txFrequency, power, m_colorCode, m_location.c_str(), slots, m_version, + ::sprintf(buffer + 8U, "%-8.8s%09u%09u%02u%02u%c%-40.40s%-40.40s", + m_callsign.c_str(), m_rxFrequency, m_txFrequency, power, m_colorCode, slots, m_version, software); - return write((unsigned char*)buffer, 139U); + return write((unsigned char*)buffer, 119U); } bool CDMRNetwork::wantsBeacon() @@ -426,8 +424,8 @@ bool CDMRNetwork::write(const unsigned char* data, unsigned int length) assert(data != NULL); assert(length > 0U); - // if (m_debug) - // CUtils::dump(1U, "Network Transmitted", data, length); + if (m_debug) + CUtils::dump(1U, "Network Transmitted", data, length); bool ret = m_socket.write(data, length, m_address, m_port); if (!ret) { diff --git a/DMRNetwork.h b/DMRNetwork.h index 7539ec374..9f01925d5 100644 --- a/DMRNetwork.h +++ b/DMRNetwork.h @@ -35,7 +35,7 @@ class CDMRNetwork CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, bool duplex, const char* version, bool debug, bool slot1, bool slot2, HW_TYPE hwType); ~CDMRNetwork(); - void setConfig(const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode, const std::string& location); + void setConfig(const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode); bool open(); @@ -78,7 +78,6 @@ class CDMRNetwork unsigned int m_txFrequency; unsigned int m_power; unsigned int m_colorCode; - std::string m_location; CTimer m_pingTimer; bool writeConfig(); diff --git a/Display.cpp b/Display.cpp index 6238d573a..39b0a0936 100644 --- a/Display.cpp +++ b/Display.cpp @@ -556,10 +556,10 @@ 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, txFrequency, rxFrequency, displayTempInF, conf.getLocation()); + display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF); } else if (port == "ump") { if (ump != NULL) { - display = new CNextion(conf.getCallsign(), dmrid, ump, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF, conf.getLocation()); + display = new CNextion(conf.getCallsign(), dmrid, ump, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF); } else { LogInfo(" NullDisplay loaded"); display = new CNullDisplay; @@ -571,7 +571,7 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, CUMP* ump, CModem* modem) LogInfo(" Display baudrate: %u ",baudrate); ISerialPort* serial = new CSerialController(port, baudrate); - display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF, conf.getLocation()); + display = new CNextion(conf.getCallsign(), dmrid, serial, brightness, displayClock, utc, idleBrightness, screenLayout, txFrequency, rxFrequency, displayTempInF); } } else if (type == "LCDproc") { std::string address = conf.getLCDprocAddress(); diff --git a/MMDVM.ini b/MMDVM.ini index c4f11e0a2..9600db8d3 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -13,7 +13,6 @@ Daemon=0 RXFrequency=435000000 TXFrequency=435000000 Power=1 -Location=Nowhere [Log] # Logging levels, 0=No logging diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 8a6c5d028..1231e99f0 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -1345,16 +1345,14 @@ bool CMMDVMHost::createDMRNetwork() unsigned int txFrequency = m_conf.getTXFrequency(); unsigned int power = m_conf.getPower(); unsigned int colorCode = m_conf.getDMRColorCode(); - std::string location = m_conf.getLocation(); LogInfo("Info Parameters"); LogInfo(" Callsign: %s", m_callsign.c_str()); LogInfo(" RX Frequency: %uHz", rxFrequency); LogInfo(" TX Frequency: %uHz", txFrequency); LogInfo(" Power: %uW", power); - LogInfo(" Location: \"%s\"", location.c_str()); - m_dmrNetwork->setConfig(m_callsign, rxFrequency, txFrequency, power, colorCode, location); + m_dmrNetwork->setConfig(m_callsign, rxFrequency, txFrequency, power, colorCode); bool ret = m_dmrNetwork->open(); if (!ret) { diff --git a/Nextion.cpp b/Nextion.cpp index b5253c1db..fa6851eaf 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -47,7 +47,7 @@ const unsigned int NXDN_BER_COUNT = 28U; // 28 * 40ms = 1120ms // 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) : CDisplay(), m_callsign(callsign), m_ipaddress("(ip unknown)"), @@ -72,8 +72,7 @@ m_txFrequency(txFrequency), m_rxFrequency(rxFrequency), m_fl_txFrequency(0.0F), m_fl_rxFrequency(0.0F), -m_displayTempInF(displayTempInF), -m_location(location) +m_displayTempInF(displayTempInF) { assert(serial != NULL); assert(brightness >= 0U && brightness <= 100U); @@ -178,10 +177,6 @@ void CNextion::setIdleInt() sendCommandAction(22U); } } - - ::sprintf(command, "t31.txt=\"%s\"", m_location.c_str()); // location - sendCommand(command); - sendCommandAction(23U); } else { sendCommandAction(17U); } diff --git a/Nextion.h b/Nextion.h index 7217d2a60..488372f20 100644 --- a/Nextion.h +++ b/Nextion.h @@ -29,7 +29,7 @@ class CNextion : public CDisplay { public: - 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(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); virtual ~CNextion(); virtual bool open(); @@ -103,7 +103,6 @@ class CNextion : public CDisplay double m_fl_txFrequency; double m_fl_rxFrequency; bool m_displayTempInF; - std::string m_location; void sendCommand(const char* command); void sendCommandAction(unsigned int status); diff --git a/Version.h b/Version.h index 426bd2a67..a4a9c5148 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20200826"; +const char* VERSION = "20200827"; #endif