Eurosignal: Minor cleanup and fixes
This commit is contained in:
parent
c2a01fb7dd
commit
bcdf61ffa5
|
@ -46,7 +46,7 @@
|
||||||
#define FREQUENCY_MAX 1153.1
|
#define FREQUENCY_MAX 1153.1
|
||||||
#define FREQUENCY_TOL 15.0 /* tolerance of frequency */
|
#define FREQUENCY_TOL 15.0 /* tolerance of frequency */
|
||||||
#define DIGIT_DETECT 200 /* time for a tone to sustain (in samples) */
|
#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 {
|
static struct dsp_digits {
|
||||||
char digit;
|
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)
|
void sender_receive(sender_t *sender, sample_t *samples, int length, double __attribute__((unused)) rf_level_db)
|
||||||
{
|
{
|
||||||
euro_t *euro = (euro_t *) sender;
|
euro_t *euro = (euro_t *) sender;
|
||||||
sample_t down[length];
|
|
||||||
int count;
|
|
||||||
|
|
||||||
/* downsample and decode */
|
if (euro->rx) {
|
||||||
memcpy(down, samples, sizeof(down)); // copy, so audio will not be corrupted at loopback
|
sample_t down[length];
|
||||||
count = samplerate_downsample(&euro->sender.srstate, 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);
|
tone_decode(euro, down, count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate tone of paging digits. */
|
/* Generate tone of paging digits. */
|
||||||
|
|
|
@ -362,18 +362,18 @@ void euro_get_id(euro_t *euro, char *id)
|
||||||
euro_call_t *call;
|
euro_call_t *call;
|
||||||
int i;
|
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) {
|
if (euro->scan_from < euro->scan_to) {
|
||||||
sprintf(id, "%06d", euro->scan_from++);
|
sprintf(id, "%06d", euro->scan_from++);
|
||||||
PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Transmitting ID '%s'.\n", id);
|
PDEBUG_CHAN(DEURO, DEBUG_NOTICE, "Transmitting ID '%s'.\n", id);
|
||||||
goto encode;
|
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) {
|
for (call = euro->call_list; call; call = call->next) {
|
||||||
if ((call->state == EURO_CALL_ACKNOWLEDGE || call->state == EURO_CALL_RELEASED) && call->page_count) {
|
if ((call->state == EURO_CALL_ACKNOWLEDGE || call->state == EURO_CALL_RELEASED) && call->page_count) {
|
||||||
call->page_count--;
|
call->page_count--;
|
||||||
|
|
|
@ -163,6 +163,9 @@ int main(int argc, char *argv[])
|
||||||
const char *station_id = "";
|
const char *station_id = "";
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* eurosignal does not use emphasis, so disable it */
|
||||||
|
uses_emphasis = 0;
|
||||||
|
|
||||||
/* init common tones */
|
/* init common tones */
|
||||||
init_besetzton();
|
init_besetzton();
|
||||||
|
|
||||||
|
@ -222,6 +225,10 @@ int main(int argc, char *argv[])
|
||||||
if (!tx && !rx)
|
if (!tx && !rx)
|
||||||
tx = 1;
|
tx = 1;
|
||||||
|
|
||||||
|
/* TX & RX if loopback */
|
||||||
|
if (loopback)
|
||||||
|
tx = rx = 1;
|
||||||
|
|
||||||
/* create transceiver instance */
|
/* create transceiver instance */
|
||||||
for (i = 0; i < num_kanal; i++) {
|
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);
|
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);
|
||||||
|
|
Loading…
Reference in New Issue