Skip to content

Latest commit

 

History

History
561 lines (480 loc) · 31.1 KB

README.md

File metadata and controls

561 lines (480 loc) · 31.1 KB

JT65/JT9/JT4/FT8/WSPR/FSQ Encoder Library for Arduino

This library very simply generates a set of channel symbols for JT65, JT9, JT4, FT8, FT4, or WSPR based on the user providing a properly formatted Type 6 message for JT65, JT9, or JT4 (which is 13 valid characters), Type 0.0 or 0.5 message for FT8/FT4 (v2.0.0 protocol) or a Type 1, Type 2, or Type 3 message for WSPR. With the full packmsg path enabled (JTENCODE_FULL_PACKMSG, see Message Encoding Path), JT65/JT9/JT4 also accept standard messages — callsign, grid, and report in the usual WSJT-X formats (including CQ/QRZ/DE prefixes and /P-style suffixes) — which are then encoded as the corresponding standard message types instead of as free text. The full path also enables standard FT8/FT4 Type 1/2 messages (callsign, grid, and report), including CQ/QRZ/DE prefixes and /P suffixes. It will also generate an arbitrary FSQ message of up to 130 characters (non-directed) or 100 characters (directed). When paired with a synthesizer that can output frequencies in fine, phase-continuous tuning steps (such as the Si5351), then a beacon or telemetry transmitter can be created which can change the transmitted characters as needed from the Arduino.

Please feel free to use the issues feature of GitHub if you run into problems or have suggestions for important features to implement.

Thanks For Your Support!

If you would like to support my library development efforts, I would ask that you please consider sending a one-time PayPal tip or subscribe to me on SubscribeStar for an ongoing contribution.. Thank you!

Hardware Requirements and Setup

This library has been written for the Arduino platform and has been successfully tested on the Arduino Uno, an Uno clone, an Arduino Zero clone, and a NodeMCU. Since the library itself does not access the hardware, there is no reason it should not run on any Arduino model of recent vintage as long as it has at least 2 kB of RAM.

How To Install

The best way to install the library is via the Arduino Library Manager, which is available if you are using Arduino IDE version 1.6.2 or greater. To install it this way, simply go to the menu Sketch > Include Library > Manage Libraries..., and then in the search box at the upper-right, type "Etherkit JTEncode". Click on the entry in the list below, then click on the provided "Install" button. By installing the library this way, you will always have notifications of future library updates, and can easily switch between library versions.

If you need to or would like to install the library in the old way, then you can download a copy of the library in a ZIP file. Download a ZIP file of the library from the GitHub repository by going to this page and clicking the "Source code (zip)" link under the latest release. Finally, open the Arduino IDE, select menu Sketch > Import Library... > Add Library..., and select the ZIP that you just downloaded.

RAM Usage

Most of the encoding functions need to manipulate multiple arrays of symbols in RAM at the same time, and therefore are quite RAM intensive. Care has been taken to put as much data into program memory as is possible, but the encoding functions still can cause problems with the low RAM microcontrollers such as the ATmegaxx8 series. If you are using these, then please be sure to call them only once when a transmit buffer needs to be created or changed, and call them separately of other subroutine calls. When using other microcontrollers that have more RAM, such as most of the ARM ICs, this won't be as much of a problem. If you see unusual freezes, that almost certainly indicates a RAM shortage.

Message Encoding Path (compact vs full packmsg)

The library encodes JT65/JT9/JT4 messages using one of two paths, selected at compile time.

Compact path (default) — a simple free-text encoder: the message is uppercased and padded to 13 characters, then encoded as base-42 with the freeform flag set. This is what the library has done historically, and it is small enough to leave plenty of flash on a 32 KB Arduino Uno (~18 KB total for the JT9/JT4 path). It does not implement the standard message types (standard callsign/grid, CQ/QRZ/DE prefixes and suffixes, grid/report packing) — everything is transmitted as free text, so decoding tools see the message as free-form.

Full path — a faithful C++ port of WSJT-X packjt.f90 (packmsg and helpers): type detection, callsign packing (CQ/QRZ/DE and Swaziland/Guinea workarounds), 339-entry prefix and 12-entry suffix tables, Maidenhead grid and report packing (including the extended KA/LA report range), free-text fallback, and entail. It costs ~7.7 KB of extra flash (~25.8 KB total for JT9/JT4 on a Uno) and ~120 B of extra RAM. Verified bit-exact against the WSJT-X Fortran reference (28/28 messages, itype/dat/entail). Enable it by defining JTENCODE_FULL_PACKMSG in the sketch's build flags (see below for the exact options per toolchain).

