Merge pull request #145 from phl0/CW2display

Display CW activity on displays
This commit is contained in:
Jonathan Naylor 2016-09-17 09:15:45 +01:00 committed by GitHub
commit cb8cc99efd
12 changed files with 82 additions and 1 deletions

View file

@ -23,6 +23,7 @@ const unsigned char MODE_IDLE = 0U;
const unsigned char MODE_DSTAR = 1U; const unsigned char MODE_DSTAR = 1U;
const unsigned char MODE_DMR = 2U; const unsigned char MODE_DMR = 2U;
const unsigned char MODE_YSF = 3U; const unsigned char MODE_YSF = 3U;
const unsigned char MODE_CW = 4U;
const unsigned char MODE_LOCKOUT = 99U; const unsigned char MODE_LOCKOUT = 99U;
const unsigned char MODE_ERROR = 100U; const unsigned char MODE_ERROR = 100U;

View file

@ -155,6 +155,14 @@ void CDisplay::clearFusion()
} }
} }
void CDisplay::writeCW()
{
m_timer1.start();
m_mode1 = MODE_CW;
writeCWInt();
}
void CDisplay::clock(unsigned int ms) void CDisplay::clock(unsigned int ms)
{ {
m_timer1.clock(ms); m_timer1.clock(ms);
@ -175,6 +183,11 @@ void CDisplay::clock(unsigned int ms)
m_mode1 = MODE_IDLE; m_mode1 = MODE_IDLE;
m_timer1.stop(); m_timer1.stop();
break; break;
case MODE_CW:
clearCWInt();
m_mode1 = MODE_IDLE;
m_timer1.stop();
break;
default: default:
break; break;
} }

View file

@ -44,6 +44,9 @@ public:
void writeFusion(const char* source, const char* dest, const char* type, const char* origin); void writeFusion(const char* source, const char* dest, const char* type, const char* origin);
void clearFusion(); void clearFusion();
void writeCW();
void clearCW();
virtual void close() = 0; virtual void close() = 0;
void clock(unsigned int ms); 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 writeFusionInt(const char* source, const char* dest, const char* type, const char* origin) = 0;
virtual void clearFusionInt() = 0; virtual void clearFusionInt() = 0;
virtual void writeCWInt() = 0;
virtual void clearCWInt() = 0;
virtual void clockInt(unsigned int ms); virtual void clockInt(unsigned int ms);
private: private:

View file

@ -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) void CHD44780::clockInt(unsigned int ms)
{ {
m_clockDisplayTimer.clock(ms); m_clockDisplayTimer.clock(ms);

View file

@ -110,6 +110,9 @@ protected:
virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin);
virtual void clearFusionInt(); virtual void clearFusionInt();
virtual void writeCWInt();
virtual void clearCWInt();
virtual void clockInt(unsigned int ms); virtual void clockInt(unsigned int ms);
private: private:

View file

@ -628,6 +628,7 @@ int CMMDVMHost::run()
if (m_cwIdTimer.isRunning() && m_cwIdTimer.hasExpired()) { if (m_cwIdTimer.isRunning() && m_cwIdTimer.hasExpired()) {
if (m_mode == MODE_IDLE && !m_modem->hasTX()){ if (m_mode == MODE_IDLE && !m_modem->hasTX()){
LogDebug("sending CW ID"); LogDebug("sending CW ID");
m_display->writeCW();
m_modem->sendCWId(m_callsign); m_modem->sendCWId(m_callsign);
m_cwIdTimer.start(); //reset only after sending ID, timer-overflow after 49 days doesnt matter m_cwIdTimer.start(); //reset only after sending ID, timer-overflow after 49 days doesnt matter

View file

@ -233,11 +233,25 @@ void CNextion::clearFusionInt()
sendCommand("t2.txt=\"\""); 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) void CNextion::clockInt(unsigned int ms)
{ {
// Update the clock display in IDLE mode every 400ms // Update the clock display in IDLE mode every 400ms
m_clockDisplayTimer.clock(ms); 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; time_t currentTime;
struct tm *Time; struct tm *Time;
::time(&currentTime); // Get the current time ::time(&currentTime); // Get the current time

View file

@ -50,6 +50,9 @@ protected:
virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin);
virtual void clearFusionInt(); virtual void clearFusionInt();
virtual void writeCWInt();
virtual void clearCWInt();
virtual void clockInt(unsigned int ms); virtual void clockInt(unsigned int ms);
private: private:

View file

@ -68,6 +68,14 @@ void CNullDisplay::clearFusionInt()
{ {
} }
void CNullDisplay::writeCWInt()
{
}
void CNullDisplay::clearCWInt()
{
}
void CNullDisplay::close() void CNullDisplay::close()
{ {
} }

View file

@ -47,6 +47,9 @@ protected:
virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin);
virtual void clearFusionInt(); virtual void clearFusionInt();
virtual void writeCWInt();
virtual void clearCWInt();
private: private:
}; };

View file

@ -311,6 +311,20 @@ void CTFTSerial::clearFusionInt()
displayText(" "); 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() void CTFTSerial::close()
{ {
m_serial.close(); m_serial.close();

View file

@ -49,6 +49,9 @@ protected:
virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin); virtual void writeFusionInt(const char* source, const char* dest, const char* type, const char* origin);
virtual void clearFusionInt(); virtual void clearFusionInt();
virtual void writeCWInt();
virtual void clearCWInt();
private: private:
std::string m_callsign; std::string m_callsign;
unsigned int m_dmrid; unsigned int m_dmrid;