From 756f5010a900b85d5a64c0e67463f53a172630c8 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 10:44:21 +0200 Subject: [PATCH 01/13] Add display of CW Ident to Nextion display --- Nextion.cpp | 14 ++++++++++++++ Nextion.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/Nextion.cpp b/Nextion.cpp index 7fdc72d..0cd97cb 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -233,6 +233,20 @@ void CNextion::clearFusionInt() sendCommand("t2.txt=\"\""); } +void CNextion::sendCWInt() +{ + sendCommand("page MMDVM"); + + char command[30]; + ::sprintf(command, "dim=%u", m_brightness); + sendCommand(command); + + ::sprintf(command, "t0.txt=\"%-6s / %u\"", m_callsign.c_str(), m_dmrid); + + sendCommand(command); + sendCommand("t1.txt=\"Sending CW Ident\""); +} + void CNextion::clockInt(unsigned int ms) { // Update the clock display in IDLE mode every 400ms diff --git a/Nextion.h b/Nextion.h index 38fa55f..112d974 100644 --- a/Nextion.h +++ b/Nextion.h @@ -50,6 +50,8 @@ protected: virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void clearFusionInt(); + virtual void sendCWInt(); + virtual void clockInt(unsigned int ms); private: From 7daa0b9c15eaa4b51da002216d875e1899b9b82e Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 10:58:55 +0200 Subject: [PATCH 02/13] Rename according to already existing functions --- Nextion.cpp | 2 +- Nextion.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Nextion.cpp b/Nextion.cpp index 0cd97cb..eb0fb3b 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -233,7 +233,7 @@ void CNextion::clearFusionInt() sendCommand("t2.txt=\"\""); } -void CNextion::sendCWInt() +void CNextion::writeCWInt() { sendCommand("page MMDVM"); diff --git a/Nextion.h b/Nextion.h index 112d974..749f73e 100644 --- a/Nextion.h +++ b/Nextion.h @@ -50,7 +50,7 @@ protected: virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void clearFusionInt(); - virtual void sendCWInt(); + virtual void writeCWInt(); virtual void clockInt(unsigned int ms); From 7246fde0ec7734b997b0978f9b0a1b441f957998 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 11:50:35 +0200 Subject: [PATCH 03/13] Add functions to Display.cpp and .h --- Display.cpp | 5 +++++ Display.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Display.cpp b/Display.cpp index 5732169..d08c0a8 100644 --- a/Display.cpp +++ b/Display.cpp @@ -155,6 +155,11 @@ void CDisplay::clearFusion() } } +void CDisplay::writeCW() +{ + writeCWInt(); +} + void CDisplay::clock(unsigned int ms) { m_timer1.clock(ms); diff --git a/Display.h b/Display.h index 15f4faa..7abeb5c 100644 --- a/Display.h +++ b/Display.h @@ -44,6 +44,8 @@ public: void writeFusion(const char* source, const char* dest, const char* type, const char* origin); void clearFusion(); + void writeCW(); + virtual void close() = 0; void clock(unsigned int ms); @@ -62,6 +64,8 @@ protected: virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin) = 0; virtual void clearFusionInt() = 0; + virtual void writeCWInt() = 0; + virtual void clockInt(unsigned int ms); private: From 11a1ccf2bba746842cb4479d6e6f7f88e50b97cf Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 13:57:07 +0200 Subject: [PATCH 04/13] Add functions to NullDisplay and TFTSerial --- NullDisplay.cpp | 4 ++++ NullDisplay.h | 2 ++ TFTSerial.cpp | 4 ++++ TFTSerial.h | 2 ++ 4 files changed, 12 insertions(+) diff --git a/NullDisplay.cpp b/NullDisplay.cpp index 9eb3059..e412018 100644 --- a/NullDisplay.cpp +++ b/NullDisplay.cpp @@ -68,6 +68,10 @@ void CNullDisplay::clearFusionInt() { } +void CNullDisplay::writeCWInt() +{ +} + void CNullDisplay::close() { } diff --git a/NullDisplay.h b/NullDisplay.h index 7040157..6d818ef 100644 --- a/NullDisplay.h +++ b/NullDisplay.h @@ -47,6 +47,8 @@ protected: virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void clearFusionInt(); + virtual void writeCWInt(); + private: }; diff --git a/TFTSerial.cpp b/TFTSerial.cpp index 8a0dc9d..e1199a4 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -311,6 +311,10 @@ void CTFTSerial::clearFusionInt() displayText(" "); } +void CTFTSerial::writeCWInt() +{ +} + void CTFTSerial::close() { m_serial.close(); diff --git a/TFTSerial.h b/TFTSerial.h index 00e60fc..b86d2d5 100644 --- a/TFTSerial.h +++ b/TFTSerial.h @@ -49,6 +49,8 @@ protected: virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void clearFusionInt(); + virtual void writeCWInt(); + private: std::string m_callsign; unsigned int m_dmrid; From 4e1b002665e4e84277c670b030cd491d5f5399e1 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 14:01:42 +0200 Subject: [PATCH 05/13] Reset display to idle after CW transmission --- MMDVMHost.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index b3bef3b..ef96a59 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -620,6 +620,7 @@ int CMMDVMHost::run() if (m_mode == MODE_IDLE && !m_modem->hasTX()){ LogDebug("sending CW ID"); m_modem->sendCWId(m_callsign); + m_display->setIdle(); m_cwIdTimer.start(); //reset only after sending ID, timer-overflow after 49 days doesnt matter } From 28775026d48c1ebb603b5f047f83ab45ddec3550 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 15:17:51 +0200 Subject: [PATCH 06/13] Add timer to return from CW Ident --- Defines.h | 1 + Display.cpp | 8 ++++++++ Display.h | 2 ++ MMDVMHost.cpp | 2 +- Nextion.cpp | 9 +++++++++ Nextion.h | 1 + NullDisplay.cpp | 4 ++++ NullDisplay.h | 1 + TFTSerial.cpp | 4 ++++ TFTSerial.h | 1 + 10 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Defines.h b/Defines.h index c4a1419..479d463 100644 --- a/Defines.h +++ b/Defines.h @@ -23,6 +23,7 @@ const unsigned char MODE_IDLE = 0U; const unsigned char MODE_DSTAR = 1U; const unsigned char MODE_DMR = 2U; const unsigned char MODE_YSF = 3U; +const unsigned char MODE_CW = 4U; const unsigned char MODE_LOCKOUT = 99U; const unsigned char MODE_ERROR = 100U; diff --git a/Display.cpp b/Display.cpp index d08c0a8..3b994d4 100644 --- a/Display.cpp +++ b/Display.cpp @@ -157,6 +157,9 @@ void CDisplay::clearFusion() void CDisplay::writeCW() { + m_timer1.start(); + m_mode1 = MODE_CW; + writeCWInt(); } @@ -180,6 +183,11 @@ void CDisplay::clock(unsigned int ms) m_mode1 = MODE_IDLE; m_timer1.stop(); break; + case MODE_CW: + clearCWInt(); + m_mode1 = MODE_IDLE; + m_timer1.stop(); + break; default: break; } diff --git a/Display.h b/Display.h index 7abeb5c..9966282 100644 --- a/Display.h +++ b/Display.h @@ -45,6 +45,7 @@ public: void clearFusion(); void writeCW(); + void clearCW(); virtual void close() = 0; @@ -65,6 +66,7 @@ protected: virtual void clearFusionInt() = 0; virtual void writeCWInt() = 0; + virtual void clearCWInt() = 0; virtual void clockInt(unsigned int ms); diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index ef96a59..16777a4 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -619,8 +619,8 @@ int CMMDVMHost::run() if (m_cwIdTimer.isRunning() && m_cwIdTimer.hasExpired()) { if (m_mode == MODE_IDLE && !m_modem->hasTX()){ LogDebug("sending CW ID"); + m_display->writeCW(); m_modem->sendCWId(m_callsign); - m_display->setIdle(); m_cwIdTimer.start(); //reset only after sending ID, timer-overflow after 49 days doesnt matter } diff --git a/Nextion.cpp b/Nextion.cpp index eb0fb3b..882abb4 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -245,6 +245,15 @@ void CNextion::writeCWInt() sendCommand(command); sendCommand("t1.txt=\"Sending CW Ident\""); + + m_clockDisplayTimer.stop(); + + m_mode = MODE_CW; +} + +void CNextion::clearCWInt() +{ + setIdleInt(); } void CNextion::clockInt(unsigned int ms) diff --git a/Nextion.h b/Nextion.h index 749f73e..b6459ad 100644 --- a/Nextion.h +++ b/Nextion.h @@ -51,6 +51,7 @@ protected: virtual void clearFusionInt(); virtual void writeCWInt(); + virtual void clearCWInt(); virtual void clockInt(unsigned int ms); diff --git a/NullDisplay.cpp b/NullDisplay.cpp index e412018..002cc06 100644 --- a/NullDisplay.cpp +++ b/NullDisplay.cpp @@ -72,6 +72,10 @@ void CNullDisplay::writeCWInt() { } +void CNullDisplay::clearCWInt() +{ +} + void CNullDisplay::close() { } diff --git a/NullDisplay.h b/NullDisplay.h index 6d818ef..fc79184 100644 --- a/NullDisplay.h +++ b/NullDisplay.h @@ -48,6 +48,7 @@ protected: virtual void clearFusionInt(); virtual void writeCWInt(); + virtual void clearCWInt(); private: }; diff --git a/TFTSerial.cpp b/TFTSerial.cpp index e1199a4..785058d 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -315,6 +315,10 @@ void CTFTSerial::writeCWInt() { } +void CTFTSerial::clearCWInt() +{ +} + void CTFTSerial::close() { m_serial.close(); diff --git a/TFTSerial.h b/TFTSerial.h index b86d2d5..8f778e7 100644 --- a/TFTSerial.h +++ b/TFTSerial.h @@ -50,6 +50,7 @@ protected: virtual void clearFusionInt(); virtual void writeCWInt(); + virtual void clearCWInt(); private: std::string m_callsign; From 4ea3a7e591c731b143f690967826d78e8a682e97 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 15:47:48 +0200 Subject: [PATCH 07/13] Leave display in idle brightness for CW transmission --- Nextion.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Nextion.cpp b/Nextion.cpp index 882abb4..2d2c9e7 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -238,8 +238,6 @@ void CNextion::writeCWInt() sendCommand("page MMDVM"); char command[30]; - ::sprintf(command, "dim=%u", m_brightness); - sendCommand(command); ::sprintf(command, "t0.txt=\"%-6s / %u\"", m_callsign.c_str(), m_dmrid); From 952bcb95ac7ba95f6e755408a44d91c4d7ec1154 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 15:51:48 +0200 Subject: [PATCH 08/13] No need to switch to idle page --- Nextion.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Nextion.cpp b/Nextion.cpp index 2d2c9e7..09ca7f4 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -235,8 +235,6 @@ void CNextion::clearFusionInt() void CNextion::writeCWInt() { - sendCommand("page MMDVM"); - char command[30]; ::sprintf(command, "t0.txt=\"%-6s / %u\"", m_callsign.c_str(), m_dmrid); From 5039b42027052f6525de265afd37347242b11ec6 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 16:27:06 +0200 Subject: [PATCH 09/13] Just replace the one text area --- Nextion.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Nextion.cpp b/Nextion.cpp index 09ca7f4..925dd5a 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -237,9 +237,6 @@ void CNextion::writeCWInt() { char command[30]; - ::sprintf(command, "t0.txt=\"%-6s / %u\"", m_callsign.c_str(), m_dmrid); - - sendCommand(command); sendCommand("t1.txt=\"Sending CW Ident\""); m_clockDisplayTimer.stop(); @@ -249,7 +246,7 @@ void CNextion::writeCWInt() void CNextion::clearCWInt() { - setIdleInt(); + sendCommand("t1.txt=\"MMDVM IDLE\""); } void CNextion::clockInt(unsigned int ms) From 400659e3f16a8508a5c92ccaf08a6993a75fdad2 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 16:28:56 +0200 Subject: [PATCH 10/13] Remove unused variable --- Nextion.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Nextion.cpp b/Nextion.cpp index 925dd5a..c35a623 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -235,9 +235,7 @@ void CNextion::clearFusionInt() void CNextion::writeCWInt() { - char command[30]; - - sendCommand("t1.txt=\"Sending CW Ident\""); + sendCommand("t1.txt=\"Sending CW Ident\""); m_clockDisplayTimer.stop(); From 148b64039761d6c10f67035111fbab79be32ab6c Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 16:57:10 +0200 Subject: [PATCH 11/13] Let the clock run on when transmitting CW --- Nextion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nextion.cpp b/Nextion.cpp index c35a623..9a388d6 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -237,7 +237,7 @@ void CNextion::writeCWInt() { sendCommand("t1.txt=\"Sending CW Ident\""); - m_clockDisplayTimer.stop(); + m_clockDisplayTimer.start(); m_mode = MODE_CW; } @@ -251,7 +251,7 @@ void CNextion::clockInt(unsigned int ms) { // Update the clock display in IDLE mode every 400ms m_clockDisplayTimer.clock(ms); - if (m_displayClock && m_mode == MODE_IDLE && m_clockDisplayTimer.isRunning() && m_clockDisplayTimer.hasExpired()) { + if (m_displayClock && (m_mode == MODE_IDLE || m_mode == MODE_CW) && m_clockDisplayTimer.isRunning() && m_clockDisplayTimer.hasExpired()) { time_t currentTime; struct tm *Time; ::time(¤tTime); // Get the current time From 7ab66136ee4634e81acea79955328fc34f1f38ab Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 23:03:48 +0200 Subject: [PATCH 12/13] Add CW transmission info to HD44780 LCD displays --- HD44780.cpp | 12 ++++++++++++ HD44780.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/HD44780.cpp b/HD44780.cpp index 0af603e..249a293 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -730,6 +730,18 @@ void CHD44780::clearFusionInt() } } +void CHD44780::writeCWInt() +{ + ::lcdPosition(m_fd, m_cols - 5, m_rows - 1); + ::lcdPuts(m_fd, "CW TX"); +} + +void CHD44780::clearCWInt() +{ + ::lcdPosition(m_fd, m_cols - 5, m_rows - 1); + ::lcdPuts(m_fd, " Idle"); +} + void CHD44780::clockInt(unsigned int ms) { m_clockDisplayTimer.clock(ms); diff --git a/HD44780.h b/HD44780.h index 4748b79..c0ab802 100644 --- a/HD44780.h +++ b/HD44780.h @@ -110,6 +110,9 @@ protected: virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void clearFusionInt(); + virtual void writeCWInt(); + virtual void clearCWInt(); + virtual void clockInt(unsigned int ms); private: From 4cf0c9031aca133cf20d30cee5dfd418b281472b Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 15 Sep 2016 23:26:17 +0200 Subject: [PATCH 13/13] Add routines for TFTSerial --- TFTSerial.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/TFTSerial.cpp b/TFTSerial.cpp index 785058d..04a02c8 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -313,10 +313,16 @@ void CTFTSerial::clearFusionInt() void CTFTSerial::writeCWInt() { + gotoPosPixel(45U, 90U); + displayText("CW TX"); + + m_mode = MODE_CW; } void CTFTSerial::clearCWInt() { + gotoPosPixel(45U, 90U); + displayText("IDLE"); } void CTFTSerial::close()