* Changed extended rsid iaw doc/rsid_codes.gnumeric

pull/1/head
David Freese 2013-06-02 21:30:07 -05:00
rodzic 3bb70e4308
commit e12a3733b3
6 zmienionych plików z 218 dodań i 234 usunięć

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -8273,8 +8273,8 @@ d frequency"));
if (progdefaults.rsid_notify_only) chkRSidAutoDisable->deactivate();
} // Fl_Check_Button* chkRSidAutoDisable
{ Fl_Value_Slider2* o = sldrRSIDresolution = new Fl_Value_Slider2(10, 233, 145, 22, _("Sensitivity"));
sldrRSIDresolution->tooltip(_("2 = low sensitivity / decreased false detection\n5 = high sensitivity / incre\
ased false detection"));
sldrRSIDresolution->tooltip(_("2 = normal sensitivity / decreased false detection\n5 = high sensitivity / in\
creased false detection"));
sldrRSIDresolution->type(1);
sldrRSIDresolution->box(FL_DOWN_BOX);
sldrRSIDresolution->color(FL_BACKGROUND_COLOR);
@ -8283,10 +8283,10 @@ ased false detection"));
sldrRSIDresolution->labelfont(0);
sldrRSIDresolution->labelsize(14);
sldrRSIDresolution->labelcolor(FL_FOREGROUND_COLOR);
sldrRSIDresolution->minimum(1);
sldrRSIDresolution->minimum(2);
sldrRSIDresolution->maximum(5);
sldrRSIDresolution->step(1);
sldrRSIDresolution->value(5);
sldrRSIDresolution->value(2);
sldrRSIDresolution->textsize(14);
sldrRSIDresolution->callback((Fl_Callback*)cb_sldrRSIDresolution);
sldrRSIDresolution->align(Fl_Align(FL_ALIGN_RIGHT));

Wyświetl plik

@ -4803,8 +4803,8 @@ progdefaults.changed = true;}
label Sensitivity
callback {progdefaults.rsid_resolution = (int)o->value();
progdefaults.changed = true;}
tooltip {2 = low sensitivity / decreased false detection
5 = high sensitivity / increased false detection} xywh {10 233 145 22} type Horizontal align 8 minimum 1 maximum 5 step 1 value 5 textsize 14
tooltip {2 = normal sensitivity / decreased false detection
5 = high sensitivity / increased false detection} xywh {10 233 145 22} type Horizontal align 8 minimum 2 maximum 5 step 1 value 2 textsize 14
code0 {o->value(progdefaults.rsid_resolution);}
code2 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2

Wyświetl plik

@ -80,15 +80,18 @@ enum { INITIAL, EXTENDED, WAIT };
private:
// Table of precalculated Reed Solomon symbols
unsigned char *pCodes;
unsigned char *pCodes1;
unsigned char *pCodes2;
static const RSIDs rsid_ids[];
static const int rsid_ids_size;
bool found1;
bool found2;
static const RSIDs rsid_ids_1[];
static const int rsid_ids_size1;
static const int Squares[];
static const int indices[];
static const RSIDs rsid_ids2[];
static const RSIDs rsid_ids_2[];
static const int rsid_ids_size2;
int rsid_secondary_time_out;
@ -105,27 +108,24 @@ private:
Cfft *rsfft;
// Hashing tables
unsigned char aHashTable1[RSID_HASH_LEN];
unsigned char aHashTable2[RSID_HASH_LEN];
unsigned char hash_table_A[RSID_HASH_LEN];
unsigned char hash_table_B[RSID_HASH_LEN];
unsigned char aHashTable1_2[RSID_HASH_LEN];
unsigned char aHashTable2_2[RSID_HASH_LEN];
unsigned char hash_table_C[RSID_HASH_LEN];
unsigned char hash_table_D[RSID_HASH_LEN];
bool bPrevTimeSliceValid;
int iPrevDistance;
int iPrevBin;
int iPrevSymbol;
int iTime; // modulo RSID_NTIMES
int aBuckets[RSID_NTIMES][RSID_FFT_SIZE];
int i1, i2, i3;
int aBuckets[RSID_NTIMES][RSID_FFT_SIZE]; // history of detected rsid tones
bool bPrevTimeSliceValid2;
int iPrevDistance2;
int iPrevBin2;
int iPrevSymbol2;
int iTime2; // modulo RSID_NTIMES
int DistanceOut;
int MetricsOut;
// resample
SRC_STATE* src_state;
@ -141,10 +141,10 @@ private:
void Encode(int code, unsigned char *rsid);
int HammingDistance(int iBucket, unsigned char *p2);
void CalculateBuckets(const double *pSpectrum, int iBegin, int iEnd);
bool search_amp( int &pSymbolOut, int &pBinOut);
bool search_amp2( int &pSymbolOut, int &pBinOut);
bool search_amp1( int &pSymbolOut, int &pBinOut, unsigned char *table);
bool search_amp2( int &pSymbolOut, int &pBinOut, unsigned char *table);
void search(void);
void apply (int iSymbol, int iBin);
void apply1 (int iSymbol, int iBin);
void apply2 (int iSymbol, int iBin);
void setup_mode(int m);
public:

Wyświetl plik

@ -88,38 +88,58 @@ cRsId::cRsId()
rsfft = new Cfft(RSID_FFT_SIZE);
memset(aHashTable1, 255, sizeof(aHashTable1));
memset(aHashTable2, 255, sizeof(aHashTable2));
memset(hash_table_A, 255, sizeof(hash_table_A));
memset(hash_table_B, 255, sizeof(hash_table_B));
memset(hash_table_C, 255, sizeof(hash_table_C));
memset(hash_table_D, 255, sizeof(hash_table_D));
memset(fftwindow, 0, RSID_ARRAY_SIZE * sizeof(double));
RectWindow(fftwindow, RSID_FFT_SIZE);
pCodes = new unsigned char[rsid_ids_size * RSID_NSYMBOLS];
memset(pCodes, 0, rsid_ids_size * RSID_NSYMBOLS);
pCodes1 = new unsigned char[rsid_ids_size1 * RSID_NSYMBOLS];
memset(pCodes1, 0, rsid_ids_size1 * RSID_NSYMBOLS);
pCodes2 = new unsigned char[rsid_ids_size2 * RSID_NSYMBOLS];
memset(pCodes, 0, rsid_ids_size2 * RSID_NSYMBOLS);
memset(pCodes2, 0, rsid_ids_size2 * RSID_NSYMBOLS);
// Initialization of assigned mode/submode IDs.
// HashTable is used for finding a code with lowest Hamming distance.
unsigned char* c;
int hash1, hash2;
for (int i = 0; i < rsid_ids_size; i++) {
c = pCodes + i * RSID_NSYMBOLS;
Encode(rsid_ids[i].rs, c);
for (int i = 0; i < rsid_ids_size1; i++) {
c = pCodes1 + i * RSID_NSYMBOLS;
Encode(rsid_ids_1[i].rs, c);
hash1 = c[11] | (c[12] << 4);
hash2 = c[13] | (c[14] << 4);
aHashTable1[hash1] = i;
aHashTable2[hash2] = i;
hash_table_A[hash1] = i;
hash_table_B[hash2] = i;
}
for (int i = 0; i < rsid_ids_size2; i++) {
c = pCodes2 + i * RSID_NSYMBOLS;
Encode(rsid_ids2[i].rs, c);
Encode(rsid_ids_2[i].rs, c);
hash1 = c[11] | (c[12] << 4);
hash2 = c[13] | (c[14] << 4);
aHashTable1_2[hash1] = i;
aHashTable2_2[hash2] = i;
hash_table_C[hash1] = i;
hash_table_D[hash2] = i;
}
#if 0
printf("pcode table 1\n");
printf("rs, name, mode,sequence\n");
for (int i = 0; i < rsid_ids_size1; i++) {
printf("%d,%s,%d", rsid_ids_1[i].rs, rsid_ids_1[i].name, rsid_ids_1[i].mode);
for (int j = 0; j < RSID_NSYMBOLS; j++)
printf(",%d", pCodes1[i*RSID_NSYMBOLS + j]);
printf("\n");
}
printf("pcode table 2\n");
printf("rs, name, mode,sequence\n");
for (int i = 0; i < rsid_ids_size2; i++) {
printf("%d,%s,%d", rsid_ids_2[i].rs, rsid_ids_2[i].name, rsid_ids_2[i].mode);
for (int j = 0; j < RSID_NSYMBOLS; j++)
printf(",%d", pCodes2[i*RSID_NSYMBOLS + j]);
printf("\n");
}
#endif
nBinLow = RSID_RESOL + 1;
nBinHigh = RSID_FFT_SIZE - 32;
@ -127,14 +147,13 @@ cRsId::cRsId()
outbuf = 0;
symlen = 0;
hamming_resolution = progdefaults.rsid_resolution + 1;
hamming_resolution = progdefaults.rsid_resolution;
rsid_secondary_time_out = 0;
}
cRsId::~cRsId()
{
delete [] pCodes;
delete [] pCodes1;
delete [] pCodes2;
delete [] outbuf;
@ -144,11 +163,12 @@ cRsId::~cRsId()
void cRsId::reset()
{
iPrevDistance = 99;
bPrevTimeSliceValid = false;
bPrevTimeSliceValid2 = false;
iTime = 0;
iTime2 = 0;
iPrevDistance = iPrevDistance2 = 99;
bPrevTimeSliceValid = bPrevTimeSliceValid2 = false;
found1 = found2 = false;
rsid_secondary_time_out = 0;
memset(aInputSamples, 0, sizeof(aInputSamples));
memset(aFFTReal, 0, sizeof(aFFTReal));
memset(aFFTAmpl, 0, sizeof(aFFTAmpl));
@ -159,7 +179,7 @@ void cRsId::reset()
LOG_ERROR("src_reset error %d: %s", error, src_strerror(error));
src_data.src_ratio = 0.0;
inptr = aInputSamples + RSID_FFT_SAMPLES;
hamming_resolution = progdefaults.rsid_resolution + 1;
hamming_resolution = progdefaults.rsid_resolution;
}
void cRsId::Encode(int code, unsigned char *rsid)
@ -216,7 +236,7 @@ void cRsId::receive(const float* buf, size_t len)
rsid_secondary_time_out -= (int)(len / src_ratio);
if (rsid_secondary_time_out <= 0) {
LOG_INFO("%s", "Secondary RsID sequence timed out");
rsid_secondary_time_out = 0;
reset();
}
}
@ -304,30 +324,43 @@ void cRsId::search(void)
aFFTAmpl[i] = Real * Real + Imag * Imag;
}
int SymbolOut = -1, BinOut = -1;
if (++iTime == RSID_NTIMES)
iTime = 0;
i1 = iTime - 3 * RSID_RESOL;
if (i1 < 0) i1 += RSID_NTIMES;
i2 = i1 + RSID_RESOL;
i3 = i2 + RSID_RESOL;
CalculateBuckets ( aFFTAmpl, nBinLow, nBinHigh - RSID_NTIMES);
CalculateBuckets ( aFFTAmpl, nBinLow + 1, nBinHigh - RSID_NTIMES);
int symbol_out_1 = -1;
int bin_out_1 = -1;
int symbol_out_2 = -1;
int bin_out_2 = -1;
if (!found1) found1 = search_amp1(symbol_out_1, bin_out_1, pCodes1);
found2 = search_amp2(symbol_out_2, bin_out_2, pCodes2);
// rsid_secondary_time_out == 0 ==> waiting for initial rsid tone sequence
if (rsid_secondary_time_out == 0 && search_amp(SymbolOut, BinOut)) {
LOG_INFO("Rsid_code detected: %d", SymbolOut);
if (SymbolOut == RSID_ESCAPE) {
if (rsid_secondary_time_out == 0 && found1) {
if (symbol_out_1 != RSID_ESCAPE) {
if (bReverse)
bin_out_1 = 1024 - bin_out_1 - 31;
apply1(symbol_out_1, bin_out_1);
reset();
rsid_secondary_time_out = 2*15*1024;
return;
} else {
LOG_INFO("%s", "Extended RsID");
rsid_secondary_time_out = 3*15*1024;
return;
}
if (bReverse)
BinOut = 1024 - BinOut - 31;
apply(SymbolOut, BinOut);
rsid_secondary_time_out = 0;
reset();
// rsid_secondary_time_out > 0 ==> waiting for secondary rsid tone sequence
} else if (rsid_secondary_time_out > 0 && search_amp(SymbolOut, BinOut)) {
if (SymbolOut != RSID_ESCAPE2) {
LOG_INFO("Ext' rsid_code detected: %d", SymbolOut);
} else if (found1 && found2) {
if (symbol_out_2 != RSID_NONE2) { //RSID_ESCAPE2) {
if (bReverse)
BinOut = 1024 - BinOut - 31;
apply2(SymbolOut, BinOut);
bin_out_2 = 1024 - bin_out_2 - 31;
apply2(symbol_out_2, bin_out_2);
} else
LOG_INFO("%s", "Invalid secondary RsID code");
rsid_secondary_time_out = 0;
reset();
}
}
@ -553,7 +586,7 @@ void cRsId::setup_mode(int iSymbol)
} // switch (iSymbol)
}
void cRsId::apply(int iSymbol, int iBin)
void cRsId::apply1(int iSymbol, int iBin)
{
ENSURE_THREAD(TRX_TID);
@ -563,17 +596,17 @@ void cRsId::apply(int iSymbol, int iBin)
currfreq = active_modem->get_freq();
rsidfreq = (iBin + (RSID_NSYMBOLS - 1) * RSID_RESOL / 2) * RSID_SAMPLE_RATE / 2048.0;
for (n = 0; n < rsid_ids_size; n++) {
if (rsid_ids[n].rs == iSymbol) {
mbin = rsid_ids[n].mode;
for (n = 0; n < rsid_ids_size1; n++) {
if (rsid_ids_1[n].rs == iSymbol) {
mbin = rsid_ids_1[n].mode;
break;
}
}
if (mbin == NUM_MODES) {
char msg[50];
if (n < rsid_ids_size) // RSID known but unimplemented
snprintf(msg, sizeof(msg), "RSID: %s unimplemented", rsid_ids[n].name);
if (n < rsid_ids_size1) // RSID known but unimplemented
snprintf(msg, sizeof(msg), "RSID: %s unimplemented", rsid_ids_1[n].name);
else // RSID unknown; shouldn't happen
snprintf(msg, sizeof(msg), "RSID: code %d unknown", iSymbol);
put_status(msg, 4.0);
@ -581,10 +614,10 @@ void cRsId::apply(int iSymbol, int iBin)
return;
}
else if (progdefaults.rsid_rx_modes.test(mbin)) {
LOG_INFO("RSID: %s @ %0.0f Hz", rsid_ids[n].name, rsidfreq);
LOG_INFO("RSID: %s @ %0.0f Hz", rsid_ids_1[n].name, rsidfreq);
}
else {
LOG_DEBUG("Ignoring RSID: %s @ %0.0f Hz", rsid_ids[n].name, rsidfreq);
LOG_DEBUG("Ignoring RSID: %s @ %0.0f Hz", rsid_ids_1[n].name, rsidfreq);
return;
}
@ -626,8 +659,8 @@ void cRsId::apply2(int iSymbol, int iBin)
rsidfreq = (iBin + (RSID_NSYMBOLS - 1) * RSID_RESOL / 2) * RSID_SAMPLE_RATE / 2048.0;
for (n = 0; n < rsid_ids_size2; n++) {
if (rsid_ids2[n].rs == iSymbol) {
mbin = rsid_ids2[n].mode;
if (rsid_ids_2[n].rs == iSymbol) {
mbin = rsid_ids_2[n].mode;
break;
}
}
@ -635,7 +668,7 @@ void cRsId::apply2(int iSymbol, int iBin)
if (mbin == NUM_MODES) {
char msg[50];
if (n < rsid_ids_size2) // RSID known but unimplemented
snprintf(msg, sizeof(msg), "RSID-2: %s unimplemented", rsid_ids2[n].name);
snprintf(msg, sizeof(msg), "RSID-2: %s unimplemented", rsid_ids_2[n].name);
else // RSID unknown; shouldn't happen
snprintf(msg, sizeof(msg), "RSID-2: code %d unknown", iSymbol);
put_status(msg, 4.0);
@ -643,10 +676,10 @@ void cRsId::apply2(int iSymbol, int iBin)
return;
}
else if (progdefaults.rsid_rx_modes.test(mbin)) {
LOG_INFO("RSID: %s @ %0.0f Hz", rsid_ids2[n].name, rsidfreq);
LOG_INFO("RSID: %s @ %0.0f Hz", rsid_ids_2[n].name, rsidfreq);
}
else {
LOG_DEBUG("Ignoring RSID: %s @ %0.0f Hz", rsid_ids2[n].name, rsidfreq);
LOG_DEBUG("Ignoring RSID: %s @ %0.0f Hz", rsid_ids_2[n].name, rsidfreq);
return;
}
@ -675,7 +708,7 @@ void cRsId::apply2(int iSymbol, int iBin)
}
//=============================================================================
// search_amp routine #1
// search_amp1 routine #1
//=============================================================================
int cRsId::HammingDistance(int iBucket, unsigned char *p2)
@ -686,7 +719,6 @@ int cRsId::HammingDistance(int iBucket, unsigned char *p2)
j += RSID_NTIMES;
for (int i = 0; i < RSID_NSYMBOLS; i++) {
if (aBuckets[j][iBucket] != p2[i])
//VK2ETA For ARQ modes, allow more bit corrections (4 in 6)
if (++dist == hamming_resolution)
return dist;
j += RSID_RESOL;//2;
@ -696,54 +728,35 @@ int cRsId::HammingDistance(int iBucket, unsigned char *p2)
return dist;
}
bool cRsId::search_amp( int &SymbolOut, int &BinOut)
bool cRsId::search_amp1( int &SymbolOut, int &BinOut, unsigned char *pcode)
{
int i, j;
int iDistanceMin = 99; // infinity
int iDistance;
int iBin = -1;
int iSymbol = -1;
int iEnd = nBinHigh - RSID_NTIMES;
int i1, i2, i3;
if (++iTime == RSID_NTIMES)
iTime = 0;
i1 = iTime - 3 * RSID_RESOL;
i2 = i1 + RSID_RESOL;
i3 = i2 + RSID_RESOL;
if (i1 < 0) {
i1 += RSID_NTIMES;
if (i2 < 0) {
i2 += RSID_NTIMES;
if (i3 < 0)
i3 += RSID_NTIMES;
}
}
CalculateBuckets ( aFFTAmpl, nBinLow, iEnd);
CalculateBuckets ( aFFTAmpl, nBinLow + 1, iEnd);
for (i = nBinLow; i < iEnd; ++ i) {
j = aHashTable1[aBuckets[i1][i] | (aBuckets[i2][i] << 4)];
if (j < rsid_ids_size) {
iDistance = HammingDistance(i, pCodes + j * RSID_NSYMBOLS);
//VK2ETA For ARQ modes, allow more bit corrections (4 in 6)
if (iDistance < hamming_resolution && iDistance < iDistanceMin) {
iDistanceMin = iDistance;
iSymbol = rsid_ids[j].rs;
iBin = i;
for (i = nBinLow; i < nBinHigh - RSID_NTIMES; ++ i) {
int n = aBuckets[i1][i] | (aBuckets[i2][i] << 4);
if (n > 0 && n < 256) {
if ( (j = hash_table_A[n]) != 255) {
iDistance = HammingDistance(i, pcode + j * RSID_NSYMBOLS);
if (iDistance < hamming_resolution && iDistance < iDistanceMin) {
iDistanceMin = iDistance;
iSymbol = rsid_ids_1[j].rs;
iBin = i;
}
}
}
j = aHashTable2[aBuckets[i3][i] | (aBuckets[iTime][i] << 4)];
if (j < rsid_ids_size) { //!= 255) {
iDistance = HammingDistance (i, pCodes + j * RSID_NSYMBOLS);
//VK2ETA For ARQ modes, allow more bit corrections (4 in 6)
if (iDistance < hamming_resolution && iDistance < iDistanceMin) {
iDistanceMin = iDistance;
iSymbol = rsid_ids[j].rs;
iBin = i;
n = aBuckets[i3][i] | (aBuckets[iTime][i] << 4);
if (n > 0 && n < 256) {
if ((j = hash_table_B[n]) != 255) {
iDistance = HammingDistance (i, pcode + j * RSID_NSYMBOLS);
if (iDistance < hamming_resolution && iDistance < iDistanceMin) {
iDistanceMin = iDistance;
iSymbol = rsid_ids_1[j].rs;
iBin = i;
}
}
}
}
@ -754,8 +767,6 @@ bool cRsId::search_amp( int &SymbolOut, int &BinOut)
if (bPrevTimeSliceValid) {
SymbolOut = iPrevSymbol;
BinOut = iPrevBin;
DistanceOut = iPrevDistance;
MetricsOut = 0;
bPrevTimeSliceValid = false;
return true;
}
@ -772,54 +783,35 @@ bool cRsId::search_amp( int &SymbolOut, int &BinOut)
return false;
}
bool cRsId::search_amp2( int &SymbolOut, int &BinOut)
bool cRsId::search_amp2( int &SymbolOut, int &BinOut, unsigned char *pcode)
{
int i, j;
int iDistanceMin = 99; // infinity
int iDistance;
int iBin = -1;
int iSymbol = -1;
int iEnd = nBinHigh - RSID_NTIMES;
int i1, i2, i3;
if (++iTime2 == RSID_NTIMES)
iTime2 = 0;
i1 = iTime2 - 3 * RSID_RESOL;//6;
i2 = i1 + RSID_RESOL;//2;
i3 = i2 + RSID_RESOL;//2;
if (i1 < 0) {
i1 += RSID_NTIMES;
if (i2 < 0) {
i2 += RSID_NTIMES;
if (i3 < 0)
i3 += RSID_NTIMES;
}
}
CalculateBuckets ( aFFTAmpl, nBinLow, iEnd);
CalculateBuckets ( aFFTAmpl, nBinLow + 1, iEnd);
for (i = nBinLow; i < iEnd; ++ i) {
j = aHashTable1_2[aBuckets[i1][i] | (aBuckets[i2][i] << 4)];
if (j < rsid_ids_size2) {
iDistance = HammingDistance(i, pCodes2 + j * RSID_NSYMBOLS);
//VK2ETA For ARQ modes, allow more bit corrections (4 in 6)
if (iDistance < hamming_resolution && iDistance < iDistanceMin) {
iDistanceMin = iDistance;
iSymbol = rsid_ids2[j].rs;
iBin = i;
for (i = nBinLow; i < nBinHigh - RSID_NTIMES; ++ i) {
int n = aBuckets[i1][i] | (aBuckets[i2][i] << 4);
if (n > 0 && n < 256) {
if ( (j = hash_table_C[n]) != 255) {
iDistance = HammingDistance(i, pcode + j * RSID_NSYMBOLS);
if (iDistance < hamming_resolution && iDistance < iDistanceMin) {
iDistanceMin = iDistance;
iSymbol = rsid_ids_2[j].rs;
iBin = i;
}
}
}
j = aHashTable2_2[aBuckets[i3][i] | (aBuckets[iTime2][i] << 4)];
if (j < rsid_ids_size2) {
iDistance = HammingDistance (i, pCodes2 + j * RSID_NSYMBOLS);
//VK2ETA For ARQ modes, allow more bit corrections (4 in 6)
if (iDistance < hamming_resolution && iDistance < iDistanceMin) {
iDistanceMin = iDistance;
iSymbol = rsid_ids2[j].rs;
iBin = i;
n = aBuckets[i3][i] | (aBuckets[iTime][i] << 4);
if (n > 0 && n < 256) {
if ( (j = hash_table_D[n]) != 255) {
iDistance = HammingDistance (i, pcode + j * RSID_NSYMBOLS);
if (iDistance < hamming_resolution && iDistance < iDistanceMin) {
iDistanceMin = iDistance;
iSymbol = rsid_ids_2[j].rs;
iBin = i;
}
}
}
}
@ -830,9 +822,7 @@ bool cRsId::search_amp2( int &SymbolOut, int &BinOut)
if (bPrevTimeSliceValid2) {
SymbolOut = iPrevSymbol2;
BinOut = iPrevBin2;
DistanceOut = iPrevDistance2;
MetricsOut = 0;
bPrevTimeSliceValid = false;
bPrevTimeSliceValid2 = false;
return true;
}
return false;
@ -1029,21 +1019,21 @@ void cRsId::send(bool preRSID)
// if rmode is still unset, look it up
// Try secondary table first
if (rmode == RSID_NONE) {
for (size_t i = 0; i < sizeof(rsid_ids2)/sizeof(*rsid_ids2); i++) {
if (mode == rsid_ids2[i].mode) {
rmode2 = rsid_ids2[i].rs;
for (size_t i = 0; i < sizeof(rsid_ids_2)/sizeof(*rsid_ids_2); i++) {
if (mode == rsid_ids_2[i].mode) {
rmode = RSID_ESCAPE;
rmode2 = rsid_ids_2[i].rs;
break;
}
}
if (rmode2 == RSID_NONE2) {
for (size_t i = 0; i < sizeof(rsid_ids)/sizeof(*rsid_ids); i++) {
if (mode == rsid_ids[i].mode) {
rmode = rsid_ids[i].rs;
for (size_t i = 0; i < sizeof(rsid_ids_1)/sizeof(*rsid_ids_1); i++) {
if (mode == rsid_ids_1[i].mode) {
rmode = rsid_ids_1[i].rs;
break;
}
}
} else
rmode = RSID_ESCAPE;
}
}
if (rmode == RSID_NONE)
return;
@ -1065,12 +1055,10 @@ void cRsId::send(bool preRSID)
outbuf = new double[symlen];
}
// transmit 3 symbol periods of silence at end of transmission
if (!preRSID) {
memset(outbuf, 0, symlen * sizeof(*outbuf));
for (int i = 0; i < 3; i++)
active_modem->ModulateXmtr(outbuf, symlen);
}
// transmit 5 symbol periods of silence at beginning of rsid
memset(outbuf, 0, symlen * sizeof(*outbuf));
for (int i = 0; i < 5; i++)
active_modem->ModulateXmtr(outbuf, symlen);
// transmit sequence of 15 symbols (tones)
fr = 1.0 * active_modem->get_txfreq() - (RSID_SAMPLE_RATE * 7 / 1024);
@ -1092,9 +1080,9 @@ void cRsId::send(bool preRSID)
}
if (rmode == RSID_ESCAPE && rmode2 != RSID_NONE2) {
// transmit 3 symbol periods between rsid sequences
// transmit 10 symbol periods of silence between rsid sequences
memset(outbuf, 0, symlen * sizeof(*outbuf));
for (int i = 0; i < 3; i++)
for (int i = 0; i < 10; i++)
active_modem->ModulateXmtr(outbuf, symlen);
Encode(rmode2, rsid);
@ -1125,17 +1113,12 @@ void cRsId::send(bool preRSID)
}
}
// one symbol period of silence
// 5 symbol periods of silence at end of transmission
// and between RsID and the data signal
int nperiods = 5;
memset(outbuf, 0, symlen * sizeof(*outbuf));
active_modem->ModulateXmtr(outbuf, symlen);
// transmit 3 symbol periods of silence at beginning of transmission
if (preRSID) {
memset(outbuf, 0, symlen * sizeof(*outbuf));
for (int i = 0; i < 3; i++)
active_modem->ModulateXmtr(outbuf, symlen);
}
for (int i = 0; i < nperiods; i++)
active_modem->ModulateXmtr(outbuf, symlen);
}

Wyświetl plik

@ -4,6 +4,9 @@
// rsid_tag is stringified and may be shown to the user.
#undef ELEM_
#define RSID_LIST \
/* ESCAPE used to transition to 2nd RSID set */ \
ELEM_(6, ESCAPE, NUM_MODES) \
\
ELEM_(1, BPSK31, MODE_PSK31) \
ELEM_(110, QPSK31, MODE_QPSK31) \
ELEM_(2, BPSK63, MODE_PSK63) \
@ -183,8 +186,6 @@
\
ELEM_(172, MODE_188_110A_8N1, NUM_MODES) \
\
/* ESCAPE used to transition to 2nd RSID set */ \
ELEM_(263, ESCAPE, NUM_MODES) \
/* NONE must be the last element */ \
ELEM_(0, NONE, NUM_MODES)
@ -193,70 +194,70 @@ enum { RSID_LIST };
#undef ELEM_
#define ELEM_(code_, tag_, mode_) { RSID_ ## tag_, mode_, #tag_ },
const RSIDs cRsId::rsid_ids[] = { RSID_LIST };
const RSIDs cRsId::rsid_ids_1[] = { RSID_LIST };
#undef ELEM_
const int cRsId::rsid_ids_size = sizeof(rsid_ids)/sizeof(*rsid_ids) - 1;
const int cRsId::rsid_ids_size1 = sizeof(rsid_ids_1)/sizeof(*rsid_ids_1) - 1;
//======================================================================
/* ELEM_(263, ESCAPE2, NUM_MODES) \ */
#define RSID_LIST2 \
ELEM_(263, ESCAPE2, NUM_MODES) \
ELEM2_(450, PSK63RX4, MODE_4X_PSK63R) \
ELEM2_(457, PSK63RX5, MODE_5X_PSK63R) \
ELEM2_(458, PSK63RX10, MODE_10X_PSK63R) \
ELEM2_(460, PSK63RX20, MODE_20X_PSK63R) \
ELEM2_(462, PSK63RX32, MODE_32X_PSK63R) \
\
ELEM_(1, PSK63RX4, MODE_4X_PSK63R) \
ELEM_(2, PSK63RX5, MODE_5X_PSK63R) \
ELEM_(3, PSK63RX10, MODE_10X_PSK63R) \
ELEM_(4, PSK63RX20, MODE_20X_PSK63R) \
ELEM_(5, PSK63RX32, MODE_32X_PSK63R) \
ELEM2_(467, PSK125RX4, MODE_4X_PSK125R) \
ELEM2_(497, PSK125RX5, MODE_5X_PSK125R) \
ELEM2_(513, PSK125RX10, MODE_10X_PSK125R) \
ELEM2_(519, PSK125X12, MODE_12X_PSK125) \
ELEM2_(522, PSK125RX12, MODE_12X_PSK125R) \
ELEM2_(527, PSK125RX16, MODE_16X_PSK125R) \
\
ELEM_(10, PSK125RX4, MODE_4X_PSK125R) \
ELEM_(11, PSK125RX5, MODE_5X_PSK125R) \
ELEM_(12, PSK125RX10, MODE_10X_PSK125R) \
ELEM_(61, PSK125X12, MODE_12X_PSK125) \
ELEM_(62, PSK125RX12, MODE_12X_PSK125R) \
ELEM_(13, PSK125RX16, MODE_16X_PSK125R) \
ELEM2_(529, PSK250RX2, MODE_2X_PSK250R) \
ELEM2_(533, PSK250RX3, MODE_3X_PSK250R) \
ELEM2_(539, PSK250RX5, MODE_5X_PSK250R) \
ELEM2_(541, PSK250X6, MODE_6X_PSK250) \
ELEM2_(545, PSK250RX6, MODE_6X_PSK250R) \
ELEM2_(551, PSK250RX7, MODE_7X_PSK250R) \
\
ELEM_(20, PSK250RX2, MODE_2X_PSK250R) \
ELEM_(21, PSK250RX3, MODE_3X_PSK250R) \
ELEM_(22, PSK250RX5, MODE_5X_PSK250R) \
ELEM_(63, PSK250X6, MODE_6X_PSK250) \
ELEM_(65, PSK250RX6, MODE_6X_PSK250R) \
ELEM_(23, PSK250RX7, MODE_7X_PSK250R) \
ELEM2_(553, PSK500RX2, MODE_2X_PSK500R) \
ELEM2_(558, PSK500RX3, MODE_3X_PSK500R) \
ELEM2_(564, PSK500RX4, MODE_4X_PSK500R) \
ELEM2_(566, PSK500X2, MODE_2X_PSK500) \
ELEM2_(569, PSK500X4, MODE_4X_PSK500) \
\
ELEM_(24, PSK500RX2, MODE_2X_PSK500R) \
ELEM_(25, PSK500RX3, MODE_3X_PSK500R) \
ELEM_(26, PSK500RX4, MODE_4X_PSK500R) \
ELEM_(27, PSK500X2, MODE_2X_PSK500) \
ELEM_(28, PSK500X4, MODE_4X_PSK500) \
ELEM2_(570, PSK1000, MODE_PSK1000) \
ELEM2_(580, PSK1000R, MODE_PSK1000R) \
ELEM2_(587, PSK1000X2, MODE_2X_PSK1000) \
ELEM2_(595, PSK1000RX2, MODE_2X_PSK1000R) \
ELEM2_(604, PSK800RX2, MODE_2X_PSK800R) \
ELEM2_(610, PSK800X2, MODE_2X_PSK800) \
\
ELEM_(30, MFSK64, MODE_MFSK64) \
ELEM_(31, MFSK128, MODE_MFSK128) \
ELEM2_(620, MFSK64, MODE_MFSK64) \
ELEM2_(625, MFSK128, MODE_MFSK128) \
\
ELEM_(40, THOR25x4, MODE_THOR25x4) \
ELEM_(41, THOR50x1, MODE_THOR50x1) \
ELEM_(42, THOR50x2, MODE_THOR50x2) \
ELEM_(43, THOR100, MODE_THOR100) \
ELEM2_(639, THOR25x4, MODE_THOR25x4) \
ELEM2_(649, THOR50x1, MODE_THOR50x1) \
ELEM2_(653, THOR50x2, MODE_THOR50x2) \
ELEM2_(658, THOR100, MODE_THOR100) \
\
ELEM_(45, DOMINOEX_44, MODE_DOMINOEX44) \
ELEM_(46, DOMINOEX_88, MODE_DOMINOEX88) \
ELEM2_(662, DOMINOEX_44, MODE_DOMINOEX44) \
ELEM2_(681, DOMINOEX_88, MODE_DOMINOEX88) \
\
ELEM_(50, PSK1000, MODE_PSK1000) \
ELEM_(51, PSK1000R, MODE_PSK1000R) \
ELEM_(52, PSK1000X2, MODE_2X_PSK1000) \
ELEM_(53, PSK1000RX2, MODE_2X_PSK1000R) \
ELEM_(54, PSK800RX2, MODE_2X_PSK800R) \
ELEM_(57, PSK800X2, MODE_2X_PSK800) \
ELEM2_(687, MFSK31, MODE_MFSK31) \
\
/* NONE2 must be the last element */ \
ELEM_(0, NONE2, NUM_MODES)
ELEM2_(0, NONE2, NUM_MODES)
#define ELEM_(code_, tag_, mode_) RSID_ ## tag_ = code_,
#define ELEM2_(code_, tag_, mode_) RSID_ ## tag_ = code_,
enum { RSID_LIST2 };
#undef ELEM_
#undef ELEM2_
#define ELEM_(code_, tag_, mode_) { RSID_ ## tag_, mode_, #tag_ },
const RSIDs cRsId::rsid_ids2[] = { RSID_LIST2 };
#undef ELEM_
#define ELEM2_(code_, tag_, mode_) { RSID_ ## tag_, mode_, #tag_ },
const RSIDs cRsId::rsid_ids_2[] = { RSID_LIST2 };
#undef ELEM2_
const int cRsId::rsid_ids_size2 = sizeof(rsid_ids2)/sizeof(*rsid_ids2) - 1;
const int cRsId::rsid_ids_size2 = sizeof(rsid_ids_2)/sizeof(*rsid_ids_2) - 1;