From 388620b182392895d42a7fb79fcb600030dffa75 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Fri, 15 May 2020 18:53:34 +0200 Subject: [PATCH 1/5] Add FM EOT --- FM.cpp | 7 +++++++ SerialPort.cpp | 20 +++++++++++++++++++- SerialPort.h | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/FM.cpp b/FM.cpp index f4174fc..a165fab 100644 --- a/FM.cpp +++ b/FM.cpp @@ -411,6 +411,8 @@ void CFM::kerchunkRFState(bool validSignal) m_ackMinTimer.stop(); m_callsignTimer.stop(); m_statusTimer.stop(); + + serial.writeFMEOT(); } } @@ -423,6 +425,8 @@ void CFM::relayingRFState(bool validSignal) m_ackMinTimer.stop(); m_timeoutTimer.stop(); m_timeoutTone.start(); + + serial.writeFMEOT(); } } else { DEBUG1("State to RELAYING_WAIT_RF"); @@ -574,10 +578,13 @@ void CFM::hangState(bool validRFSignal, bool validExtSignal) m_hangTimer.stop(); m_statusTimer.stop(); + serial.writeFMEOT(); + if (m_callsignAtEnd) sendCallsign(); m_callsignTimer.stop(); + } } diff --git a/SerialPort.cpp b/SerialPort.cpp index d0bf4fc..a320ed1 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -71,6 +71,7 @@ const uint8_t MMDVM_FM_PARAMS3 = 0x62U; const uint8_t MMDVM_FM_PARAMS4 = 0x63U; const uint8_t MMDVM_FM_DATA = 0x65U; const uint8_t MMDVM_FM_STATUS = 0x66U; +const uint8_t MMDVM_FM_EOT = 0x67U; const uint8_t MMDVM_ACK = 0x70U; const uint8_t MMDVM_NAK = 0x7FU; @@ -1286,7 +1287,24 @@ void CSerialPort::writeFMStatus(uint8_t status) reply[2U] = MMDVM_FM_STATUS; reply[3U] = status; - writeInt(1U, reply, 4); + writeInt(1U, reply, 4Us); +} + +void CSerialPort::writeFMEOT() +{ + if (m_modemState != STATE_FM && m_modemState != STATE_IDLE) + return; + + if (!m_fmEnable) + return; + + uint8_t reply[10U]; + + reply[0U] = MMDVM_FRAME_START; + reply[1U] = 4U; + reply[2U] = MMDVM_FM_EOT; + + writeInt(1U, reply, 3U); } void CSerialPort::writeCalData(const uint8_t* data, uint8_t length) diff --git a/SerialPort.h b/SerialPort.h index 2b5eb9a..a75731a 100644 --- a/SerialPort.h +++ b/SerialPort.h @@ -52,6 +52,7 @@ public: void writeFMData(const uint8_t* data, uint8_t length); void writeFMStatus(uint8_t status); + void writeFMEOT(); void writeCalData(const uint8_t* data, uint8_t length); void writeRSSIData(const uint8_t* data, uint8_t length); From e330c9f52acc9196e00d2d754b5fe7e4ee89d52c Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Fri, 15 May 2020 21:05:57 +0200 Subject: [PATCH 2/5] Fix typo --- SerialPort.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index a320ed1..6518ebf 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -1287,7 +1287,7 @@ void CSerialPort::writeFMStatus(uint8_t status) reply[2U] = MMDVM_FM_STATUS; reply[3U] = status; - writeInt(1U, reply, 4Us); + writeInt(1U, reply, 4U); } void CSerialPort::writeFMEOT() From 7b915f9cacdc357a6688fc3c1c9ac2d6c35f20b9 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Fri, 15 May 2020 21:06:16 +0200 Subject: [PATCH 3/5] Only send EOT when EXT is enabled --- FM.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/FM.cpp b/FM.cpp index a165fab..cfd7ba6 100644 --- a/FM.cpp +++ b/FM.cpp @@ -412,7 +412,8 @@ void CFM::kerchunkRFState(bool validSignal) m_callsignTimer.stop(); m_statusTimer.stop(); - serial.writeFMEOT(); + if(m_extEnabled) + serial.writeFMEOT(); } } @@ -426,7 +427,8 @@ void CFM::relayingRFState(bool validSignal) m_timeoutTimer.stop(); m_timeoutTone.start(); - serial.writeFMEOT(); + if(m_extEnabled) + serial.writeFMEOT(); } } else { DEBUG1("State to RELAYING_WAIT_RF"); @@ -578,7 +580,8 @@ void CFM::hangState(bool validRFSignal, bool validExtSignal) m_hangTimer.stop(); m_statusTimer.stop(); - serial.writeFMEOT(); + if(m_extEnabled) + serial.writeFMEOT(); if (m_callsignAtEnd) sendCallsign(); From 48e863d1d06479ff025d2b8f0bb019f776e35899 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Fri, 15 May 2020 21:19:26 +0200 Subject: [PATCH 4/5] Sent EOT on rf timeout --- FM.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FM.cpp b/FM.cpp index cfd7ba6..09f8c5d 100644 --- a/FM.cpp +++ b/FM.cpp @@ -602,6 +602,10 @@ void CFM::timeoutRFState(bool validSignal) if (!validSignal) { DEBUG1("State to TIMEOUT_WAIT_RF"); m_state = FS_TIMEOUT_WAIT_RF; + + if (m_callsignAtEnd) + sendCallsign(); + m_ackDelayTimer.start(); } From 296ac888425b4a13367d70bfc80bd41639174bf2 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sat, 16 May 2020 12:08:26 +0200 Subject: [PATCH 5/5] Correct length --- SerialPort.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SerialPort.cpp b/SerialPort.cpp index 6518ebf..8d5040b 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -1301,7 +1301,7 @@ void CSerialPort::writeFMEOT() uint8_t reply[10U]; reply[0U] = MMDVM_FRAME_START; - reply[1U] = 4U; + reply[1U] = 3U; reply[2U] = MMDVM_FM_EOT; writeInt(1U, reply, 3U);