Skip to content

Fix #32 (2m/6m overflow) and #21 (PROGMEM tables) - #41

Merged
NT7S merged 1 commit into
masterfrom
fix/progm-memory-and-2m-overflow
Nov 28, 2026
Merged

NT7S merged 1 commit into
masterfrom
fix/progm-memory-and-2m-overflow

Conversation

@NT7S

@NT7S NT7S commented Nov 28, 2026

Copy link
Copy Markdown
Member

Summary

Two fixes in one PR:

#32 — 2m/6m frequency overflow (example sketch)

The example sketch computed (freq * 100) in a 32-bit unsigned long. At 2m frequencies (e.g. 144,075,000 Hz) that is 1.44e10 — overflows 32 bits on AVR, silently corrupting the frequency. The frequency math now uses uint64_t throughout (freq, (freq * 100ULL), the symbol-step term), and the example documents the 2m/6m re-lock caveat from the issue comments (manual set_freq with pre-computed frequency and reduced tone delay above ~80 MHz). Also fixed the README's example snippet to match.

#21 — move sync-vector tables to flash (PROGMEM)

jt65, jt9, jt4 and wspr sync vectors, plus the ft8 costas7x7/graymap tables, are now stored in flash and read back via pgm_read_byte() (the portable JTEncode_pgmspace.h shim — real flash on AVR, plain memory on other architectures). This saves ~510 bytes of RAM on AVR (smoke build: 863 → 353 bytes, 42% → 17%), matching the savings measured in the issue.

Version bumped to 1.4.2.

Verification

  • 17-check harness — 17/17 PASS
  • Symbol-stream diff vs the pre-change library (JT65/JT9/JT4/FT8/WSPR/FSQ/FSQ-dir/grid) — bit-identical
  • AVR smoke build — 0 warnings/errors; RAM 863 → 353 bytes (55% flash unchanged)
  • Example sketch builds clean on AVR
  • Build matrix (AVR / ATSAMD / ESP32 / ESP8266 / Renesas) — see CI checks

Closes #32, closes #21.

#32: the example sketch computed (freq * 100) in a 32-bit unsigned long,
overflowing at 2m frequencies (144,075,000 Hz -> 1.44e10 > 2^32-1).
Switch the frequency math to uint64_t and document the 2m/6m re-lock
caveat from the issue comments.

#21: move the sync-vector tables to flash (PROGMEM): jt65/jt9/jt4/wspr
sync vectors and the ft8 costas7x7/graymap tables, read back via
pgm_read_byte(). Output is bit-identical to the pre-change library
(verified by diffing symbol streams across all modes); AVR smoke build
saves ~510 bytes of RAM (863 -> 353 bytes).

Bumps version to 1.4.2.
@NT7S
NT7S merged commit 9130555 into master Nov 28, 2026
7 checks passed
@NT7S
NT7S deleted the fix/progm-memory-and-2m-overflow branch November 30, 2026 03:49
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.

Tone spacing and frequency scaling error + only FT8 working on 2m/6m Saving some more memory - solutions

1 participant