Note: enabling the full path changes the encoded symbols for standard messages relative to the compact path — the compact path sets the freeform flag unconditionally, so its symbols are not what WSJT-X would transmit. Decoded messages are unaffected by the encoder choice. JT65 uses the same packmsg port with the 12-byte dat block fed directly to the Reed-Solomon encoder (no entail); JT9/JT4 feed it through entail.

FT8/FT4 (full path) — a faithful C++ port of WSJT-X packjt77.f90 (pack77 and helpers), reusing the same JTENCODE_FULL_PACKMSG gate and free-text fallback architecture 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, and free-text fallback. The common JT-mode features that are out of scope here (Type 3 contest, hash-call <...>, EU VHF and WSPR types) fall back to free text, mirroring the JT-mode port's deliberate no-hash-table decision. Message payloads are checked against an independent pack77 implementation, and the test harness independently re-derives the CRC-14 from the generated tones (see docs/FT8_FT4_CRC_BUG.md).

The macro must be defined at compile time for the library itself — a #define in the sketch does not propagate to the library's translation units. The cleanest options are:

  • PlatformIO — build_flags = -DJTENCODE_FULL_PACKMSG in platformio.ini
  • arduino-cli — --build-property "build.extra_flags=-DJTENCODE_FULL_PACKMSG"
  • Arduino IDE — no built-in build-flag UI; use PlatformIO/arduino-cli, or copy the library into your sketch folder and uncomment the #define in src/JTEncode.cpp

Note on the bundled example sketches: FT4_Beacon_UnoR4WiFi and FT8_Beacon_UnoR4WiFi each cycle through every encoding type the active path supports — Type 0 free text and Type 0.5 telemetry in the compact path, plus Type 1 (standard callsign/grid/report) and Type 2 (/P-style suffixes) with the full path. Each slot transmits the next message in the rotation, so running the beacon exercises every supported encoding. Both sketches use the same rotation table and WiFi/NTP time sync; only the modulation parameters differ (FT4: 105 symbols, 4 tones, 48 ms symbols, 7.5 s slots; FT8: 79 symbols, 8 tones, 160 ms symbols, 15 s slots). On an Arduino Uno the example still builds only with the compact path — at 28.4 KB it would overflow the 32 KB limit with the full path (~36.3 KB). On the Uno R4 WiFi the example builds with both paths (~77 KB compact / ~81 KB full, both comfortable). Use the compact path on an Uno; enable the full path on devices with more flash.

If the build fails because of the full path, the default compact path is still in use — simply remove the flag.

WSPR Messages

JTEncode includes support for all three WSPR message types. A brief listing of the three types is given below:

Message Type Fields Example
Type 1 Callsign, Grid (4 digit), Power NT7S CN85 30
Type 2 Callsign with prefix or suffix, Power NT7S/P 30
Type 3 Callsign Hash, Grid (6 digit), Power <NT7S> CN85NM 30

Most WSPR messages are type 1, however sometimes type 2 and 3 messages are needed. Type 2 messages allow you to send a callsign with a prefix of up to three characters, a suffix of a single character, or a suffix consisting of two numerical digits. Type 3 messages are typically used in conjunction with type 2 messages since type 2 messages don't include a grid locator. The type 3 message sends a 15-bit hash of the included callsign, along with a 6 digit grid locator and the power.

Type 2 messages can be sent in JTEncode simply by including the slashed prefix or suffix in the callsign field. A type 3 message can be sent by enclosing a callsign with angle brackets (as seen in the example above).

Example

There is a simple example that is placed in your examples menu under JTEncode. Open this to see how to incorporate this library with your code. The example provided with with the library is meant to be used in conjunction with the Etherkit Si5351A Breakout Board, although it could be modified to use with other synthesizers which meet the technical requirements of the JT65/JT9/JT4/WSPR/FSQ modes.

To run this example, be sure to download the Si5351Arduino library and follow the instructions there to connect the Si5351A Breakout Board to your Arduino. In order to trigger transmissions, you will also need to connect a momentary pushbutton from pin 12 of the Arduino to ground.

The example sketch itself is fairly straightforward. JT65, JT9, JT4, FT8, WSPR, and FSQ modes are modulated in same way: phase-continuous multiple-frequency shift keying (MFSK). The message to be transmitted is passed to the JTEncode method corresponding to the desired mode, along with a pointer to an array which holds the returned channel symbols. When the pushbutton is pushed, the sketch then transmits each channel symbol sequentially as an offset from the base frequency given in the sketch define section.

An instance of the JTEncode object is created:

JTEncode jtencode;

On sketch startup, the mode parameters are set based on which mode is currently selected (by the DEFAULT_MODE define):

// Set the proper frequency, tone spacing, symbol count, and
// tone delay depending on mode
switch(cur_mode)
{
case MODE_JT9:
  freq = JT9_DEFAULT_FREQ;
  symbol_count = JT9_SYMBOL_COUNT; // From the library defines
  tone_spacing = JT9_TONE_SPACING;
  tone_delay = JT9_DELAY;
  break;
case MODE_JT65:
  freq = JT65_DEFAULT_FREQ;
  symbol_count = JT65_SYMBOL_COUNT; // From the library defines
  tone_spacing = JT65_TONE_SPACING;
  tone_delay = JT65_DELAY;
  break;
case MODE_JT4:
  freq = JT4_DEFAULT_FREQ;
  symbol_count = JT4_SYMBOL_COUNT; // From the library defines
  tone_spacing = JT4_TONE_SPACING;
  tone_delay = JT4_DELAY;
  break;
case MODE_WSPR:
  freq = WSPR_DEFAULT_FREQ;
  symbol_count = WSPR_SYMBOL_COUNT; // From the library defines
  tone_spacing = WSPR_TONE_SPACING;
  tone_delay = WSPR_DELAY;
  break;
case MODE_FT8:
  freq = FT8_DEFAULT_FREQ;
  symbol_count = FT8_SYMBOL_COUNT; // From the library defines
  tone_spacing = FT8_TONE_SPACING;
  tone_delay = FT8_DELAY;
  break;
case MODE_FSQ_2:
  freq = FSQ_DEFAULT_FREQ;
  tone_spacing = FSQ_TONE_SPACING;
  tone_delay = FSQ_2_DELAY;
  break;
case MODE_FSQ_3:
  freq = FSQ_DEFAULT_FREQ;
  tone_spacing = FSQ_TONE_SPACING;
  tone_delay = FSQ_3_DELAY;
  break;
case MODE_FSQ_4_5:
  freq = FSQ_DEFAULT_FREQ;
  tone_spacing = FSQ_TONE_SPACING;
  tone_delay = FSQ_4_5_DELAY;
  break;
case MODE_FSQ_6:
  freq = FSQ_DEFAULT_FREQ;
  tone_spacing = FSQ_TONE_SPACING;
  tone_delay = FSQ_6_DELAY;
  break;
}

Note that the number of channel symbols for each mode is defined in the library, so you can use those defines to initialize your own symbol array sizes.

Before transmit, the proper class method is chosen based on the desired mode, then the transmit symbol buffer and the other mode information is set:

// Set the proper frequency and timer CTC depending on mode
switch(cur_mode)
{
case MODE_JT9:
  jtencode.jt9_encode(message, tx_buffer);
  break;
case MODE_JT65:
  jtencode.jt65_encode(message, tx_buffer);
  break;
case MODE_JT4:
  jtencode.jt4_encode(message, tx_buffer);
  break;
case MODE_WSPR:
  jtencode.wspr_encode(call, loc, dbm, tx_buffer);
  break;
case MODE_FT8:
  jtencode.ft8_encode(message, tx_buffer);
  break;
case MODE_FSQ_2:
case MODE_FSQ_3:
case MODE_FSQ_4_5:
case MODE_FSQ_6:
  jtencode.fsq_dir_encode(call, "n0call", " ", "hello world", tx_buffer);
  break;
}

As mentioned above, it is best if the message encoding functions are called only when needed, in its own subroutine.

Once the channel symbols have been generated, it is a simple matter of transmitting them in sequence, each the correct amount of time:

// Now transmit the channel symbols
for(i = 0; i < symbol_count; i++)
{
    si5351.set_freq((freq * 100ULL) + ((uint64_t)tx_buffer[i] * tone_spacing), SI5351_CLK0);
    delay(tone_delay);
}

Public Methods

