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 5732169..3b994d4 100644 --- a/Display.cpp +++ b/Display.cpp @@ -155,6 +155,14 @@ void CDisplay::clearFusion() } } +void CDisplay::writeCW() +{ + m_timer1.start(); + m_mode1 = MODE_CW; + + writeCWInt(); +} + void CDisplay::clock(unsigned int ms) { m_timer1.clock(ms); @@ -175,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 15f4faa..9966282 100644 --- a/Display.h +++ b/Display.h @@ -44,6 +44,9 @@ public: void writeFusion(const char* source, const char* dest, const char* type, const char* origin); void clearFusion(); + void writeCW(); + void clearCW(); + virtual void close() = 0; void clock(unsigned int ms); @@ -62,6 +65,9 @@ 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 clearCWInt() = 0; + virtual void clockInt(unsigned int ms); private: 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: diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index bc26dce..89aeb55 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -628,6 +628,7 @@ 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_cwIdTimer.start(); //reset only after sending ID, timer-overflow after 49 days doesnt matter diff --git a/Nextion.cpp b/Nextion.cpp index 7fdc72d..9a388d6 100644 --- a/Nextion.cpp +++ b/Nextion.cpp @@ -233,11 +233,25 @@ void CNextion::clearFusionInt() sendCommand("t2.txt=\"\""); } +void CNextion::writeCWInt() +{ + sendCommand("t1.txt=\"Sending CW Ident\""); + + m_clockDisplayTimer.start(); + + m_mode = MODE_CW; +} + +void CNextion::clearCWInt() +{ + sendCommand("t1.txt=\"MMDVM IDLE\""); +} + 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 diff --git a/Nextion.h b/Nextion.h index 38fa55f..b6459ad 100644 --- a/Nextion.h +++ b/Nextion.h @@ -50,6 +50,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: diff --git a/NullDisplay.cpp b/NullDisplay.cpp index 9eb3059..002cc06 100644 --- a/NullDisplay.cpp +++ b/NullDisplay.cpp @@ -68,6 +68,14 @@ void CNullDisplay::clearFusionInt() { } +void CNullDisplay::writeCWInt() +{ +} + +void CNullDisplay::clearCWInt() +{ +} + void CNullDisplay::close() { } diff --git a/NullDisplay.h b/NullDisplay.h index 7040157..fc79184 100644 --- a/NullDisplay.h +++ b/NullDisplay.h @@ -47,6 +47,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(); + private: }; diff --git a/TFTSerial.cpp b/TFTSerial.cpp index 8a0dc9d..04a02c8 100644 --- a/TFTSerial.cpp +++ b/TFTSerial.cpp @@ -311,6 +311,20 @@ void CTFTSerial::clearFusionInt() displayText(" "); } +void CTFTSerial::writeCWInt() +{ + gotoPosPixel(45U, 90U); + displayText("CW TX"); + + m_mode = MODE_CW; +} + +void CTFTSerial::clearCWInt() +{ + gotoPosPixel(45U, 90U); + displayText("IDLE"); +} + void CTFTSerial::close() { m_serial.close(); diff --git a/TFTSerial.h b/TFTSerial.h index 00e60fc..8f778e7 100644 --- a/TFTSerial.h +++ b/TFTSerial.h @@ -49,6 +49,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(); + private: std::string m_callsign; unsigned int m_dmrid;