MT63 transmit bug fix

1. MT63 tx buffer was not correctly initialized at the start
       of each transmission.
    2. Added Rx Integration length selector to MT63 configuration.
    3. Added lowest / highest preamble tones as a signal acquisition
       aid.  User can enable lowest, both or none.
pull/2/head
David Freese 2009-07-23 18:30:25 -05:00 zatwierdzone przez Stelios Bounanos
rodzic 52fb02e33d
commit cf4c6710fa
10 zmienionych plików z 597 dodań i 506 usunięć

Wyświetl plik

@ -818,6 +818,27 @@ static void cb_btnMT63_8bit(Fl_Check_Button* o, void*) {
progdefaults.changed = true;
}
Fl_Check_Button *btnMT63_rx_integration=(Fl_Check_Button *)0;
static void cb_btnMT63_rx_integration(Fl_Check_Button* o, void*) {
progdefaults.mt63_rx_integration = o->value();
progdefaults.changed = true;
}
Fl_Check_Button *btnMT63_usetones=(Fl_Check_Button *)0;
static void cb_btnMT63_usetones(Fl_Check_Button* o, void*) {
progdefaults.mt63_usetones = o->value();
progdefaults.changed = true;
}
Fl_Check_Button *btnMT63_upper_lower=(Fl_Check_Button *)0;
static void cb_btnMT63_upper_lower(Fl_Check_Button* o, void*) {
progdefaults.mt63_twotones = o->value();
progdefaults.changed = true;
}
Fl_Group *tabOlivia=(Fl_Group *)0;
Fl_Choice *mnuOlivia_Bandwidth=(Fl_Choice *)0;
@ -2123,6 +2144,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
{ tabOperator = new Fl_Group(0, 25, 500, 345, _("Operator"));
tabOperator->callback((Fl_Callback*)cb_tabOperator);
tabOperator->when(FL_WHEN_CHANGED);
tabOperator->hide();
{ Fl_Group* o = new Fl_Group(5, 35, 490, 165, _("Station"));
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
@ -2707,11 +2729,11 @@ an merging"));
tabWaterfall->end();
} // Fl_Group* tabWaterfall
{ tabModems = new Fl_Group(0, 25, 500, 345, _("Modems"));
tabModems->hide();
{ tabsModems = new Fl_Tabs(0, 25, 500, 345);
tabsModems->selection_color(FL_LIGHT1);
tabsModems->align(FL_ALIGN_TOP_RIGHT);
{ tabCW = new Fl_Group(0, 50, 500, 320, _("CW"));
tabCW->hide();
{ tabsCW = new Fl_Tabs(0, 50, 500, 320);
tabsCW->selection_color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(0, 75, 500, 295, _("General"));
@ -3076,8 +3098,7 @@ an merging"));
tabFeld->end();
} // Fl_Group* tabFeld
{ tabMT63 = new Fl_Group(0, 50, 500, 320, _("MT-63"));
tabMT63->hide();
{ Fl_Group* o = new Fl_Group(5, 60, 490, 85);
{ Fl_Group* o = new Fl_Group(5, 60, 490, 184);
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
{ Fl_Check_Button* o = btnmt63_interleave = new Fl_Check_Button(150, 78, 185, 20, _("64-bit (long) interleave"));
@ -3087,12 +3108,30 @@ an merging"));
btnmt63_interleave->callback((Fl_Callback*)cb_btnmt63_interleave);
o->value(0);if (progdefaults.mt63_interleave == 64) o->value(1);
} // Fl_Check_Button* btnmt63_interleave
{ Fl_Check_Button* o = btnMT63_8bit = new Fl_Check_Button(150, 113, 205, 20, _("8-bit extended characters"));
{ Fl_Check_Button* o = btnMT63_8bit = new Fl_Check_Button(150, 114, 205, 20, _("8-bit extended characters"));
btnMT63_8bit->tooltip(_("Enable this for Latin-1 accented characters"));
btnMT63_8bit->down_box(FL_DOWN_BOX);
btnMT63_8bit->callback((Fl_Callback*)cb_btnMT63_8bit);
o->value(progdefaults.mt63_8bit);
} // Fl_Check_Button* btnMT63_8bit
{ Fl_Check_Button* o = btnMT63_rx_integration = new Fl_Check_Button(150, 151, 167, 15, _("Long Rx Integration"));
btnMT63_rx_integration->tooltip(_("Enable for very weak signals"));
btnMT63_rx_integration->down_box(FL_DOWN_BOX);
btnMT63_rx_integration->callback((Fl_Callback*)cb_btnMT63_rx_integration);
o->value(progdefaults.mt63_rx_integration);
} // Fl_Check_Button* btnMT63_rx_integration
{ Fl_Check_Button* o = btnMT63_usetones = new Fl_Check_Button(150, 183, 133, 15, _("Use start tones"));
btnMT63_usetones->tooltip(_("Xmt startup tones in first / last frequency bins"));
btnMT63_usetones->down_box(FL_DOWN_BOX);
btnMT63_usetones->callback((Fl_Callback*)cb_btnMT63_usetones);
o->value(progdefaults.mt63_usetones);
} // Fl_Check_Button* btnMT63_usetones
{ Fl_Check_Button* o = btnMT63_upper_lower = new Fl_Check_Button(150, 215, 136, 15, _("Upper && Lower"));
btnMT63_upper_lower->tooltip(_("Select for two / clear for only lower tone"));
btnMT63_upper_lower->down_box(FL_DOWN_BOX);
btnMT63_upper_lower->callback((Fl_Callback*)cb_btnMT63_upper_lower);
o->value(progdefaults.mt63_twotones);
} // Fl_Check_Button* btnMT63_upper_lower
o->end();
} // Fl_Group* o
tabMT63->end();

Wyświetl plik

@ -80,15 +80,15 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
code {} {}
Fl_Window {} {
label {Fldigi configuration} open
xywh {326 139 500 400} type Double color 45 selection_color 51 labelsize 18 align 80 visible
xywh {536 199 500 400} type Double color 45 selection_color 51 labelsize 18 align 80 visible
} {
Fl_Tabs tabsConfigure {open
xywh {0 0 505 372} color 50 selection_color 50
} {
Fl_Group tabOperator {
label Operator
callback {progdefaults.changed = true;} open selected
xywh {0 25 500 345} when 1
callback {progdefaults.changed = true;} open
xywh {0 25 500 345} when 1 hide
} {
Fl_Group {} {
label Station open
@ -699,14 +699,14 @@ behaves inside the waterfall} xywh {15 196 150 22} down_box BORDER_BOX align 8
}
Fl_Group tabModems {
label Modems open
xywh {0 25 500 345} hide
xywh {0 25 500 345}
} {
Fl_Tabs tabsModems {open
xywh {0 25 500 345} selection_color 50 align 9
} {
Fl_Group tabCW {
label CW open
xywh {0 50 500 320}
xywh {0 50 500 320} hide
} {
Fl_Tabs tabsCW {open
xywh {0 50 500 320} selection_color 50
@ -830,14 +830,14 @@ progdefaults.changed = true;}
label {Dash to dot ratio}
callback {progdefaults.CWdash2dot=o->value();
progdefaults.changed = true;}
tooltip {Dash to dot ratio} xywh {240 114 64 20} type Simple align 8 minimum 2.5 maximum 4 step 0.1 value 3
tooltip {Dash to dot ratio} xywh {240 114 64 20} type Simple align 8 minimum 2.5 maximum 4 value 3
code0 {o->value(progdefaults.CWdash2dot);}
}
Fl_Counter cntCWrisetime {
label {Edge timing}
callback {progdefaults.CWrisetime=o->value();
progdefaults.changed = true;}
tooltip {Leading and Trailing edge risetimes (msec)} xywh {240 145 65 20} type Simple align 8 minimum 0 maximum 15 step 0.1 value 4
tooltip {Leading and Trailing edge risetimes (msec)} xywh {240 145 65 20} type Simple align 8 minimum 0 maximum 15 value 4
code0 {o->value(progdefaults.CWrisetime);}
}
Fl_Choice mnuQSKshape {
@ -927,7 +927,7 @@ progdefaults.changed = true;}
callback {progdefaults.DOMINOEX_BW = o->value();
resetDOMEX();
progdefaults.changed = true;}
tooltip {Filter bandwidth relative to signal width} xywh {156 141 63 20} type Simple align 8 minimum 1 maximum 2 step 0.1 value 1.5
tooltip {Filter bandwidth relative to signal width} xywh {156 141 63 20} type Simple align 8 minimum 1 maximum 2 value 1.5
code0 {o->value(progdefaults.DOMINOEX_BW);}
}
Fl_Check_Button chkDominoEX_FEC {
@ -941,7 +941,7 @@ progdefaults.changed = true;}
label {CWI threshold}
callback {progdefaults.DomCWI = o->value();
progdefaults.changed = true;}
tooltip {CWI detection and suppression} xywh {15 207 260 20} type Horizontal align 1 step 0.01 textsize 14
tooltip {CWI detection and suppression} xywh {15 207 260 20} type Horizontal align 1 textsize 14
code0 {o->value(progdefaults.DomCWI);}
}
Fl_Counter valDominoEX_PATHS {
@ -1025,10 +1025,10 @@ progdefaults.changed = true;}
}
Fl_Group tabMT63 {
label {MT-63} open
xywh {0 50 500 320} hide
xywh {0 50 500 320}
} {
Fl_Group {} {open
xywh {5 60 490 85} box ENGRAVED_FRAME align 21
xywh {5 60 490 184} box ENGRAVED_FRAME align 21
} {
Fl_Check_Button btnmt63_interleave {
label {64-bit (long) interleave}
@ -1044,9 +1044,30 @@ progdefaults.changed = true;}
label {8-bit extended characters}
callback {progdefaults.mt63_8bit = o->value();
progdefaults.changed = true;}
tooltip {Enable this for Latin-1 accented characters} xywh {150 113 205 20} down_box DOWN_BOX
tooltip {Enable this for Latin-1 accented characters} xywh {150 114 205 20} down_box DOWN_BOX
code0 {o->value(progdefaults.mt63_8bit);}
}
Fl_Check_Button btnMT63_rx_integration {
label {Long Rx Integration}
callback {progdefaults.mt63_rx_integration = o->value();
progdefaults.changed = true;}
tooltip {Enable for very weak signals} xywh {150 151 167 15} down_box DOWN_BOX
code0 {o->value(progdefaults.mt63_rx_integration);}
}
Fl_Check_Button btnMT63_usetones {
label {Use start tones}
callback {progdefaults.mt63_usetones = o->value();
progdefaults.changed = true;}
tooltip {Xmt startup tones in first / last frequency bins} xywh {150 183 133 15} down_box DOWN_BOX
code0 {o->value(progdefaults.mt63_usetones);}
}
Fl_Check_Button btnMT63_upper_lower {
label {Upper && Lower}
callback {progdefaults.mt63_twotones = o->value();
progdefaults.changed = true;} selected
tooltip {Select for two / clear for only lower tone} xywh {150 215 136 15} down_box DOWN_BOX
code0 {o->value(progdefaults.mt63_twotones);}
}
}
}
Fl_Group tabOlivia {
@ -1402,7 +1423,7 @@ progdefaults.changed = true;}
callback {progdefaults.THOR_BW = o->value();
resetTHOR();
progdefaults.changed = true;}
tooltip {Filter bandwidth relative to signal width} xywh {156 141 63 20} type Simple align 8 minimum 1 maximum 2 step 0.1 value 1.5
tooltip {Filter bandwidth relative to signal width} xywh {156 141 63 20} type Simple align 8 minimum 1 maximum 2 value 1.5
code0 {o->value(progdefaults.THOR_BW);}
}
Fl_Check_Button valTHOR_SOFT {
@ -1416,7 +1437,7 @@ progdefaults.changed = true;}
label {CWI threshold}
callback {progdefaults.ThorCWI = o->value();
progdefaults.changed = true;}
tooltip {CWI detection and suppression} xywh {15 218 260 20} type Horizontal align 1 step 0.01 textsize 14
tooltip {CWI detection and suppression} xywh {15 218 260 20} type Horizontal align 1 textsize 14
code0 {o->value(progdefaults.ThorCWI);}
}
Fl_Counter valTHOR_PATHS {
@ -2191,7 +2212,7 @@ progdefaults.changed = true;}
label PCM
callback {setPCMvolume(o->value());
progdefaults.changed = true;}
tooltip {Set the sound card PCM level} xywh {15 167 340 20} type Horizontal selection_color 15 align 8 step 0.01 value 0.8 textsize 14
tooltip {Set the sound card PCM level} xywh {15 167 340 20} type Horizontal selection_color 15 align 8 value 0.8 textsize 14
code0 {extern void setPCMvolume(double);}
}
}

Wyświetl plik

@ -139,6 +139,9 @@ extern Fl_Check_Button *btnHellXmtWidth;
extern Fl_Group *tabMT63;
extern Fl_Check_Button *btnmt63_interleave;
extern Fl_Check_Button *btnMT63_8bit;
extern Fl_Check_Button *btnMT63_rx_integration;
extern Fl_Check_Button *btnMT63_usetones;
extern Fl_Check_Button *btnMT63_upper_lower;
extern Fl_Group *tabOlivia;
extern Fl_Choice *mnuOlivia_Bandwidth;
extern Fl_Choice *mnuOlivia_Tones;

Wyświetl plik

@ -143,6 +143,9 @@
/* MT63 */ \
ELEM_(bool, mt63_8bit, "MT638BIT", false) \
ELEM_(int, mt63_interleave, "MT63INTERLEAVE", 64) /* long interleave */ \
ELEM_(bool, mt63_rx_integration, "MT63INTEGRATION", false) \
ELEM_(bool, mt63_twotones, "MT63TWOTONES", true) \
ELEM_(bool, mt63_usetones, "MT63USETONES", true) \
/* Waterfall & UI */ \
ELEM_(uchar, red, "", 0) \
ELEM_(uchar, green, "", 255) \

Wyświetl plik

@ -37,6 +37,7 @@ private:
int Interleave;
int flush;
int escape;
bool long_integral;
MT63tx *Tx;
MT63rx *Rx;

Wyświetl plik

@ -180,7 +180,7 @@ public:
~MT63tx();
void Free(void);
int Preset(int BandWidth=1000, int LongInterleave=0);//, char *ID=NULL);
int SendTune(void);
int SendTune(bool twotones);
int SendChar(char ch);
int SendJam(void);
int SendSilence(void);

Plik diff jest za duży Load Diff

Wyświetl plik

@ -31,8 +31,7 @@
#include "mt63.h"
using namespace std;
static int IntegLen = 32; // integration period for sync./data tracking
bool startflag = true;
void mt63::tx_init(SoundBase *sb)
{
@ -41,11 +40,14 @@ void mt63::tx_init(SoundBase *sb)
set_freq(500.0 + bandwidth / 2.0);
flush = Tx->DataInterleave;
videoText();
startflag = true;
}
void mt63::rx_init()
{
Rx->Preset((int)bandwidth, Interleave == 64 ? 1 : 0, IntegLen);
Rx->Preset( (int)bandwidth,
Interleave == 64 ? 1 : 0,
long_integral ? 32 : 16 );
set_freq(500.0 + bandwidth / 2.0);
InpLevel->Preset(64.0, 0.75);
escape = 0;
@ -60,6 +62,23 @@ int mt63::tx_process()
rx_flush();
if (startflag == true) {
startflag = false;
for (int i = 0; i < Tx->DataInterleave; i++) Tx->SendChar(0);
if (progdefaults.mt63_usetones) {
double maxval = 0.0;
for (int i = 0; i < Tx->DataInterleave / 2; i++) {
Tx->SendTune( progdefaults.mt63_twotones );
for (int i = 0; i < Tx->Comb.Output.Len; i++)
if (fabs(Tx->Comb.Output.Data[i]) > maxval)
maxval = fabs(Tx->Comb.Output.Data[i]);
for (int i = 0; i < Tx->Comb.Output.Len; i++)
Tx->Comb.Output.Data[i] /= maxval;
ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len);
}
}
}
c = get_tx_char();
if (c == 0x03) {
stopflag = true;
@ -99,12 +118,12 @@ int mt63::tx_process()
}
Tx->SendChar(c);
for (int i = 0; i < Tx->Comb.Output.Len; i++)
if (fabs(Tx->Comb.Output.Data[i]) > maxval)
maxval = fabs(Tx->Comb.Output.Data[i]);
for (int i = 0; i < Tx->Comb.Output.Len; i++) {
Tx->Comb.Output.Data[i] /= maxval;
}
for (int i = 0; i < Tx->Comb.Output.Len; i++)
if (fabs(Tx->Comb.Output.Data[i]) > maxval)
maxval = fabs(Tx->Comb.Output.Data[i]);
for (int i = 0; i < Tx->Comb.Output.Len; i++) {
Tx->Comb.Output.Data[i] /= maxval;
}
ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len);
return 0;
@ -125,15 +144,20 @@ int mt63::rx_process(const double *buf, int len)
Interleave = progdefaults.mt63_interleave;
restart();
}
if (long_integral != progdefaults.mt63_rx_integration) {
long_integral = progdefaults.mt63_rx_integration;
restart();
}
if (InpBuff->EnsureSpace(len) == -1) {
fprintf(stderr, "mt63_rxprocess: buffer error\n");
return -1;
}
for (i = 0; i < len; i++)
InpBuff->Data[i] = buf[i];
InpBuff->Len = len;
InpBuff->Len = len;
InpLevel->Process(InpBuff);
Rx->Process(InpBuff);
@ -250,11 +274,9 @@ void mt63::restart()
fprintf(stderr, "mt63_txinit: init failed\n");
flush = Tx->DataInterleave;
// Rx->Preset( int BandWidth = 1000,
// int LongInterleave = 0,
// int Integ = 16,
// void (*Display)(double *Spectra, int Len) = NULL);
err = Rx->Preset((int)bandwidth, Interleave == 64 ? 1 : 0, IntegLen);
err = Rx->Preset( (int)bandwidth,
Interleave == 64 ? 1 : 0,
long_integral ? 32 : 16);
if (err)
fprintf(stderr, "mt63_rxinit: init failed\n");
InpLevel->Preset(64.0, 0.75);
@ -282,6 +304,7 @@ mt63::mt63 (trx_mode mt63_mode) : modem()
break;
}
Interleave = progdefaults.mt63_interleave;
long_integral = progdefaults.mt63_rx_integration;
Tx = new MT63tx;
Rx = new MT63rx;

