From e3f35e0875b512db63d227d85b809e453a541439 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 17 Nov 2016 11:29:43 +0100 Subject: [PATCH 1/3] Add carrier detect LED to MMDVM firmware --- IO.cpp | 5 +++++ IO.h | 2 ++ SerialPort.cpp | 9 +++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/IO.cpp b/IO.cpp index 282a7de..b7721a2 100644 --- a/IO.cpp +++ b/IO.cpp @@ -312,6 +312,11 @@ void CIO::setDecode(bool dcd) m_dcd = dcd; } +bool CIO::getDecode() +{ + return m_dcd; +} + void CIO::setADCDetection(bool detect) { m_detect = detect; diff --git a/IO.h b/IO.h index 2113358..39f2364 100644 --- a/IO.h +++ b/IO.h @@ -51,6 +51,8 @@ public: bool hasLockout() const; + bool getDecode(); + void resetWatchdog(); private: diff --git a/SerialPort.cpp b/SerialPort.cpp index b623332..0f02897 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -116,7 +116,7 @@ void CSerialPort::getStatus() // Send all sorts of interesting internal values reply[0U] = MMDVM_FRAME_START; - reply[1U] = 11U; + reply[1U] = 12U; reply[2U] = MMDVM_GET_STATUS; reply[3U] = 0x00U; @@ -180,7 +180,12 @@ void CSerialPort::getStatus() else reply[10U] = 0U; - writeInt(1U, reply, 11); + if (io.getDecode()) + reply[11U] = 1U; + else + reply[11U] = 0U; + + writeInt(1U, reply, 12); } void CSerialPort::getVersion() From 230fab308cec01f76739ba0f44be22d88c100370 Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 17 Nov 2016 14:05:19 +0100 Subject: [PATCH 2/3] Make m_dcd global variable and save extra function --- Globals.h | 1 + IO.cpp | 6 ------ IO.h | 1 - MMDVM.cpp | 3 ++- MMDVM.ino | 3 ++- SerialPort.cpp | 2 +- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Globals.h b/Globals.h index 82d4f8e..b0e29bc 100644 --- a/Globals.h +++ b/Globals.h @@ -86,6 +86,7 @@ extern bool m_p25Enable; extern bool m_duplex; extern bool m_tx; +extern bool m_dcd; extern uint32_t m_sampleCount; extern bool m_sampleInsert; diff --git a/IO.cpp b/IO.cpp index b7721a2..006a47c 100644 --- a/IO.cpp +++ b/IO.cpp @@ -61,7 +61,6 @@ m_ysfTXLevel(128 * 128), m_p25TXLevel(128 * 128), m_ledCount(0U), m_ledValue(true), -m_dcd(false), m_detect(false), m_adcOverflow(0U), m_dacOverflow(0U), @@ -312,11 +311,6 @@ void CIO::setDecode(bool dcd) m_dcd = dcd; } -bool CIO::getDecode() -{ - return m_dcd; -} - void CIO::setADCDetection(bool detect) { m_detect = detect; diff --git a/IO.h b/IO.h index 39f2364..27379ed 100644 --- a/IO.h +++ b/IO.h @@ -78,7 +78,6 @@ private: uint32_t m_ledCount; bool m_ledValue; - bool m_dcd; bool m_detect; uint16_t m_adcOverflow; diff --git a/MMDVM.cpp b/MMDVM.cpp index 4f21843..9a410ff 100644 --- a/MMDVM.cpp +++ b/MMDVM.cpp @@ -33,7 +33,8 @@ bool m_p25Enable = true; bool m_duplex = true; -bool m_tx = false; +bool m_tx = false; +bool m_dcd = false; uint32_t m_sampleCount = 0U; bool m_sampleInsert = false; diff --git a/MMDVM.ino b/MMDVM.ino index dac658a..7b30b41 100644 --- a/MMDVM.ino +++ b/MMDVM.ino @@ -30,7 +30,8 @@ bool m_p25Enable = true; bool m_duplex = true; -bool m_tx = false; +bool m_tx = false; +bool m_dcd = false; uint32_t m_sampleCount = 0U; bool m_sampleInsert = false; diff --git a/SerialPort.cpp b/SerialPort.cpp index 0f02897..b77de92 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -180,7 +180,7 @@ void CSerialPort::getStatus() else reply[10U] = 0U; - if (io.getDecode()) + if (m_dcd) reply[11U] = 1U; else reply[11U] = 0U; From afce2b6cb9cba9351db61b36f1d4175b855c188a Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 17 Nov 2016 14:07:08 +0100 Subject: [PATCH 3/3] Remove forgotten function definition --- IO.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/IO.h b/IO.h index 27379ed..357c04e 100644 --- a/IO.h +++ b/IO.h @@ -51,8 +51,6 @@ public: bool hasLockout() const; - bool getDecode(); - void resetWatchdog(); private: