Skip to content

Commit 9fedd04

Browse files
committed
Add WSPR Type 2 and 3 message support
1 parent 6cbce8e commit 9fedd04

File tree

5 files changed

+430
-11
lines changed

5 files changed

+430
-11
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
JT65/JT9/JT4/FT8/WSPR/FSQ Encoder Library for Arduino
22
=====================================================
33

4-
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.
4+
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.
55

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

@@ -23,6 +23,20 @@ RAM Usage
2323
---------
2424
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.
2525

26+
WSPR Messages
27+
-------------
28+
JTEncode includes support for all three WSPR message types. A brief listing of the three types is given below:
29+
30+
| Message Type | Fields | Example |
31+
|--------------|--------|---------|
32+
| Type 1 | Callsign, Grid (4 digit), Power | NT7S CN85 30 |
33+
| Type 2 | Callsign with prefix or suffix, Power | NT7S/P 30 |
34+
| Type 3 | Callsign Hash, Grid (6 digit), Power | \<NT7S\> CN85NM 30 |
35+
36+
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.
37+
38+
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).
39+
2640
Example
2741
-------
2842
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](https://www.etherkit.com/rf-modules/si5351a-breakout-board.html), although it could be modified to use with other synthesizers which meet the technical requirements of the JT65/JT9/JT4/WSPR/FSQ modes.
@@ -185,10 +199,11 @@ Public Methods
185199
/*
186200
* wspr_encode(const char * call, const char * loc, const uint8_t dbm, uint8_t * symbols)
187201
*
188-
* Takes an arbitrary message of up to 13 allowable characters and returns
202+
* Takes a callsign, grid locator, and power level and returns a WSPR symbol
203+
* table for a Type 1, 2, or 3 message.
189204
*
190-
* call - Callsign (6 characters maximum).
191-
* loc - Maidenhead grid locator (4 characters maximum).
205+
* call - Callsign (11 characters maximum).
206+
* loc - Maidenhead grid locator (6 characters maximum).
192207
* dbm - Output power in dBm.
193208
* symbols - Array of channel symbols to transmit returned by the method.
194209
* Ensure that you pass a uint8_t array of at least size WSPR_SYMBOL_COUNT to the method.
@@ -262,6 +277,10 @@ Also, a big thank you to Murray Greenman, ZL1BPU for working allowing me to pick
262277

263278
Changelog
264279
---------
280+
* v1.3.0
281+
282+
* WSPR Type 2 and Type 3 message capability added
283+
265284
* v1.2.1
266285

267286
* Fix keywords.txt

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Etherkit JTEncode
2-
version=1.2.1
2+
version=1.3.0
33
author=Jason Milldrum <[email protected]>
44
maintainer=Jason Milldrum <[email protected]>
55
sentence=Generate JT65, JT9, JT4, FT8, WSPR, and FSQ symbols on your Arduino.

src/JTEncode.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* JTEncode.h - JT65/JT9/WSPR/FSQ encoder library for Arduino
33
*
4-
* Copyright (C) 2015-2018 Jason Milldrum <[email protected]>
4+
* Copyright (C) 2015-2021 Jason Milldrum <[email protected]>
55
*
66
* Based on the algorithms presented in the WSJT software suite.
77
* Thanks to Andy Talbot G4JNT for the whitepaper on the WSPR encoding
@@ -26,6 +26,7 @@
2626

2727
#include "int.h"
2828
#include "rs_common.h"
29+
#include "nhash.h"
2930

3031
#include "Arduino.h"
3132

@@ -220,7 +221,7 @@ class JTEncode
220221
void jt65_encode(const char *, uint8_t *);
221222
void jt9_encode(const char *, uint8_t *);
222223
void jt4_encode(const char *, uint8_t *);
223-
void wspr_encode(const char *, const char *, const uint8_t, uint8_t *);
224+
void wspr_encode(const char *, const char *, const int8_t, uint8_t *);
224225
void fsq_encode(const char *, const char *, uint8_t *);
225226
void fsq_dir_encode(const char *, const char *, const char, const char *, uint8_t *);
226227
void ft8_encode(const char *, uint8_t *);
@@ -232,7 +233,7 @@ class JTEncode
232233
int8_t hex2int(char);
233234
void jt_message_prep(char *);
234235
void ft_message_prep(char *);
235-
void wspr_message_prep(char *, char *, uint8_t);
236+
void wspr_message_prep(char *, char *, int8_t);
236237
void jt65_bit_packing(char *, uint8_t *);
237238
void jt9_bit_packing(char *, uint8_t *);
238239
void wspr_bit_packing(uint8_t *);
@@ -254,10 +255,11 @@ class JTEncode
254255
void free_rs_int(void *);
255256
void * init_rs_int(int, int, int, int, int, int);
256257
uint8_t crc8(const char *);
258+
void pad_callsign(char *);
257259
void * rs_inst;
258-
char callsign[7];
259-
char locator[5];
260-
uint8_t power;
260+
char callsign[12];
261+
char locator[7];
262+
int8_t power;
261263
};
262264

263265
#endif

0 commit comments

Comments
 (0)