WIP on SuperFox transmit capability.

This commit is contained in:
Joe Taylor 2024-03-03 15:08:19 -05:00
parent ed248eb702
commit 05dd89c552
6 changed files with 76 additions and 46 deletions

View File

@ -430,6 +430,7 @@ set (wsjt_FSRCS
lib/ft8/foxgen.f90
lib/superfox/foxgen2.f90
lib/superfox/sfox_assemble.f90
lib/superfox/sfox_wave.f90
lib/ft8/foxgen_wrap.f90
lib/freqcal.f90
lib/ft8/ft8apset.f90

View File

@ -1,4 +1,4 @@
subroutine foxgen(bSuperFox,cmnd)
subroutine foxgen(bSuperFox,data_dir)
! Called from MainWindow::foxTxSequencer() to generate the Tx waveform in
! FT8 Fox mode. The Tx message can contain up to 5 "slots", each carrying
@ -18,7 +18,7 @@ subroutine foxgen(bSuperFox,cmnd)
parameter (NWAVE=(160+2)*134400*4) !the biggest waveform we generate (FST4-1800 at 48kHz)
parameter (NFFT=614400,NH=NFFT/2)
logical*1 bSuperFox
character*120 cmnd
character*(*) data_dir
character*40 cmsg
character*37 msg,msgsent
integer itone(79)
@ -32,7 +32,10 @@ subroutine foxgen(bSuperFox,cmnd)
equivalence (x,cx),(y,cy)
if(bSuperFox) then
call foxgen2(nslots,cmsg,cmnd)
! call foxgen2(nslots,cmsg,cmnd)
open(25,file=data_dir,status='unknown')
write(25,'(a40)') cmsg(1:nslots)
close(25)
return
endif

View File

@ -1,9 +1,23 @@
program sfox_tx
character*120 line
character*120 fname
character*40 cmsg(5)
integer itone(151)
call getarg(1,fname)
open(25,file=trim(fname),status='unknown')
do i=1,5
read(25,1000,end=10) cmsg(i)
1000 format(a40)
! write(*,1000) cmsg(i)
enddo
10 rewind(25)
do i=1,151
itone(i)=i-1
enddo
write(25,1100) itone
1100 format(20i4)
close(25)
call getarg(1,line)
write(*,1000) trim(line)
1000 format(a)
end program sfox_tx

View File

@ -0,0 +1,35 @@
subroutine sfox_wave(fname)
parameter (NWAVE=(160+2)*134400*4) !Max WSJT-X waveform (FST4-1800 at 48kHz)
parameter (NN=151,NSPS=1024)
character*(*) fname
integer itone(151)
real*8 dt,twopi,f0,baud,phi,dphi
common/foxcom/wave(NWAVE)
open(25,file=trim(fname),status='unknown')
read(25,'(20i4)') itone
close(25)
! Generate the SuperFox waveform.
dt=1.d0/48000.d0
twopi=8.d0*atan(1.d0)
f0=750.0d0
phi=0.d0
baud=12000.d0/NSPS
k=0
do j=1,NN
f=f0 + baud*itone(j)
dphi=twopi*f*dt
do ii=1,NSPS
k=k+1
phi=phi+dphi
xphi=phi
wave(k)=wave(k)+sin(xphi)
enddo
enddo
return
end subroutine sfox_wave

View File

@ -176,7 +176,9 @@ extern "C" {
void calibrate_(char const * data_dir, int* iz, double* a, double* b, double* rms,
double* sigmaa, double* sigmab, int* irc, fortran_charlen_t);
void foxgen_(bool* bSuperFox, char* cmnd, fortran_charlen_t);
void foxgen_(bool* bSuperFox, char const * fname, FCL len);
void sfox_wave_(char const * fname, FCL len);
void plotsave_(float swide[], int* m_w , int* m_h1, int* irow);
@ -4824,12 +4826,9 @@ void MainWindow::guiUpdate()
QString foxCall=m_config.my_callsign() + " ";
::memcpy(foxcom_.mycall, foxCall.toLatin1(), sizeof foxcom_.mycall); //Copy Fox callsign into foxcom_
bool bSuperFox=m_config.superFox();
char cmnd[120];
foxgen_(&bSuperFox, cmnd, 120);
if(bSuperFox) {
QString t=QString::fromLatin1(cmnd).trimmed();
sfox_tx(t);
}
auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox.dat")).toLocal8Bit()};
foxgen_(&bSuperFox, fname.constData(), (FCL)fname.size());
if(bSuperFox) sfox_tx();
}
}
}
@ -10304,13 +10303,9 @@ Transmit:
QString foxCall=m_config.my_callsign() + " ";
::memcpy(foxcom_.mycall, foxCall.toLatin1(),sizeof foxcom_.mycall); //Copy Fox callsign into foxcom_
bool bSuperFox=m_config.superFox();
// qDebug() << "bb" << foxcom_.nslots << foxcom_.mycall << foxcom_.cmsg[0];
char cmnd[120];
foxgen_(&bSuperFox, cmnd, 120);
if(bSuperFox) {
QString t=QString::fromLatin1(cmnd).trimmed();
sfox_tx(t);
}
auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox.dat")).toLocal8Bit()};
foxgen_(&bSuperFox, fname.constData(), (FCL)fname.size());
if(bSuperFox) sfox_tx();
m_tFoxTxSinceCQ++;
for(QString hc: m_foxQSO.keys()) { //Check for strikeout or timeout
@ -10886,30 +10881,12 @@ void MainWindow::on_jt65Button_clicked()
on_actionJT65_triggered();
}
void MainWindow::sfox_tx(QString t)
void MainWindow::sfox_tx()
{
// qint64 ms0 = QDateTime::currentMSecsSinceEpoch();
p2.start("sfox_tx", QStringList {t});
auto fname {QDir::toNativeSeparators(m_config.writeable_data_dir().absoluteFilePath("sfox.dat")).toLocal8Bit()};
p2.start("sfox_tx", QStringList {fname});
p2.waitForFinished();
QString t2=p2.readAllStandardOutput();
t2=t2.left(t2.length()-2);
// qDebug() << "aa" << QDateTime::currentMSecsSinceEpoch() - ms0 << t2;
// qDebug() << "aa" << t2;
p4.start("sfox_tx2",QStringList {""});
p4.waitForStarted();
QString t0;
for(int i=0; i<foxcom_.nslots; i++) {
foxcom_.cmsg[i][39]=0;
t0=t0.asprintf("%s\n",foxcom_.cmsg[i]).trimmed();
// qDebug() << i << t0;
p4.write(t0.toLatin1());
}
p4.closeWriteChannel();
p4.waitForFinished();
QString t4;
t4=p4.readAllStandardOutput();
// for(int i=0; i<foxcom_.nslots; i++) {
// t4=p4.readLine();
// t4=t4.left(t2.length()-2);
qDebug() << "bb" << t4;
sfox_wave_(fname.constData(), (FCL)fname.size());
// qDebug() << "cc" << QDateTime::currentMSecsSinceEpoch() - ms0;
}

View File

@ -379,7 +379,7 @@ private:
bool elide_tx1_not_allowed () const;
void readWidebandDecodes();
void configActiveStations();
void sfox_tx(QString t);
void sfox_tx();
QProcessEnvironment const& m_env;
NetworkAccessManager m_network_manager;