Skip to content

Commit b356a38

Browse files
authored
Merge pull request #11 from etherkit/v1.1.2
V1.1.2
2 parents b1a8d5d + ed13e95 commit b356a38

File tree

6 files changed

+196
-177
lines changed

6 files changed

+196
-177
lines changed

README.md

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@ Please feel free to use the issues feature of GitHub if you run into problems or
66

77
Hardware Requirements and Setup
88
-------------------------------
9-
This library has been written for the Arduino platform and has been successfully tested on the Arduino Uno and an Uno clone. Since the library itself does not access the hardware, there is no reason it should not run on any Arduino model of recent vintage.
9+
This library has been written for the Arduino platform and has been successfully tested on the Arduino Uno, an Uno clone, and an Arduino Zero clone. 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.
1010

1111
How To Install
1212
--------------
1313
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.
1414

1515
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](https://github.com/etherkit/JTEncode/releases) 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.
1616

17+
RAM Usage
18+
---------
19+
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.
20+
1721
Example
1822
-------
19-
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 conjuction 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.
23+
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.
2024

2125
To run this example, be sure to download the [Si5351Arduino](https://github.com/etherkit/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.
2226

@@ -29,58 +33,58 @@ An instance of the JTEncode object is created:
2933
On sketch startup, the mode parameters are set based on which mode is currently selected (by the DEFAULT_MODE define):
3034

3135
// Set the proper frequency, tone spacing, symbol count, and
32-
// timer CTC depending on mode
36+
// tone delay depending on mode
3337
switch(cur_mode)
3438
{
3539
case MODE_JT9:
3640
freq = JT9_DEFAULT_FREQ;
37-
ctc = JT9_CTC;
3841
symbol_count = JT9_SYMBOL_COUNT; // From the library defines
3942
tone_spacing = JT9_TONE_SPACING;
43+
tone_delay = JT9_DELAY;
4044
break;
4145
case MODE_JT65:
4246
freq = JT65_DEFAULT_FREQ;
43-
ctc = JT65_CTC;
4447
symbol_count = JT65_SYMBOL_COUNT; // From the library defines
4548
tone_spacing = JT65_TONE_SPACING;
49+
tone_delay = JT65_DELAY;
4650
break;
4751
case MODE_JT4:
4852
freq = JT4_DEFAULT_FREQ;
49-
ctc = JT4_CTC;
5053
symbol_count = JT4_SYMBOL_COUNT; // From the library defines
5154
tone_spacing = JT4_TONE_SPACING;
55+
tone_delay = JT4_DELAY;
5256
break;
5357
case MODE_WSPR:
5458
freq = WSPR_DEFAULT_FREQ;
55-
ctc = WSPR_CTC;
5659
symbol_count = WSPR_SYMBOL_COUNT; // From the library defines
5760
tone_spacing = WSPR_TONE_SPACING;
61+
tone_delay = WSPR_DELAY;
5862
break;
5963
case MODE_FSQ_2:
6064
freq = FSQ_DEFAULT_FREQ;
61-
ctc = FSQ_2_CTC;
6265
tone_spacing = FSQ_TONE_SPACING;
66+
tone_delay = FSQ_2_DELAY;
6367
break;
6468
case MODE_FSQ_3:
6569
freq = FSQ_DEFAULT_FREQ;
66-
ctc = FSQ_3_CTC;
6770
tone_spacing = FSQ_TONE_SPACING;
71+
tone_delay = FSQ_3_DELAY;
6872
break;
6973
case MODE_FSQ_4_5:
7074
freq = FSQ_DEFAULT_FREQ;
71-
ctc = FSQ_4_5_CTC;
7275
tone_spacing = FSQ_TONE_SPACING;
76+
tone_delay = FSQ_4_5_DELAY;
7377
break;
7478
case MODE_FSQ_6:
7579
freq = FSQ_DEFAULT_FREQ;
76-
ctc = FSQ_6_CTC;
7780
tone_spacing = FSQ_TONE_SPACING;
81+
tone_delay = FSQ_6_DELAY;
7882
break;
7983
}
8084

8185
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.
8286

83-
During transmit, the proper class method is chosen based on the desired mode, then the transmit symbol buffer and the other mode information is set:
87+
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:
8488

8589
// Set the proper frequency and timer CTC depending on mode
8690
switch(cur_mode)
@@ -95,34 +99,33 @@ During transmit, the proper class method is chosen based on the desired mode, th
9599
jtencode.jt4_encode(message, tx_buffer);
96100
break;
97101
case MODE_WSPR:
98-
call.toUpperCase();
99102
jtencode.wspr_encode(call, loc, dbm, tx_buffer);
100103
break;
101104
case MODE_FSQ_2:
102105
case MODE_FSQ_3:
103106
case MODE_FSQ_4_5:
104107
case MODE_FSQ_6:
105-
call.toLowerCase();
106108
jtencode.fsq_dir_encode(call, "n0call", " ", "hello world", tx_buffer);
107109
break;
108110
}
109111

112+
As mentioned above, it is best if the message encoding functions are called only when needed, in its own subroutine.
113+
110114
Once the channel symbols have been generated, it is a simple matter of transmitting them in sequence, each the correct amount of time:
111115

112116
// Now transmit the channel symbols
113117
for(i = 0; i < symbol_count; i++)
114118
{
115-
si5351.set_freq((freq * 100) + (tx_buffer[i] * tone_spacing), 0, SI5351_CLK0);
116-
proceed = false;
117-
while(!proceed);
119+
si5351.set_freq((freq * 100) + (tx_buffer[i] * tone_spacing), SI5351_CLK0);
120+
delay(tone_delay);
118121
}
119122

120123
Public Methods
121124
------------------
122125
### jt65_encode()
123126
```
124127
/*
125-
* jt65_encode(char * message, uint8_t * symbols)
128+
* jt65_encode(const char * message, uint8_t * symbols)
126129
*
127130
* Takes an arbitrary message of up to 13 allowable characters and returns
128131
* a channel symbol table.
@@ -136,7 +139,7 @@ Public Methods
136139
### jt9_encode()
137140
```
138141
/*
139-
* jt9_encode(char * message, uint8_t * symbols)
142+
* jt9_encode(const char * message, uint8_t * symbols)
140143
*
141144
* Takes an arbitrary message of up to 13 allowable characters and returns
142145
* a channel symbol table.
@@ -151,7 +154,7 @@ Public Methods
151154
### jt4_encode()
152155
```
153156
/*
154-
* jt4_encode(char * message, uint8_t * symbols)
157+
* jt4_encode(const char * message, uint8_t * symbols)
155158
*
156159
* Takes an arbitrary message of up to 13 allowable characters and returns
157160
* a channel symbol table.
@@ -166,7 +169,7 @@ Public Methods
166169
### wspr_encode()
167170
```
168171
/*
169-
* wspr_encode(char * call, char * loc, uint8_t dbm, uint8_t * symbols)
172+
* wspr_encode(const char * call, const char * loc, const uint8_t dbm, uint8_t * symbols)
170173
*
171174
* Takes an arbitrary message of up to 13 allowable characters and returns
172175
*
@@ -182,7 +185,7 @@ Public Methods
182185
### fsq_encode()
183186
```
184187
/*
185-
* fsq_encode(char * from_call, char * message, uint8_t * symbols)
188+
* fsq_encode(const char * from_call, const char * message, uint8_t * symbols)
186189
*
187190
* Takes an arbitrary message and returns a FSQ channel symbol table.
188191
*
@@ -198,7 +201,7 @@ Public Methods
198201
### fsq_dir_encode()
199202
```
200203
/*
201-
* fsq_dir_encode(char * from_call, char * to_call, char cmd, char * message, uint8_t * symbols)
204+
* fsq_dir_encode(const char * from_call, const char * to_call, const char cmd, const char * message, uint8_t * symbols)
202205
*
203206
* Takes an arbitrary message and returns a FSQ channel symbol table.
204207
*
@@ -229,21 +232,28 @@ Also, a big thank you to Murray Greenman, ZL1BPU for working allowing me to pick
229232

230233
Changelog
231234
---------
235+
* v1.1.2
236+
237+
* Fix buffer bug in _jt_message_prep()_ that caused messages of 11 chars to lock up the processor
238+
* Made a handful of changes to make the library more friendly to ATmegaxx8 processors
239+
* Rewrote example sketch to be generically compatible with most Arduino platforms
240+
232241
* v1.1.1
233242

234243
* Update example sketch for Si5351Arduino v2.0.0
235244

236245
* v1.1.0
237246

238-
* Added FSQ.
247+
* Added FSQ
239248

240249
* v1.0.1
241250

242-
* Fixed a bug in jt65_interleave that was causing a buffer overrun.
251+
* Fixed a bug in _jt65_interleave()_ that was causing a buffer overrun.
243252

244253
* v1.0.0
245254

246-
* Initial Release.
255+
* Initial Release
256+
247257

248258
License
249259
-------

0 commit comments

Comments
 (0)