From 8ca756ec223804751c896e47ba7066e6eb096710 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sat, 18 Apr 2020 13:47:41 +0100 Subject: [PATCH] Simplify the FM arguments. --- FM.cpp | 4 ++-- FM.h | 2 +- SerialPort.cpp | 15 +++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/FM.cpp b/FM.cpp index af70fb1..4ff0a6a 100644 --- a/FM.cpp +++ b/FM.cpp @@ -105,7 +105,7 @@ void CFM::reset() { } -uint8_t CFM::setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd) +uint8_t CFM::setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t level, bool callsignAtStart, bool callsignAtEnd) { m_callsignAtStart = callsignAtStart; m_callsignAtEnd = callsignAtEnd; @@ -118,7 +118,7 @@ uint8_t CFM::setCallsign(const char* callsign, uint8_t speed, uint16_t frequency m_holdoffTimer.setTimeout(holdoffTime, 0U); m_callsignTimer.setTimeout(callsignTime, 0U); - return m_callsign.setParams(callsign, speed, frequency, lowLevel); + return m_callsign.setParams(callsign, speed, frequency, level); } uint8_t CFM::setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level) diff --git a/FM.h b/FM.h index bcea9ab..b96ccc8 100644 --- a/FM.h +++ b/FM.h @@ -47,7 +47,7 @@ public: void reset(); - uint8_t setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd); + uint8_t setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t level, bool callsignAtStart, bool callsignAtEnd); uint8_t setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level); uint8_t setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime); diff --git a/SerialPort.cpp b/SerialPort.cpp index 63313e8..45624da 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -101,7 +101,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U; #define HW_TYPE "MMDVM" #endif -#define DESCRIPTION "20200417 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" +#define DESCRIPTION "20200418 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #if defined(GITVERSION) #define concat(h, a, b, c) h " " a " " b " GitID #" c "" @@ -365,26 +365,25 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length) uint8_t CSerialPort::setFMParams1(const uint8_t* data, uint8_t length) { - if (length < 8U) + if (length < 7U) return 4U; uint8_t speed = data[0U];; uint16_t frequency = data[1U] * 10U; uint8_t time = data[2U]; uint8_t holdoff = data[3U]; - uint8_t highLevel = data[4U]; - uint8_t lowLevel = data[5U]; + uint8_t level = data[4U]; - bool callAtStart = (data[6U] & 0x01U) == 0x01U; - bool callAtEnd = (data[6U] & 0x02U) == 0x02U; + bool callAtStart = (data[5U] & 0x01U) == 0x01U; + bool callAtEnd = (data[5U] & 0x02U) == 0x02U; char callsign[50U]; uint8_t n = 0U; - for (uint8_t i = 7U; i < length; i++, n++) + for (uint8_t i = 6U; i < length; i++, n++) callsign[n] = data[i]; callsign[n] = '\0'; - return fm.setCallsign(callsign, speed, frequency, time, holdoff, highLevel, lowLevel, callAtStart, callAtEnd); + return fm.setCallsign(callsign, speed, frequency, time, holdoff, level, callAtStart, callAtEnd); } uint8_t CSerialPort::setFMParams2(const uint8_t* data, uint8_t length)