From bc889f3d264a648138f189112ad01a6425325e0d Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 17 Apr 2020 13:11:21 +0100 Subject: [PATCH] Handle some extra edge cases. --- FM.cpp | 7 +++++-- FMKeyer.cpp | 3 +++ FMTimeout.cpp | 2 +- SerialPort.cpp | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/FM.cpp b/FM.cpp index c455858..3e600eb 100644 --- a/FM.cpp +++ b/FM.cpp @@ -154,6 +154,11 @@ void CFM::stateMachine(bool validSignal, uint8_t length) default: break; } + + if (m_state == FS_LISTENING && m_modemState == STATE_FM) { + if (!m_callsign.isRunning() && !m_rfAck.isRunning()) + m_modemState = STATE_IDLE; + } } void CFM::listeningState(bool validSignal) @@ -188,7 +193,6 @@ void CFM::kerchunkState(bool validSignal) m_ackMinTimer.stop(); m_callsignTimer.stop(); m_holdoffTimer.stop(); - m_modemState = STATE_IDLE; } } @@ -259,7 +263,6 @@ void CFM::hangState(bool validSignal) m_callsignTimer.stop(); m_holdoffTimer.stop(); - m_modemState = STATE_IDLE; } } diff --git a/FMKeyer.cpp b/FMKeyer.cpp index 925a484..77da003 100644 --- a/FMKeyer.cpp +++ b/FMKeyer.cpp @@ -154,6 +154,9 @@ void CFMKeyer::getAudio(q15_t* samples, uint8_t length) void CFMKeyer::start() { + if (isRunning()) + return; + m_wanted = true; m_poPos = 0U; m_dotPos = 0U; diff --git a/FMTimeout.cpp b/FMTimeout.cpp index 0090f2e..38030f4 100644 --- a/FMTimeout.cpp +++ b/FMTimeout.cpp @@ -21,7 +21,7 @@ #include "FMTimeout.h" // 400 Hz sine wave at 24000 Hz sample rate -const q15_t BUSY_AUDIO[] = {0, 3426, 6813, 10126, 13328, 16384, 19261, 21926, 24351, 26510, 28378, 29935, 31164, 32052, 32588, 32768, 32588, 32052, 31164, 29935, 28378, 26510, 24351, +const q15_t BUSY_AUDIO[] = {0, 3426, 6813, 10126, 13328, 16384, 19261, 21926, 24351, 26510, 28378, 29935, 31164, 32052, 32588, 32767, 32588, 32052, 31164, 29935, 28378, 26510, 24351, 21926, 19261, 16384, 13328, 10126, 6813, 3425, 0, -3425, -6813, -10126, -13328, -16384, -19261, -21926, -24351, -26510, -28378, -29935, -31164, -32052, -32588, -32768, -32588, -32052, -31164, -29935, -28378, -26510, -24351, -21926, -19261, -16384, -13328, -10126, -6813, -3425}; const uint8_t BUSY_AUDIO_LEN = 60U; diff --git a/SerialPort.cpp b/SerialPort.cpp index 7256571..63313e8 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -101,7 +101,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20200415 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20200417 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c ""