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;