diff --git a/DMRSlot.cpp b/DMRSlot.cpp index 7d37a4e..792d280 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -79,6 +79,9 @@ m_rfEmbeddedReadN(0U), m_rfEmbeddedWriteN(1U), m_rfTalkerId(TALKER_ID_NONE), m_rfTalkerAlias(NULL), +m_rfGPSLatitude(0U), +m_rfGPSLongitude(0U), +m_rfGPSPositionError(0U), m_netEmbeddedLC(), m_netEmbeddedData(NULL), m_netEmbeddedReadN(0U), @@ -612,7 +615,8 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len) if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded GPS Info", m_slotNo); CUtils::dump(2U, text, data, 9U); - logGPSPosition(data); + decodeGPSPosition(data); + m_display->writeDMRGPS(m_slotNo, m_rfGPSLatitude, m_rfGPSLongitude,m_rfGPSPositionError); } if (m_network != NULL) m_network->writePosition(m_rfLC->getSrcId(), data); @@ -1404,7 +1408,8 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) if (m_dumpTAData) { ::sprintf(text, "DMR Slot %u, Embedded GPS Info", m_slotNo); CUtils::dump(2U, text, data, 9U); - logGPSPosition(data); + decodeGPSPosition(data); + m_display->writeDMRGPS(m_slotNo, m_rfGPSLatitude, m_rfGPSLongitude,m_rfGPSPositionError); } break; case FLCO_TALKER_ALIAS_HEADER: @@ -1636,7 +1641,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData) } -void CDMRSlot::logGPSPosition(const unsigned char* data) +void CDMRSlot::decodeGPSPosition(const unsigned char* data) { unsigned int errorI = (data[2U] & 0x0E) >> 1U; @@ -1680,6 +1685,10 @@ void CDMRSlot::logGPSPosition(const unsigned char* data) longitude *= float(longitudeI); latitude *= float(latitudeI); + m_rfGPSLongitude=longitude; + m_rfGPSLatitude=latitude; + m_rfGPSPositionError=errorI; + LogMessage("GPS position [%f,%f] (Position error %s)", latitude, longitude, error); } diff --git a/DMRSlot.h b/DMRSlot.h index ffe1dde..64030b6 100644 --- a/DMRSlot.h +++ b/DMRSlot.h @@ -70,6 +70,9 @@ private: unsigned int m_rfEmbeddedWriteN; unsigned char m_rfTalkerId; unsigned char* m_rfTalkerAlias; + float m_rfGPSLatitude; + float m_rfGPSLongitude; + unsigned char m_rfGPSPositionError; CDMREmbeddedData m_netEmbeddedLC; CDMREmbeddedData* m_netEmbeddedData; unsigned int m_netEmbeddedReadN; @@ -132,7 +135,7 @@ private: static unsigned char m_id2; static ACTIVITY_TYPE m_activity2; - void logGPSPosition(const unsigned char* data); + void decodeGPSPosition(const unsigned char* data); void writeQueueRF(const unsigned char* data); void writeQueueNet(const unsigned char* data); diff --git a/Display.cpp b/Display.cpp index 8e8822a..a087b84 100644 --- a/Display.cpp +++ b/Display.cpp @@ -172,6 +172,12 @@ void CDisplay::writeDMRTA(unsigned int slotNo, unsigned char* talkerAlias, const } +void CDisplay::writeDMRGPS(unsigned int slotNo, float latitude, float longitude, unsigned char positionError) +{ + writeDMRGPSInt(slotNo, latitude, longitude, positionError); +} + + void CDisplay::writeDMRBER(unsigned int slotNo, float ber) { writeDMRBERInt(slotNo, ber); @@ -341,6 +347,10 @@ void CDisplay::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, co { } +void CDisplay::writeDMRGPSInt(unsigned int slotNo, float latitude, float longitude, unsigned char positionError) +{ +} + void CDisplay::writeDMRBERInt(unsigned int slotNo, float ber) { } diff --git a/Display.h b/Display.h index b8f2763..3371cfd 100644 --- a/Display.h +++ b/Display.h @@ -44,6 +44,7 @@ public: void writeDMRRSSI(unsigned int slotNo, unsigned char rssi); void writeDMRBER(unsigned int slotNo, float ber); void writeDMRTA(unsigned int slotNo, unsigned char* talkerAlias, const char* type); + void writeDMRGPS(unsigned int slotNo, float latitude, float longitude, unsigned char positionError); void clearDMR(unsigned int slotNo); void writeFusion(const char* source, const char* dest, const char* type, const char* origin); @@ -76,6 +77,7 @@ protected: virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type) = 0; virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi); virtual void writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, const char* type); + virtual void writeDMRGPSInt(unsigned int slotNo, float latitude, float longitude, unsigned char positionError); virtual void writeDMRBERInt(unsigned int slotNo, float ber); virtual void clearDMRInt(unsigned int slotNo) = 0; diff --git a/Nextion.cpp b/Nextion.cpp index b4a09b5..c88c029 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -84,6 +84,7 @@ bool CNextion::open() m_ipaddress = (char*)info; sendCommand("bkcmd=0"); + sendCommandAction(0,0); setIdle(); @@ -94,6 +95,7 @@ bool CNextion::open() void CNextion::setIdleInt() { sendCommand("page MMDVM"); + sendCommandAction(0,1U); char command[30U]; ::sprintf(command, "dim=%u", m_idleBrightness); @@ -101,14 +103,14 @@ void CNextion::setIdleInt() ::sprintf(command, "t0.txt=\"%s/%u\"", m_callsign.c_str(), m_dmrid); sendCommand(command); - sendCommandAction(0,0); + sendCommandAction(0,17U); sendCommand("t1.txt=\"MMDVM IDLE\""); - sendCommandAction(1U,1U); + sendCommandAction(1U,11U); ::sprintf(command, "t3.txt=\"%s\"", m_ipaddress.c_str()); sendCommand(command); - sendCommandAction(3U,0); + sendCommandAction(3U,16U); m_clockDisplayTimer.start(); @@ -120,17 +122,18 @@ void CNextion::setErrorInt(const char* text) assert(text != NULL); sendCommand("page MMDVM"); + sendCommandAction(0,1U); char command[20]; ::sprintf(command, "dim=%u", m_brightness); sendCommand(command); ::sprintf(command, "t0.txt=\"%s\"", text); - sendCommandAction(0,0); + sendCommandAction(0,13U); sendCommand(command); sendCommand("t1.txt=\"ERROR\""); - sendCommandAction(1U,3U); + sendCommandAction(1U,14U); m_clockDisplayTimer.stop(); @@ -140,13 +143,14 @@ void CNextion::setErrorInt(const char* text) void CNextion::setLockoutInt() { sendCommand("page MMDVM"); + sendCommandAction(0,1U); char command[20]; ::sprintf(command, "dim=%u", m_brightness); sendCommand(command); sendCommand("t0.txt=\"LOCKOUT\""); - sendCommandAction(0,4U); + sendCommandAction(0,15U); m_clockDisplayTimer.stop(); @@ -161,8 +165,10 @@ void CNextion::writeDStarInt(const char* my1, const char* my2, const char* your, assert(type != NULL); assert(reflector != NULL); - if (m_mode != MODE_DSTAR) + if (m_mode != MODE_DSTAR) { sendCommand("page DStar"); + sendCommandAction(0,2U); + } char text[30U]; ::sprintf(text, "dim=%u", m_brightness); @@ -170,16 +176,16 @@ void CNextion::writeDStarInt(const char* my1, const char* my2, const char* your, ::sprintf(text, "t0.txt=\"%s %.8s/%4.4s\"", type, my1, my2); sendCommand(text); - sendCommandAction(0,0); + sendCommandAction(0,22U); ::sprintf(text, "t1.txt=\"%.8s\"", your); sendCommand(text); - sendCommandAction(1U,0); + sendCommandAction(1U,23U); if (::strcmp(reflector, " ") != 0) { ::sprintf(text, "t2.txt=\"via %.8s\"", reflector); sendCommand(text); - sendCommandAction(2U,0); + sendCommandAction(2U,24U); } m_clockDisplayTimer.stop(); @@ -197,7 +203,7 @@ void CNextion::writeDStarRSSIInt(unsigned char rssi) char text[20U]; ::sprintf(text, "t3.txt=\"-%udBm\"", rssi); sendCommand(text); - sendCommandAction(3U,0); + sendCommandAction(3U,25U); m_rssiCount1 = 1U; return; } @@ -209,7 +215,7 @@ void CNextion::writeDStarRSSIInt(unsigned char rssi) char text[20U]; ::sprintf(text, "t3.txt=\"-%udBm\"", m_rssiAccum1 / DSTAR_RSSI_COUNT); sendCommand(text); - sendCommandAction(3U,0); + sendCommandAction(3U,25U); m_rssiAccum1 = 0U; m_rssiCount1 = 1U; } @@ -221,7 +227,7 @@ void CNextion::writeDStarBERInt(float ber) char text[20U]; ::sprintf(text, "t4.txt=\"%.1f%%\"", ber); sendCommand(text); - sendCommandAction(4U,0); + sendCommandAction(4U,26U); m_berCount1 = 1U; return; } @@ -233,7 +239,7 @@ void CNextion::writeDStarBERInt(float ber) char text[20U]; ::sprintf(text, "t4.txt=\"%.1f%%\"", m_berAccum1 / float(DSTAR_BER_COUNT)); sendCommand(text); - sendCommandAction(4U,0); + sendCommandAction(4U,26U); m_berAccum1 = 0.0F; m_berCount1 = 1U; } @@ -242,7 +248,7 @@ void CNextion::writeDStarBERInt(float ber) void CNextion::clearDStarInt() { sendCommand("t0.txt=\"Listening\""); - sendCommandAction(0,11U); + sendCommandAction(0,21U); sendCommand("t1.txt=\"\""); sendCommand("t2.txt=\"\""); sendCommand("t3.txt=\"\""); @@ -255,6 +261,8 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro if (m_mode != MODE_DMR) { sendCommand("page DMR"); + sendCommandAction(0,3U); + if (slotNo == 1U) { if (m_screenLayout == 2U) { @@ -263,7 +271,7 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro } sendCommand("t2.txt=\"2 Listening\""); - sendCommandAction(2U,11U); + sendCommandAction(2U,31U); } else { if (m_screenLayout == 2U) { sendCommand("t0.pco=0"); @@ -271,7 +279,7 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro } sendCommand("t0.txt=\"1 Listening\""); - sendCommandAction(0,11U); + sendCommandAction(0,31U); } } @@ -288,11 +296,11 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro } sendCommand(text); - sendCommandAction(0,12U); + sendCommandAction(0,32U); ::sprintf(text, "t1.txt=\"%s%s\"", group ? "TG" : "", dst.c_str()); sendCommand(text); - sendCommandAction(1U,0); + sendCommandAction(1U,36U); } else { ::sprintf(text, "t2.txt=\"2 %s %s\"", type, src.c_str()); @@ -302,11 +310,11 @@ void CNextion::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro } sendCommand(text); - sendCommandAction(2U,12U); + sendCommandAction(2U,32U); ::sprintf(text, "t3.txt=\"%s%s\"", group ? "TG" : "", dst.c_str()); sendCommand(text); - sendCommandAction(3U,0); + sendCommandAction(3U,36U); } m_clockDisplayTimer.stop(); @@ -329,7 +337,7 @@ void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi) char text[20U]; ::sprintf(text, "t4.txt=\"-%udBm\"", rssi); sendCommand(text); - sendCommandAction(4U,0); + sendCommandAction(4U,37U); m_rssiCount1 = 1U; return; } @@ -341,7 +349,7 @@ void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi) char text[20U]; ::sprintf(text, "t4.txt=\"-%udBm\"", m_rssiAccum1 / DMR_RSSI_COUNT); sendCommand(text); - sendCommandAction(4U,0); + sendCommandAction(4U,37U); m_rssiAccum1 = 0U; m_rssiCount1 = 1U; } @@ -349,7 +357,7 @@ void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi) if (m_rssiCount2 == 0U) { char text[20U]; ::sprintf(text, "t5.txt=\"-%udBm\"", rssi); - sendCommandAction(5U,0); + sendCommandAction(5U,37U); sendCommand(text); m_rssiCount2 = 1U; return; @@ -362,7 +370,7 @@ void CNextion::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi) char text[20U]; ::sprintf(text, "t5.txt=\"-%udBm\"", m_rssiAccum2 / DMR_RSSI_COUNT); sendCommand(text); - sendCommandAction(5U,0); + sendCommandAction(5U,37U); m_rssiAccum2 = 0U; m_rssiCount2 = 1U; } @@ -377,10 +385,10 @@ void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, co if (type[0] == ' ') { if (slotNo == 1U) { if (m_screenLayout == 2U) sendCommand("t0.pco=33808"); - sendCommandAction(0,14U); + sendCommandAction(0,34U); } else { if (m_screenLayout == 2U) sendCommand("t2.pco=33808"); - sendCommandAction(2,14U); + sendCommandAction(2,34U); } return; } @@ -400,7 +408,7 @@ void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, co sendCommand("t0.pco=1024"); } sendCommand(text); - sendCommandAction(0,13U); + sendCommandAction(0,33U); } else { char text[40U]; ::sprintf(text, "t2.txt=\"2 %s %s\"", type, talkerAlias); @@ -416,7 +424,61 @@ void CNextion::writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, co sendCommand("t2.pco=1024"); } sendCommand(text); - sendCommandAction(2,13U); + sendCommandAction(2U,33U); + } +} + +void CNextion::writeDMRGPSInt(unsigned int slotNo, float latitude, float longitude, unsigned char positionError) +{ + char Lat,Lon,text[40]; + + if (m_screenLayout < 2U) + return; + + if (latitude<0) { + latitude=-latitude; + Lat='S'; + } else { + Lat='N'; + } + if (longitude<0) { + longitude=-longitude; + Lon='W'; + } else { + Lon='E'; + } + int degreeLat = (int)latitude; + int minutesLat = (int)((latitude - (float)degreeLat) * 60.0); + float secondsLat = (float)((latitude - (float)degreeLat - (float)minutesLat / 60.0) * 60.0 * 60.0); + int degreeLon = (int)longitude; + int minutesLon = (int)((longitude - (float)degreeLon) * 60.0); + float secondsLon = (float)((longitude - (float)degreeLon - (float)minutesLon / 60.0) * 60.0 * 60.0); + + ::sprintf(text, "%d°%d'%.2f\"%c %d°%d'%.2f\"%c",degreeLat,minutesLat,secondsLat,Lat,degreeLon,minutesLon,secondsLon,Lon); + + if (slotNo == 1U) { + sendCommand(text); + sendCommandAction(9U,35U); + + ::sprintf(text, "t8.txt=\"%f %f\"", latitude, longitude); + sendCommand(text); + sendCommandAction(8U,35U); + + ::sprintf(text, "t12.txt=\"%d\"", positionError); + sendCommand(text); + sendCommandAction(12U,35U); + } + if (slotNo == 2U) { + sendCommand(text); + sendCommandAction(11U,35U); + + ::sprintf(text, "t10.txt=\"%f %f\"", latitude, longitude); + sendCommand(text); + sendCommandAction(10U,35U); + + ::sprintf(text, "t13.txt=\"%d\"", positionError); + sendCommand(text); + sendCommandAction(13U,35U); } } @@ -427,7 +489,7 @@ void CNextion::writeDMRBERInt(unsigned int slotNo, float ber) char text[20U]; ::sprintf(text, "t6.txt=\"%.1f%%\"", ber); sendCommand(text); - sendCommandAction(6U,0); + sendCommandAction(6U,38U); m_berCount1 = 1U; return; } @@ -439,7 +501,7 @@ void CNextion::writeDMRBERInt(unsigned int slotNo, float ber) char text[20U]; ::sprintf(text, "t6.txt=\"%.1f%%\"", m_berAccum1 / DMR_BER_COUNT); sendCommand(text); - sendCommandAction(6U,0); + sendCommandAction(6U,38U); m_berAccum1 = 0U; m_berCount1 = 1U; } @@ -448,7 +510,7 @@ void CNextion::writeDMRBERInt(unsigned int slotNo, float ber) char text[20U]; ::sprintf(text, "t7.txt=\"%.1f%%\"", ber); sendCommand(text); - sendCommandAction(7U,0); + sendCommandAction(7U,38U); m_berCount2 = 1U; return; } @@ -460,7 +522,7 @@ void CNextion::writeDMRBERInt(unsigned int slotNo, float ber) char text[20U]; ::sprintf(text, "t7.txt=\"%.1f%%\"", m_berAccum2 / DMR_BER_COUNT); sendCommand(text); - sendCommandAction(7U,0); + sendCommandAction(7U,38U); m_berAccum2 = 0U; m_berCount2 = 1U; } @@ -471,7 +533,7 @@ void CNextion::clearDMRInt(unsigned int slotNo) { if (slotNo == 1U) { sendCommand("t0.txt=\"1 Listening\""); - sendCommandAction(0,11U); + sendCommandAction(0,31U); if (m_screenLayout == 2U) { sendCommand("t0.pco=0"); @@ -483,7 +545,7 @@ void CNextion::clearDMRInt(unsigned int slotNo) sendCommand("t6.txt=\"\""); } else { sendCommand("t2.txt=\"2 Listening\""); - sendCommandAction(2U,11U); + sendCommandAction(2U,31U); if (m_screenLayout == 2U) { sendCommand("t2.pco=0"); @@ -503,8 +565,11 @@ void CNextion::writeFusionInt(const char* source, const char* dest, const char* assert(type != NULL); assert(origin != NULL); - if (m_mode != MODE_YSF) + if (m_mode != MODE_YSF) { sendCommand("page YSF"); + sendCommandAction(0,4U); + } + char text[30U]; ::sprintf(text, "dim=%u", m_brightness); @@ -512,15 +577,15 @@ void CNextion::writeFusionInt(const char* source, const char* dest, const char* ::sprintf(text, "t0.txt=\"%s %.10s\"", type, source); sendCommand(text); - sendCommandAction(0,0); + sendCommandAction(0,42U); ::sprintf(text, "t1.txt=\"%.10s\"", dest); sendCommand(text); - sendCommandAction(1U,0); + sendCommandAction(1U,43U); if (::strcmp(origin, " ") != 0) { ::sprintf(text, "t2.txt=\"at %.10s\"", origin); sendCommand(text); - sendCommandAction(2U,0); + sendCommandAction(2U,44U); } m_clockDisplayTimer.stop(); @@ -538,7 +603,7 @@ void CNextion::writeFusionRSSIInt(unsigned char rssi) char text[20U]; ::sprintf(text, "t3.txt=\"-%udBm\"", rssi); sendCommand(text); - sendCommandAction(3U,0); + sendCommandAction(3U,45U); m_rssiCount1 = 1U; return; } @@ -550,7 +615,7 @@ void CNextion::writeFusionRSSIInt(unsigned char rssi) char text[20U]; ::sprintf(text, "t3.txt=\"-%udBm\"", m_rssiAccum1 / YSF_RSSI_COUNT); sendCommand(text); - sendCommandAction(3U,0); + sendCommandAction(3U,45U); m_rssiAccum1 = 0U; m_rssiCount1 = 1U; } @@ -562,7 +627,7 @@ void CNextion::writeFusionBERInt(float ber) char text[20U]; ::sprintf(text, "t4.txt=\"%.1f%%\"", ber); sendCommand(text); - sendCommandAction(4U,0); + sendCommandAction(4U,46U); m_berCount1 = 1U; return; } @@ -574,7 +639,7 @@ void CNextion::writeFusionBERInt(float ber) char text[20U]; ::sprintf(text, "t4.txt=\"%.1f%%\"", m_berAccum1 / float(YSF_BER_COUNT)); sendCommand(text); - sendCommandAction(4U,0); + sendCommandAction(4U,46U); m_berAccum1 = 0.0F; m_berCount1 = 1U; } @@ -583,7 +648,7 @@ void CNextion::writeFusionBERInt(float ber) void CNextion::clearFusionInt() { sendCommand("t0.txt=\"Listening\""); - sendCommandAction(0,11U); + sendCommandAction(0,41U); sendCommand("t1.txt=\"\""); sendCommand("t2.txt=\"\""); sendCommand("t3.txt=\"\""); @@ -595,8 +660,10 @@ void CNextion::writeP25Int(const char* source, bool group, unsigned int dest, co assert(source != NULL); assert(type != NULL); - if (m_mode != MODE_P25) + if (m_mode != MODE_P25) { sendCommand("page P25"); + sendCommandAction(0,5U); + } char text[30U]; ::sprintf(text, "dim=%u", m_brightness); @@ -604,11 +671,11 @@ void CNextion::writeP25Int(const char* source, bool group, unsigned int dest, co ::sprintf(text, "t0.txt=\"%s %.10s\"", type, source); sendCommand(text); - sendCommandAction(0,0); + sendCommandAction(0,52U); ::sprintf(text, "t1.txt=\"%s%u\"", group ? "TG" : "", dest); sendCommand(text); - sendCommandAction(1U,0); + sendCommandAction(1U,53U); m_clockDisplayTimer.stop(); @@ -625,7 +692,7 @@ void CNextion::writeP25RSSIInt(unsigned char rssi) char text[20U]; ::sprintf(text, "t2.txt=\"-%udBm\"", rssi); sendCommand(text); - sendCommandAction(2U,0); + sendCommandAction(2U,54U); m_rssiCount1 = 1U; return; } @@ -637,7 +704,7 @@ void CNextion::writeP25RSSIInt(unsigned char rssi) char text[20U]; ::sprintf(text, "t2.txt=\"-%udBm\"", m_rssiAccum1 / P25_RSSI_COUNT); sendCommand(text); - sendCommandAction(2U,0); + sendCommandAction(2U,54); m_rssiAccum1 = 0U; m_rssiCount1 = 1U; } @@ -649,7 +716,7 @@ void CNextion::writeP25BERInt(float ber) char text[20U]; ::sprintf(text, "t3.txt=\"%.1f%%\"", ber); sendCommand(text); - sendCommandAction(3U,0); + sendCommandAction(3U,55U); m_berCount1 = 1U; return; } @@ -661,7 +728,7 @@ void CNextion::writeP25BERInt(float ber) char text[20U]; ::sprintf(text, "t3.txt=\"%.1f%%\"", m_berAccum1 / float(P25_BER_COUNT)); sendCommand(text); - sendCommandAction(3U,0); + sendCommandAction(3U,55U); m_berAccum1 = 0.0F; m_berCount1 = 1U; } @@ -670,7 +737,7 @@ void CNextion::writeP25BERInt(float ber) void CNextion::clearP25Int() { sendCommand("t0.txt=\"Listening\""); - sendCommandAction(0,11U); + sendCommandAction(0,51U); sendCommand("t1.txt=\"\""); sendCommand("t2.txt=\"\""); sendCommand("t3.txt=\"\""); @@ -679,7 +746,7 @@ void CNextion::clearP25Int() void CNextion::writeCWInt() { sendCommand("t1.txt=\"Sending CW Ident\""); - sendCommandAction(1,2U); + sendCommandAction(1U,12U); m_clockDisplayTimer.start(); m_mode = MODE_CW; @@ -688,7 +755,7 @@ void CNextion::writeCWInt() void CNextion::clearCWInt() { sendCommand("t1.txt=\"MMDVM IDLE\""); - sendCommandAction(1U,1U); + sendCommandAction(1U,11U); } void CNextion::clockInt(unsigned int ms) @@ -717,8 +784,9 @@ void CNextion::clockInt(unsigned int ms) void CNextion::close() { sendCommand("page MMDVM"); + sendCommandAction(0,1U); sendCommand("t1.txt=\"MMDVM STOPPED\""); - sendCommandAction(1U,5U); + sendCommandAction(1U,19U); m_serial->close(); delete m_serial; } diff --git a/Nextion.h b/Nextion.h index 38f6583..2eb7f41 100644 --- a/Nextion.h +++ b/Nextion.h @@ -49,6 +49,8 @@ protected: virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type); virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi); virtual void writeDMRTAInt(unsigned int slotNo, unsigned char* talkerAlias, const char* type); + virtual void writeDMRGPSInt(unsigned int slotNo, float latitude, float longitude, unsigned char positionError); + virtual void writeDMRBERInt(unsigned int slotNo, float ber); virtual void clearDMRInt(unsigned int slotNo); diff --git a/Nextion_ON7LDS/NX4832T035-L3.HMI b/Nextion_ON7LDS/NX4832T035-L3.HMI index a765c34..3d70039 100644 Binary files a/Nextion_ON7LDS/NX4832T035-L3.HMI and b/Nextion_ON7LDS/NX4832T035-L3.HMI differ diff --git a/Nextion_ON7LDS/README-L2 b/Nextion_ON7LDS/README-L2 index e5cbe73..ed3f5af 100644 --- a/Nextion_ON7LDS/README-L2 +++ b/Nextion_ON7LDS/README-L2 @@ -7,8 +7,8 @@ Nextion Display Layouts by ON7LDS (for MMDVMHost) # # ################################ -The files in this directory are Nextion screen layouts with better fonts than - the(rather ugly) standard Nextion fonts +The -L2 files in this directory are Nextion screen layouts with better + fonts than the (rather ugly) standard Nextion fonts There are some other changes: @@ -29,11 +29,13 @@ There are some other changes: must copy this font to the lesser ('smaller') fonts. i.e. : the 3.2" the display can show more than 31 characters (the maximum TA length) in font 2, so this font is also copied to font 1. +* If you want more control about what and how it is displayed, you better + select Layout 3 or 4 (see README-L3) * The screenlayout has to be selected with the parameter ScreenLayout in the MMDVM.ini file under the Nextion section. This way, the extra function to automatically change the font size, is activated. 0 = auto (future use, for now it's G4KLX layout) 1 = G4KLX layout - 2 = ON7LDS layout - - + 2 = ON7LDS layout (this README file) + 3 = DIY by ON7LDS layout (see README-L3) + 4 = DIY by ON7LDS layout Hig Speed (see README-L3) diff --git a/Nextion_ON7LDS/README-L3 b/Nextion_ON7LDS/README-L3 index 8318dea..a76c7b4 100644 --- a/Nextion_ON7LDS/README-L3 +++ b/Nextion_ON7LDS/README-L3 @@ -14,61 +14,113 @@ MMDVM.ini file under the Nextion section. This way, the extra functions are activated. 0 = auto (future use, for now it's G4KLX layout) 1 = G4KLX layout - 2 = ON7LDS layout (see README-L2) - 3 = DIY layout - 4 = DIY layout Hig Speed + 2 = ON7LDS layout (see README-L2) + 3 = ON7LDS DIY layout (this README file) + 4 = ON7LDS DIY layout Hig Speed (this README file) screenLayout 3 and 4 are the same, but selecting 3, MMDVMHost wil communicate at 9600bps with the display and selecting 4 will set the baudrate to 115200. If you select 4 (115200bps) *you* have to program your Nextion to default to that baudrate. +How to set the default Nextion Display baudrate ? +You could use the Nextion editor, connect to your display with the debug + tool (do not forget to select your display and not the simulator) and + give the command 'bauds=115200'. +Another option is to set the command above in the Preinitialization Event + of the first page. Nextion recommends to do the latter in any case, + because 'on rare occasions bauds has become lost' + DIY layouts ----------- - When selecting this layout, all processing can and should be done in the Nextion display itsself. Whenever MMDVMHost sends new data to the screen, it also sends information about wat was sent: * global variable MMDVM.cmd will hold the number of the changed field - (not the object id ! 0 for t0, 1 for t2, etc.) + (not the object id ! 0 for t0, 1 for t1, etc.) * global variable MMDVM.status will hold the status of the change + (the type of information sent - see further in this document) Then MMDVMHost activates the Touch Press Event of object 'S0' of the active page. In this event procedure, all processing can be done. Check the Touch Press Event of object 'S0' of the DMR page of the example -HMI file. The code there will change colors and fonts of the TA on -the DMR page when it arrives. +HMI file. As a straightforward example, the code there will: +- change colors and fonts of the TA on the DMR page when it arrives. + (TA length calculation is done in the display itsself !) +- display the GPS data (if received) in a new field (called 'GPS'), + by copying the GPS data form the field where MMDVMHost has + written to (t11 for GPS data from slot 2 in DMS format) + Status codes that will be sent: ------------------------------- The status code gives more information about what was sent in the changed field. - 1 : IDLE - 2 : CW - 3 : ERROR - 4 : LOCKOUT - 5 : END -11 : listening -12 : ID -13 : TA -14 : call end + + 1 : page MMDVM + 2 : page D-Star + 3 : page DMR + 4 : page YSF + 5 : page P25 + +11 : IDLE +12 : CW +13 : ERROR text +14 : ERROR +15 : LOCKOUT +16 : IPaddress +17 : ID/Call +19 : END + +21 : D-Star listening +22 : type/my1/my2 +23 : your +24 : reflector +25 : RSSI +26 : ber + +31 : DMR listening +32 : ID +33 : TA +34 : Call end +35 : GPS +36 : TG +37 : RSSI +38 : ber + +41 : YSF listening +42 : src +43 : dest +44 : origin +45 : RSSI +46 : ber + +51 : P25 listening +52 : source +53 : dest +54 : RSSI +55 : ber -Fields on the pages, used by MMDVMHost --------------------------------------- +Fields (and their numbers) on the pages, used by MMDVMHost +---------------------------------------------------------- + MMDVM -t0 : owner call & ID / errortext LOCKOUT +t0 : owner call & ID / errortext LOCKOUT t1 : status / ERROR t2 : date & time + +screenLayout >1 : t3 : ip address + D-Star t0 : type my1 my2 t1 : your @@ -76,6 +128,7 @@ t2 : reflector t3 : rssi t4 : ber + DMR t0 : src1 id / call / TA t1 : dst @@ -86,6 +139,15 @@ t5 : rssi2 t6 : ber1 t7 : ber2 +screenLayout >1 : +t8 : GPS1 dec +t9 : GPS1 DMS +t10: GPS2 dec +t11: GPS2 DMS +t12: GPS1 err +t13: GPS2 err + + YSF t0 : type,source t1 : dst @@ -93,6 +155,7 @@ t2 : src t3 : rssi t4 : ber + P25 t0 : type,source t1 : dst diff --git a/Nextion_ON7LDS/README.md b/Nextion_ON7LDS/README.md index 9237571..efcefd2 100644 --- a/Nextion_ON7LDS/README.md +++ b/Nextion_ON7LDS/README.md @@ -11,11 +11,15 @@ are activated. 3 = DIY layout 4 = DIY layout High Speed - +Layout 2 is a no-nonsense layout. It is the original (G4KLX) layout with the Talker Alias added. TA color and fonts size can not be changed. At least not easily. + +Layout 3 (as is 4) is a layout without any predefined layout options (color, fonts). All layout processing can and should be done in the display ittself. + More information about the layouts can be found in * README-L2 for the screenLayout 2 setting * README-L2 for the screenLayout 3 and 4 settings + When you want extra control over what has to be sent to the Nextion display, -you could consider the program 'NextionDriver' at https://github.com/on7lds/NextionDriver -Also, in debug mode, this program shows you all communication between MMDVMHost and the display. +you could consider the program 'NextionDriver' at https://github.com/on7lds/NextionDriver as a companion to MMDVMHost (it also makes it possible to use buttons on the display). +In verbose mode, this program shows you all communication between MMDVMHost and the display.