Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - add end-of-train and head-of-train message decoding #387

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
709f229
Initial checkin for EOTD support.
dtiller Mar 18, 2022
c491655
More framework.
dtiller Mar 19, 2022
7bde86f
#ifdef'ed debugging.
dtiller Mar 19, 2022
507f04e
Added date tag for debugging.
dtiller Mar 20, 2022
3b17d45
#ifdef'ed a lot of stuff.
dtiller Mar 20, 2022
26ac27b
Added beginnings of BCH processing.
dtiller Mar 20, 2022
d898d1b
Added derived code to calc/apply BCH codes.
dtiller Mar 21, 2022
be0f9c4
debug and comment changes.
dtiller Mar 21, 2022
475f951
Put original program back for reference. Added fixed codes.
dtiller Mar 21, 2022
53d5b2b
checked return status and found that we _can_ use 'forward' packets (…
dtiller Mar 22, 2022
a707fc8
Cleaned up output.
dtiller Mar 22, 2022
5be9e44
Closer. Lots of ACCA data to chew on.
dtiller Mar 22, 2022
742dfb4
Last checkin before trying dev branch.
dtiller Mar 29, 2022
98b8949
Slight fixes before switching to uint64_t and MSB processing.
dtiller Mar 30, 2022
7d58e40
New branch for 64 bit processing. Probably not needed.
dtiller Mar 30, 2022
2cf23db
Default buffer was _way_ too small.
dtiller Apr 2, 2022
1fb18ed
changes for 64 bit uint. Not sure I like them.
dtiller Apr 2, 2022
07209b5
First fully-working BCH code.
dtiller Apr 4, 2022
fa49b6a
Starting to look like a real project.
dtiller Apr 4, 2022
7646fc5
Shortened timestamp.
dtiller Apr 4, 2022
9871ba8
Added f2r decoder.
dtiller Apr 5, 2022
72708ec
Added mS to time.
dtiller Apr 5, 2022
09d2d5f
Added ARM logic.
dtiller Apr 5, 2022
a12f9e0
Added option block processing.
dtiller Apr 5, 2022
b17d987
Merge branch 'wb2osz:master' into feat-EOTD-master
dtiller Apr 5, 2022
27c97e3
Debian needs stdint.h in more places.
dtiller Apr 6, 2022
16d102e
Cleanup and changes to fix DTMF message.
dtiller Apr 6, 2022
f20fcd0
Debian is _picky_. Fixed a few warnings.
dtiller Apr 6, 2022
971383a
Deleted unneeded file.
dtiller Apr 6, 2022
2ea1a18
Added support for gen_packets.
dtiller Apr 7, 2022
89bc82b
Moved unit_addr closer to the beginning so it's always in the same pl…
dtiller Apr 8, 2022
1d7a4b9
Changed FRONT>REAR to dir=f2r, etc for consistency.
dtiller Apr 8, 2022
c4ccbdc
Added msg re: BCH code and added protective #ifndefs.
dtiller Apr 9, 2022
52298c1
Made -e flag imply the right (wrong\!) mark and space freqs and baud …
dtiller Apr 9, 2022
67d5900
Removed unused variable.
dtiller Apr 9, 2022
2048747
Added XOR for t=3 packets, added more verbiage, removed variable-leng…
dtiller Apr 9, 2022
6c8cf2a
Added pkttest and bchapply to the CMake system.
dtiller Apr 9, 2022
52d3d84
Deleted spurious executable.
dtiller Apr 9, 2022
b17f6f0
Fixed CMake issue and missing inttypes.h
dtiller Apr 29, 2022
c8d8977
Fixed typo.
dtiller May 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Initial checkin for EOTD support.
  • Loading branch information
dtiller committed Mar 18, 2022
commit 709f229d83a33aefb1d8533deaa6cca6c3b968c7
2 changes: 1 addition & 1 deletion src/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct audio_s {
/* Could all be the same or different. */


enum modem_t { MODEM_AFSK, MODEM_BASEBAND, MODEM_SCRAMBLE, MODEM_QPSK, MODEM_8PSK, MODEM_OFF, MODEM_16_QAM, MODEM_64_QAM, MODEM_AIS, MODEM_EAS } modem_type;
enum modem_t { MODEM_AFSK, MODEM_BASEBAND, MODEM_SCRAMBLE, MODEM_QPSK, MODEM_8PSK, MODEM_OFF, MODEM_16_QAM, MODEM_64_QAM, MODEM_AIS, MODEM_EAS, MODEM_EOTD } modem_type;

/* Usual AFSK. */
/* Baseband signal. Not used yet. */
Expand Down
5 changes: 4 additions & 1 deletion src/demod.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ int demod_init (struct audio_s *pa)

case MODEM_AFSK:
case MODEM_EAS:
case MODEM_EOTD: // TODO DET

if (save_audio_config_p->achan[chan].modem_type == MODEM_EAS) {
if (save_audio_config_p->achan[chan].fix_bits != RETRY_NONE) {
Expand Down Expand Up @@ -969,6 +970,7 @@ void demod_process_sample (int chan, int subchan, int sam)

case MODEM_AFSK:
case MODEM_EAS:
case MODEM_EOTD:

if (save_audio_config_p->achan[chan].decimate > 1) {

Expand Down Expand Up @@ -1086,7 +1088,8 @@ alevel_t demod_get_audio_level (int chan, int subchan)
alevel.rec = (int) (( D->alevel_rec_peak - D->alevel_rec_valley ) * 50.0f + 0.5f);

if (save_audio_config_p->achan[chan].modem_type == MODEM_AFSK ||
save_audio_config_p->achan[chan].modem_type == MODEM_EAS) {
save_audio_config_p->achan[chan].modem_type == MODEM_EAS ||
save_audio_config_p->achan[chan].modem_type == MODEM_EOTD) {

/* For AFSK, we have mark and space amplitudes. */

Expand Down
13 changes: 12 additions & 1 deletion src/direwolf.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,9 @@ int main (int argc, char *argv[])
}
else if (strcasecmp(optarg, "EAS") == 0) {
B_opt = 23456; // See special case below.
}
else if (strcasecmp(optarg, "EOTD") == 0) {
B_opt = 34567; // See special case below.
}
else {
B_opt = atoi(optarg);
Expand Down Expand Up @@ -760,7 +763,14 @@ int main (int argc, char *argv[])
audio_config.achan[0].space_freq = 1563; // Actually 1562.5 - logic 0.
strlcpy (audio_config.achan[0].profiles, "D", sizeof(audio_config.achan[0].profiles));
}
else {
else if (audio_config.achan[0].baud == 34567) {
audio_config.achan[0].modem_type = MODEM_EOTD;
audio_config.achan[0].baud = 1200;
audio_config.achan[0].mark_freq = 1200;
audio_config.achan[0].space_freq = 1800;
strlcpy (audio_config.achan[0].profiles, "D", sizeof(audio_config.achan[0].profiles));
}
else {
audio_config.achan[0].modem_type = MODEM_SCRAMBLE;
audio_config.achan[0].mark_freq = 0;
audio_config.achan[0].space_freq = 0;
Expand Down Expand Up @@ -1463,6 +1473,7 @@ static void usage (char **argv)
dw_printf (" 9600 bps and up uses K9NG/G3RUH standard.\n");
dw_printf (" AIS for ship Automatic Identification System.\n");
dw_printf (" EAS for Emergency Alert System (EAS) Specific Area Message Encoding (SAME).\n");
dw_printf (" EOTD for End-of-train devices.\n");
dw_printf (" -g Force G3RUH modem regardless of speed.\n");
dw_printf (" -j 2400 bps QPSK compatible with direwolf <= 1.5.\n");
dw_printf (" -J 2400 bps QPSK compatible with MFJ-2400.\n");
Expand Down
46 changes: 45 additions & 1 deletion src/hdlc_rec.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,42 @@ a good modem here and providing a result when it is received.

*/

/***********************************************************************************
*
* Name: eotd_rec_bit
*
* Purpose: Extract EOTD trasmissions from a stream of bits.
*
* Inputs: chan - Channel number.
*
* subchan - This allows multiple demodulators per channel.
*
* slice - Allows multiple slicers per demodulator (subchannel).
*
* raw - One bit from the demodulator.
* should be 0 or 1.
*
* future_use - Not implemented yet. PSK already provides it.
*
*
* Description: This is called once for each received bit.
* For each valid transmission, process_rec_frame()
* is called for further processing.
*
***********************************************************************************/


static void eotd_rec_bit (int chan, int subchan, int slice, int raw, int future_use)
{
struct hdlc_state_s *H;

/*
* Different state information for each channel / subchannel / slice.
*/
H = &hdlc_state[chan][subchan][slice];
fprintf(stderr, "chan=%d subchan=%d slice=%d raw=%d\n", chan, subchan, slice, raw);
return;
} // end eotd_rec_bit

/***********************************************************************************
*
Expand Down Expand Up @@ -463,6 +499,13 @@ void hdlc_rec_bit (int chan, int subchan, int slice, int raw, int is_scrambled,
return;
}

// EOTD does not use HDLC.

if (g_audio_p->achan[chan].modem_type == MODEM_EOTD) {
eotd_rec_bit (chan, subchan, slice, raw, not_used_remove);
return;
}

/*
* Different state information for each channel / subchannel / slice.
*/
Expand Down Expand Up @@ -564,7 +607,7 @@ void hdlc_rec_bit (int chan, int subchan, int slice, int raw, int is_scrambled,
if (actual_fcs == expected_fcs) {
alevel_t alevel = demod_get_audio_level (chan, subchan);

multi_modem_process_rec_frame (chan, subchan, slice, H->frame_buf, H->frame_len - 2, alevel, RETRY_NONE, 0); /* len-2 to remove FCS. */
:ulti_modem_process_rec_frame (chan, subchan, slice, H->frame_buf, H->frame_len - 2, alevel, RETRY_NONE, 0); /* len-2 to remove FCS. */
}
else {

Expand Down Expand Up @@ -802,6 +845,7 @@ int hdlc_rec_data_detect_any (int chan)

} /* end hdlc_rec_data_detect_any */


/* end hdlc_rec.c */