Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 61 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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, 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 (v2.0.0 protocol) or a Type 1, Type 2, or Type 3 message for WSPR. It will also generate an arbitrary FSQ message of up to 200 characters in both directed and non-directed format. 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.
This library very simply generates a set of channel symbols for JT65, JT9, JT4, FT8, 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 (v2.0.0 protocol) or a Type 1, Type 2, or Type 3 message for WSPR. 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.

Expand Down Expand Up @@ -127,7 +127,7 @@ Before transmit, the proper class method is chosen based on the desired mode, th
jtencode.wspr_encode(call, loc, dbm, tx_buffer);
break;
case MODE_FT8:
jtencode.ft_encode(message, tx_buffer);
jtencode.ft8_encode(message, tx_buffer);
break;
case MODE_FSQ_2:
case MODE_FSQ_3:
Expand All @@ -150,6 +150,19 @@ Once the channel symbols have been generated, it is a simple matter of transmitt

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()
```
/*
Expand Down Expand Up @@ -189,22 +202,23 @@ Public Methods
*
* message - Plaintext Type 6 message.
* 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.
* Ensure that you pass a uint8_t array of at least size JT4_SYMBOL_COUNT to the method.
*
*/
```

### wspr_encode()
```
/*
* wspr_encode(const char * call, const char * loc, const uint8_t dbm, uint8_t * symbols)
* 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.
* 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.
*
Expand Down Expand Up @@ -237,8 +251,12 @@ Public Methods
* 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 the size of the message
* plus 5 characters to the method. Terminated in 0xFF.
* 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).
*
*/
```
Expand All @@ -255,8 +273,12 @@ Public Methods
* 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 the size of the message
* plus 5 characters to the method. Terminated in 0xFF.
* 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).
*
*/
```
Expand Down Expand Up @@ -293,6 +315,36 @@ Also, a big thank you to Murray Greenman, ZL1BPU for working allowing me to pick

Changelog
---------
* 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
Expand Down
8 changes: 5 additions & 3 deletions examples/Si5351JTDemo/Si5351JTDemo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ unsigned long freq;
char message[] = "N0CALL AA00";
char call[] = "N0CALL";
char loc[] = "AA00";
uint8_t dbm = 27;
uint8_t tx_buffer[255];
int8_t dbm = 27;
// Sized for fsq_dir_encode's documented maximum (2 symbols per char + terminator);
// also covers jt4_encode (207 symbols) and every other mode.
uint8_t tx_buffer[320];
enum mode cur_mode = DEFAULT_MODE;
uint8_t symbol_count;
uint16_t tone_delay, tone_spacing;
Expand Down Expand Up @@ -125,7 +127,7 @@ void encode()
void set_tx_buffer()
{
// Clear out the transmit buffer
memset(tx_buffer, 0, 255);
memset(tx_buffer, 0, 320);

// Set the proper frequency and timer CTC depending on mode
switch(cur_mode)
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ wspr_encode KEYWORD2
ft8_encode KEYWORD2
fsq_encode KEYWORD2
fsq_dir_encode KEYWORD2
latlon_to_grid KEYWORD2

JT65_SYMBOL_COUNT LITERAL1
JT9_SYMBOL_COUNT LITERAL1
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Etherkit JTEncode
version=1.3.1
version=1.4.0
author=Jason Milldrum <[email protected]>
maintainer=Jason Milldrum <[email protected]>
sentence=Generate JT65, JT9, JT4, FT8, WSPR, and FSQ symbols on your Arduino.
paragraph=This library very simply generates a set of channel symbols for JT65, JT9, JT4, FT8, 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 (v2.0.0 protocol) or a callsign, Maidenhead grid locator, and power output for WSPR. It will also generate an arbitrary FSQ message of up to 200 characters in both directed and non-directed format. 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.
paragraph=This library very simply generates a set of channel symbols for JT65, JT9, JT4, FT8, 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 (v2.0.0 protocol) or a callsign, Maidenhead grid locator, and power output for WSPR. 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.
category=Data Processing
url=https://github.com/etherkit/JTEncode
architectures=*
Loading
Loading