Wyświetl plik

@ -167,7 +167,7 @@ Error:
return -1;
}
int MT63tx::SendTune(void)
int MT63tx::SendTune(bool twotones)
{
int i, c, r, mask;
double dspAmpl;
@ -187,14 +187,15 @@ int MT63tx::SendTune(void)
WindowBuff.Data[r].re = dspAmpl * FFT.Twiddle[TxVect[i]].re;
WindowBuff.Data[r].im = (-dspAmpl) * FFT.Twiddle[TxVect[i]].im;
i = DataCarriers - 1;
c = FirstDataCarr + i * DataCarrSepar;
c &= mask;
r = WindowLen + FFT.BitRevIdx[c];
WindowBuff.Data[r].re = dspAmpl * FFT.Twiddle[TxVect[i]].re;
WindowBuff.Data[r].im = (-dspAmpl) * FFT.Twiddle[TxVect[i]].im;
// inverse FFT: WindowBuff is already scrmabled
if (twotones) {
i = DataCarriers - 1;
c = FirstDataCarr + i * DataCarrSepar;
c &= mask;
r = WindowLen + FFT.BitRevIdx[c];
WindowBuff.Data[r].re = dspAmpl * FFT.Twiddle[TxVect[i]].re;
WindowBuff.Data[r].im = (-dspAmpl) * FFT.Twiddle[TxVect[i]].im;
}
// inverse FFT: WindowBuff is already scrambled
FFT.CoreProc(WindowBuff.Data);
FFT.CoreProc(WindowBuff.Data + WindowLen);
// negate the imaginary part for the IFFT