JTEncode(void) / ~JTEncode()

/*
 * JTEncode();
 * ~JTEncode();
 *
 * Constructs a JTEncode instance, initializing the callsign, locator, and
 * power fields and allocating the Reed-Solomon instance used by jt65_encode().
 * The destructor frees that instance; it is safe to let a JTEncode instance
 * go out of scope without an explicit delete.
 *
 */

jt65_encode()

/*
 * jt65_encode(const char * message, uint8_t * symbols)
 *
 * Takes an arbitrary message of up to 13 allowable characters and returns
 * a channel symbol table.
 *
 * message - Plaintext Type 6 message (compact path, the default). With
 *  JTENCODE_FULL_PACKMSG enabled, standard WSJT-X messages are also accepted
 *  (callsign, grid, and report in the usual formats) and are encoded as the
 *  corresponding standard message type instead of as free text.
 * symbols - Array of channel symbols to transmit returned by the method.
 *  Ensure that you pass a uint8_t array of at least size JT65_SYMBOL_COUNT to the method.
 *
 */

jt9_encode()

/*
 * jt9_encode(const char * message, uint8_t * symbols)
 *
 * Takes an arbitrary message of up to 13 allowable characters and returns
 * a channel symbol table.
 *
 * message - Plaintext Type 6 message (compact path, the default). With
 *  JTENCODE_FULL_PACKMSG enabled, standard WSJT-X messages are also accepted
 *  (callsign, grid, and report in the usual formats) and are encoded as the
 *  corresponding standard message type instead of as free text.
 * symbols - Array of channel symbols to transmit returned by the method.
 *  Ensure that you pass a uint8_t array of at least size JT9_SYMBOL_COUNT to the method.
 *
 */

jt4_encode()

/*
 * jt4_encode(const char * message, uint8_t * symbols)
 *
 * Takes an arbitrary message of up to 13 allowable characters and returns
 * a channel symbol table.
 *
 * message - Plaintext Type 6 message (compact path, the default). With
 *  JTENCODE_FULL_PACKMSG enabled, standard WSJT-X messages are also accepted
 *  (callsign, grid, and report in the usual formats) and are encoded as the
 *  corresponding standard message type instead of as free text.
 * symbols - Array of channel symbols to transmit returned by the method.
 *  Ensure that you pass a uint8_t array of at least size JT4_SYMBOL_COUNT to the method.
 *
 * JT4 transmits a 206-symbol frame: 206 data symbols interleaved with the
 * 206-bit pseudo-random sync vector from WSJT-X gen4 (sync in the LSB, data
 * in the MSB, so each symbol is 0-3 for the 4-FSK tones). If the message
 * contains a negative report (a '-' in the report field — the 9th character
 * or later — followed by a digit 0-3), the sync vector is inverted, exactly
 * as WSJT-X does.
 *
 */

wspr_encode()

/*
 * wspr_encode(const char * call, const char * loc, const int8_t dbm, uint8_t * symbols)
 *
 * Takes a callsign, grid locator, and power level and returns a WSPR symbol
 * table for a Type 1, 2, or 3 message.
 *
 * call - Callsign (12 characters maximum).
 * loc - Maidenhead grid locator (6 characters maximum).
 * dbm - Output power in dBm. Valid range is -30 to 60 dBm; values are rounded
 *  down to the nearest valid power level.
 * symbols - Array of channel symbols to transmit returned by the method.
 *  Ensure that you pass a uint8_t array of at least size WSPR_SYMBOL_COUNT to the method.
 *
 */

ft8_encode()

/*
 * ft8_encode(const char * message, uint8_t * symbols)
 *
 * Takes an arbitrary message of up to 13 allowable characters or a telemetry message
 * of up to 18 hexadecimal digit (in string format) and returns a channel symbol table.
 * Encoded for the FT8 protocol used in WSJT-X v2.0 and beyond (79 channel symbols).
 * With the full packmsg path enabled (`JTENCODE_FULL_PACKMSG`), also accepts
 * standard Type 1/2 messages (callsign, grid, and report — up to 36 characters,
 * e.g. "WA9XYZ KA1ABC R FN42").
 *
 * message - Type 0.0 free text message, Type 0.5 telemetry message, or (full path)
 *  standard Type 1/2 message.
 * symbols - Array of channel symbols to transmit returned by the method.
 *  Ensure that you pass a uint8_t array of at least size FT8_SYMBOL_COUNT to the method.
 *
 */

