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

pull/114/head
Silvano Seva 2022-08-12 09:30:26 +02:00
rodzic fa33f15417
commit d11bb903b1
4 zmienionych plików z 25 dodań i 11 usunięć

Wyświetl plik

@ -18,6 +18,14 @@ def = {}
def += {'FONT_UBUNTU_REGULAR': ''}
# 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 -------------------------
##

Wyświetl plik

@ -75,7 +75,14 @@ public:
* @param isLast: flag signalling that current block is the last one being
* 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:
@ -89,9 +96,6 @@ private:
*/
void sendBaseband();
/** Gracefully end the transmission **/
void stop();
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_FRAME_SAMPLES = M17_FRAME_SYMBOLS * M17_SAMPLES_PER_SYMBOL;

Wyświetl plik

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

Wyświetl plik

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