From 2434e5f13be129b8aa6b7f100eeebbacbf461b55 Mon Sep 17 00:00:00 2001 From: wb2osz Date: Tue, 8 Aug 2023 17:34:06 +0100 Subject: [PATCH] Minor cleanups. --- src/config.c | 3 ++- src/direwolf.c | 6 +++--- src/igate.c | 22 ---------------------- src/log.c | 2 +- src/pfilter.c | 5 +++++ src/recv.c | 8 +++++--- systemd/direwolf.service | 3 +++ 7 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/config.c b/src/config.c index f3edc15..b1b0829 100644 --- a/src/config.c +++ b/src/config.c @@ -5775,8 +5775,9 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_ else if (strcasecmp(keyword, "POWER") == 0) { b->power = atoi(value); } - else if (strcasecmp(keyword, "HEIGHT") == 0) { + else if (strcasecmp(keyword, "HEIGHT") == 0) { // This is in feet. b->height = atoi(value); + // TODO: ability to add units suffix, e.g. 10m } else if (strcasecmp(keyword, "GAIN") == 0) { b->gain = atoi(value); diff --git a/src/direwolf.c b/src/direwolf.c index 1a92968..8735193 100644 --- a/src/direwolf.c +++ b/src/direwolf.c @@ -300,8 +300,8 @@ int main (int argc, char *argv[]) text_color_init(t_opt); text_color_set(DW_COLOR_INFO); - //dw_printf ("Dire Wolf version %d.%d (%s) Beta Test 4\n", MAJOR_VERSION, MINOR_VERSION, __DATE__); - dw_printf ("Dire Wolf DEVELOPMENT version %d.%d %s (%s)\n", MAJOR_VERSION, MINOR_VERSION, "G", __DATE__); + dw_printf ("Dire Wolf version %d.%d (%s) BETA TEST 4\n", MAJOR_VERSION, MINOR_VERSION, __DATE__); + //dw_printf ("Dire Wolf DEVELOPMENT version %d.%d %s (%s)\n", MAJOR_VERSION, MINOR_VERSION, "G", __DATE__); //dw_printf ("Dire Wolf version %d.%d\n", MAJOR_VERSION, MINOR_VERSION); @@ -387,7 +387,7 @@ int main (int argc, char *argv[]) dw_printf ("\n"); dw_printf ("Dire Wolf requires only privileges available to ordinary users.\n"); dw_printf ("Running this as root is an unnecessary security risk.\n"); - SLEEP_SEC(1); + //SLEEP_SEC(1); } } #endif diff --git a/src/igate.c b/src/igate.c index 11f2896..d77d78c 100644 --- a/src/igate.c +++ b/src/igate.c @@ -1749,7 +1749,6 @@ static void * satgate_delay_thread (void *arg) * *--------------------------------------------------------------------*/ -#warning - clean up // It is unforunate that the : data type indicator (DTI) was overloaded with // so many different meanings. Simply looking at the DTI is not adequate for @@ -1825,9 +1824,6 @@ static void maybe_xmit_packet_from_igate (char *message, int to_chan) *gt = '\0'; } -// FIXME NO! - ///////ax25_get_addr_with_ssid (pp3, AX25_SOURCE, src); - /* * Drop if path contains: * NOGATE or RFONLY - means IGate should not pass them. @@ -2472,24 +2468,6 @@ void ig_to_tx_remember (packet_t pp, int chan, int bydigi) } -#warning remove - -static int is_message_overload (char *infop) -{ - if (*infop != ':') return (0); - if (strlen(infop) < 16) return (0); - if (strncmp(infop+10, ":PARM.", 6) == 0) return (1); - if (strncmp(infop+10, ":UNIT.", 6) == 0) return (1); - if (strncmp(infop+10, ":EQNS.", 6) == 0) return (1); - if (strncmp(infop+10, ":BITS.", 6) == 0) return (1); - if (strncmp(infop+1, "BLN", 3) == 0) return (1); - if (strncmp(infop+1, "NWS", 3) == 0) return (1); - if (strncmp(infop+1, "SKY", 3) == 0) return (1); - if (strncmp(infop+1, "CWA", 3) == 0) return (1); - if (strncmp(infop+1, "BOM", 3) == 0) return (1); - return (0); -} - static int ig_to_tx_allow (packet_t pp, int chan) { diff --git a/src/log.c b/src/log.c index c8b2f82..d7ef544 100644 --- a/src/log.c +++ b/src/log.c @@ -224,7 +224,7 @@ void log_write (int chan, decode_aprs_t *A, packet_t pp, alevel_t alevel, retry_ now = time(NULL); // Get current time. (void)gmtime_r (&now, &tm); - +// FIXME: https://github.com/wb2osz/direwolf/issues/473 if (g_daily_names) { diff --git a/src/pfilter.c b/src/pfilter.c index b7ad63e..35767a6 100644 --- a/src/pfilter.c +++ b/src/pfilter.c @@ -1303,6 +1303,11 @@ static int filt_s (pfstate_t *pf) * what they are for other digipeaters. * I think the best solution is to simply ignore the hop count. * + * Release 1.7: I got overly ambitious and now realize this is just giving people too much + * "rope to hang themselves," drop messages unexpectedly, and accidentally break messaging. + * Change documentation to mention only the time limit. + * The other functionality will be undocumented and maybe disappear over time. + * *------------------------------------------------------------------------------*/ static int filt_i (pfstate_t *pf) diff --git a/src/recv.c b/src/recv.c index 9873bbd..a6b4afb 100644 --- a/src/recv.c +++ b/src/recv.c @@ -207,7 +207,7 @@ static void * recv_adev_thread (void *arg) int eof; /* This audio device can have one (mono) or two (stereo) channels. */ - /* Find number of the first channel. */ + /* Find number of the first channel and number of channels. */ int first_chan = ADEVFIRSTCHAN(a); int num_chan = save_pa->adev[a].num_channels; @@ -234,6 +234,8 @@ static void * recv_adev_thread (void *arg) if (audio_sample >= 256 * 256) eof = 1; + // Future? provide more flexible mapping. + // i.e. for each valid channel where audio_source[] is first_chan+c. multi_modem_process_sample(first_chan + c, audio_sample); @@ -262,14 +264,14 @@ static void * recv_adev_thread (void *arg) aprs_tt_button (first_chan + c, tt); } } - } + } // for c is just 0 or 0 then 1 /* When a complete frame is accumulated, */ /* dlq_rec_frame, is called. */ /* recv_process, below, drains the queue. */ - } + } // while !eof on audio stream // What should we do now? // Seimply terminate the application? diff --git a/systemd/direwolf.service b/systemd/direwolf.service index d4109a0..c3380fa 100644 --- a/systemd/direwolf.service +++ b/systemd/direwolf.service @@ -1,6 +1,7 @@ [Unit] Description=Direwolf Sound Card-based AX.25 TNC After=sound.target +After=network.target [Service] EnvironmentFile=/etc/sysconfig/direwolf @@ -22,3 +23,5 @@ ReadWritePaths=/var/log/direwolf [Install] WantedBy=multi-user.target DefaultInstance=1 + +# alternate version: https://www.f4fxl.org/start-direwolf-at-boot-the-systemd-way/