ft4_encode()

/*
 * ft4_encode(const char * message, uint8_t * symbols)
 *
 * Takes an arbitrary message of up to 13 allowable characters or a telemetry message
 * of up to 18 hexadecimal digit (in string format) and returns a channel symbol table.
 * Encoded for the FT4 protocol used in WSJT-X v2.0 and beyond (105 channel symbols).
 * With the full packmsg path enabled (`JTENCODE_FULL_PACKMSG`), also accepts
 * standard Type 1/2 messages (callsign, grid, and report — up to 36 characters,
 * e.g. "WA9XYZ KA1ABC R FN42").
 *
 * message - Type 0.0 free text message, Type 0.5 telemetry message, or (full path)
 *  standard Type 1/2 message.
 * symbols - Array of channel symbols to transmit returned by the method.
 *  Ensure that you pass a uint8_t array of at least size FT4_SYMBOL_COUNT to the method.
 *
 */

fsq_encode()

/*
 * fsq_encode(const char * from_call, const char * message, uint8_t * symbols)
 *
 * Takes an arbitrary message and returns a FSQ channel symbol table.
 *
 * from_call - Callsign of issuing station (maximum size: 20)
 * message - Null-terminated message string, no greater than 130 chars in length
 * symbols - Array of channel symbols to transmit returned by the method.
 *  Ensure that you pass a uint8_t array of at least 2x (call + message + 5) + 1
 *  characters to the method. Each transmitted character can produce up to two
 *  channel symbols, plus the 0xFF terminator.
 *
 * Note: characters with no entry in the FSQ table are silently dropped
 * (they produce no channel symbols).
 *
 */

fsq_dir_encode()

/*
* fsq_dir_encode(const char * from_call, const char * to_call, const char cmd, const char * message, uint8_t * symbols)
*
* Takes an arbitrary message and returns a FSQ channel symbol table.
*
* from_call - Callsign from which message is directed (maximum size: 20)
* to_call - Callsign to which message is directed (maximum size: 20)
* cmd - Directed command
* message - Null-terminated message string, no greater than 100 chars in length
* symbols - Array of channel symbols to transmit returned by the method.
*  Ensure that you pass a uint8_t array of at least 2x (from_call + to_call + message + 13) + 1
*  characters to the method. Each transmitted character can produce up to two
*  channel symbols, plus the 0xFF terminator.
*
* Note: characters with no entry in the FSQ table are silently dropped
* (they produce no channel symbols).
*
*/

latlon_to_grid()

/*
 * latlon_to_grid(float lat, float lon, char* ret_grid)
 *
 * Takes a station latitude and longitude provided in decimal degrees format and
 * returns a string with the 6-digit Maidenhead grid designator.
 *
 * lat - Latitude in decimal degrees format.
 * lon - Longitude in decimal degrees format.
 * ret_grid - Derived Maidenhead grid square. A pointer to a character array of
 *   at least 7 bytes must be provided here for the function return value.
 *
 */

Tokens

Here are the defines, structs, and enumerations you will find handy to use with the library.

Defines:

JT65_SYMBOL_COUNT, JT9_SYMBOL_COUNT, JT4_SYMBOL_COUNT, WSPR_SYMBOL_COUNT, FT8_SYMBOL_COUNT

Acknowledgements

Many thanks to Joe Taylor K1JT for his innovative work in amateur radio. We are lucky to have him. The algorithms in this program were derived from the source code in the WSJT-X suite of applications. Also, many thanks for Andy Talbot G4JNT for his paper on the WSPR coding protocol, which helped me to understand the WSPR encoding process, which in turn helped me to understand the related JT protocols.

Also, a big thank you to Murray Greenman, ZL1BPU for working allowing me to pick his brain regarding his neat new mode FSQ.

