From bcdf61ffa5864c9d758ad7d5d030e39bc842c8cd Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 21 Nov 2021 09:29:32 +0100 Subject: [PATCH] Eurosignal: Minor cleanup and fixes --- src/eurosignal/dsp.c | 16 +++++++++------- src/eurosignal/eurosignal.c | 12 ++++++------ src/eurosignal/main.c | 7 +++++++ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/eurosignal/dsp.c b/src/eurosignal/dsp.c index 119fc21..dc8bf92 100644 --- a/src/eurosignal/dsp.c +++ b/src/eurosignal/dsp.c @@ -46,7 +46,7 @@ #define FREQUENCY_MAX 1153.1 #define FREQUENCY_TOL 15.0 /* tolerance of frequency */ #define DIGIT_DETECT 200 /* time for a tone to sustain (in samples) */ -#define TIMEOUT_DETECT 4000 /* time for a tone to sustain (in samples) */ +#define TIMEOUT_DETECT 4000 /* time for timeout detection (in samples) */ static struct dsp_digits { char digit; @@ -256,15 +256,17 @@ static void tone_decode(euro_t *euro, sample_t *samples, int length) void sender_receive(sender_t *sender, sample_t *samples, int length, double __attribute__((unused)) rf_level_db) { euro_t *euro = (euro_t *) sender; - sample_t down[length]; - int count; - /* downsample and decode */ - memcpy(down, samples, sizeof(down)); // copy, so audio will not be corrupted at loopback - count = samplerate_downsample(&euro->sender.srstate, down, length); + if (euro->rx) { + sample_t down[length]; + int count; + + /* downsample and decode */ + memcpy(down, samples, sizeof(down)); // copy, so audio will not be corrupted at loopback + count = samplerate_downsample(&euro->sender.srstate, down, length); - if (euro->rx) tone_decode(euro, down, count); + } } /* Generate tone of paging digits. */ diff --git a/src/eurosignal/eurosignal.c b/src/eurosignal/eurosignal.c index a38c228..5ad37d1 100644 --- a/src/eurosignal/eurosignal.c +++ b/src/eurosignal/eurosignal.c @@ -362,18 +362,18 @@ void euro_get_id(euro_t *euro, char *id) euro_call_t *call; int i; - if (euro->sender.loopback) { - PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Transmitting test ID '123456'.\n"); - memcpy(id, "123456", 6); - goto encode; - } - if (euro->scan_from < euro->scan_to) { sprintf(id, "%06d", euro->scan_from++); PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Transmitting ID '%s'.\n", id); goto encode; } + if (euro->sender.loopback) { + PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Transmitting test ID '123456'.\n"); + memcpy(id, "123456", 6); + goto encode; + } + for (call = euro->call_list; call; call = call->next) { if ((call->state == EURO_CALL_ACKNOWLEDGE || call->state == EURO_CALL_RELEASED) && call->page_count) { call->page_count--; diff --git a/src/eurosignal/main.c b/src/eurosignal/main.c index 2aaedb4..8d0b5bc 100644 --- a/src/eurosignal/main.c +++ b/src/eurosignal/main.c @@ -163,6 +163,9 @@ int main(int argc, char *argv[]) const char *station_id = ""; int i; + /* eurosignal does not use emphasis, so disable it */ + uses_emphasis = 0; + /* init common tones */ init_besetzton(); @@ -222,6 +225,10 @@ int main(int argc, char *argv[]) if (!tx && !rx) tx = 1; + /* TX & RX if loopback */ + if (loopback) + tx = rx = 1; + /* create transceiver instance */ for (i = 0; i < num_kanal; i++) { rc = euro_create(kanal[i], dsp_device[i], use_sdr, dsp_samplerate, rx_gain, tx_gain, fm, tx, rx, repeat, degraded, random_id, scan_from, scan_to, write_rx_wave, write_tx_wave, read_rx_wave, read_tx_wave, loopback);