mirror of https://github.com/g4klx/MMDVM.git
Add a bery simple FM mode for internet gatewaying.
This commit is contained in:
parent
a5eaafc7e0
commit
70bf47f93e
78
FM.cpp
78
FM.cpp
|
@ -28,13 +28,6 @@ const uint16_t FM_SERIAL_BLOCK_SIZE = 80U;//this is the number of sample pairs t
|
|||
//three times this value shall never exceed 252
|
||||
const uint16_t FM_SERIAL_BLOCK_SIZE_BYTES = FM_SERIAL_BLOCK_SIZE * 3U;
|
||||
|
||||
/*
|
||||
* Access Mode values are:
|
||||
* 0 - Carrier access with COS
|
||||
* 1 - CTCSS only access without COS
|
||||
* 2 - CTCSS only access with COS
|
||||
* 3 - CTCSS only access with COS to start, then carrier access with COS
|
||||
*/
|
||||
|
||||
CFM::CFM() :
|
||||
m_callsign(),
|
||||
|
@ -63,6 +56,7 @@ m_filterStage2(32768, 0,-32768, 32768, -50339, 19052),
|
|||
m_filterStage3(32768, -65536, 32768, 32768, -64075, 31460),
|
||||
m_blanking(),
|
||||
m_accessMode(1U),
|
||||
m_simpleMode(false),
|
||||
m_cosInvert(false),
|
||||
m_noiseSquelch(false),
|
||||
m_rfAudioBoost(1U),
|
||||
|
@ -317,9 +311,10 @@ uint8_t CFM::setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_
|
|||
return m_rfAck.setParams(rfAck, speed, frequency, level, level);
|
||||
}
|
||||
|
||||
uint8_t CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, uint8_t accessMode, bool cosInvert, bool noiseSquelch, uint8_t squelchHighThreshold, uint8_t squelchLowThreshold, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel)
|
||||
uint8_t CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, uint8_t accessMode, bool simpleMode, bool cosInvert, bool noiseSquelch, uint8_t squelchHighThreshold, uint8_t squelchLowThreshold, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel)
|
||||
{
|
||||
m_accessMode = accessMode;
|
||||
m_simpleMode = simpleMode;
|
||||
m_cosInvert = cosInvert;
|
||||
m_noiseSquelch = noiseSquelch;
|
||||
|
||||
|
@ -356,10 +351,14 @@ uint8_t CFM::setExt(const char* ack, uint8_t audioBoost, uint8_t speed, uint16_t
|
|||
|
||||
void CFM::stateMachine(bool validRFSignal, bool validExtSignal)
|
||||
{
|
||||
if (m_duplex)
|
||||
duplexStateMachine(validRFSignal, validExtSignal);
|
||||
else
|
||||
simplexStateMachine(validRFSignal, validExtSignal);
|
||||
if (m_simpleMode) {
|
||||
simpleStateMachine(validRFSignal, validExtSignal);
|
||||
} else {
|
||||
if (m_duplex)
|
||||
duplexStateMachine(validRFSignal, validExtSignal);
|
||||
else
|
||||
simplexStateMachine(validRFSignal, validExtSignal);
|
||||
}
|
||||
}
|
||||
|
||||
void CFM::simplexStateMachine(bool validRFSignal, bool validExtSignal)
|
||||
|
@ -1009,6 +1008,61 @@ void CFM::timeoutExtWaitStateSimplex(bool validSignal)
|
|||
}
|
||||
}
|
||||
|
||||
void CFM::simpleStateMachine(bool validRFSignal, bool validExtSignal)
|
||||
{
|
||||
switch (m_state) {
|
||||
case FS_LISTENING:
|
||||
if (validRFSignal) {
|
||||
io.setDecode(true);
|
||||
io.setADCDetection(true);
|
||||
|
||||
insertSilence(50U);
|
||||
|
||||
DEBUG1("State to RELAYING_RF");
|
||||
m_state = FS_RELAYING_RF;
|
||||
serial.writeFMStatus(m_state);
|
||||
} else if (validExtSignal) {
|
||||
io.setDecode(true);
|
||||
io.setADCDetection(true);
|
||||
|
||||
insertSilence(50U);
|
||||
|
||||
DEBUG1("State to RELAYING_EXT");
|
||||
m_state = FS_RELAYING_EXT;
|
||||
serial.writeFMStatus(m_state);
|
||||
}
|
||||
break;
|
||||
|
||||
case FS_RELAYING_RF:
|
||||
if (!validRFSignal) {
|
||||
io.setDecode(false);
|
||||
io.setADCDetection(false);
|
||||
|
||||
DEBUG1("State to LISTENING");
|
||||
m_state = FS_LISTENING;
|
||||
|
||||
if (m_extEnabled)
|
||||
serial.writeFMEOT();
|
||||
|
||||
if (m_duplex)
|
||||
m_needReverse = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case FS_RELAYING_EXT:
|
||||
if (!validExtSignal) {
|
||||
io.setDecode(false);
|
||||
io.setADCDetection(false);
|
||||
|
||||
DEBUG1("State to LISTENING");
|
||||
m_state = FS_LISTENING;
|
||||
|
||||
m_needReverse = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CFM::sendCallsign()
|
||||
{
|
||||
if (m_holdoffTimer.isRunning()) {
|
||||
|
|
7
FM.h
7
FM.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2020,2021 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
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, bool callsignAtLatch);
|
||||
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 ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, uint8_t accessMode, bool cosInvert, bool noiseSquelch, uint8_t squelchHighThreshold, uint8_t squelchLowThreshold, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel);
|
||||
uint8_t setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssHighThreshold, uint8_t ctcssLowThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, uint8_t accessMode, bool simpleMode, bool cosInvert, bool noiseSquelch, uint8_t squelchHighThreshold, uint8_t squelchLowThreshold, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel);
|
||||
uint8_t setExt(const char* ack, uint8_t audioBoost, uint8_t speed, uint16_t frequency, uint8_t level);
|
||||
|
||||
uint8_t getSpace() const;
|
||||
|
@ -97,6 +97,7 @@ private:
|
|||
CFMDirectFormI m_filterStage3;
|
||||
CFMBlanking m_blanking;
|
||||
uint8_t m_accessMode;
|
||||
bool m_simpleMode;
|
||||
bool m_cosInvert;
|
||||
bool m_noiseSquelch;
|
||||
q15_t m_rfAudioBoost;
|
||||
|
@ -135,6 +136,8 @@ private:
|
|||
void timeoutExtStateSimplex(bool validSignal);
|
||||
void timeoutExtWaitStateSimplex(bool validSignal);
|
||||
|
||||
void simpleStateMachine(bool validRFSignal, bool validExtSignal);
|
||||
|
||||
void clock(uint8_t length);
|
||||
|
||||
void sendCallsign();
|
||||
|
|
|
@ -652,6 +652,7 @@ uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint16_t length)
|
|||
uint8_t hangTime = data[7U];
|
||||
|
||||
uint8_t accessMode = data[8U] & 0x0FU;
|
||||
bool simpleMode = (data[8U] & 0x20U) == 0x20U;
|
||||
bool noiseSquelch = (data[8U] & 0x40U) == 0x40U;
|
||||
bool cosInvert = (data[8U] & 0x80U) == 0x80U;
|
||||
|
||||
|
@ -662,7 +663,7 @@ uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint16_t length)
|
|||
uint8_t squelchHighThreshold = data[12U];
|
||||
uint8_t squelchLowThreshold = data[13U];
|
||||
|
||||
return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, accessMode, cosInvert, noiseSquelch, squelchHighThreshold, squelchLowThreshold, rfAudioBoost, maxDev, rxLevel);
|
||||
return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssHighThreshold, ctcssLowThreshold, ctcssLevel, kerchunkTime, hangTime, accessMode, simpleMode, cosInvert, noiseSquelch, squelchHighThreshold, squelchLowThreshold, rfAudioBoost, maxDev, rxLevel);
|
||||
}
|
||||
|
||||
uint8_t CSerialPort::setFMParams4(const uint8_t* data, uint16_t length)
|
||||
|
|
Loading…
Reference in New Issue