Repository navigation
Conversation
FT4 (issue #37): - New ft4_encode(): 105-symbol FT4 encoder. 174-bit payload (77-bit message + 14-bit CRC-14 + 83-bit LDPC-174-91 parity), 4 tones at 20.833 Hz spacing, 7.5 s T/R slots, Costas sync arrays (S1-S4), ramp tones, 4-level gray-mapped data symbols, whitened with the standard 77-bit pseudo-random vector. Verified bit-exact against the WSJT-X Fortran reference (FT4 105-symbol frames). - Fixed the FT8/FT4 augmented CRC (#37): the CRC-14 trailer is now finalized with the correct augmented-CRC path (crc_finalize on the update result). This changes the encoded symbols for all FT8 messages relative to v1.4.x. - New FT4_Beacon_UnoR4WiFi example sketch (NTP time sync, UTC-aligned 7.5 s slots), sanitized: credentials via arduino_secrets.h (git-ignored). Full packmsg path for FT8/FT4 (JTENCODE_FULL_PACKMSG): - New src/upstream_pack77.{h,cpp}: faithful C++ port of WSJT-X packjt77.f90 (pack77 and helpers), behind the same JTENCODE_FULL_PACKMSG gate as the JT-mode port. Type 1 (standard callsign/grid/report) and Type 2 (/P-style suffixes) messages, CQ/QRZ/DE/CQ_ prefixes, grid4/report packing, free-text fallback. Type 3 contest / hash-call / EU VHF fall back to free text, mirroring the JT-mode port's deliberate no-hash-table decision. Verified bit-exact against the WSJT-X Fortran reference (FT8 79-symbol and FT4 105-symbol frames, Type 1 and Type 2, plus free-text and telemetry paths). - ft8_encode/ft4_encode now size the message buffer at 37 bytes under JTENCODE_FULL_PACKMSG (18 bytes in the compact path). Harness: 26/26 checks pass in both compact and full-packmsg builds. README updated (FT4 section, ft8/ft4 docs, full-path FT note, v1.5.0 changelog), keywords.txt and library.properties bumped to 1.5.0.
The default STUB path pointed at a transient scratch artifact that had been pruned, so the harness failed out of the box. Commit the working stub (tests/stub/Arduino.h) and default to it. STUB=/path still works for overrides.
The sketch now cycles through every encoding type the active path supports (Type 0 free text and Type 0.5 telemetry in the compact path; additionally Type 1 standard and Type 2 /P-suffix messages with JTENCODE_FULL_PACKMSG), transmitting the next message each slot so every supported encoding can be verified on air. All rotation messages are verified bit-exact against the WSJT-X Fortran reference. README example note updated.
The C++ split77 NUL-terminates each word, so Fortran's space-padded word tests never match: - is_grid4: check the first 4 chars directly (Fortran passes w(nwords)(1:4) and checks len(trim)==4, which is redundant for 4+ char words but matters for short words — first-4-char check already rejects short words) - CQ/DE/QRZ ok1 override: match exact trimmed lengths (DE=2, CQ=2, CQ_=3+, QRZ=3) instead of space-dependent strncmp - CQ special case in split77: check trimmed length ==2 for bare 'CQ' instead of w[0][2]==' ' - is_rrr/is_rr73/is_73: require exact trimmed lengths (3/4/2) to avoid over-matching R+/RR73/73 prefixes Verified: all 26 harness checks pass (compact + full), and the FT4 frames for all four rotation messages (CQ NT7S AA00, 123456789ABCDEF012, WA9XYZ KA1ABC R FN42, PA3XYZ/P GM4ABC/P R JO22) plus CQ-prefixed messages (CQ 001 K1ABC CN84, CQ 001 WA9XYZ KA1ABC R FN42) now match the Fortran reference bit-exactly.
'CQ NT7S AA00' is packed as Type 1 (CQ prefix + callsign + grid), not Type 0 free text, so the rotation was never actually transmitting a free-text frame. Replace it with 'HELLO WORLD' — a genuine Type 0 free text message (verified bit-exact against the Fortran reference). Rotation now exercises: Type 0 free text, Type 0.5 telemetry, Type 1 standard callsign/grid/report, Type 2 /P-suffix.
The FT4 pack77_1 space-padding fix (b7dba15) was not caught by the harness — the existing Type 1/2 bit-exact tests used WA9XYZ KA1ABC R FN42 and PA3XYZ/P GM4ABC/P R JO22, which exercise neither CQ prefixes nor exact-length report guards. Add 7 tests, all verified bit-exact vs the Fortran reference: - CQ-prefixed Type 1 (CQ NT7S AA00) — CQ special case + ok1 override - CQ + grid (CQ 001 K1ABC CN84) — CQ special case - CQ + Type 1 (CQ 001 WA9XYZ KA1ABC R FN42) - RRR report (WA9XYZ KA1ABC RRR) - over-length RRRM report — must fall back to free text - RR73 report (WA9XYZ KA1ABC RR73) - 73 report (WA9XYZ KA1ABC 73) Verified: all 33 tests pass with the fix; 3 fail with the pre-fix code (CQ prefix, CQ+grid, over-length RRRM).
Mirrors the FT4_Beacon_UnoR4WiFi sketch with FT8 modulation parameters: 79 symbols (58 data + 21 Costas sync), 8 tones at 6.25 Hz spacing (12000/1920 Hz), 160 ms symbol period (1920 samples @ 12000 S/s), 12.64 s frame duration, 15 s UTC-aligned T/R slots. Same rotation table and WiFi/NTP time sync as the FT4 sketch — Type 0 free text, Type 0.5 telemetry, and (with the full packmsg path) Type 1 standard callsign/grid/report and Type 2 /P-style suffixes. All four full-path messages verified bit-exact against the WSJT-X Fortran reference (ft8_driver_ref): HELLO WORLD, 123456789ABCDEF012, WA9XYZ KA1ABC R FN42, PA3XYZ/P GM4ABC/P R JO22. Compact path also verified for the two free-text/telemetry entries. Compiles cleanly with both paths (full: 80,584 B flash / 11,548 B RAM; compact: 77,256 B flash / 11,548 B RAM).
WSJT-X FT8 starts the transmission half a second into the 15 s slot. Since the epoch is in whole seconds, start 1 s in (slot_top + 1). Frame is 12.64 s, so it ends at slot_top + 13.64 s, leaving 1.36 s of margin.
…ble) 3c4b563 wrapped crc_update() in crc_finalize(). crc14.c is pycrc's bit-by-bit algorithm, where crc_update() over the zero-padded 96-bit buffer already equals WSJT-X's boost::augmented_crc (= ft8_lib ftx_compute_crc over 82 bits). crc_finalize() shifted 14 more zero bits through, producing a CRC that every decoder rejects, so no FT8 or FT4 frame decoded. The FT8/FT4 'bit-exact' harness vectors contained the same wrong CRC. Regenerate all 12 (payload bits verified unchanged, new CRC verified against an independent implementation) and add ft_crc_independent, which re-derives the CRC from the generated tones without using crc14.c. It fails with the bad line restored. See docs/FT8_FT4_CRC_BUG.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CcqVKGsQyJEDub3JS7TCsx
…ches - Schedule symbol edges against the frame start instead of set_freq()+delay(), so I2C write time no longer stretches each symbol. - Use the NTP fractional second plus half-RTT correction and a millisecond clock; start at slot + TX_START_OFFSET_MS (FT8 500 ms, FT4 300 ms) instead of a whole-second boundary that was 0-1 s late. - Never block on an NTP re-sync in the last 7 s before a transmission; do a fresh sync ~15 s before the slot instead. A failed re-sync no longer invalidates a previously good clock. Host-side simulation (1.5 ms per set_freq): start error was 0.2-2.0 s with up to 156 ms of edge drift per frame; now within 2 ms, <0.1 ms drift. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CcqVKGsQyJEDub3JS7TCsx
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CcqVKGsQyJEDub3JS7TCsx
The 20 m FT4 dial frequency is 14.080 MHz (not 14.074, which is FT8). A receiver tuned to the dial frequency in USB passes tones above it, so the transmit base frequency is dial + 1.5 kHz = 14.0815 MHz. Update BASE_FREQ_HZ and the stale header/define comments; the FT8 sketch is unchanged.
Test Lab's full-packmsg verification found that an upstream_pack77 message like "DE K1ABC CN84" was classified as a Type 0.5 telemetry message (i3=0, n3=5, message rewritten to " DE"). The telemetry guard ran before split77 and never rejected CQ/DE/QRZ-prefixed messages or multi-word messages, even though the WSJT-X reference only considers telemetry for a single-word, CQ/DE/QRZ-free message whose first word is at least 18 characters. Reorder to the Fortran's guard structure: split77 first, then skip telemetry if the message begins with CQ/DE/QRZ (on the space-padded 37-char message, exactly as the Fortran reads it) or holds two or more words, then attempt telemetry (first word >= 18 characters, all hex digits, first 6-char group < 2**23). Also apply the same guard to the compact path's inline telemetry detection. Add a harness regression test (ft4_de_prefix_not_telemetry) and a sanity check that a valid single-word 18-hex message still encodes as telemetry. Fix the misleading label on ft4_cq_type1_bit_exact (that message is a free-text message, not Type 1) and correct the docs' vector count and LDPC-parity claim.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #37. Two related pieces, both verified bit-exact against the WSJT-X Fortran reference:
FT4 support (new mode)
ft4_encode()— 105-symbol FT4 encoder: 174-bit payload (77-bit message + 14-bit CRC-14 + 83-bit LDPC-174-91 parity), 4 tones at 20.833 Hz spacing, Costas sync arrays (S1–S4), ramp tones, 4-level gray-mapped data symbols, whitened with the standard 77-bit pseudo-random vector.FT4_Beacon_UnoR4WiFiexample sketch (NTP time sync, UTC-aligned 7.5 s slots) — rotates through every encoding type the active path supports (Type 0 free text / Type 0.5 telemetry in the compact path; additionally Type 1 standard / Type 2 /P-suffix with the full path).FT8_Beacon_UnoR4WiFiexample sketch (same architecture, 15 s slots).Full packmsg path for FT8/FT4 (
JTENCODE_FULL_PACKMSG)src/upstream_pack77.{h,cpp}— faithful port of WSJT-Xpackjt77.f90(pack77and helpers), behind the sameJTENCODE_FULL_PACKMSGgate as the JT-mode port. Type 1 (standard callsign/grid/report) and Type 2 (/P-style suffixes) messages,CQ/QRZ/DE/CQ_prefixes, grid4/report packing. Nonstandard types (hash-call<...>, EU VHF, WSPR) fall back to free text, mirroring the JT-mode port's deliberate no-hash-table decision.ft8_encode/ft4_encodesize the message buffer at 37 bytes underJTENCODE_FULL_PACKMSG.FT8/FT4 CRC-14 regression fix. The previous code passed the init CRC to
crc_finalize(), and the interim change on this branch wrappedcrc_update()incrc_finalize()—src/crc14.cis pycrc's bit-by-bit variant wherecrc_update()over the zero-padded buffer already equals WSJT-X's augmented CRC. That produced an undecodable CRC, so all FT8/FT4 frames were broken. This branch reverts tocrc_update()only (seedocs/FT8_FT4_CRC_BUG.md), and the harness now re-derives the CRC-14 independently from the generated tones. This changes the encoded symbols for all FT8 messages relative to v1.4.x. FT8 decoding tools will see correct frames from this release.Verification
tests/run_tests.sh(compact): 35/35 PASS (0/35 checks detected a bug)JTENCODE_FULL_PACKMSG=1 tests/run_tests.sh(full): 35/35 PASS, plus full packmsg regression testALL OKf4e464d):DE K1ABC CN84andCQ K1ABC CN84now both classify as Type 1 (not telemetry); a valid single-word 18-hex message still encodes as telemetry (n3=5); short/non-hex first words (e.g.DEADBEEF) fall back to free text — with a new harness regression testNotes
docs/FT8_FT4_CRC_BUG.mdpost-mortem.Changelog
v1.5.0 changelog entry included in README.
library.propertiesbumped to 1.5.0.