diff --git a/man/atest.1 b/man/atest.1 index a1b554c..58c90f6 100644 --- a/man/atest.1 +++ b/man/atest.1 @@ -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. .P 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 .PD diff --git a/src/atest.c b/src/atest.c index aec626f..733e8c4 100644 --- a/src/atest.c +++ b/src/atest.c @@ -2,7 +2,7 @@ // // 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 // 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 */ /* 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) { - B_opt = 12345; // See special case below. + B_opt = 0xA15A15; // See special case below. } else if (strcasecmp(optarg, "EAS") == 0) { - B_opt = 23456; // See special case below. + B_opt = 0xEA5EA5; // See special case below. } else { B_opt = atoi(optarg); @@ -425,11 +425,6 @@ int main (int argc, char *argv[]) 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, */ /* 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].mark_freq = 1615; 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 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; // 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". - //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 my_audio_config.achan[0].modem_type = MODEM_AFSK; my_audio_config.achan[0].mark_freq = DEFAULT_MARK_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) { 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; 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].baud = 9600; my_audio_config.achan[0].mark_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. } - 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].baud = 521; // Actually 520.83 but we have an integer field here. // 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. } + 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. */