Skip to content

Commit dd0d2ef

Browse files
committed
Fixed PR31 that I mistakenly brought back, and removed unused variables.
1 parent dad9a5c commit dd0d2ef

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

radioCWModulator_F32.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ void radioCWModulator_F32::update(void) {
1515
if(!enableXmit)
1616
return;
1717

18-
float32_t circTemp[64]; // Storage for data from Gaussian
19-
uint16_t tempIndex;
2018
uint16_t index, i;
2119
float32_t a, b;
2220
audio_block_f32_t *blockOut;
23-
int32_t circIndexSave24;
2421
blockOut = AudioStream_F32::allocate_f32(); // Output block
2522
if (!blockOut) return;
2623

@@ -193,17 +190,20 @@ void radioCWModulator_F32::update(void) {
193190
*/
194191
if(sampleRate == SR_24KSPS)
195192
{
193+
// ToDo: Re-scale coefficients of FIR x2.0 to eliminate next statement
196194
for(int kk=0; kk<64; kk++) dataBuf12A[kk] *= 2.0f;
197195
arm_fir_interpolate_f32 (&interp12_24Inst, dataBuf12A, dataBuf24, 64);
198196
}
199197
else if(sampleRate == SR_48KSPS)
200198
{
199+
// ToDo: Re-scale coefficients of FIR x2.0 to eliminate next statement
201200
for(int kk=0; kk<32; kk++) dataBuf12A[kk] *= 4.0f;
202201
arm_fir_interpolate_f32 (&interp12_24Inst, dataBuf12A, dataBuf24, 32);
203202
arm_fir_interpolate_f32 (&interp24_48Inst, dataBuf24, dataBuf48, 64);
204203
}
205204
else if(sampleRate == SR_96KSPS)
206205
{
206+
// ToDo: Re-scale coefficients of FIR x2.0 to eliminate next statement
207207
for(int kk=0; kk<16; kk++) dataBuf12A[kk] *= 8.0f;
208208
arm_fir_interpolate_f32 (&interp12_24Inst, dataBuf12A, dataBuf24, 16);
209209
arm_fir_interpolate_f32 (&interp24_48Inst, dataBuf24, dataBuf48, 32);
@@ -213,7 +213,7 @@ void radioCWModulator_F32::update(void) {
213213
// Interpolation is complete, now amplitude modulate CW onto a sine wave.
214214
for (i=0; i < 128; i++) // Always 128 modulation signals
215215
{
216-
float32_t vOut;
216+
float32_t vOut = 0.0;
217217
if(sampleRate == SR_12KSPS)
218218
vOut = dataBuf12[i];
219219
else if(sampleRate == SR_24KSPS)

radioCWModulator_F32.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@
4545
// 22 to 25 ksps. setSampleRate_Hz() changed to bool (true if successful, false
4646
// if unsupported rate.
4747

48-
// *** 15 SEPT 2025 VERSION USING FULL FIR FILTERS (multiplying by zeros) ***
49-
48+
/* *** 15 SEPT 2025 VERSION USING FULL FIR FILTERS (multiplying by zeros) ***
49+
Processor time per update():
50+
12 ksps Sample rate 81 uSec 0.76% of processor
51+
24 ksps 59 uSec 1.1%
52+
48 ksps 48 uSec 1.8%
53+
96 ksks 41 uSec 3.1%
54+
*/
5055
/* ToDo: Revise to polyphase interpolation to improve execution time.
5156
See Richard G. Lyons, "Understanding Digital Signal Processing,"
5257
Third Edition, Prentice-Hall 2011, Section 10.12.2 Half-Band
@@ -59,6 +64,8 @@
5964
filter coefficient is zero, except for the center one that is
6065
always 0.5. The zero-product multiply-and-accumulates are not done by
6166
omitting them from the coefficient array.
67+
68+
Comment: The processor useage is so small, this change is not of value. RSL
6269
*/
6370

6471
#ifndef radioCWModulator_F32_h_
@@ -115,7 +122,7 @@ class radioCWModulator_F32 : public AudioStream_F32
115122
dataBuf12[ii] = 0.0f;
116123
for(int ii=0; ii<128; ii++)
117124
{
118-
dataBuf12[ii] = 0.0f;
125+
dataBuf12[ii] = 0.0f;
119126
dataBuf24[ii] = 0.0f; // Buffer for 12 to 24 ksps interp
120127
dataBuf48[ii] = 0.0f;
121128
dataBuf96[ii] = 0.0f;
@@ -167,7 +174,7 @@ class radioCWModulator_F32 : public AudioStream_F32
167174
{
168175
uint16_t space = getBufferSpace();
169176
uint16_t size = strlen(_pStr);
170-
if(space < size) return false;
177+
if(space <= size) return false; // Fixed twice - thanks defragster!
171178
for(int kk=0; kk<(int)strlen(_pStr); kk++)
172179
sendCW( (uint16_t)*(_pStr+kk) );
173180
return true;

0 commit comments

Comments
 (0)