Clean up atest EAS receive.

This commit is contained in:
wb2osz 2023-04-30 21:48:51 +01:00
parent 4cd63df5be
commit 4ac666df6a
2 changed files with 16 additions and 14 deletions

View File

@ -37,6 +37,10 @@ Data rate in bits/sec. Standard values are 300, 1200, 2400, 4800, 9600.
4800 bps uses 8PSK based on V.27 standard. 4800 bps uses 8PSK based on V.27 standard.
.P .P
9600 bps and up uses K9NG/G3RUH standard. 9600 bps and up uses K9NG/G3RUH standard.
.P
AIS for ship Automatic Identification System.
.P
EAS for Emergency Alert System (EAS) Specific Area Message Encoding (SAME).
.RE .RE
.RE .RE
.PD .PD

View File

@ -2,7 +2,7 @@
// //
// This file is part of Dire Wolf, an amateur radio packet TNC. // This file is part of Dire Wolf, an amateur radio packet TNC.
// //
// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2019, 2021, 2022 John Langner, WB2OSZ // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2019, 2021, 2022, 2023 John Langner, WB2OSZ
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -276,12 +276,12 @@ int main (int argc, char *argv[])
case 'B': /* -B for data Bit rate */ case 'B': /* -B for data Bit rate */
/* Also implies modem type based on speed. */ /* Also implies modem type based on speed. */
/* Special case "AIS" rather than number. */ /* Special cases AIS, EAS rather than number. */
if (strcasecmp(optarg, "AIS") == 0) { if (strcasecmp(optarg, "AIS") == 0) {
B_opt = 12345; // See special case below. B_opt = 0xA15A15; // See special case below.
} }
else if (strcasecmp(optarg, "EAS") == 0) { else if (strcasecmp(optarg, "EAS") == 0) {
B_opt = 23456; // See special case below. B_opt = 0xEA5EA5; // See special case below.
} }
else { else {
B_opt = atoi(optarg); B_opt = atoi(optarg);
@ -425,11 +425,6 @@ int main (int argc, char *argv[])
my_audio_config.achan[0].baud = B_opt; my_audio_config.achan[0].baud = B_opt;
if (my_audio_config.achan[0].baud < MIN_BAUD || my_audio_config.achan[0].baud > MAX_BAUD) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Use a more reasonable bit rate in range of %d - %d.\n", MIN_BAUD, MAX_BAUD);
exit (EXIT_FAILURE);
}
/* We have similar logic in direwolf.c, config.c, gen_packets.c, and atest.c, */ /* We have similar logic in direwolf.c, config.c, gen_packets.c, and atest.c, */
/* that need to be kept in sync. Maybe it could be a common function someday. */ /* that need to be kept in sync. Maybe it could be a common function someday. */
@ -438,7 +433,6 @@ int main (int argc, char *argv[])
my_audio_config.achan[0].modem_type = MODEM_AFSK; my_audio_config.achan[0].modem_type = MODEM_AFSK;
my_audio_config.achan[0].mark_freq = 1615; my_audio_config.achan[0].mark_freq = 1615;
my_audio_config.achan[0].space_freq = 1785; my_audio_config.achan[0].space_freq = 1785;
//strlcpy (my_audio_config.achan[0].profiles, "A", sizeof(my_audio_config.achan[0].profiles));
} }
else if (my_audio_config.achan[0].baud < 600) { // e.g. HF SSB packet else if (my_audio_config.achan[0].baud < 600) { // e.g. HF SSB packet
my_audio_config.achan[0].modem_type = MODEM_AFSK; my_audio_config.achan[0].modem_type = MODEM_AFSK;
@ -446,13 +440,11 @@ int main (int argc, char *argv[])
my_audio_config.achan[0].space_freq = 1800; my_audio_config.achan[0].space_freq = 1800;
// Previously we had a "D" which was fine tuned for 300 bps. // Previously we had a "D" which was fine tuned for 300 bps.
// In v1.7, it's not clear if we should use "B" or just stick with "A". // In v1.7, it's not clear if we should use "B" or just stick with "A".
//strlcpy (my_audio_config.achan[0].profiles, "B", sizeof(my_audio_config.achan[0].profiles));
} }
else if (my_audio_config.achan[0].baud < 1800) { // common 1200 else if (my_audio_config.achan[0].baud < 1800) { // common 1200
my_audio_config.achan[0].modem_type = MODEM_AFSK; my_audio_config.achan[0].modem_type = MODEM_AFSK;
my_audio_config.achan[0].mark_freq = DEFAULT_MARK_FREQ; my_audio_config.achan[0].mark_freq = DEFAULT_MARK_FREQ;
my_audio_config.achan[0].space_freq = DEFAULT_SPACE_FREQ; my_audio_config.achan[0].space_freq = DEFAULT_SPACE_FREQ;
// Should default to E+ or something similar later.
} }
else if (my_audio_config.achan[0].baud < 3600) { else if (my_audio_config.achan[0].baud < 3600) {
my_audio_config.achan[0].modem_type = MODEM_QPSK; my_audio_config.achan[0].modem_type = MODEM_QPSK;
@ -466,14 +458,14 @@ int main (int argc, char *argv[])
my_audio_config.achan[0].space_freq = 0; my_audio_config.achan[0].space_freq = 0;
strlcpy (my_audio_config.achan[0].profiles, "", sizeof(my_audio_config.achan[0].profiles)); strlcpy (my_audio_config.achan[0].profiles, "", sizeof(my_audio_config.achan[0].profiles));
} }
else if (my_audio_config.achan[0].baud == 12345) { // Hack for different use of 9600 else if (my_audio_config.achan[0].baud == 0xA15A15) { // Hack for different use of 9600
my_audio_config.achan[0].modem_type = MODEM_AIS; my_audio_config.achan[0].modem_type = MODEM_AIS;
my_audio_config.achan[0].baud = 9600; my_audio_config.achan[0].baud = 9600;
my_audio_config.achan[0].mark_freq = 0; my_audio_config.achan[0].mark_freq = 0;
my_audio_config.achan[0].space_freq = 0; my_audio_config.achan[0].space_freq = 0;
strlcpy (my_audio_config.achan[0].profiles, " ", sizeof(my_audio_config.achan[0].profiles)); // avoid getting default later. strlcpy (my_audio_config.achan[0].profiles, " ", sizeof(my_audio_config.achan[0].profiles)); // avoid getting default later.
} }
else if (my_audio_config.achan[0].baud == 23456) { else if (my_audio_config.achan[0].baud == 0xEA5EA5) {
my_audio_config.achan[0].modem_type = MODEM_EAS; my_audio_config.achan[0].modem_type = MODEM_EAS;
my_audio_config.achan[0].baud = 521; // Actually 520.83 but we have an integer field here. my_audio_config.achan[0].baud = 521; // Actually 520.83 but we have an integer field here.
// Will make more precise in afsk demod init. // Will make more precise in afsk demod init.
@ -488,6 +480,12 @@ int main (int argc, char *argv[])
strlcpy (my_audio_config.achan[0].profiles, " ", sizeof(my_audio_config.achan[0].profiles)); // avoid getting default later. strlcpy (my_audio_config.achan[0].profiles, " ", sizeof(my_audio_config.achan[0].profiles)); // avoid getting default later.
} }
if (my_audio_config.achan[0].baud < MIN_BAUD || my_audio_config.achan[0].baud > MAX_BAUD) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Use a more reasonable bit rate in range of %d - %d.\n", MIN_BAUD, MAX_BAUD);
exit (EXIT_FAILURE);
}
/* /*
* -g option means force g3RUH regardless of speed. * -g option means force g3RUH regardless of speed.
*/ */