Eurosignal: Minor cleanup and fixes

This commit is contained in:
Andreas Eversberg 2021-11-21 09:29:32 +01:00
parent c2a01fb7dd
commit bcdf61ffa5
3 changed files with 22 additions and 13 deletions

View File

@ -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. */

View File

@ -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--;

View File

@ -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);