Add "Apply" button to calibration solution message box

Make calibration  solution application iterative so  that calibrations
can be applied sequentially if desired.

Tidy up calibration solution messages boxes and make i18n friendly.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8153 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-10-01 21:44:15 +00:00
parent e2771c0cd7
commit a3bdea0a21
4 changed files with 37 additions and 7 deletions

View File

@ -673,6 +673,12 @@ QString Configuration::rig_name () const {return m_->rig_params_.rig_name;}
bool Configuration::pwrBandTxMemory () const {return m_->pwrBandTxMemory_;}
bool Configuration::pwrBandTuneMemory () const {return m_->pwrBandTuneMemory_;}
void Configuration::adjust_calibration_parameters (double intercept, double slope_ppm)
{
m_->frequency_calibration_intercept_ += intercept;
m_->frequency_calibration_slope_ppm_ += slope_ppm;
}
bool Configuration::is_transceiver_online () const
{
return m_->rig_active_;

View File

@ -159,6 +159,11 @@ public:
QColor color_NewCall () const;
bool pwrBandTxMemory () const;
bool pwrBandTuneMemory () const;
// Adjust the current calibration parameters, both arguments are in
// Hertz. They will be added to the current values.
void adjust_calibration_parameters (double intercept, double slope_ppm);
// This method queries if a CAT and PTT connection is operational.
bool is_transceiver_online () const;

View File

@ -24,7 +24,7 @@ subroutine calibrate(data_dir,iz,a,b,rms,sigmaa,sigmab,irc)
n=0
j=0
do i=1,99999
read(10,*,end=10) cutc,nkHz,ncal,noffset,faudio,df,dblevel,snr
read(10,*,end=10,err=995) cutc,nkHz,ncal,noffset,faudio,df,dblevel,snr
if((nkHz.ne.nkHz0) .and. i.ne.1) then
ave=sum/n
rms=0.d0
@ -84,6 +84,7 @@ subroutine calibrate(data_dir,iz,a,b,rms,sigmaa,sigmab,irc)
enddo
go to 999
995 irc=-4; iz=i; go to 999
996 irc=-1; go to 999
997 irc=-2; go to 999
998 irc=-3

View File

@ -2110,16 +2110,34 @@ void MainWindow::on_actionSolve_FreqCal_triggered()
double a,b,rms,sigmaa,sigmab;
strncpy(data_dir,dpath.toLatin1(),len);
calibrate_(data_dir,&iz,&a,&b,&rms,&sigmaa,&sigmab,&irc,len);
QString t1;
t1.sprintf("Slope: %10.3f ±%7.3f ppm\nIntercept: %7.2f ±%5.2f Hz\n\nN: %18d\nStdDev: %8.2f Hz",
b,sigmab,a,sigmaa,iz,rms);
QString t2{"Solution looks good."};
if(irc<0) t1="";
QString t2;
if(irc==-1) t2="Cannot open " + dpath + "fmt.all";
if(irc==-2) t2="Cannot open " + dpath + "fcal2.out";
if(irc==-3) t2="Insufficient data in fmt.all";
if(irc==-4) t2 = tr ("Invalid data in fmt.all at line %1").arg (iz);
if(irc>0 or rms>1.0) t2="Check fmt.all for possible bad data.";
MessageBox::information_message(this,t1,t2,0);
if (irc < 0 || irc > 0 || rms > 1.) {
MessageBox::warning_message (this, "Calibration Error", t2);
}
else if (MessageBox::Apply == MessageBox::query_message (this
, tr ("Good Calibration Solution")
, tr ("<pre>"
"%1%L2 ±%L3 ppm\n"
"%4%L5 ±%L6 Hz\n\n"
"%7%L8\n"
"%9%L10 Hz"
"</pre>")
.arg ("Slope: ", 12).arg (b, 0, 'f', 3).arg (sigmab, 0, 'f', 3)
.arg ("Intercept: ", 12).arg (a, 0, 'f', 2).arg (sigmaa, 0, 'f', 2)
.arg ("N: ", 12).arg (iz)
.arg ("StdDev: ", 12).arg (rms, 0, 'f', 2)
, QString {}
, MessageBox::Cancel | MessageBox::Apply)) {
m_config.adjust_calibration_parameters (a, b);
// discard fmt.all as we have consumed the resulting calibration solution
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("fmt.all")};
f.remove ();
}
}
// This allows the window to shrink by removing certain things