Made public the M17Modulator.stop() function, added macro to enable the transmission of an M17 EOT frame (disabled by default).

This commit is contained in:
Silvano Seva 2022-08-12 09:30:26 +02:00
parent fa33f15417
commit d11bb903b1
4 changed files with 25 additions and 11 deletions

View File

@ -18,6 +18,14 @@ def = {}
def += {'FONT_UBUNTU_REGULAR': ''} def += {'FONT_UBUNTU_REGULAR': ''}
# def += {'FONT_FREE_SANS': ''} # def += {'FONT_FREE_SANS': ''}
##
## Firmware configuration parameters
##
# Send an M17 EOT frame at the end of transmission
#def += {'M17_ENABLE_EOT' : ''}
## ##
## ----------------- Platform-independent source files ------------------------- ## ----------------- Platform-independent source files -------------------------
## ##

View File

@ -75,7 +75,14 @@ public:
* @param isLast: flag signalling that current block is the last one being * @param isLast: flag signalling that current block is the last one being
* transmitted. * transmitted.
*/ */
void send(const frame_t& frame, const bool isLast); void send(const frame_t& frame);
/**
* Terminate baseband transmission.
* If the macro M17_ENABLE_EOT is defined an EOT frame is sent before
* terminating the transmission.
*/
void stop();
private: private:
@ -89,9 +96,6 @@ private:
*/ */
void sendBaseband(); void sendBaseband();
/** Gracefully end the transmission **/
void stop();
static constexpr size_t M17_TX_SAMPLE_RATE = 48000; static constexpr size_t M17_TX_SAMPLE_RATE = 48000;
static constexpr size_t M17_SAMPLES_PER_SYMBOL = M17_TX_SAMPLE_RATE / M17_SYMBOL_RATE; static constexpr size_t M17_SAMPLES_PER_SYMBOL = M17_TX_SAMPLE_RATE / M17_SYMBOL_RATE;
static constexpr size_t M17_FRAME_SAMPLES = M17_FRAME_SYMBOLS * M17_SAMPLES_PER_SYMBOL; static constexpr size_t M17_FRAME_SAMPLES = M17_FRAME_SYMBOLS * M17_SAMPLES_PER_SYMBOL;

View File

@ -71,7 +71,7 @@ void M17Modulator::terminate()
baseband_buffer.reset(); baseband_buffer.reset();
} }
void M17::M17Modulator::start() void M17Modulator::start()
{ {
if(txRunning) return; if(txRunning) return;
@ -102,7 +102,7 @@ void M17::M17Modulator::start()
} }
void M17Modulator::send(const frame_t& frame, const bool isLast) void M17Modulator::send(const frame_t& frame)
{ {
auto it = symbols.begin(); auto it = symbols.begin();
for(size_t i = 0; i < frame.size(); i++) for(size_t i = 0; i < frame.size(); i++)
@ -113,9 +113,6 @@ void M17Modulator::send(const frame_t& frame, const bool isLast)
symbolsToBaseband(); symbolsToBaseband();
sendBaseband(); sendBaseband();
// If last frame, signal stop of transmission
if(isLast) stop();
} }
void M17Modulator::stop() void M17Modulator::stop()
@ -123,6 +120,7 @@ void M17Modulator::stop()
if(txRunning == false) if(txRunning == false)
return; return;
#ifdef M17_ENABLE_EOT
frame_t eotFrame; frame_t eotFrame;
// Fill EOT frame with 0x55, 0x5D as per M17 spec. // Fill EOT frame with 0x55, 0x5D as per M17 spec.
for(size_t i = 0; i < eotFrame.size(); i += 2) for(size_t i = 0; i < eotFrame.size(); i += 2)
@ -141,6 +139,7 @@ void M17Modulator::stop()
symbolsToBaseband(); symbolsToBaseband();
sendBaseband(); sendBaseband();
#endif
outputStream_stop(outStream); outputStream_stop(outStream);
outputStream_sync(outStream, false); outputStream_sync(outStream, false);

View File

@ -219,7 +219,7 @@ void OpMode_M17::txState(rtxStatus_t *const status)
radio_enableTx(); radio_enableTx();
modulator.start(); modulator.start();
modulator.send(m17Frame, false); modulator.send(m17Frame);
} }
payload_t dataFrame; payload_t dataFrame;
@ -237,5 +237,8 @@ void OpMode_M17::txState(rtxStatus_t *const status)
} }
encoder.encodeStreamFrame(dataFrame, m17Frame, lastFrame); encoder.encodeStreamFrame(dataFrame, m17Frame, lastFrame);
modulator.send(m17Frame, lastFrame); modulator.send(m17Frame);
if(lastFrame)
modulator.stop();
} }