diff --git a/Modulator.cpp b/Modulator.cpp index d4ca21ce3..0708d3e28 100644 --- a/Modulator.cpp +++ b/Modulator.cpp @@ -1,17 +1,12 @@ #include "Modulator.hpp" - #include - #include #include #include - #include "mainwindow.h" -extern float gran(); // Noise generator (for tests only) - -// MUST be an integral factor of 2^16 -#define RAMP_INCREMENT 64 +extern float gran(); // Noise generator (for tests only) +#define RAMP_INCREMENT 64 // MUST be an integral factor of 2^16 #if defined (WSJT_SOFT_KEYING) # define SOFT_KEYING true @@ -26,65 +21,66 @@ double const Modulator::m_twoPi = 2.0 * 3.141592653589793238462; // m_nspd=3072; //18.75 WPM unsigned const Modulator::m_nspd = 2048 + 512; // 22.5 WPM -Modulator::Modulator (unsigned frameRate, unsigned periodLengthInSeconds, QObject * parent) +Modulator::Modulator (unsigned frameRate, unsigned periodLengthInSeconds, \ + QObject * parent) : AudioDevice (parent) + , m_phi (0.0) + , m_framesSent (0) , m_frameRate (frameRate) , m_period (periodLengthInSeconds) - , m_framesSent (0) , m_state (Idle) , m_tuning (false) , m_muted (false) - , m_phi (0.) { qsrand (QDateTime::currentMSecsSinceEpoch()); // Initialize random seed } -void Modulator::open (unsigned symbolsLength, double framesPerSymbol, unsigned frequency, Channel channel, bool synchronize, double dBSNR) +void Modulator::open (unsigned symbolsLength, double framesPerSymbol, \ + unsigned frequency, Channel channel, bool synchronize, double dBSNR) { // Time according to this computer which becomes our base time qint64 ms0 = QDateTime::currentMSecsSinceEpoch() % 86400000; - qDebug () << "Modulator: Using soft keying for CW is " << SOFT_KEYING;; +// qDebug () << "Modulator: Using soft keying for CW is " << SOFT_KEYING;; m_symbolsLength = symbolsLength; - m_framesSent = 0; - m_isym0 = std::numeric_limits::max (); // ensure we set up first symbol tone + m_isym0 = std::numeric_limits::max (); // Arbitrary big number m_addNoise = dBSNR < 0.; m_nsps = framesPerSymbol; m_frequency = frequency; m_amp = std::numeric_limits::max (); // noise generator parameters - if (m_addNoise) - { - m_snr = qPow (10.0, 0.05 * (dBSNR - 6.0)); - m_fac = 3000.0; - if (m_snr > 1.0) - { - m_fac = 3000.0 / m_snr; - } - } + if (m_addNoise) { + m_snr = qPow (10.0, 0.05 * (dBSNR - 6.0)); + m_fac = 3000.0; + if (m_snr > 1.0) m_fac = 3000.0 / m_snr; + } unsigned mstr = ms0 % (1000 * m_period); // ms in period m_ic = (mstr / 1000) * m_frameRate; // we start exactly N seconds - // into period where N is the - // next whole second + // into period where N is the next whole second m_silentFrames = 0; - if (synchronize && !m_tuning) // calculate number of silent frames to send - { - m_silentFrames = m_ic + m_frameRate - (mstr * m_frameRate / 1000); - } + // calculate number of silent frames to send + if (synchronize && !m_tuning) { + m_silentFrames = m_ic + m_frameRate - (mstr * m_frameRate / 1000); + } // qDebug () << "Modulator: starting at " << m_ic / m_frameRate << " sec, sending " << m_silentFrames << " silent frames"; AudioDevice::open (QIODevice::ReadOnly, channel); - Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ? Synchronizing : Active)); + Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ? + Synchronizing : Active)); } qint64 Modulator::readData (char * data, qint64 maxSize) { + static int j0=-1; + static double toneFrequency0; + double toneFrequency; + if(maxSize==0) return 0; Q_ASSERT (!(maxSize % static_cast (bytesPerFrame ()))); // no torn frames Q_ASSERT (isOpen ()); @@ -94,142 +90,131 @@ qint64 Modulator::readData (char * data, qint64 maxSize) qint16 * end (samples + numFrames * (bytesPerFrame () / sizeof (qint16))); // qDebug () << "Modulator: " << numFrames << " requested, m_ic = " << m_ic << ", tune mode is " << m_tuning; - +// qDebug() << "C" << maxSize << numFrames << bytesPerFrame(); switch (m_state) - { - case Synchronizing: - { - if (m_silentFrames) // send silence up to first second - { - numFrames = qMin (m_silentFrames, numFrames); - for ( ; samples != end; samples = load (0, samples)) // silence - { + { + case Synchronizing: + { + if (m_silentFrames) { // send silence up to first second + numFrames = qMin (m_silentFrames, numFrames); + for ( ; samples != end; samples = load (0, samples)) { // silence } - m_silentFrames -= numFrames; - return numFrames * bytesPerFrame (); - } + m_silentFrames -= numFrames; + return numFrames * bytesPerFrame (); + } - Q_EMIT stateChanged ((m_state = Active)); - m_ramp = 0; // prepare for CW wave shaping - } + Q_EMIT stateChanged ((m_state = Active)); + m_ramp = 0; // prepare for CW wave shaping + } // fall through - case Active: - { - unsigned isym (m_tuning ? 0 : m_ic / (4.0 * m_nsps)); // Actual fsample=48000 + case Active: + { + unsigned isym (m_tuning ? 0 : m_ic / (4.0 * m_nsps)); // Actual fsample=48000 + if (isym >= m_symbolsLength && icw[0] > 0) { // start CW condition + // Output the CW ID + m_dphi = m_twoPi * m_frequency / m_frameRate; + unsigned const ic0 = m_symbolsLength * 4 * m_nsps; + unsigned j (0); + qint64 framesGenerated (0); - if (isym >= m_symbolsLength && icw[0] > 0) // start CW condition - { - // Output the CW ID - m_dphi = m_twoPi * m_frequency / m_frameRate; + while (samples != end) { + m_phi += m_dphi; + if (m_phi > m_twoPi) m_phi -= m_twoPi; - unsigned const ic0 = m_symbolsLength * 4 * m_nsps; - unsigned j (0); - qint64 framesGenerated (0); + qint16 sample ((SOFT_KEYING ? qAbs (m_ramp - 1) : + (m_ramp ? 32767 : 0)) * qSin (m_phi)); - while (samples != end) - { - m_phi += m_dphi; - if (m_phi > m_twoPi) - { - m_phi -= m_twoPi; - } + j = (m_ic - ic0 - 1) / m_nspd + 1; + bool l0 (icw[j] && icw[j] <= 1); // first element treated specially as it's a count + j = (m_ic - ic0) / m_nspd + 1; - qint16 sample ((SOFT_KEYING ? qAbs (m_ramp - 1) : (m_ramp ? 32767 : 0)) * qSin (m_phi)); + if ((m_ramp != 0 && m_ramp != std::numeric_limits::min ()) || + !!icw[j] != l0) { + if (!!icw[j] != l0) { + Q_ASSERT (m_ramp == 0 || m_ramp == std::numeric_limits::min ()); + } + m_ramp += RAMP_INCREMENT; // ramp + } - j = (m_ic - ic0 - 1) / m_nspd + 1; - bool l0 (icw[j] && icw[j] <= 1); // first element treated specially as it's a count - j = (m_ic - ic0) / m_nspd + 1; + if (j < NUM_CW_SYMBOLS) { // stop condition + // if (!m_ramp && !icw[j]) + // { + // sample = 0; + // } - if ((m_ramp != 0 && m_ramp != std::numeric_limits::min ()) || !!icw[j] != l0) - { - if (!!icw[j] != l0) - { - Q_ASSERT (m_ramp == 0 || m_ramp == std::numeric_limits::min ()); - } - m_ramp += RAMP_INCREMENT; // ramp - } + samples = load (postProcessSample (sample), samples); + ++framesGenerated; + ++m_ic; + } + } - if (j < NUM_CW_SYMBOLS) // stop condition - { - // if (!m_ramp && !icw[j]) - // { - // sample = 0; - // } + if (j > static_cast (icw[0])) { + Q_EMIT stateChanged ((m_state = Idle)); + } - samples = load (postProcessSample (sample), samples); - - ++framesGenerated; - ++m_ic; - } - } - - if (j > static_cast (icw[0])) - { - Q_EMIT stateChanged ((m_state = Idle)); - } - - m_framesSent += framesGenerated; - return framesGenerated * bytesPerFrame (); - } - - double const baud (12000.0 / m_nsps); + m_framesSent += framesGenerated; + return framesGenerated * bytesPerFrame (); + } + double const baud (12000.0 / m_nsps); // fade out parameters (no fade out for tuning) - unsigned const i0 = m_tuning ? 999 * m_nsps : (m_symbolsLength - 0.017) * 4.0 * m_nsps; - unsigned const i1 = m_tuning ? 999 * m_nsps : m_symbolsLength * 4.0 * m_nsps; + unsigned const i0 = m_tuning ? 999 * m_nsps : + (m_symbolsLength - 0.017) * 4.0 * m_nsps; + unsigned const i1 = m_tuning ? 999 * m_nsps : + m_symbolsLength * 4.0 * m_nsps; - for (unsigned i = 0; i < numFrames; ++i) - { - isym = m_tuning ? 0 : m_ic / (4.0 * m_nsps); //Actual fsample=48000 - if (isym != m_isym0) - { - double toneFrequency = m_frequency + itone[isym] * baud; - m_dphi = m_twoPi * toneFrequency / m_frameRate; - m_isym0 = isym; - } - m_phi += m_dphi; - if (m_phi > m_twoPi) - { - m_phi -= m_twoPi; - } - if (m_ic > i0) - { - m_amp = 0.98 * m_amp; - } - if (m_ic > i1) - { - m_amp = 0.0; - } + for (unsigned i = 0; i < numFrames; ++i) { + isym = m_tuning ? 0 : m_ic / (4.0 * m_nsps); //Actual fsample=48000 + if (isym != m_isym0) { + if(m_toneSpacing==0.0) { + toneFrequency0=m_frequency + itone[isym]*baud; + } else { + toneFrequency0=m_frequency + itone[isym]*m_toneSpacing; + } + m_dphi = m_twoPi * toneFrequency0 / m_frameRate; + m_isym0 = isym; + } - samples = load (postProcessSample (m_amp * qSin (m_phi)), samples); + int j=m_ic/480; + if(m_fSpread>0.0 and j!=j0) { + float x1=(float)rand()/RAND_MAX; + float x2=(float)rand()/RAND_MAX; + toneFrequency = toneFrequency0 + 0.5*m_fSpread*(x1+x2-1.0); + m_dphi = m_twoPi * toneFrequency / m_frameRate; + j0=j; + } + m_phi += m_dphi; + if (m_phi > m_twoPi) m_phi -= m_twoPi; + if (m_ic > i0) m_amp = 0.98 * m_amp; + if (m_ic > i1) m_amp = 0.0; + + samples = load (postProcessSample (m_amp * qSin (m_phi)), samples); ++m_ic; } - if (m_amp == 0.0) // TODO G4WJS: compare double with zero might not be wise - { - if (icw[0] == 0) - { - // no CW ID to send - Q_EMIT stateChanged ((m_state = Idle)); - m_framesSent += numFrames; - return numFrames * bytesPerFrame (); - } + if (m_amp == 0.0) { // TODO G4WJS: compare double with zero might not be wise + if (icw[0] == 0) { + // no CW ID to send + Q_EMIT stateChanged ((m_state = Idle)); + m_framesSent += numFrames; + return numFrames * bytesPerFrame (); + } - m_phi = 0.0; - } + m_phi = 0.0; + } // done for this chunk - continue on next call - m_framesSent += numFrames; - return numFrames * bytesPerFrame (); - } - Q_EMIT stateChanged ((m_state = Idle)); - // fall through + m_framesSent += numFrames; + return numFrames * bytesPerFrame (); + } + Q_EMIT stateChanged ((m_state = Idle)); + // fall through - case Idle: - break; - } + case Idle: + break; + } Q_ASSERT (Idle == m_state); return 0; @@ -237,22 +222,17 @@ qint64 Modulator::readData (char * data, qint64 maxSize) qint16 Modulator::postProcessSample (qint16 sample) const { - if (m_muted) // silent frame - { + if (m_muted) { // silent frame sample = 0; + } else if (m_addNoise) { // Test frame, we'll add noise + qint32 s = m_fac * (gran () + sample * m_snr / 32768.0); + if (s > std::numeric_limits::max ()) { + s = std::numeric_limits::max (); } - else if (m_addNoise) - { - qint32 s = m_fac * (gran () + sample * m_snr / 32768.0); - if (s > std::numeric_limits::max ()) - { - s = std::numeric_limits::max (); - } - if (s < std::numeric_limits::min ()) - { - s = std::numeric_limits::min (); - } - sample = s; + if (s < std::numeric_limits::min ()) { + s = std::numeric_limits::min (); } + sample = s; + } return sample; } diff --git a/Modulator.hpp b/Modulator.hpp index 250a3dfc3..ba6b8edc2 100644 --- a/Modulator.hpp +++ b/Modulator.hpp @@ -35,6 +35,7 @@ public: bool isMuted () const {return m_muted;} unsigned frequency () const {return m_frequency;} bool isActive () const {return m_state != Idle;} + void setWide9(double d1, double d2) {m_toneSpacing=d1; m_fSpread=d2;} protected: qint64 readData (char * data, qint64 maxSize); @@ -66,22 +67,28 @@ private: static double const m_twoPi; static unsigned const m_nspd; // CW ID WPM factor - int m_frameRate; - int m_period; - double m_nsps; - double volatile m_frequency; - double m_snr; - qint64 m_silentFrames; - qint64 m_framesSent; - ModulatorState volatile m_state; - bool volatile m_tuning; - bool volatile m_muted; - bool m_addNoise; double m_phi; double m_dphi; double m_amp; - unsigned m_ic; + double m_nsps; + double volatile m_frequency; + double m_snr; double m_fac; + double m_toneSpacing; + double m_fSpread; + + qint64 m_silentFrames; + qint64 m_framesSent; + + int m_frameRate; + int m_period; + ModulatorState volatile m_state; + + bool volatile m_tuning; + bool volatile m_muted; + bool m_addNoise; + + unsigned m_ic; unsigned m_isym0; qint16 m_ramp; }; diff --git a/commons.h b/commons.h index 4b875c210..51834f3ba 100644 --- a/commons.h +++ b/commons.h @@ -29,4 +29,10 @@ extern struct FortranCommon { char datetime[20]; } jt9com_; +extern "C" { +extern struct { + float syellow[NSMAX]; +} jt9w_; +} + #endif // COMMONS_H diff --git a/devsetup.cpp b/devsetup.cpp index 6036c0cec..dfbf6c8cc 100644 --- a/devsetup.cpp +++ b/devsetup.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -85,10 +86,13 @@ void DevSetup::initDlg() ui->pttMethodComboBox->setCurrentIndex(m_pttMethodIndex); ui->saveDirEntry->setText(m_saveDir); ui->cbID73->setChecked(m_After73); + ui->cbDisplayAstroData->setChecked(m_bAstroData); ui->cbPSKReporter->setChecked(m_pskReporter); ui->cbSplit->setChecked(m_bSplit and m_catEnabled); ui->cbXIT->setChecked(m_bXIT); ui->cbXIT->setVisible(false); + ui->dtMinSpinBox->setValue(m_DTmin); + ui->dtMaxSpinBox->setValue(m_DTmax); enableWidgets(); @@ -99,6 +103,9 @@ void DevSetup::initDlg() ui->handshakeComboBox->setCurrentIndex(m_handshakeIndex); ui->rbData->setChecked(m_pttData); ui->pollSpinBox->setValue(m_poll); + ui->cbEMEband->setCurrentIndex(m_EMEbandIndex); + ui->cbBWmult->setCurrentIndex(m_toneMultIndex); + ui->astroFontSpinBox->setValue(m_astroFont); // PY2SDR -- Per OS serial port names m_tmp=m_pttPort; @@ -708,3 +715,36 @@ void DevSetup::enumerateRigs () ui->rigComboBox->addItem ("Ham Radio Deluxe", 9999); ui->rigComboBox->setCurrentIndex (ui->rigComboBox->findData (m_rig)); } + +void DevSetup::on_cbEMEband_activated(int index) +{ + m_EMEbandIndex=index; + m_EMEband=ui->cbEMEband->itemText(index).toInt(); +} + +void DevSetup::on_cbBWmult_activated(int index) +{ + m_toneMultIndex=index; + m_toneMult=pow(2,index); +} + +void DevSetup::on_dtMinSpinBox_valueChanged(double arg1) +{ + m_DTmin=arg1; +} + +void DevSetup::on_dtMaxSpinBox_valueChanged(double arg1) +{ + m_DTmax=arg1; +} + +void DevSetup::on_astroFontSpinBox_valueChanged(int arg1) +{ + if(arg1==-999) m_astroFont=18; //silence compiler warning + m_astroFont=ui->astroFontSpinBox->value(); +} + +void DevSetup::on_cbDisplayAstroData_toggled(bool checked) +{ + m_bAstroData=checked; +} diff --git a/devsetup.h b/devsetup.h index ca77695ca..139628492 100644 --- a/devsetup.h +++ b/devsetup.h @@ -32,6 +32,9 @@ public: void initDlg(); + float m_DTmin; + float m_DTmax; + qint32 m_idInt; qint32 m_pttMethodIndex; qint32 m_pttPort; @@ -48,17 +51,22 @@ public: qint32 m_test; qint32 m_poll; qint32 m_tmp; + qint32 m_EMEband; + qint32 m_EMEbandIndex; + qint32 m_toneMult; + qint32 m_toneMultIndex; + qint32 m_astroFont; typedef QList AudioDevices; - AudioDevices m_audioInputDevices; /* available input devices */ - AudioDevices m_audioOutputDevices; /* available output devices */ - QAudioDeviceInfo m_audioInputDevice; /* selected input device */ - QAudioDeviceInfo m_audioOutputDevice; /* selected output device */ - bool m_restartSoundIn; - bool m_restartSoundOut; + AudioDevices m_audioInputDevices; // available input devices + AudioDevices m_audioOutputDevices; // available output devices + QAudioDeviceInfo m_audioInputDevice; // selected input device + QAudioDeviceInfo m_audioOutputDevice; // selected output device AudioDevice::Channel m_audioInputChannel; AudioDevice::Channel m_audioOutputChannel; + bool m_restartSoundIn; + bool m_restartSoundOut; bool m_pskReporter; bool m_firstCall; bool m_catEnabled; @@ -69,6 +77,7 @@ public: bool m_pttData; bool m_bSplit; bool m_bXIT; + bool m_bAstroData; QString m_myCall; QString m_myGrid; @@ -112,6 +121,12 @@ private slots: void on_pttMethodComboBox_currentIndexChanged(int index); void on_cbSplit_toggled(bool checked); void on_cbXIT_toggled(bool checked); + void on_cbEMEband_activated(int index); + void on_cbBWmult_activated(int index); + void on_dtMinSpinBox_valueChanged(double arg1); + void on_dtMaxSpinBox_valueChanged(double arg1); + void on_astroFontSpinBox_valueChanged(int arg1); + void on_cbDisplayAstroData_toggled(bool checked); private: void loadAudioDevices (AudioDevices const&, QComboBox *, QAudioDeviceInfo const&, QAudioDeviceInfo const&); diff --git a/devsetup.ui b/devsetup.ui index 4310f38ff..9abc92652 100644 --- a/devsetup.ui +++ b/devsetup.ui @@ -1868,7 +1868,7 @@ 0 0 - 308 + 510 449 @@ -2522,6 +2522,228 @@ + + + JT9W + + + + + 140 + 101 + 202 + 161 + + + + + + + Band (MHz): + + + + + + + 9 + + + + 50 + + + + + 144 + + + + + 222 + + + + + 432 + + + + + 903 + + + + + 1296 + + + + + 2320 + + + + + 3400 + + + + + 5760 + + + + + 10368 + + + + + 24192 + + + + + + + + BW Mult: + + + + + + + 5 + + + + 1 + + + + + 2 + + + + + 4 + + + + + 8 + + + + + 16 + + + + + 32 + + + + + 64 + + + + + 128 + + + + + + + + DT min (s): + + + + + + + 1 + + + -2.500000000000000 + + + 5.000000000000000 + + + 0.100000000000000 + + + -2.500000000000000 + + + + + + + DT max (s): + + + + + + + 1 + + + -2.500000000000000 + + + 5.000000000000000 + + + 0.100000000000000 + + + 5.000000000000000 + + + + + + + Astro Font Size: + + + + + + + 14 + + + 18 + + + 2 + + + 18 + + + + + + + Display Astronomical Data on startup + + + + + + diff --git a/lib/Makefile.MinGW b/lib/Makefile.MinGW index 1c0f292e2..f009e0e10 100644 --- a/lib/Makefile.MinGW +++ b/lib/Makefile.MinGW @@ -3,25 +3,15 @@ # C> make > junk1 2>&1 # Set paths -EXE_DIR = ..\..\wsjtx_install -QT_DIR = c:/QtSDK/Desktop/Qt/4.7.4/mingw +EXE_DIR = ../../wsjtx_install -#INCPATH = -I'${QT_DIR}/include/QtCore' \ -# -I'${QT_DIR}/include' \ -# -I'${QT_DIR}/include/ActiveQt' \ -# -I'release' -I'.' -I'${QT_DIR}/mkspecs/win32-g++' - -INCPATH = -I'${QT_DIR}/include/QtCore' \ - -I'${QT_DIR}/include' \ +INCPATH = -I'C:/wsjt-env/Qt5/5.2.1/mingw48_32/include/QtCore' \ + -I'C:/wsjt-env/Qt5/5.2.1/mingw48_32/include/' # Compilers CC = gcc CXX = g++ FC = g95 -AR = ar -RANLIB = ranlib -CP = cp -MKDIR = mkdir -p FFLAGS = -O2 -fbounds-check -Wall -Wno-precision-loss -fno-second-underscore CFLAGS = -I. -fbounds-check -mno-stack-arg-probe @@ -38,14 +28,14 @@ CFLAGS = -I. -fbounds-check -mno-stack-arg-probe %.o: %.F90 ${FC} ${FFLAGS} -c $< -all: libjt9.a jt9sim.exe jt9.exe jt9code.exe jt65code.exe jt65.exe +all: libjt9.a libastro.a jt9.exe jt9code.exe jt65code.exe OBJS1 = pctile.o graycode.o sort.o ssort.o chkmsg.o \ unpackmsg.o igray.o unpackcall.o unpackgrid.o \ grid2k.o unpacktext.o getpfx2.o packmsg.o deg2grid.o \ packtext.o getpfx1.o packcall.o k2grid.o packgrid.o \ nchar.o four2a.o grid2deg.o pfxdump.o f77_wisdom.o \ - symspec.o analytic.o db.o genjt9.o \ + symspec.o analytic.o db.o genjt9.o flat1.o smo.o \ packbits.o unpackbits.o encode232.o interleave9.o \ entail.o fano232.o gran.o sync9.o decode9.o \ fil3.o decoder.o grid2n.o n2grid.o timer.o \ @@ -60,16 +50,16 @@ OBJS1 = pctile.o graycode.o sort.o ssort.o chkmsg.o \ flat3.o polfit.o determ.o baddata.o libjt9.a: $(OBJS1) - ${AR} cr libjt9.a $(OBJS1) - ${RANLIB} libjt9.a + ar cr libjt9.a $(OBJS1) + ranlib libjt9.a OBJS2 = jt9.o jt9a.o jt9b.o jt9c.o ipcomm.o sec_midn.o usleep.o -LIBS2 = -L'${QT_DIR}/lib' -lQt5Core +LIBS2 = -L'C:/wsjt-env/Qt5/5.2.1/mingw48_32/lib' -lQt5Core jt9.exe: $(OBJS2) libjt9.a $(CXX) -o jt9.exe -static $(OBJS2) $(LIBS2) libjt9.a \ - ../libfftw3f_win.a -lgfortran - -$(MKDIR) $(EXE_DIR) - ${CP} jt9.exe $(EXE_DIR) + ../libfftw3f_win.a c:/MinGW/lib/libf95.a + mkdir -p $(EXE_DIR) + cp jt9.exe $(EXE_DIR) OBJS3 = jt9sim.o jt9sim.exe: $(OBJS3) libjt9.a @@ -78,16 +68,24 @@ jt9sim.exe: $(OBJS3) libjt9.a OBJS4 = jt9code.o jt9code.exe: $(OBJS4) libjt9.a $(FC) -o jt9code.exe $(OBJS4) libjt9.a - $(CP) jt9code.exe $(EXE_DIR) + cp jt9code.exe $(EXE_DIR) OBJS5 = jt65.o jt65.exe: $(OBJS5) libjt9.a $(FC) -o jt65.exe $(OBJS5) libjt9.a ../libfftw3f_win.a +OBJS7 = astrosub.o astro0.o astro.o tm2.o grid2deg.o sun.o moondop.o \ + coord.o dot.o moon2.o tmoonsub.o toxyz.o geocentric.o \ + dcoord.o + +libastro.a: $(OBJS7) + ar cr libastro.a $(OBJS7) + ranlib libastro.a + OBJS6 = jt65code.o jt65code.exe: $(OBJS6) libjt9.a $(FC) -o jt65code.exe $(OBJS6) libjt9.a - $(CP) jt65code.exe $(EXE_DIR) + cp jt65code.exe $(EXE_DIR) sync9.o: sync9.f90 jt9sync.f90 $(FC) $(FFLAGS) -c sync9.f90 diff --git a/lib/decoder.f90 b/lib/decoder.f90 index ef9e4cbce..6127559cb 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -37,7 +37,7 @@ subroutine decoder(ss,id2) ntol65=20 done65=.false. - if(nmode.ge.65 .and. ntxmode.eq.65) then + if((nmode.eq.65 .or. nmode.eq.65+9) .and. ntxmode.eq.65) then if(newdat.ne.0) dd(1:npts65)=id2(1:npts65) nf1=nfa nf2=nfb diff --git a/lib/flat1.f90 b/lib/flat1.f90 index 526ab9bd6..b9dfdd1d5 100644 --- a/lib/flat1.f90 +++ b/lib/flat1.f90 @@ -1,30 +1,27 @@ -subroutine flat1(psavg,s2,nh,nsteps,nhmax,nsmax) +subroutine flat1(savg,iz,nsmo,syellow) - real psavg(nh) - real s2(nhmax,nsmax) - real x(8192),tmp(33) + real savg(iz) + real syellow(iz) + real x(8192) - nsmo=33 ia=nsmo/2 + 1 - ib=nh - nsmo/2 - 1 - do i=ia,ib - call pctile(psavg(i-nsmo/2),nsmo,50,x(i)) + ib=iz - nsmo/2 - 1 + nstep=20 + nh=nstep/2 + do i=ia,ib,nstep + call pctile(savg(i-nsmo/2),nsmo,50,x(i)) + x(i-nh:i+nh-1)=x(i) enddo do i=1,ia-1 x(i)=x(ia) enddo - do i=ib+1,nh + do i=ib+1,iz x(i)=x(ib) enddo - do i=1,nh - psavg(i)=psavg(i)/x(i) - do j=1,nsteps - s2(i,j)=s2(i,j)/x(i) - enddo - enddo + x0=0.001*maxval(x(1:iz)) + syellow(1:iz)=savg(1:iz)/(x(1:iz)+x0) return end subroutine flat1 - diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 584b93a18..be87637a5 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -22,11 +22,13 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nflatten,pxdb,s,df3,ihsym,npts8) real*4 s(NSMAX) real*4 ssum(NSMAX) real*4 xc(0:MAXFFT3-1) + real*4 tmp(NSMAX) complex cx(0:MAXFFT3/2) integer*2 id2 common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat, & ntr,mousefqso,newdat,npts8a,nfa,nfsplit,nfb,ntol,kin,nzhsym, & nsave,nagain,ndepth,ntxmode,nmode,junk(5) + common/jt9w/syellow(NSMAX) data rms/999.0/,k0/99999999/,nfft3z/0/ equivalence (xc,cx) save @@ -99,6 +101,20 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nflatten,pxdb,s,df3,ihsym,npts8) savg=ssum/ihsym + if(mod(n,10).eq.0) then + mode4=36 + nsmo=min(10*mode4,150) + nsmo=4*nsmo + call flat1(savg,iz,nsmo,syellow) + if(mode4.ge.9) call smo(syellow,iz,tmp,mode4) + ia=500./df3 + ib=2700.0/df3 + smin=minval(syellow(ia:ib)) + smax=maxval(syellow(1:iz)) + syellow=(50.0/(smax-smin))*(syellow-smin) + where(syellow<0) syellow=0. + endif + if(nflatten.ne.0) then call flat3(s,iz,nfa,nfb,3,1.0,s) call flat3(savg,iz,nfa,nfb,3,1.0,savg) diff --git a/mainwindow.cpp b/mainwindow.cpp index d317db89b..edc0f7f30 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,5 @@ -//------------------------------------------------------------ MainWindow +//----------------------------------------------------------- MainWindow + #include "mainwindow.h" #include "ui_mainwindow.h" @@ -9,6 +10,7 @@ #include "devsetup.h" #include "plotter.h" #include "about.h" +#include "astro.h" #include "widegraph.h" #include "sleep.h" #include "getfile.h" @@ -27,7 +29,7 @@ qint32 g_COMportOpen; qint32 g_iptt; static int nc1=1; wchar_t buffer[256]; - +Astro* g_pAstro = NULL; Rig* rig = NULL; QTextEdit* pShortcuts; @@ -35,7 +37,7 @@ QTextEdit* pPrefixes; QTcpSocket* commanderSocket = new QTcpSocket(0); QString rev="$Rev$"; -QString Program_Title_Version=" WSJT-X v1.3, r" + rev.mid(6,4) + +QString Program_Title_Version=" WSJT-X v1.4, r" + rev.mid(6,4) + " by K1JT"; //--------------------------------------------------- MainWindow constructor @@ -48,7 +50,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the ui(new Ui::MainWindow), m_wideGraph (new WideGraph (settings)), m_logDlg (new LogQSO (settings, this)), - m_detector (RX_SAMPLE_RATE, NTMAX/2, 6912/2, downSampleFactor), + m_detector (RX_SAMPLE_RATE, NTMAX / 2, 6912 / 2, downSampleFactor), m_audioInputDevice (QAudioDeviceInfo::defaultInputDevice ()), // start with default m_modulator (TX_SAMPLE_RATE, NTMAX / 2), m_audioOutputDevice (QAudioDeviceInfo::defaultOutputDevice ()), // start with default @@ -64,7 +66,6 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the connect (this, &MainWindow::finished, this, &MainWindow::close); // start audio thread and hook up slots & signals for shutdown management - // these objects need to be in the audio thread so that invoking // their slots is done in a thread safe way m_soundOutput.moveToThread (&m_audioThread); @@ -125,6 +126,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the QActionGroup* modeGroup = new QActionGroup(this); ui->actionJT9_1->setActionGroup(modeGroup); + ui->actionJT9W_1->setActionGroup(modeGroup); ui->actionJT65->setActionGroup(modeGroup); ui->actionJT9_JT65->setActionGroup(modeGroup); @@ -272,6 +274,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the m_QSOText.clear(); m_CATerror=false; decodeBusy(false); + m_toneSpacing=0; signalMeter = new SignalMeter(ui->meterFrame); signalMeter->resize(50, 160); @@ -370,8 +373,11 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the genStdMsgs(m_rpt); m_ntx=6; ui->txrb6->setChecked(true); - if(m_mode!="JT9" and m_mode!="JT65" and m_mode!="JT9+JT65") m_mode="JT9"; + if(m_mode!="JT9" and m_mode!="JT9W-1" and m_mode!="JT65" and + m_mode!="JT9+JT65") m_mode="JT9"; on_actionWide_Waterfall_triggered(); //### +// on_actionAstronomical_data_triggered(); + if(m_bAstroData) on_actionAstronomical_data_triggered(); m_wideGraph->setRxFreq(m_rxFreq); m_wideGraph->setTxFreq(m_txFreq); m_wideGraph->setLockTxFreq(m_lockTxFreq); @@ -383,6 +389,7 @@ MainWindow::MainWindow(QSettings * settings, QSharedMemory *shdmem, QString *the SLOT(setFreq4(int,int))); if(m_mode=="JT9") on_actionJT9_1_triggered(); + if(m_mode=="JT9W-1") on_actionJT9W_1_triggered(); if(m_mode=="JT65") on_actionJT65_triggered(); if(m_mode=="JT9+JT65") on_actionJT9_JT65_triggered(); @@ -461,6 +468,10 @@ void MainWindow::writeSettings() m_settings->setValue("TxFirst",m_txFirst); m_settings->setValue("DXcall",ui->dxCallEntry->text()); m_settings->setValue("DXgrid",ui->dxGridEntry->text()); + if(g_pAstro!=NULL and g_pAstro->isVisible()) { + m_astroGeom = g_pAstro->geometry(); + m_settings->setValue("AstroGeom",m_astroGeom); + } m_settings->endGroup(); m_settings->beginGroup("Common"); @@ -469,6 +480,7 @@ void MainWindow::writeSettings() m_settings->setValue("IDint",m_idInt); m_settings->setValue("PTTmethod",m_pttMethodIndex); m_settings->setValue("PTTport",m_pttPort); + m_settings->setValue("AstroFont",m_astroFont); m_settings->setValue("SaveDir",m_saveDir); m_settings->setValue("SoundInName", m_audioInputDevice.deviceName ()); m_settings->setValue("SoundOutName", m_audioOutputDevice.deviceName ()); @@ -489,6 +501,7 @@ void MainWindow::writeSettings() m_settings->setValue("OutAttenuation", ui->outAttenuation->value ()); m_settings->setValue("PSKReporter",m_pskReporter); m_settings->setValue("After73",m_After73); + m_settings->setValue("DisplayAstro",m_bAstroData); m_settings->setValue("Macros",m_macro); //Band Settings m_settings->setValue("BandFrequencies",m_dFreq); @@ -531,6 +544,11 @@ void MainWindow::writeSettings() m_settings->setValue("UseXIT",m_bXIT); m_settings->setValue("XIT",m_XIT); m_settings->setValue("Plus2kHz",m_plus2kHz); + m_settings->setValue("EMEbandIndex",m_EMEbandIndex); + m_settings->setValue("ToneMultIndex",m_toneMultIndex); + m_settings->setValue("DTmin",m_DTmin); + m_settings->setValue("DTmax",m_DTmax); + m_settings->endGroup(); } @@ -542,6 +560,7 @@ void MainWindow::readSettings() restoreState (m_settings->value ("state", saveState ()).toByteArray ()); ui->dxCallEntry->setText(m_settings->value("DXcall","").toString()); ui->dxGridEntry->setText(m_settings->value("DXgrid","").toString()); + m_astroGeom = m_settings->value("AstroGeom", QRect(71,390,227,403)).toRect(); m_path = m_settings->value("MRUdir", m_appDir + "/save").toString(); m_txFirst = m_settings->value("TxFirst",false).toBool(); ui->txFirstCheckBox->setChecked(m_txFirst); @@ -554,6 +573,7 @@ void MainWindow::readSettings() m_idInt=m_settings->value("IDint",0).toInt(); m_pttMethodIndex=m_settings->value("PTTmethod",1).toInt(); m_pttPort=m_settings->value("PTTport",0).toInt(); + m_astroFont=m_settings->value("AstroFont",18).toInt(); m_saveDir=m_settings->value("SaveDir",m_appDir + "/save").toString(); { @@ -591,7 +611,7 @@ void MainWindow::readSettings() m_mode=m_settings->value("Mode","JT9").toString(); m_modeTx=m_settings->value("ModeTx","JT9").toString(); - if(m_modeTx=="JT9") ui->pbTxMode->setText("Tx JT9 @"); + if(m_modeTx.mid(0,3)=="JT9") ui->pbTxMode->setText("Tx JT9 @"); if(m_modeTx=="JT65") ui->pbTxMode->setText("Tx JT65 #"); ui->actionNone->setChecked(m_settings->value("SaveNone",true).toBool()); ui->actionSave_decoded->setChecked(m_settings->value( @@ -617,6 +637,7 @@ void MainWindow::readSettings() ui->actionMonitor_OFF_at_startup->setChecked(m_monitorStartOFF); m_pskReporter=m_settings->value("PSKReporter",false).toBool(); m_After73=m_settings->value("After73",false).toBool(); + m_bAstroData=m_settings->value("DisplayAstro",false).toBool(); m_macro=m_settings->value("Macros","TNX 73 GL").toStringList(); //Band Settings m_dFreq=m_settings->value("BandFrequencies","").toStringList(); @@ -676,6 +697,10 @@ void MainWindow::readSettings() m_XIT=m_settings->value("XIT",0).toInt(); m_plus2kHz=m_settings->value("Plus2kHz",false).toBool(); ui->cbPlus2kHz->setChecked(m_plus2kHz); + m_EMEbandIndex=m_settings->value("EMEbandIndex",0).toInt(); + m_toneMultIndex=m_settings->value("ToneMultIndex",0).toInt(); + m_DTmin=m_settings->value("DTmin",-2.5).toFloat(); + m_DTmax=m_settings->value("DTmax",5.0).toFloat(); m_settings->endGroup(); // use these initialisation settings to tune the audio o/p bufefr @@ -768,6 +793,7 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog dlg.m_idInt=m_idInt; dlg.m_pttMethodIndex=m_pttMethodIndex; dlg.m_pttPort=m_pttPort; + dlg.m_astroFont=m_astroFont; dlg.m_saveDir=m_saveDir; dlg.m_audioInputDevice = m_audioInputDevice; dlg.m_audioOutputDevice = m_audioOutputDevice; @@ -775,6 +801,7 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog dlg.m_audioOutputChannel = m_audioOutputChannel; dlg.m_pskReporter=m_pskReporter; dlg.m_After73=m_After73; + dlg.m_bAstroData=m_bAstroData; dlg.m_macro=m_macro; dlg.m_dFreq=m_dFreq; dlg.m_antDescription=m_antDescription; @@ -797,6 +824,10 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog dlg.m_poll=m_poll; dlg.m_bSplit=m_bSplit; dlg.m_bXIT=m_bXIT; + dlg.m_EMEbandIndex=m_EMEbandIndex; + dlg.m_toneMultIndex=m_toneMultIndex; + dlg.m_DTmin=m_DTmin; + dlg.m_DTmax=m_DTmax; if(m_bRigOpen) { rig->close(); @@ -815,6 +846,10 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog m_idInt=dlg.m_idInt; m_pttMethodIndex=dlg.m_pttMethodIndex; m_pttPort=dlg.m_pttPort; + m_astroFont=dlg.m_astroFont; + if(g_pAstro!=NULL and g_pAstro->isVisible()) { + g_pAstro->setFontSize(m_astroFont); + } m_saveDir=dlg.m_saveDir; m_audioInputDevice = dlg.m_audioInputDevice; m_audioOutputDevice = dlg.m_audioOutputDevice; @@ -841,18 +876,22 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog m_bRTS=dlg.m_bRTS; m_pttData=dlg.m_pttData; m_poll=dlg.m_poll; + m_EMEbandIndex=dlg.m_EMEbandIndex; + m_toneMultIndex=dlg.m_toneMultIndex; + if(m_mode=="JT9W-1") m_toneSpacing=pow(2,m_toneMultIndex)*12000.0/6912.0; + m_DTmin=dlg.m_DTmin; + m_DTmax=dlg.m_DTmax; //Band Settings ui->bandComboBox->clear(); ui->bandComboBox->addItems(dlg.m_bandDescription); ui->bandComboBox->setCurrentIndex(m_band); m_pskReporter=dlg.m_pskReporter; - if(m_pskReporter) { psk_Reporter->setLocalStation(m_myCall, m_myGrid, m_antDescription[m_band], "WSJT-X r" + rev.mid(6,4) ); } - m_After73=dlg.m_After73; + m_bAstroData=dlg.m_bAstroData; if(dlg.m_restartSoundIn) { Q_EMIT stopAudioInputStream (); @@ -1114,6 +1153,7 @@ void MainWindow::closeEvent(QCloseEvent * e) { writeSettings (); OnExit(); + delete g_pAstro; //Is there a better way ? QMainWindow::closeEvent (e); } @@ -1160,6 +1200,20 @@ void MainWindow::on_actionWide_Waterfall_triggered() //Display Waterfalls m_wideGraph->show(); } +void MainWindow::on_actionAstronomical_data_triggered() +{ + if(g_pAstro==NULL) { + g_pAstro = new Astro(0); + g_pAstro->setWindowTitle("Astronomical Data"); + Qt::WindowFlags flags = Qt::Dialog | Qt::WindowCloseButtonHint | + Qt::WindowMinimizeButtonHint; + g_pAstro->setWindowFlags(flags); + g_pAstro->setGeometry(m_astroGeom); + } + g_pAstro->setFontSize(m_astroFont); + g_pAstro->show(); +} + void MainWindow::on_actionOpen_triggered() //Open File { m_monitoring=false; @@ -1174,6 +1228,7 @@ void MainWindow::on_actionOpen_triggered() //Open File if(i>=0) { lab1->setStyleSheet("QLabel{background-color: #66ff66}"); lab1->setText(" " + fname.mid(i,15) + " "); +// lab1->setText(" " + fname + " "); } on_stopButton_clicked(); m_diskData=true; @@ -1187,7 +1242,7 @@ void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next int i,len; QFileInfo fi(m_path); QStringList list; - list= fi.dir().entryList().filter(".wav"); + list= fi.dir().entryList().filter(".wav",Qt::CaseInsensitive); for (i = 0; i < list.size()-1; ++i) { if(i==list.size()-2) m_loopall=false; len=list.at(i).length(); @@ -1375,8 +1430,9 @@ void MainWindow::decode() //decode() jt9com_.ntxmode=9; if(m_modeTx=="JT65") jt9com_.ntxmode=65; jt9com_.nmode=9; + if(m_mode=="JT9W-1") jt9com_.nmode=91; if(m_mode=="JT65") jt9com_.nmode=65; - if(m_mode=="JT9+JT65") jt9com_.nmode=9+65; + if(m_mode=="JT9+JT65") jt9com_.nmode=9+65; // = 74 jt9com_.ntrperiod=m_TRperiod; m_nsave=0; if(m_saveDecoded) m_nsave=2; @@ -1406,6 +1462,7 @@ void MainWindow::jt9_error(QProcess::ProcessError e) { if(!m_killAll) { msgBox("Error starting or running\n" + m_appDir + "/jt9 -s"); + qDebug() << e; // silence compiler warning exit(1); } } @@ -1758,6 +1815,11 @@ void MainWindow::guiUpdate() if(nsec != m_sec0) { //Once per second QDateTime t = QDateTime::currentDateTimeUtc(); + int fQSO=125; + m_azelDir=m_appDir; + if(g_pAstro!=NULL) g_pAstro->astroUpdate(t, m_myGrid, m_hisGrid, fQSO, + m_setftx, m_txFreq, m_azelDir); + if(m_transmitting) { if(nsendingsh==1) { lab1->setStyleSheet("QLabel{background-color: #66ffff}"); @@ -1807,8 +1869,13 @@ void MainWindow::guiUpdate() void MainWindow::startTx2() { if (!m_modulator.isActive ()) { - QString t=ui->tx6->text(); - double snr=t.mid(1,5).toDouble(); + m_fSpread=0.0; + double snr=99.0; + QString t=ui->tx5->text(); + if(t.mid(0,1)=="#") m_fSpread=t.mid(1,5).toDouble(); + m_modulator.setWide9(m_toneSpacing, m_fSpread); + t=ui->tx6->text(); + if(t.mid(0,1)=="#") snr=t.mid(1,5).toDouble(); if(snr>0.0 or snr < -50.0) snr=99.0; transmit (snr); signalMeter->setValue(0); @@ -2472,6 +2539,7 @@ void MainWindow::on_actionJT9_1_triggered() m_TRperiod=60; m_nsps=6912; m_hsymStop=173; + m_toneSpacing=0.0; lab2->setStyleSheet("QLabel{background-color: #ff6ec7}"); lab2->setText(m_mode); ui->actionJT9_1->setChecked(true); @@ -2481,6 +2549,24 @@ void MainWindow::on_actionJT9_1_triggered() ui->pbTxMode->setEnabled(false); } +void MainWindow::on_actionJT9W_1_triggered() +{ + m_mode="JT9W-1"; + if(m_modeTx!="JT9") on_pbTxMode_clicked(); + statusChanged(); + m_TRperiod=60; + m_nsps=6912; + m_hsymStop=173; + m_toneSpacing=pow(2,m_toneMultIndex)*12000.0/6912.0; + lab2->setStyleSheet("QLabel{background-color: #ff6ec7}"); + lab2->setText(m_mode); + ui->actionJT9W_1->setChecked(true); + m_wideGraph->setPeriod(m_TRperiod,m_nsps); + m_wideGraph->setMode(m_mode); + m_wideGraph->setModeTx(m_modeTx); + ui->pbTxMode->setEnabled(false); +} + void MainWindow::on_actionJT65_triggered() { m_mode="JT65"; @@ -3066,13 +3152,18 @@ void MainWindow::transmit (double snr) { if (m_modeTx == "JT65") { - Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), m_audioOutputChannel, true, snr); + Q_EMIT sendMessage (NUM_JT65_SYMBOLS, 4096.0 * 12000.0 / 11025.0, + m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), + m_audioOutputChannel, true, snr); } else { - Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), m_audioOutputChannel, true, snr); + Q_EMIT sendMessage (NUM_JT9_SYMBOLS, m_nsps, + m_txFreq - (m_bSplit || m_bXIT ? m_XIT : 0), + m_audioOutputChannel, true, snr); } - Q_EMIT startAudioOutputStream (m_audioOutputDevice, AudioDevice::Mono == m_audioOutputChannel ? 1 : 2, m_msAudioOutputBuffered); + Q_EMIT startAudioOutputStream (m_audioOutputDevice, + AudioDevice::Mono == m_audioOutputChannel ? 1 : 2, m_msAudioOutputBuffered); } void MainWindow::on_outAttenuation_valueChanged (int a) diff --git a/mainwindow.h b/mainwindow.h index fec88eb40..71bfd690c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -179,8 +179,10 @@ private slots: void on_actionTx2QSO_triggered(bool checked); void on_cbPlus2kHz_toggled(bool checked); void on_outAttenuation_valueChanged (int); + void on_actionAstronomical_data_triggered(); void on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered(); void getpfx(); + void on_actionJT9W_1_triggered(); private: Q_SIGNAL void startAudioOutputStream (QAudioDeviceInfo, unsigned channels, unsigned msBuffered); @@ -210,6 +212,11 @@ private: QScopedPointer m_logDlg; double m_dialFreq; + double m_toneSpacing; + double m_fSpread; + + float m_DTmin; + float m_DTmax; qint64 m_msErase; qint64 m_secBandChanged; @@ -266,6 +273,9 @@ private: qint32 m_poll; qint32 m_fMax; qint32 m_bad; + qint32 m_EMEbandIndex; + qint32 m_toneMultIndex; + qint32 m_astroFont; bool m_monitoring; bool m_btxok; //True if OK to transmit @@ -318,6 +328,7 @@ private: bool m_bSplit; bool m_bXIT; bool m_plus2kHz; + bool m_bAstroData; char m_decoded[80]; @@ -376,6 +387,7 @@ private: QString m_cmnd; QString m_msgSent0; QString m_fileToSave; + QString m_azelDir; QStringList m_macro; QStringList m_dFreq; // per band frequency in MHz as a string @@ -388,6 +400,7 @@ private: QHash m_sfx; QDateTime m_dateTimeQSO; + QRect m_astroGeom; QSharedMemory *mem_jt9; // Multiple instances: diff --git a/mainwindow.ui b/mainwindow.ui index ecb59c0fb..41288c6f9 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2135,28 +2135,6 @@ p, li { white-space: pre-wrap; } - - - - - 0 - 0 - - - - - 48 - 16777215 - - - - Set Tx frequency to Rx Frequency - - - Tx<Rx - - - @@ -2179,6 +2157,28 @@ p, li { white-space: pre-wrap; } + + + + + 0 + 0 + + + + + 48 + 16777215 + + + + Set Tx frequency to Rx Frequency + + + Tx<Rx + + + @@ -2306,6 +2306,7 @@ p, li { white-space: pre-wrap; } + @@ -2340,6 +2341,7 @@ p, li { white-space: pre-wrap; } + @@ -2652,6 +2654,19 @@ p, li { white-space: pre-wrap; } Show DXCC entity and worked B4 status + + + Astronomical data + + + + + true + + + JT9W-1 + + Short list of add-on prefixes and suffixes diff --git a/plotter.cpp b/plotter.cpp index 7d0e79f7c..df9d4311d 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -96,7 +96,11 @@ void CPlotter::draw(float swide[]) //draw() m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2); QPainter painter2D(&m_2DPixmap); - painter2D.setPen(Qt::green); + if(m_bLinearAvg) { + painter2D.setPen(Qt::yellow); + } else { + painter2D.setPen(Qt::green); + } QPoint LineBuf[MAX_SCREENSIZE]; j=0; @@ -122,8 +126,18 @@ void CPlotter::draw(float swide[]) //draw() sum+=jt9com_.savg[j++]; } y2=gain*6.0*log10(sum/m_binsPerPixel) - 10.0; + y2 += m_plotZero; } - y2 += m_plotZero; + + if(m_bLinearAvg) { + float sum=0.0; + int j=j0+m_binsPerPixel*i; + for(int k=0; k (m_stream->format ().channelCount ())) + if (!m_stream || device != m_currentDevice || + channels != static_cast (m_stream->format ().channelCount ())) { QAudioFormat format (device.preferredFormat ()); @@ -79,9 +81,11 @@ void SoundOutput::startStream (QAudioDeviceInfo const& device, unsigned channels m_stream->setVolume (m_volume); m_stream->setNotifyInterval(100); - connect (m_stream.data(), &QAudioOutput::stateChanged, this, &SoundOutput::handleStateChanged); + connect (m_stream.data(), &QAudioOutput::stateChanged, this, \ + &SoundOutput::handleStateChanged); m_currentDevice = device; +// qDebug() << "A" << m_volume << m_stream->notifyInterval(); } // @@ -97,7 +101,10 @@ void SoundOutput::startStream (QAudioDeviceInfo const& device, unsigned channels // we have to set this before every start on the stream because the // Windows implementation seems to forget the buffer size after a // stop. - m_stream->setBufferSize (m_stream->format ().bytesForDuration ((msBuffered ? msBuffered : MS_BUFFERED) * 1000)); + m_stream->setBufferSize (m_stream->format().bytesForDuration( + (msBuffered ? msBuffered : MS_BUFFERED) * 1000)); +// qDebug() << "B" << m_stream->bufferSize() << m_stream->periodSize() << m_stream->notifyInterval(); + m_stream->start (m_source); audioError (); } diff --git a/widegraph.cpp b/widegraph.cpp index a2cb99a55..e3693fe9a 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -44,8 +44,10 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) : ui->waterfallAvgSpinBox->setValue(m_waterfallAvg); ui->widePlot->m_bCurrent=m_settings->value("Current",false).toBool(); ui->widePlot->m_bCumulative=m_settings->value("Cumulative",true).toBool(); + ui->widePlot->m_bLinearAvg=m_settings->value("LinearAvg",false).toBool(); if(ui->widePlot->m_bCurrent) ui->spec2dComboBox->setCurrentIndex(0); if(ui->widePlot->m_bCumulative) ui->spec2dComboBox->setCurrentIndex(1); + if(ui->widePlot->m_bLinearAvg) ui->spec2dComboBox->setCurrentIndex(2); int nbpp=m_settings->value("BinsPerPixel",2).toInt(); ui->widePlot->setBinsPerPixel(nbpp); ui->widePlot->setStartFreq(m_settings->value("StartFreq",0).toInt()); @@ -94,6 +96,7 @@ void WideGraph::saveSettings() m_settings->setValue ("WaterfallAvg", ui->waterfallAvgSpinBox->value ()); m_settings->setValue ("Current", ui->widePlot->m_bCurrent); m_settings->setValue ("Cumulative", ui->widePlot->m_bCumulative); + m_settings->setValue ("LinearAvg", ui->widePlot->m_bLinearAvg); m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ()); m_settings->setValue ("StartFreq", ui->widePlot->startFreq ()); m_settings->setValue ("WaterfallPalette", m_waterfallPalette); @@ -278,8 +281,10 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(const QString &arg1) { ui->widePlot->m_bCurrent=false; ui->widePlot->m_bCumulative=false; + ui->widePlot->m_bLinearAvg=false; if(arg1=="Current") ui->widePlot->m_bCurrent=true; if(arg1=="Cumulative") ui->widePlot->m_bCumulative=true; + if(arg1=="Linear Avg") ui->widePlot->m_bLinearAvg=true; } void WideGraph::on_fMinSpinBox_valueChanged(int n) diff --git a/widegraph.ui b/widegraph.ui index fbc4f09e7..b167559dc 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -70,6 +70,11 @@ Cumulative + + + Linear Avg + + diff --git a/wsjtx.iss b/wsjtx.iss index 4c9c0009d..16a7dd965 100644 --- a/wsjtx.iss +++ b/wsjtx.iss @@ -2,8 +2,8 @@ AppName=wsjtx AppVerName=wsjtx Version 1.3 r3673 AppCopyright=Copyright (C) 2001-2014 by Joe Taylor, K1JT -DefaultDirName=c:\wsjtx -DefaultGroupName=wsjtx +DefaultDirName=c:\wsjtx_w +DefaultGroupName=wsjtx_w [Files] Source: "c:\Users\joe\wsjt\wsjtx_install\wsjtx.exe"; DestDir: "{app}" @@ -25,6 +25,6 @@ Source: "c:\Users\joe\wsjt\wsjtx_install\platforms\qwindows.dll"; DestDir Source: "c:\Users\joe\wsjt\wsjtx_install\Palettes\*.pal"; DestDir: "{app}\Palettes"; [Icons] -Name: "{group}\wsjtx1.3"; Filename: "{app}\wsjtx.exe"; WorkingDir: {app}; IconFilename: {app}\wsjt.ico -Name: "{userdesktop}\wsjtx1.3"; Filename: "{app}\wsjtx.exe"; WorkingDir: {app}; IconFilename: {app}\wsjt.ico +Name: "{group}\wsjtx_w"; Filename: "{app}\wsjtx.exe"; WorkingDir: {app}; IconFilename: {app}\wsjt.ico +Name: "{userdesktop}\wsjtx_w"; Filename: "{app}\wsjtx.exe"; WorkingDir: {app}; IconFilename: {app}\wsjt.ico diff --git a/wsjtx.pro b/wsjtx.pro index 418c2e5d7..3731697e8 100644 --- a/wsjtx.pro +++ b/wsjtx.pro @@ -37,47 +37,27 @@ QMAKE_EXTRA_COMPILERS += gfortran # # Order matters here as the link is in this order so referrers need to be after referred # -SOURCES += \ - logbook/adif.cpp \ - logbook/countrydat.cpp \ - logbook/countriesworked.cpp \ - logbook/logbook.cpp \ - rigclass.cpp \ - psk_reporter.cpp \ - Modulator.cpp \ - Detector.cpp \ - logqso.cpp \ - displaytext.cpp \ - getfile.cpp \ - soundout.cpp \ - soundin.cpp \ - meterwidget.cpp \ - signalmeter.cpp \ - plotter.cpp \ - widegraph.cpp \ - devsetup.cpp \ - about.cpp \ - mainwindow.cpp \ - main.cpp \ - decodedtext.cpp +SOURCES += logbook/adif.cpp logbook/countrydat.cpp astro.cpp \ + logbook/countriesworked.cpp logbook/logbook.cpp rigclass.cpp \ + psk_reporter.cpp Modulator.cpp Detector.cpp logqso.cpp \ + displaytext.cpp getfile.cpp soundout.cpp soundin.cpp \ + meterwidget.cpp signalmeter.cpp plotter.cpp widegraph.cpp \ + devsetup.cpp about.cpp mainwindow.cpp main.cpp decodedtext.cpp win32 { SOURCES += killbyname.cpp } -HEADERS += mainwindow.h plotter.h soundin.h soundout.h \ +HEADERS += mainwindow.h plotter.h soundin.h soundout.h astro.h \ about.h devsetup.h widegraph.h getfile.h \ commons.h sleep.h displaytext.h logqso.h \ - AudioDevice.hpp Detector.hpp Modulator.hpp psk_reporter.h rigclass.h \ - signalmeter.h \ - meterwidget.h \ - logbook/logbook.h \ - logbook/countrydat.h \ - logbook/countriesworked.h \ - logbook/adif.h + AudioDevice.hpp Detector.hpp Modulator.hpp \ + psk_reporter.h rigclass.h signalmeter.h \ + meterwidget.h logbook/logbook.h logbook/countrydat.h \ + logbook/countriesworked.h logbook/adif.h -FORMS += mainwindow.ui about.ui devsetup.ui widegraph.ui \ +FORMS += mainwindow.ui about.ui devsetup.ui widegraph.ui astro.ui \ logqso.ui RC_FILE = wsjtx.rc @@ -89,10 +69,11 @@ LIBS += -lfftw3f `$$F90 -print-file-name=libgfortran.so` } win32 { -INCLUDEPATH += ../../hamlib-1.2.15.3/include -LIBS += ../../hamlib-1.2.15.3/src/.libs/libhamlib.dll.a -#LIBS += ../../hamlib-1.2.15.3/lib/gcc/libhamlib.dll.a +INCLUDEPATH += /wsjt-env//hamlib/include +LIBS += /wsjt-env/hamlib/lib/gcc/libhamlib.dll.a +#LIBS += ../wsjtx/lib/libjt9.a LIBS += ../wsjtx/lib/libjt9.a +LIBS += ../wsjtx/lib/libastro.a LIBS += ../wsjtx/libfftw3f_win.a LIBS += ../wsjtx/libpskreporter.a LIBS += ../wsjtx/libHRDInterface001.a