Skip to content

Commit

Permalink
Assorted minor cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
wb2osz committed Nov 25, 2022
1 parent 3973627 commit 07ea828
Show file tree
Hide file tree
Showing 16 changed files with 197 additions and 115 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Why waste $200 and settle for mediocre receive performance from a 1980's technol

![](tnc-test-cd-results.png)

Dire Wolf now includes [FX.25](https://en.wikipedia.org/wiki/FX.25_Forward_Error_Correction) which adds Forward Error Correction (FEC) in a way that is completely compatible with existing systems. If both ends are capable of FX.25, your information will continue to get through under conditions where regular AX.25 is completely useless.
Dire Wolf now includes [FX.25](https://en.wikipedia.org/wiki/FX.25_Forward_Error_Correction) which adds Forward Error Correction (FEC) in a way that is completely compatible with existing systems. If both ends are capable of FX.25, your information will continue to get through under conditions where regular AX.25 is completely useless. This was originally developed for satellites and is now seeing widespread use on HF.

![](fx25.png)

Expand Down Expand Up @@ -80,7 +80,21 @@ It can also be used as a virtual TNC for other applications such as [APRSIS32](h



- **Standard 300, 1200 & 9600 bps modems and more.**
- **Modems:**

300 bps AFSK for HF

1200 bps AFSK most common for VHF/UHF

2400 & 4800 bps PSK

9600 bps GMSK/G3RUH

AIS reception

EAS SAME reception



- **DTMF ("Touch Tone") Decoding and Encoding.**

Expand Down
7 changes: 4 additions & 3 deletions conf/generic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,11 @@
%W%
%C%#
%C%# It is sometimes possible to recover frames with a bad FCS.
%C%# This applies to all channels.
%C%# This is not a global setting.
%C%# It applies only the the most recent CHANNEL specified.
%C%#
%C%# 0 [NONE] - Don't try to repair.
%C%# 1 [SINGLE] - Attempt to fix single bit error. (default)
%C%# 0 - Don't try to repair.
%C%# 1 - Attempt to fix single bit error. (default)
%C%# ... see User Guide for more values and in-depth discussion.
%C%#
%C%
Expand Down
31 changes: 24 additions & 7 deletions src/atest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 John Langner, WB2OSZ
// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2019, 2021, 2022 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
Expand All @@ -23,11 +23,11 @@
*
* Name: atest.c
*
* Purpose: Test fixture for the AFSK demodulator.
* Purpose: Test fixture for the Dire Wolf demodulators.
*
* Inputs: Takes audio from a .WAV file instead of the audio device.
*
* Description: This can be used to test the AFSK demodulator under
* Description: This can be used to test the demodulators under
* controlled and reproducible conditions for tweaking.
*
* For example
Expand Down Expand Up @@ -107,7 +107,7 @@ struct wav_header { /* .WAV file header. */
/* 8 bit samples are unsigned bytes */
/* in range of 0 .. 255. */

/* 16 bit samples are signed short */
/* 16 bit samples are little endian signed short */
/* in range of -32768 .. +32767. */

static struct {
Expand Down Expand Up @@ -765,7 +765,7 @@ void dlq_rec_frame (int chan, int subchan, int slice, packet_t pp, alevel_t alev
unsigned char *pinfo;
int info_len;
int h;
char heard[AX25_MAX_ADDR_LEN];
char heard[2 * AX25_MAX_ADDR_LEN + 20];
char alevel_text[AX25_ALEVEL_TO_TEXT_SIZE];

packets_decoded_one++;
Expand Down Expand Up @@ -810,6 +810,23 @@ void dlq_rec_frame (int chan, int subchan, int slice, packet_t pp, alevel_t alev
}
ax25_alevel_to_text (alevel, alevel_text);

/* As suggested by KJ4ERJ, if we are receiving from */
/* WIDEn-0, it is quite likely (but not guaranteed), that */
/* we are actually hearing the preceding station in the path. */

if (h >= AX25_REPEATER_2 &&
strncmp(heard, "WIDE", 4) == 0 &&
isdigit(heard[4]) &&
heard[5] == '\0') {

char probably_really[AX25_MAX_ADDR_LEN];
ax25_get_addr_with_ssid(pp, h-1, probably_really);

strlcat (heard, " (probably ", sizeof(heard));
strlcat (heard, probably_really, sizeof(heard));
strlcat (heard, ")", sizeof(heard));
}

if (my_audio_config.achan[chan].fix_bits == RETRY_NONE && my_audio_config.achan[chan].passall == 0) {
dw_printf ("%s audio level = %s %s\n", heard, alevel_text, spectrum);
}
Expand Down Expand Up @@ -877,7 +894,7 @@ void dlq_rec_frame (int chan, int subchan, int slice, packet_t pp, alevel_t alev



#if 1 // temp experiment TODO: remove this.
#if 0 // temp experiment

#include "decode_aprs.h"
#include "log.h"
Expand All @@ -886,7 +903,7 @@ void dlq_rec_frame (int chan, int subchan, int slice, packet_t pp, alevel_t alev

decode_aprs_t A;

decode_aprs (&A, pp, 0, 0);
decode_aprs (&A, pp, 0, NULL);

// Temp experiment to see how different systems set the RR bits in the source and destination.
// log_rr_bits (&A, pp);
Expand Down
1 change: 0 additions & 1 deletion src/audio_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@

#include "audio_stats.h"
#include "textcolor.h"
#include "dtime_now.h"
#include "demod.h" /* for alevel_t & demod_get_audio_level() */


Expand Down
3 changes: 3 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,9 @@ void config_init (char *fname, struct audio_s *p_audio_config,

/*
* CFILTER from-chan to-chan filter_specification_expression
*
* Why did I put this here?
* What would be a useful use case? Perhaps block by source or destination?
*/

else if (strcasecmp(t, "CFILTER") == 0) {
Expand Down
27 changes: 18 additions & 9 deletions src/decode_aprs.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ static void process_comment (decode_aprs_t *A, char *pstart, int clen);
*
* quiet - Suppress error messages.
*
* third_party - True when parsing a third party header.
* third_party_src - Specify when parsing a third party header.
* (decode_aprs is called recursively.)
* This is mostly found when an IGate transmits a message
* that came via APRS-IS.
* NULL when not third party payload.
*
* Outputs: A-> g_symbol_table, g_symbol_code,
* g_lat, g_lon,
Expand All @@ -156,11 +157,10 @@ static void process_comment (decode_aprs_t *A, char *pstart, int clen);
*
*------------------------------------------------------------------*/

void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet, int third_party)
void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet, char *third_party_src)
{
//dw_printf ("DEBUG decode_aprs quiet=%d, third_party=%d\n", quiet, third_party);
//dw_printf ("DEBUG decode_aprs quiet=%d, third_party=%p\n", quiet, third_party_src);

//char dest[AX25_MAX_ADDR_LEN];
unsigned char *pinfo;
int info_len;

Expand Down Expand Up @@ -229,7 +229,12 @@ void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet, int third_party)

packet_t pp_payload = ax25_from_text ((char*)pinfo+1, 0);
if (pp_payload != NULL) {
decode_aprs (A, pp_payload, quiet, 1); // 1 means used recursively
char payload_src[AX25_MAX_ADDR_LEN];
memset(payload_src, 0, sizeof(payload_src));
memcpy(payload_src, (char*)pinfo+1, sizeof(payload_src)-1);
char *q = strchr(payload_src, '>');
if (q != NULL) *q = '\0';
decode_aprs (A, pp_payload, quiet, payload_src); // 1 means used recursively
ax25_delete (pp_payload);
return;
}
Expand All @@ -243,8 +248,12 @@ void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet, int third_party)
/*
* Extract source and destination including the SSID.
*/

ax25_get_addr_with_ssid (pp, AX25_SOURCE, A->g_src);
if (third_party_src != NULL) {
strlcpy (A->g_src, third_party_src, sizeof(A->g_src));
}
else {
ax25_get_addr_with_ssid (pp, AX25_SOURCE, A->g_src);
}
ax25_get_addr_with_ssid (pp, AX25_DESTINATION, A->g_dest);

//dw_printf ("DEBUG decode_aprs source=%s, dest=%s\n", A->g_src, A->g_dest);
Expand Down Expand Up @@ -5176,7 +5185,7 @@ int main (int argc, char *argv[])
ax25_safe_print ((char *)pinfo, info_len, 1); // Display non-ASCII to hexadecimal.
dw_printf ("\n");

decode_aprs (&A, pp, 0, 0); // Extract information into structure.
decode_aprs (&A, pp, 0, NULL); // Extract information into structure.

decode_aprs_print (&A); // Now print it in human readable format.

Expand All @@ -5197,7 +5206,7 @@ int main (int argc, char *argv[])
if (pp != NULL) {
decode_aprs_t A;

decode_aprs (&A, pp, 0, 0); // Extract information into structure.
decode_aprs (&A, pp, 0, NULL); // Extract information into structure.

decode_aprs_print (&A); // Now print it in human readable format.

Expand Down
6 changes: 3 additions & 3 deletions src/decode_aprs.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ typedef struct decode_aprs_s {
message_subtype_directed_query
} g_message_subtype; /* Various cases of the overloaded "message." */

char g_message_number[8]; /* Message number. Should be 1 - 5 alphanumeric characters if used. */
char g_message_number[12]; /* Message number. Should be 1 - 5 alphanumeric characters if used. */
/* Addendum 1.1 has new format {mm} or {mm}aa with only two */
/* characters for message number and an ack riding piggyback. */

Expand Down Expand Up @@ -142,9 +142,9 @@ typedef struct decode_aprs_s {



extern void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet, int third_party);
extern void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet, char *third_party_src);

extern void decode_aprs_print (decode_aprs_t *A);


#endif
#endif
29 changes: 16 additions & 13 deletions src/direwolf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ void app_process_rec_packet (int chan, int subchan, int slice, packet_t pp, alev
// we still want to decode it for logging and other processing.
// Just be quiet about errors if "-qd" is set.

decode_aprs (&A, pp, q_d_opt, 0);
decode_aprs (&A, pp, q_d_opt, NULL);

if ( ! q_d_opt ) {

Expand Down Expand Up @@ -1554,10 +1554,14 @@ void app_process_rec_packet (int chan, int subchan, int slice, packet_t pp, alev
}
else {

/* Send to Internet server if option is enabled. */
/* Consider only those with correct CRC. */

if (ax25_is_aprs(pp) && retries == RETRY_NONE) {
/*
* Send to the IGate processing.
* Use only those with correct CRC; We don't want to spread corrupted data!
* Our earlier "fix bits" hack could allow corrupted information to get thru.
* However, if it used FEC mode (FX.25. IL2P), we have much higher level of
* confidence that it is correct.
*/
if (ax25_is_aprs(pp) && ( retries == RETRY_NONE || is_fx25) ) {

igate_send_rec_packet (chan, pp);
}
Expand All @@ -1572,24 +1576,23 @@ void app_process_rec_packet (int chan, int subchan, int slice, packet_t pp, alev


/*
* APRS digipeater.
* Send to APRS digipeater.
* Use only those with correct CRC; We don't want to spread corrupted data!
* Our earlier "fix bits" hack could allow corrupted information to get thru.
* However, if it used FEC mode (FX.25. IL2P), we have much higher level of
* confidence that it is correct.
*/

// TODO: Should also use anything received with FX.25 because it is known to be good.
// Our earlier "fix bits" hack could allow corrupted information to get thru.

if (ax25_is_aprs(pp) && retries == RETRY_NONE) {
if (ax25_is_aprs(pp) && ( retries == RETRY_NONE || is_fx25) ) {

digipeater (chan, pp);
}

/*
* Connected mode digipeater.
* Use only those with correct CRC.
* Use only those with correct CRC (or using FEC.)
*/

if (retries == RETRY_NONE) {
if (retries == RETRY_NONE || is_fx25) {

cdigipeater (chan, pp);
}
Expand Down
Loading

0 comments on commit 07ea828

Please sign in to comment.