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

Conversation

dtiller
Copy link

@dtiller dtiller commented Apr 11, 2022

This pull request adds EOTD and HOTD decoding to direwolf. The EOT device transmits on 457.9375 MHz, the HOT device on 452.9375 MHz. Both messages are 1200 baud MSK (1200 Hz mark/1800 Hz space) and use BCH codes for integrity checking.

**** NOTE THAN THE MARK AND SPACE FREQUENCIES ARE BACKWARDS in gen_tone.c.

Lines 228-229 correctly set f1_change_per_sample to the MARK frequency and
f2_change_per_sample the space frequency.

Line 383, however, sends MARK on 0 and SPACE on 1:

tone_phase[chan] += dat ? f2_change_per_sample[chan] : f1_change_per_sample[chan];

As such, you have to generate packets like this:

	gen_packets -e R -m 1800 -s 1200 -o test.wav eotd.data

EOTD input to the program consists of lines of 8 byte packets in HCB+ATAD
format; i.e. the format that direwolf appends to the decoded packet.

Ex: 81 b0 32 fb 31 23 73 8f

A new option has been added to atest: -e type. That enables EOTD generation and
the 'type' signifies 'R'ear to front or 'F'ront to rear decoding.

Using "atest -B EOTD test.wav" the above packet decodes to:

DECODED[1] 0:00.123 EOTD audio level = 49(30/31)
[0] EOTD>APDW16:{DRREAR>FRONT:ts=2022-04-07T10:02:00.350,chain=ONLY,block=BASIC,devbat=OK,msgid=ONEWAY,unit_addr=18151,brake_status=GO(49 psig),disc_bits=f6,valve=OPERATIONAL,confirm=UPDATE,disc_bit_1=1,motion=STOPPED/NOT_MONITORED,light_batt=OK/NOT_MONITORED,light=ON,hex=81 b0 32 fb 31 23 73 8f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant