kopia lustrzana https://github.com/jamescoxon/dl-fldigi
rodzic
0f650e9ccb
commit
1c8e0e95cd
|
@ -9033,13 +9033,15 @@ void set_ip_to_default(int which_io)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_CSV(int how)
|
void set_CSV(int start)
|
||||||
{
|
{
|
||||||
if (! (active_modem->get_mode() == MODE_ANALYSIS ||
|
if (! (active_modem->get_mode() == MODE_ANALYSIS ||
|
||||||
active_modem->get_mode() == MODE_FFTSCAN) ) return;
|
active_modem->get_mode() == MODE_FFTSCAN) ) return;
|
||||||
if (how == 0) active_modem->stop_csv();
|
if (start == 1)
|
||||||
else if (how == 1) active_modem->start_csv();
|
active_modem->start_csv();
|
||||||
else if (active_modem->is_csv() == true)
|
else if (start == 0)
|
||||||
|
active_modem->stop_csv();
|
||||||
|
else if (active_modem->write_to_csv == true)
|
||||||
active_modem->stop_csv();
|
active_modem->stop_csv();
|
||||||
else
|
else
|
||||||
active_modem->start_csv();
|
active_modem->start_csv();
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "complex.h"
|
#include "complex.h"
|
||||||
#include "filters.h"
|
#include "filters.h"
|
||||||
|
@ -42,7 +43,6 @@ private:
|
||||||
|
|
||||||
double phaseacc;
|
double phaseacc;
|
||||||
|
|
||||||
C_FIR_filter *hilbert;
|
|
||||||
fftfilt *bpfilt;
|
fftfilt *bpfilt;
|
||||||
Cmovavg *ffilt;
|
Cmovavg *ffilt;
|
||||||
Cmovavg *favg;
|
Cmovavg *favg;
|
||||||
|
@ -78,6 +78,8 @@ public:
|
||||||
void tx_init(SoundBase *sc);
|
void tx_init(SoundBase *sc);
|
||||||
void restart();
|
void restart();
|
||||||
void start_csv();
|
void start_csv();
|
||||||
|
void stop_csv();
|
||||||
|
|
||||||
int rx_process(const double *buf, int len);
|
int rx_process(const double *buf, int len);
|
||||||
int tx_process();
|
int tx_process();
|
||||||
|
|
||||||
|
|
|
@ -246,10 +246,9 @@ public:
|
||||||
int ovhd_samples;
|
int ovhd_samples;
|
||||||
|
|
||||||
// analysis mode
|
// analysis mode
|
||||||
|
int write_to_csv;
|
||||||
virtual void start_csv() {}
|
virtual void start_csv() {}
|
||||||
virtual void stop_csv() {}
|
virtual void stop_csv() {}
|
||||||
virtual int is_csv() { return true;}
|
|
||||||
virtual double track_freq() { return 0;}
|
|
||||||
|
|
||||||
// fsq mode
|
// fsq mode
|
||||||
bool fsq_tx_image;
|
bool fsq_tx_image;
|
||||||
|
|
|
@ -664,7 +664,7 @@ update_freq:
|
||||||
if (testmode.find("CW") != string::npos)
|
if (testmode.find("CW") != string::npos)
|
||||||
afreq = 0;//-progdefaults.CWsweetspot;
|
afreq = 0;//-progdefaults.CWsweetspot;
|
||||||
if (mode == MODE_ANALYSIS) {
|
if (mode == MODE_ANALYSIS) {
|
||||||
dfreq = active_modem->track_freq();
|
dfreq = 0;
|
||||||
} else {
|
} else {
|
||||||
if (usb)
|
if (usb)
|
||||||
dfreq = rfc + afreq + offset;
|
dfreq = rfc + afreq + offset;
|
||||||
|
|
|
@ -62,7 +62,6 @@ void anal::init()
|
||||||
|
|
||||||
anal::~anal()
|
anal::~anal()
|
||||||
{
|
{
|
||||||
delete hilbert;
|
|
||||||
delete bpfilt;
|
delete bpfilt;
|
||||||
delete ffilt;
|
delete ffilt;
|
||||||
delete favg;
|
delete favg;
|
||||||
|
@ -94,6 +93,8 @@ void anal::restart()
|
||||||
dspcnt = DSP_CNT;
|
dspcnt = DSP_CNT;
|
||||||
for (int i = 0; i < PIPE_LEN; i++) pipe[i] = 0;
|
for (int i = 0; i < PIPE_LEN; i++) pipe[i] = 0;
|
||||||
|
|
||||||
|
if (write_to_csv) stop_csv();
|
||||||
|
|
||||||
start_csv();
|
start_csv();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -105,14 +106,14 @@ anal::anal()
|
||||||
samplerate = ANAL_SAMPLERATE;
|
samplerate = ANAL_SAMPLERATE;
|
||||||
|
|
||||||
bpfilt = (fftfilt *)0;
|
bpfilt = (fftfilt *)0;
|
||||||
hilbert = new C_FIR_filter();
|
|
||||||
hilbert->init_hilbert(37, 1);
|
|
||||||
ffilt = new Cmovavg(FILT_LEN * samplerate);
|
ffilt = new Cmovavg(FILT_LEN * samplerate);
|
||||||
|
|
||||||
analysisFilename = HomeDir;
|
analysisFilename = TempDir;
|
||||||
analysisFilename.append("freqanalysis.csv");
|
analysisFilename.append("analysis.csv");
|
||||||
|
|
||||||
cap &= ~CAP_TX;
|
cap &= ~CAP_TX;
|
||||||
|
write_to_csv = false;
|
||||||
|
|
||||||
restart();
|
restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,10 +141,22 @@ void anal::start_csv()
|
||||||
}
|
}
|
||||||
fprintf(out, "Clock,Elapsed Time,Freq Error,RF\n");
|
fprintf(out, "Clock,Elapsed Time,Freq Error,RF\n");
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
|
||||||
|
put_status("Writing csv file");
|
||||||
|
|
||||||
|
write_to_csv = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void anal::stop_csv()
|
||||||
|
{
|
||||||
|
write_to_csv = false;
|
||||||
|
put_status("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void anal::writeFile()
|
void anal::writeFile()
|
||||||
{
|
{
|
||||||
|
if (!write_to_csv) return;
|
||||||
|
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
|
||||||
|
@ -163,6 +176,9 @@ void anal::writeFile()
|
||||||
tm.tm_hour, tm.tm_min, tm.tm_sec, elapsed, fout,
|
tm.tm_hour, tm.tm_min, tm.tm_sec, elapsed, fout,
|
||||||
(wf->rfcarrier() + (wf->USB() ? 1.0 : -1.0) * (frequency + fout)));
|
(wf->rfcarrier() + (wf->USB() ? 1.0 : -1.0) * (frequency + fout)));
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
|
||||||
|
put_status("Writing csv file");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int anal::rx_process(const double *buf, int len)
|
int anal::rx_process(const double *buf, int len)
|
||||||
|
@ -180,7 +196,6 @@ int anal::rx_process(const double *buf, int len)
|
||||||
// create analytic signal from sound card input samples
|
// create analytic signal from sound card input samples
|
||||||
z = cmplx( *buf, *buf );
|
z = cmplx( *buf, *buf );
|
||||||
buf++;
|
buf++;
|
||||||
// hilbert->run(z, z);
|
|
||||||
// mix it with the audio carrier frequency to create a baseband signal
|
// mix it with the audio carrier frequency to create a baseband signal
|
||||||
z = mixer(z);
|
z = mixer(z);
|
||||||
// low pass filter using Windowed Sinc - Overlap-Add convolution filter
|
// low pass filter using Windowed Sinc - Overlap-Add convolution filter
|
||||||
|
@ -216,7 +231,7 @@ int anal::rx_process(const double *buf, int len)
|
||||||
snprintf(msg1, sizeof(msg1), "%12.2f", wf->rfcarrier() + frequency + fout );
|
snprintf(msg1, sizeof(msg1), "%12.2f", wf->rfcarrier() + frequency + fout );
|
||||||
else
|
else
|
||||||
snprintf(msg1, sizeof(msg1), "%12.2f", wf->rfcarrier() - frequency - fout );
|
snprintf(msg1, sizeof(msg1), "%12.2f", wf->rfcarrier() - frequency - fout );
|
||||||
put_status(msg1, 2.0);
|
put_Status2(msg1, 2.0);
|
||||||
writeFile();
|
writeFile();
|
||||||
}
|
}
|
||||||
// reset the display counter & the pipe pointer
|
// reset the display counter & the pipe pointer
|
||||||
|
|
Ładowanie…
Reference in New Issue