Changelog

  • v1.5.0

    • Add FT4 support (issue #37): 105-symbol FT4 encoder (4 tones at 20.833 Hz spacing, 7.5-second T/R slots, 174-bit payload with the augmented CRC-14 and LDPC-174-91 error correction, Costas sync sequences and the 4-level ramp, whitened with the standard 77-bit pseudo-random vector).
    • FT8/FT4 CRC-14 is unchanged from v1.4.x (WSJT-X augmented_crc / ft8_lib ftx_compute_crc). An interim change on this branch added a crc_finalize() call that produced a wrong CRC and made every FT8/FT4 frame undecodable; it has been reverted and the harness now checks the CRC independently. See docs/FT8_FT4_CRC_BUG.md.
    • Add the full packmsg path for FT8/FT4 (JTENCODE_FULL_PACKMSG): a faithful port of WSJT-X packjt77.f90 (pack77) — Type 1 (standard callsign/grid/report) and Type 2 (/P-style suffixes) messages, CQ/QRZ/DE/CQ_ prefixes, grid4/report packing, and free-text fallback. Payloads are checked against an independent Python reimplementation of pack77 (Type 1/2, free text, CQ-prefix, telemetry); CQ-prefixed messages that fail chkcall (e.g. CQ 001) are free-text messages and are checked as such. JT65/JT9/JT4 also accept standard messages in this build.
    • Add FT4_Beacon_UnoR4WiFi and FT8_Beacon_UnoR4WiFi example sketches (NTP time sync, UTC-aligned slots). Each sketch rotates through every encoding type the active path supports — Type 0 free text and Type 0.5 telemetry (compact path), plus Type 1 (standard callsign/grid/report) and Type 2 (/P-style suffixes) with the full path — so running either beacon exercises every supported encoding in turn. Transmissions start at a millisecond-accurate offset into the slot (0.5 s FT8, 0.3 s FT4) using the NTP fractional second with half-RTT correction, and symbol edges are scheduled against the frame start so I2C write time does not accumulate.
  • v1.4.3

    • Full packmsg port verified bit-exact against the WSJT-X Fortran reference (28/28 messages: itype, dat, and entail all match). Fixes applied: (1) grid2deg now copies all 6 grid characters (was truncating to 5, dropping the 6th and corrupting extended reports); (2) the c3 fill loop maps NUL bytes to blanks (was leaving NUL in the 4th field of blank grids, forcing free-text fallback); (3) getpfx1 falls through to the generic prefix/suffix path when the pfx/sfx tables miss (was returning early with a stale callsign), and keeps a copy of the original callsign for the generic path; (4) the full path now honors the Fortran early exits (nv2a >= 4, text1, text2 -> free text) and the add-on-grid k1 < 0 || k2 < 0 || k1*k2 != 0 check. The bundled example builds on the Uno (compact, 28.4 KB) and Uno R4 WiFi (compact ~72.2 KB / full ~77.3 KB); the Uno full-path build overflows by design.
    • Fix the JT4 encoder to produce frames that match WSJT-X. The previous implementation was wrong in several ways: it used a 207-symbol JT4_SYMBOL_COUNT (the JT4 frame is 206 symbols), it filled a 206-bit buffer and then shifted everything right by one symbol (memmove + a hardcoded s[0] = 0), it used a truncated 126-entry sync vector (several entries were garbled), and it put the sync in the MSB / data in the LSB.
    • The sync vector is now the full 207-entry table from WSJT-X gen4.f90 (npr, with an inert leading element), applied as tone = 2*data + sync (data MSB, sync LSB), which is the correct 4-FSK mapping.
    • Negative reports now invert the sync vector, matching WSJT-X: when the prepped message has a - in the report field followed by a digit 0-3, the sync bits are complemented.
    • Output is bit-exact against a Python reimplementation of the WSJT-X gen4/encode4 pipeline for positive, negative, and non-report messages (NT7S, G0ABC M0SUP, G0ABC M0SUP -05, CQ DX, AAAAAAA -05, ...).
    • Harness now has 20 checks (was 17): JT4 frame length/tone range, bit-exact JT4 reference output, and JT4 inverted-sync coverage.
    • Fixed the JT4_SYMBOL_COUNT doc typo in jt4_encode and the example comment (both said 207 symbols).
  • v1.4.2

    • Fix #32 — 2m/6m frequency overflow in the example sketch: freq was an unsigned long (32-bit on AVR), so (freq * 100) overflowed at 2m frequencies (e.g. 144,075,000 Hz → 1.44e10 > 2^32-1). The frequency math now uses uint64_t throughout (also documented in the README example). The example also notes the 2m/6m re-lock caveat (see issue #32 comments).
    • Fix #21 — move the sync-vector tables to flash (PROGMEM): jt65, jt9, jt4 and wspr sync vectors and the ft8 costas7x7/graymap tables are now stored in flash and read back via pgm_read_byte(), saving ~510 bytes of RAM on AVR (863 → 353 bytes in the smoke build). Output verified bit-identical to the pre-change library; harness still 17/17 PASS.
  • v1.4.1

    • Fix FCR macro collision with Renesas RA4M1 device header (R7FA4M1AB.h): the dead #define FCR (rs->fcr) in src/int.h expanded the FCR hardware register name and broke compilation on the Arduino UNO R4 WiFi (and other Renesas targets). The macro was never used (the struct field is accessed directly), so it was removed.
    • Add a sanitized WSPR_Beacon_UnoR4WiFi example: a WSPR beacon for the Uno R4 WiFi that transmits every 10 minutes on 30 m. Each transmission picks a random frequency inside the 200 Hz WSPR window (10.1401-10.1403 MHz) via the hardware TRNG, starts 1 second into the even UTC minute, and syncs time over WiFi/NTP. Credentials come from a gitignored arduino_secrets.h (never committed).
    • Add a build-matrix CI workflow that compiles a hardware-independent smoke sketch against the repo library on AVR, ATSAMD, ESP32, ESP8266 and Renesas, verifying the library builds and links on the major Arduino architectures.
  • v1.4.0

    • Added test harness (17 checks) covering memory-safety and output-correctness bugs
    • Added ~JTEncode() destructor that frees the Reed-Solomon instance allocated by the constructor
    • Initialize callsign/locator/power fields in the constructor (previously left uninitialized)
    • Fix memory-safety bugs: bounded copies in jt65/jt9/jt4/ft8 message paths, fsq/fsq_dir snprintf + buffer sized for documented maximum, bounded WSPR Type 2/3 reads, zero-pad the 207th bit in jt9_packbits, defined fallback for a missing '>' in Type 3 WSPR messages
    • Fix latlon_to_grid() not terminating ret_grid
    • Fix wspr_message_prep(): clamp dbm to [-30, 60] and no longer mutate the caller's buffers (#35)
    • Correct FSQ symbols-buffer contract in docs (2 symbols per char + terminator)
    • Guard rs_encode against a NULL Reed-Solomon codec (allocation failure)
    • Document that characters with no entry in the FSQ table are silently dropped
    • Portable PROGMEM shim: library now builds on all architectures (architectures=*), not just ATmega328P/168/32U4/16U4 — AVR chips keep tables in flash, other cores use their own pgmspace.h when available, otherwise plain memory
    • Correct stale README references (ft8_encode example call, jt4_encode symbol count, wspr_encode dbm type)
    • Fix WSPR one-character-prefix callsigns (e.g. F/PE0FKO) (#29): the prefix is now right-aligned into the 3-character field with the correct number of leading spaces, matching the WSJT-X reference (was 1 leading space for 1-char prefixes, producing an incorrect hash)
    • Fix variable-callsign length (#28): callsign member widened from 12 to 13 bytes so a 12-character compound callsign is not truncated
    • Fix FT8 telemetry mode (#18): snprintf "%*s" -> "%18s" (broken on Atmel toolchain), and i0 is now initialized before use
    • Fix ESP32 -Werror build failures (#33): removed unused variables (tone, i, k8) and initialized i0; crc8 loop variable now size_t (sign-compare)
  • v1.3.1

    • Added latitude/longitude to Maidenhead grid convenience function
  • v1.3.0

    • WSPR Type 2 and Type 3 message capability added
  • v1.2.1

    • Fix keywords.txt
  • v1.2.0

    • Add support for FT8 protocol (79 symbol version introduced December 2018)
  • v1.1.3

    • Add support for ESP8266
    • Fix WSPR regression in last release
  • v1.1.2

    • Fix buffer bug in jt_message_prep() that caused messages of 11 chars to lock up the processor
    • Made a handful of changes to make the library more friendly to ATmegaxx8 processors
    • Rewrote example sketch to be generically compatible with most Arduino platforms
  • v1.1.1

    • Update example sketch for Si5351Arduino v2.0.0
  • v1.1.0

    • Added FSQ
  • v1.0.1

    • Fixed a bug in jt65_interleave() that was causing a buffer overrun.
  • v1.0.0

    • Initial Release

Arduino Lint Status

arduino-lint Actions Status

License

JTEncode is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

JTEncode is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with JTEncode. If not, see http://www.gnu.org/licenses/.