From bca62e6715e4ade45c25477765fea8d4fbdc81b7 Mon Sep 17 00:00:00 2001 From: Stelios Bounanos Date: Sat, 8 Mar 2008 23:19:46 +0000 Subject: [PATCH] Upstream version 2.10V --- configure.ac | 2 +- src/cw_rtty/cw.cxx | 3 +- src/cw_rtty/rtty.cxx | 9 +- src/dialogs/fl_digi.cxx | 43 ++- src/dominoex/dominoex.cxx | 16 +- src/feld/feld.cxx | 3 +- src/include/configuration.h | 18 +- src/include/fl_digi.h | 4 +- src/include/modem.h | 8 - src/include/status.h | 5 + src/main.cxx | 2 +- src/mfsk/mfsk.cxx | 8 +- src/misc/configuration.cxx | 523 +++++++++++++++--------------------- src/misc/macros.cxx | 1 - src/misc/status.cxx | 33 ++- src/mt63/mt63.cxx | 15 +- src/olivia/olivia.cxx | 5 +- src/psk/psk.cxx | 8 +- src/soundcard/sound.cxx | 9 +- src/throb/throb.cxx | 7 +- src/trx/modem.cxx | 5 - src/trx/trx.cxx | 7 +- src/waterfall/waterfall.cxx | 2 +- 23 files changed, 326 insertions(+), 410 deletions(-) diff --git a/configure.ac b/configure.ac index 0190d191..45df76cf 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl major and minor must be integers; patch may dnl contain other characters or be empty m4_define(FLDIGI_MAJOR, [2]) m4_define(FLDIGI_MINOR, [10]) -m4_define(FLDIGI_PATCH, [U]) +m4_define(FLDIGI_PATCH, [V]) AC_INIT([fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[FLDIGI_PATCH], [w1hkj AT w1hkj DOT com]) diff --git a/src/cw_rtty/cw.cxx b/src/cw_rtty/cw.cxx index 4dda82ef..a4ba9d5a 100644 --- a/src/cw_rtty/cw.cxx +++ b/src/cw_rtty/cw.cxx @@ -39,6 +39,7 @@ #include "misc.h" //#include "modeIO.h" #include "configuration.h" +#include "status.h" void cw::tx_init(SoundBase *sc) { @@ -317,7 +318,7 @@ int cw::rx_process(const double *buf, int len) if (pipeptr == pipesize - 1) update_syncscope(); - if (!squelchon || metric > squelch ) { + if (!progStatus.sqlonoff || metric > progStatus.sldrSquelchValue ) { // upward trend means tone starting if ((value > 0.66 * agc_peak) && (cw_receive_state != RS_IN_TONE)) handle_event(CW_KEYDOWN_EVENT, NULL); diff --git a/src/cw_rtty/rtty.cxx b/src/cw_rtty/rtty.cxx index 0a64a908..35ad7da8 100644 --- a/src/cw_rtty/rtty.cxx +++ b/src/cw_rtty/rtty.cxx @@ -30,6 +30,7 @@ #include "waterfall.h" #include "confdialog.h" #include "configuration.h" +#include "status.h" //static char rttymsg[80]; static char msg1[20]; @@ -309,7 +310,7 @@ int rtty::rx(bool bit) case RTTY_RX_STATE_STOP: if (--counter == 0) { if (bit) { - if ((metric >= squelch && squelchon)|| !squelchon) { + if ((metric >= progStatus.sldrSquelchValue && progStatus.sqlonoff)|| !progStatus.sqlonoff) { c = decode_char(); if ( c != 0 ) put_rx_char(c); @@ -448,7 +449,7 @@ int rtty::rx_process(const double *buf, int len) rxflag = rx (reverse ? bit : !bit); if (rxflag == 2 || dspcnt == 0) { - if ((metric > squelch && squelchon) || !squelchon) { + if ((metric > progStatus.sldrSquelchValue && progStatus.sqlonoff) || !progStatus.sqlonoff) { set_scope(pipe, symbollen, false); pipe.next(); // change buffers } @@ -482,8 +483,8 @@ int rtty::rx_process(const double *buf, int len) poscnt = 0; posfreq = 0.0; negcnt = 0; negfreq = 0.0; - if (afcon) { - if (metric > squelch || !squelchon || sigsearch) { + if (progStatus.afconoff) { + if (metric > progStatus.sldrSquelchValue || !progStatus.sqlonoff || sigsearch) { set_freq(frequency + freqerr); } } diff --git a/src/dialogs/fl_digi.cxx b/src/dialogs/fl_digi.cxx index 1f74beaf..45a9696d 100644 --- a/src/dialogs/fl_digi.cxx +++ b/src/dialogs/fl_digi.cxx @@ -110,8 +110,8 @@ Fl_Box *WARNstatus = (Fl_Box *)0; Fl_Button *MODEstatus = (Fl_Button *)0; Fl_Button *btnMacro[12]; Fl_Button *btnAltMacros; -Fl_Light_Button *afconoff; -Fl_Light_Button *sqlonoff; +Fl_Light_Button *btn_afconoff; +Fl_Light_Button *btn_sqlonoff; Fl_Check_Button *chk_afconoff; Fl_Check_Button *chk_sqlonoff; Fl_Input *inpFreq; @@ -754,8 +754,7 @@ void closeRigDialog() { } void cb_sldrSquelch(Fl_Slider* o, void*) { - active_modem->set_squelch(o->value()); - progdefaults.sldrSquelchValue = o->value(); + progStatus.sldrSquelchValue = o->value(); restoreFocus(); } @@ -845,8 +844,7 @@ void afconoff_cb(Fl_Widget *w, void *vi) Fl_Button *b = (Fl_Button *)w; int v = b->value(); FL_UNLOCK_D(); - active_modem->set_afcOnOff(v); - progdefaults.afconoff = v; + progStatus.afconoff = v; } void sqlonoff_cb(Fl_Widget *w, void *vi) @@ -855,8 +853,7 @@ void sqlonoff_cb(Fl_Widget *w, void *vi) Fl_Button *b = (Fl_Button *)w; int v = b->value(); FL_UNLOCK_D(); - active_modem->set_sqlchOnOff( v ? true : false ); - progdefaults.sqlonoff = v ? true : false; + progStatus.sqlonoff = v ? true : false; } @@ -888,14 +885,14 @@ void cbMacroTimerButton(Fl_Widget *w, void *d) void cb_RcvMixer(Fl_Widget *w, void *d) { - progdefaults.RcvMixer = valRcvMixer->value(); - mixer->setRcvGain(progdefaults.RcvMixer); + progStatus.RcvMixer = valRcvMixer->value(); + mixer->setRcvGain(progStatus.RcvMixer); } void cb_XmtMixer(Fl_Widget *w, void *d) { - progdefaults.XmtMixer = valXmtMixer->value(); - mixer->setXmtLevel(progdefaults.XmtMixer); + progStatus.XmtMixer = valXmtMixer->value(); + mixer->setXmtLevel(progStatus.XmtMixer); } @@ -1361,7 +1358,7 @@ void create_fl_digi_main() { sldrSquelch->minimum(0); sldrSquelch->maximum(100); sldrSquelch->step(1); - sldrSquelch->value(progdefaults.sldrSquelchValue); + sldrSquelch->value(progStatus.sldrSquelchValue); sldrSquelch->callback((Fl_Callback*)cb_sldrSquelch); sldrSquelch->color(FL_INACTIVE_COLOR); @@ -1407,30 +1404,30 @@ void create_fl_digi_main() { Hmenu+Hrcvtxt+Hxmttxt+Hwfall, bwAfcOnOff, Hstatus, "Afc"); chk_afconoff->callback(afconoff_cb, 0); - chk_afconoff->value(1); + chk_afconoff->value(progStatus.afconoff); chk_afconoff->tooltip("AFC on/off"); chk_sqlonoff = new Fl_Check_Button( WNOM - bwSqlOnOff, Hmenu+Hrcvtxt+Hxmttxt+Hwfall, bwSqlOnOff, Hstatus, "Sql"); chk_sqlonoff->callback(sqlonoff_cb, 0); - chk_sqlonoff->value(1); + chk_sqlonoff->value(progStatus.sqlonoff); chk_sqlonoff->tooltip("SQL on/off"); } else { - afconoff = new Fl_Light_Button( + btn_afconoff = new Fl_Light_Button( WNOM - bwAfcOnOff - bwSqlOnOff, Hmenu+Hrcvtxt+Hxmttxt+Hwfall, bwAfcOnOff, Hstatus, "Afc"); - afconoff->callback(afconoff_cb, 0); - afconoff->value(1); - afconoff->tooltip("AFC on/off"); - sqlonoff = new Fl_Light_Button( + btn_afconoff->callback(afconoff_cb, 0); + btn_afconoff->value(progStatus.afconoff); + btn_afconoff->tooltip("AFC on/off"); + btn_sqlonoff = new Fl_Light_Button( WNOM - bwSqlOnOff, Hmenu+Hrcvtxt+Hxmttxt+Hwfall, bwSqlOnOff, Hstatus, "Sql"); - sqlonoff->callback(sqlonoff_cb, 0); - sqlonoff->value(1); - sqlonoff->tooltip("SQL on/off"); + btn_sqlonoff->callback(sqlonoff_cb, 0); + btn_sqlonoff->value(progStatus.sqlonoff); + btn_sqlonoff->tooltip("SQL on/off"); } Fl_Group::current()->resizable(StatusBar); diff --git a/src/dominoex/dominoex.cxx b/src/dominoex/dominoex.cxx index 147eec89..0f4617c5 100644 --- a/src/dominoex/dominoex.cxx +++ b/src/dominoex/dominoex.cxx @@ -29,6 +29,7 @@ #include #include "confdialog.h" +#include "status.h" #include "dominoex.h" #include "trx.h" @@ -251,7 +252,7 @@ void dominoex::decodesymbol(unsigned char curtone, unsigned char prevtone) for (int i = 0; i < symcounter; i++) sym |= symbolbuf[i] << (4 * i); ch = dominoex_varidec(sym); - if (!squelchon || metric > squelch) + if (!progStatus.sqlonoff || metric > progStatus.sldrSquelchValue) recvchar(ch); } symcounter = 0; @@ -304,14 +305,14 @@ void dominoex::update_syncscope(complex *bins) mag = 0; videodata[i] = 255*mag; } - if (!squelchon || metric >= squelch) { + if (!progStatus.sqlonoff || metric >= progStatus.sldrSquelchValue) { set_video(videodata, numbins); videodata.next(); // change buffers } // dom symbol synch data memset(scopedata, 0, 2 * symlen * sizeof(double)); - if (!squelchon || metric >= squelch) + if (!progStatus.sqlonoff || metric >= progStatus.sldrSquelchValue) for (int i = 0, j = 0; i < 2 * symlen; i++) { j = (i + pipeptr) % (2 * symlen); scopedata[i] = (pipe[j].vector[prev1symbol]).mag(); @@ -377,7 +378,7 @@ void dominoex::afc() // std::cout << currsymbol << ", " << freqerr << std::endl; fflush(stdout); - if (afcon && (metric > squelch || squelchon == false)) { + if (progStatus.afconoff && (metric > progStatus.sldrSquelchValue || progStatus.sqlonoff == false)) { set_freq(frequency + freqerr); } } @@ -385,9 +386,10 @@ void dominoex::afc() void dominoex::eval_s2n(complex curr, complex n) { sig = curr.mag(); // signal + noise energy - noise = n.mag() + 1e-10; // noise energy - - s2n = decayavg( s2n, fabs((sig - noise) / noise), 8); + noise = n.mag();// + 1e-10; // noise energy + if (noise < 1e-20) noise = 1e-20; + + s2n = decayavg( s2n, sig / noise, 8); metric = 20*log10(s2n); diff --git a/src/feld/feld.cxx b/src/feld/feld.cxx index 4891ff2c..63da5975 100644 --- a/src/feld/feld.cxx +++ b/src/feld/feld.cxx @@ -38,6 +38,7 @@ #include "fontdef.h" #include "confdialog.h" #include "qrunner.h" +#include "status.h" #include #include @@ -245,7 +246,7 @@ void feld::rx(complex z) col_data[col_pointer + RxColumnLen] = (int)x; col_pointer++; if (col_pointer == RxColumnLen) { - if (metric > progdefaults.sldrSquelchValue || progdefaults.sqlonoff == false) { + if (metric > progStatus.sldrSquelchValue || progStatus.sqlonoff == false) { REQ(put_rx_data, col_data, col_data.size()); if (!halfwidth) REQ(put_rx_data, col_data, col_data.size()); diff --git a/src/include/configuration.h b/src/include/configuration.h index 1faf983c..61d5dcb3 100644 --- a/src/include/configuration.h +++ b/src/include/configuration.h @@ -13,7 +13,6 @@ using namespace std; struct configuration { bool changed; - double squelch; double wfRefLevel; double wfAmpSpan; int LowFreqCutoff; @@ -27,7 +26,7 @@ struct configuration { int ServerOffset; double ACQsn; // RTTY - double rtty_squelch; +// double rtty_squelch; int rtty_shift; int rtty_baud; int rtty_bits; @@ -39,9 +38,9 @@ struct configuration { bool rtty_autocrlf; int rtty_autocount; int rtty_afcspeed; - bool afconoff; - bool sqlonoff; - double sldrSquelchValue; +// bool afconoff; +// bool sqlonoff; +// double sldrSquelchValue; bool useFSKkeyline; // use RTS for FSK bool useFSKkeylineDTR; // use DTR for FSK bool FSKisLSB; @@ -81,9 +80,6 @@ struct configuration { bool mt63_8bit; int mt63_interleave; // User interface data -// int Fontnbr; -// int FontSize; -// int FontColor; uchar red; uchar green; uchar blue; @@ -111,8 +107,6 @@ struct configuration { // Rig Interface data bool btnusb; int btnPTTis; - int btnRTSDTRis; // obsolete - int btnPTTREVis; // obsolete bool RTSptt; bool DTRptt; bool RTSplus; @@ -157,8 +151,6 @@ struct configuration { // Mixer configuration string MXdevice; - double RcvMixer; - double XmtMixer; bool MicIn; bool LineIn; bool EnableMixer; @@ -206,7 +198,7 @@ public: bool readDefaultsXML(); void loadDefaults(); void saveDefaults(); - int openDefaults(); + int setDefaults(); void initOperator(); void initInterface(); void initMixerDevices(); diff --git a/src/include/fl_digi.h b/src/include/fl_digi.h index 30b7cbfa..514efb36 100644 --- a/src/include/fl_digi.h +++ b/src/include/fl_digi.h @@ -81,8 +81,8 @@ extern Fl_Button *qsoSave; extern Fl_Button *btnMacroTimer; extern Fl_Slider *valRcvMixer; extern Fl_Slider *valXmtMixer; -extern Fl_Light_Button *afconoff; -extern Fl_Light_Button *sqlonoff; +extern Fl_Light_Button *btn_afconoff; +extern Fl_Light_Button *btn_sqlonoff; extern Fl_Check_Button *chk_afconoff; extern Fl_Check_Button *chk_sqlonoff; extern Fl_Button *btnAltMacros; diff --git a/src/include/modem.h b/src/include/modem.h index d23a110c..8dd41138 100644 --- a/src/include/modem.h +++ b/src/include/modem.h @@ -27,8 +27,6 @@ protected: trx_mode mode; SoundBase *scard; - int afcon; - int squelchon; bool stopflag; int fragmentsize; int samplerate; @@ -87,12 +85,6 @@ public: // void update_syncscope(); - void set_squelch(double val) { squelch = val; } - double get_squelch() { return squelch; } - void set_sqlchOnOff(bool val) {squelchon = val;} - bool get_sqlchOnOff() { return squelchon;} - void set_afcOnOff(int val) {afcon = val;} - bool get_afcOnOff() { return afcon;} void HistoryON(bool val) {historyON = val;} bool HistoryON() { return historyON;} diff --git a/src/include/status.h b/src/include/status.h index e64f6273..14b997bf 100644 --- a/src/include/status.h +++ b/src/include/status.h @@ -29,6 +29,11 @@ struct status { unsigned int VIEWERypos; bool VIEWERvisible; bool LOGenabled; + double sldrSquelchValue; + bool afconoff; + bool sqlonoff; + double RcvMixer; + double XmtMixer; public: diff --git a/src/main.cxx b/src/main.cxx index 396d87e1..a9759db6 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -192,7 +192,7 @@ int main(int argc, char ** argv) push2talk = new PTT(); - progdefaults.openDefaults(); + progdefaults.setDefaults(); sound_init(); trx_start(); diff --git a/src/mfsk/mfsk.cxx b/src/mfsk/mfsk.cxx index 2e590562..5003237f 100644 --- a/src/mfsk/mfsk.cxx +++ b/src/mfsk/mfsk.cxx @@ -32,6 +32,7 @@ #include "mfsk.h" #include "modem.h" #include "configuration.h" +#include "status.h" #include "trx.h" #include "ascii.h" @@ -163,7 +164,6 @@ mfsk::mfsk(trx_mode mfsk_mode) : modem() bitstate = 0; phaseacc = 0; pipeptr = 0; - squelch = 0; metric = 0; prev1symbol = prev2symbol = 0; symbolpair[0] = symbolpair[1] = 0; @@ -343,7 +343,7 @@ void mfsk::decodesymbol(unsigned char symbol) } display_metric(metric); - if (squelchon && metric < squelch) + if (progStatus.sqlonoff && metric < progStatus.sldrSquelchValue) return; recvbit(c); @@ -433,7 +433,7 @@ void mfsk::update_syncscope() { int j; memset(scopedata, 0, 2 * symlen * sizeof(double)); - if (!squelchon || metric >= squelch) + if (!progStatus.sqlonoff || metric >= progStatus.sldrSquelchValue) for (int i = 0; i < 2 * symlen; i++) { j = (i + pipeptr) % (2 * symlen); scopedata[i] = (pipe[j].vector[prev1symbol]).mag(); @@ -497,7 +497,7 @@ void mfsk::afc() f = z.arg() * samplerate / twopi; f -= (1000 + tonespacing * currsymbol); - if (afcon && (metric > squelch || squelchon == false)) { + if (progStatus.afconoff && (metric > progStatus.sldrSquelchValue || progStatus.sqlonoff == false)) { if (fabs(f) <= tonespacing / 2.0) freqerr = afcfilt->run(f / numtones); set_freq(frequency + freqerr); diff --git a/src/misc/configuration.cxx b/src/misc/configuration.cxx index 0e16f6c4..ba333ef3 100644 --- a/src/misc/configuration.cxx +++ b/src/misc/configuration.cxx @@ -17,7 +17,6 @@ configuration progdefaults = { false, // bool changed; - 25.0, // double squelch; 0.0, // double wfRefLevel; 70.0, // double wfAmpSpan; 300, // int LowFreqCutoff; @@ -31,7 +30,6 @@ configuration progdefaults = { 40, // int ServerOffset; 6.0, // double ACQsn; // RTTY - 25.0, // double rtty_squelch; 3, // int rtty_shift; = 170 0, // int rtty_baud; = 45 0, // int rtty_bits; = 5 @@ -43,9 +41,6 @@ configuration progdefaults = { true, // bool rtty_autocrlf; 72, // int rtty_autocount; 1, // int rtty_afcspeed; - true, // bool afconoff; - true, // bool sqlonoff; - 30.0, // double sldrSquelchValue;; false, // bool useFSKkeyline; false, // bool useFSKkeylineDTR; true, // bool FSKisLSB; @@ -86,9 +81,6 @@ configuration progdefaults = { false, // bool mt63_8bit; 32, // int mt63_interleave; // -// FL_SCREEN, // int Fontnbr - obsolete -// 16, // int Fontsize - obsolete -// 0, // int Fontcolor - obsolete 0, // uchar red 255, // uchar green 255, // uchar blue @@ -116,8 +108,6 @@ configuration progdefaults = { // true, // bool btnusb; 0, // int btnPTTis - 0, // int btnRTSDTRis - 0, // int btnPTTREVis false, // bool RTSptt; false, // bool DTRptt; false, // bool RTSplus; @@ -161,8 +151,6 @@ configuration progdefaults = { 0, // int timeout; "", // string MXdevice - 1.0, // double RcvMixer; - 1.0, // double XmtMixer; false, // bool MicIn; true, // bool LineIn; false, // bool EnableMixer; @@ -221,12 +209,11 @@ enum TAG { \ IGNORE, MYCALL, MYNAME, MYQTH, MYLOC, SQUELCH, WFREFLEVEL, WFAMPSPAN, LOWFREQCUTOFF, -// FONTNBR, FONTSIZE, FONTCOLOR, STARTATSWEETSPOT, PSKMAILSWEETSPOT, PSKSEARCHRANGE, PSKSERVEROFFSET, ACQSN, CWSWEETSPOT, PSKSWEETSPOT, RTTYSWEETSPOT, - RTTYSQUELCH, RTTYSHIFT, RTTYBAUD, + RTTYSHIFT, RTTYBAUD, RTTYBITS, RTTYPARITY, RTTYSTOP, RTTYREVERSE, RTTYMSBFIRST, RTTYCRCLF, RTTYAUTOCRLF, RTTYAUTOCOUNT, RTTYAFCSPEED, @@ -247,7 +234,7 @@ enum TAG { \ BWTCOLORS, VIEWXMTSIGNAL, SENDID, MACROID, SENDTEXTID, STRTEXTID, VIDEOWIDTH, QRZTYPE, QRZUSER, QRZPASSWORD, - BTNUSB, BTNPTTIS, BTNRTSDTRIS, BTNPTTREVIS, + BTNUSB, BTNPTTIS, RTSPTT, DTRPTT, RTSPLUS, DTRPLUS, CHOICEHAMLIBIS, CHKUSEMEMMAPIS, CHKUSEHAMLIBIS, CHKUSERIGCATIS, @@ -258,7 +245,8 @@ enum TAG { \ SAMPLERATE, INSAMPLERATE, OUTSAMPLERATE, RXCORR, TXCORR, TXOFFSET, USELEADINGZEROS, CONTESTSTART, CONTESTDIGITS, USETIMER, MACRONUMBER, TIMEOUT, - MXDEVICE, RCVMIXER, XMTMIXER, PCMVOLUME, + MXDEVICE, + PCMVOLUME, MICIN, LINEIN, ENABLEMIXER, MUTEINPUT, PALETTE0, PALETTE1, PALETTE2, PALETTE3, PALETTE4, PALETTE5, PALETTE6, PALETTE7, PALETTE8, @@ -269,7 +257,6 @@ enum TAG { \ RXFONTNBR, RXFONTSIZE, TXFONTNBR, TXFONTSIZE, RXFONTCOLOR, TXFONTCOLOR }; -// , ALT_TEXT_WIDGETS }; void writeXMLint(ofstream &f, const char * tag, int val) { @@ -326,13 +313,9 @@ void configuration::writeDefaultsXML() writeXMLstr(f, "MYQTH", myQth); writeXMLstr(f, "MYLOC", myLocator); - writeXMLdbl(f, "SQUELCH", squelch); writeXMLdbl(f, "WFREFLEVEL", wfRefLevel); writeXMLdbl(f, "WFAMPSPAN", wfAmpSpan); writeXMLint(f, "LOWFREQCUTOFF", LowFreqCutoff); -// writeXMLint(f, "FONTNBR", Fontnbr); -// writeXMLint(f, "FONTSIZE", FontSize); -// writeXMLint(f, "FONTCOLOR", FontColor); writeXMLbool(f, "STARTATSWEETSPOT", StartAtSweetSpot); writeXMLbool(f, "PSKMAILSWEETSPOT", PSKmailSweetSpot); @@ -342,7 +325,6 @@ void configuration::writeDefaultsXML() writeXMLdbl(f, "PSKSWEETSPOT", PSKsweetspot); writeXMLdbl(f, "ACQSN", ACQsn); writeXMLdbl(f, "RTTYSWEETSPOT", RTTYsweetspot); - writeXMLdbl(f, "RTTYSQUELCH", rtty_squelch); writeXMLint(f, "RTTYSHIFT", rtty_shift); writeXMLint(f, "RTTYBAUD", rtty_baud); writeXMLint(f, "RTTYBITS", rtty_bits); @@ -410,8 +392,6 @@ void configuration::writeDefaultsXML() writeXMLstr(f, "QRZPASSWORD", QRZuserpassword); writeXMLbool(f, "BTNUSB", btnusb); writeXMLint(f, "BTNPTTIS", btnPTTis); - writeXMLint(f, "BTNRTSDTRIS", btnRTSDTRis); - writeXMLint(f, "BTNPTTREVIS", btnPTTREVis); writeXMLbool(f, "RTSPTT", RTSptt); writeXMLbool(f, "DTRPTT", DTRptt); writeXMLbool(f, "RTSPLUS", RTSplus); @@ -444,8 +424,6 @@ void configuration::writeDefaultsXML() writeXMLint(f, "MACRONUMBER", macronumber); writeXMLint(f, "TIMEOUT", timeout); writeXMLstr(f, "MXDEVICE", MXdevice); - writeXMLdbl(f, "RCVMIXER", RcvMixer); - writeXMLdbl(f, "XMTMIXER", XmtMixer); writeXMLdbl(f, "PCMVOLUME", PCMvolume); writeXMLbool(f, "MICIN", MicIn); writeXMLbool(f, "LINEIN", LineIn); @@ -454,8 +432,6 @@ void configuration::writeDefaultsXML() for (int i = 0; i < 9; i++) writeXMLPalette(f, i, cfgpal[i].R, cfgpal[i].G, cfgpal[i].B); -// writeXMLbool(f, "ALT_TEXT_WIDGETS", alt_text_widgets); - writeXMLbool(f, "VIEWERMARQUEE", VIEWERmarquee); writeXMLbool(f, "VIEWERSHOWFREQ", VIEWERshowfreq); writeXMLint(f, "VIEWERSTART", VIEWERstart); @@ -524,9 +500,6 @@ bool configuration::readDefaultsXML() case MYLOC: myLocator = xml->getNodeData(); break; - case SQUELCH: - squelch = atof(xml->getNodeData()); - break; case WFREFLEVEL: wfRefLevel = atof(xml->getNodeData()); break; @@ -536,15 +509,6 @@ bool configuration::readDefaultsXML() case LOWFREQCUTOFF : LowFreqCutoff = atoi(xml->getNodeData()); break; -// case FONTSIZE : -// FontSize = atoi(xml->getNodeData()); -// break; -// case FONTCOLOR : -// FontColor = atoi(xml->getNodeData()); -// break; -// case FONTNBR : -// Fontnbr = atoi(xml->getNodeData()); -// break; case STARTATSWEETSPOT : StartAtSweetSpot = atoi(xml->getNodeData()); break; @@ -569,9 +533,6 @@ bool configuration::readDefaultsXML() case RTTYSWEETSPOT : RTTYsweetspot = atof(xml->getNodeData()); break; - case RTTYSQUELCH : - rtty_squelch = atof(xml->getNodeData()); - break; case RTTYSHIFT : rtty_shift = atoi(xml->getNodeData()); break; @@ -744,12 +705,6 @@ bool configuration::readDefaultsXML() case BTNPTTIS : btnPTTis = atoi(xml->getNodeData()); break; - case BTNRTSDTRIS : - btnRTSDTRis = atoi(xml->getNodeData()); - break; - case BTNPTTREVIS : - btnPTTREVis = atoi(xml->getNodeData()); - break; case RTSPTT : RTSptt = atoi(xml->getNodeData()); break; @@ -846,12 +801,6 @@ bool configuration::readDefaultsXML() case MXDEVICE : MXdevice = xml->getNodeData(); break; - case RCVMIXER : - RcvMixer = atof(xml->getNodeData()); - break; - case XMTMIXER : - XmtMixer = atof(xml->getNodeData()); - break; case PCMVOLUME : PCMvolume = atof(xml->getNodeData()); break; @@ -982,9 +931,6 @@ bool configuration::readDefaultsXML() else if (!strcmp("WFREFLEVEL", nodeName)) tag = WFREFLEVEL; else if (!strcmp("WFAMPSPAN", nodeName)) tag = WFAMPSPAN; else if (!strcmp("LOWFREQCUTOFF", nodeName)) tag = LOWFREQCUTOFF; -// else if (!strcmp("FONTSIZE", nodeName)) tag = FONTSIZE; -// else if (!strcmp("FONTCOLOR", nodeName)) tag = FONTCOLOR; -// else if (!strcmp("FONTNBR", nodeName)) tag = FONTNBR; else if (!strcmp("STARTATSWEETSPOT", nodeName)) tag = STARTATSWEETSPOT; else if (!strcmp("PSKMAILSWEETSPOT", nodeName)) tag = PSKMAILSWEETSPOT; else if (!strcmp("PSKSEARCHRANGE", nodeName)) tag = PSKSEARCHRANGE; @@ -993,7 +939,6 @@ bool configuration::readDefaultsXML() else if (!strcmp("CWSWEETSPOT", nodeName)) tag = CWSWEETSPOT; else if (!strcmp("PSKSWEETSPOT", nodeName)) tag = PSKSWEETSPOT; else if (!strcmp("RTTYSWEETSPOT", nodeName)) tag = RTTYSWEETSPOT; - else if (!strcmp("RTTYSQUELCH", nodeName)) tag = RTTYSQUELCH; else if (!strcmp("RTTYSHIFT", nodeName)) tag = RTTYSHIFT; else if (!strcmp("RTTYBAUD", nodeName)) tag = RTTYBAUD; else if (!strcmp("RTTYBITS", nodeName)) tag = RTTYBITS; @@ -1049,8 +994,6 @@ bool configuration::readDefaultsXML() else if (!strcmp("QRZTYPE", nodeName)) tag = QRZTYPE; else if (!strcmp("BTNUSB", nodeName)) tag = BTNUSB; else if (!strcmp("BTNPTTIS", nodeName)) tag = BTNPTTIS; - else if (!strcmp("BTNRTSDTRIS", nodeName)) tag = BTNRTSDTRIS; - else if (!strcmp("BTNPTTREVIS", nodeName)) tag = BTNPTTREVIS; else if (!strcmp("RTSPTT", nodeName)) tag = RTSPTT; else if (!strcmp("DTRPTT", nodeName)) tag = DTRPTT; else if (!strcmp("RTSPLUS", nodeName)) tag = RTSPLUS; @@ -1082,8 +1025,6 @@ bool configuration::readDefaultsXML() else if (!strcmp("MACRONUMBER", nodeName)) tag = MACRONUMBER; else if (!strcmp("TIMEOUT", nodeName)) tag = TIMEOUT; else if (!strcmp("MXDEVICE", nodeName)) tag = MXDEVICE; - else if (!strcmp("RCVMIXER", nodeName)) tag = RCVMIXER; - else if (!strcmp("XMTMIXER", nodeName)) tag = XMTMIXER; else if (!strcmp("PCMVOLUME", nodeName)) tag = PCMVOLUME; else if (!strcmp("MICIN", nodeName)) tag = MICIN; else if (!strcmp("LINEIN", nodeName)) tag = LINEIN; @@ -1209,7 +1150,6 @@ void configuration::saveDefaults() { secText = txtSecondary->value(); PTTdev = inpTTYdev->value(); - squelch = sldrSquelch->value(); for (int i = 0; i < 9; i++) { progdefaults.cfgpal[i].R = palette[i].R; progdefaults.cfgpal[i].G = palette[i].G; @@ -1217,262 +1157,221 @@ void configuration::saveDefaults() { } FL_UNLOCK(); -// string deffname = HomeDir; -// deffname.append("fldigi.def"); -// ofstream deffile(deffname.c_str(), ios::out); -// writeDefaults(deffile); - -// deffile.close(); - writeDefaultsXML(); - changed = false; } -int configuration::openDefaults() { +int configuration::setDefaults() { #if USE_HAMLIB getRigs(); #endif - if (readDefaultsXML()) { -// if (readDefaults()) { - FL_LOCK(); - inpMyCallsign->value(myCall.c_str()); - inpMyName->value(myName.c_str()); - inpMyQth->value(myQth.c_str()); - inpMyLocator->value(myLocator.c_str()); - UseLeadingZeros = btnUseLeadingZeros->value(); - ContestStart = (int)nbrContestStart->value(); - ContestDigits = (int)nbrContestDigits->value(); - - txtSecondary->value(secText.c_str()); - valDominoEX_BW->value(DOMINOEX_BW); - - for (int i = 0; i < 5; i++) { - btnPTT[i]->value(0); - btnPTT[i]->activate(); - } - btnPTT[btnPTTis]->value(1); -#if !USE_HAMLIB - btnPTT[1]->deactivate(); - chkUSEHAMLIB->deactivate(); - inpRIGdev->hide(); - mnuBaudRate->hide(); - cboHamlibRig->hide(); -#else - btnPTT[1]->activate(); - chkUSEHAMLIB->activate(); - inpRIGdev->show(); - mnuBaudRate->show(); - cboHamlibRig->show(); - cboHamlibRig->value(HamRigName.c_str()); -#endif - btnRTSptt->value(RTSptt); - btnDTRptt->value(DTRptt); - btnRTSplusV->value(RTSplus); - btnDTRplusV->value(DTRplus); - - inpTTYdev->value(PTTdev.c_str()); - - if(chkUSEMEMMAPis) { - chkUSEMEMMAP->value(1); - chkUSEHAMLIB->value(0); - chkUSERIGCAT->value(0); - cboHamlibRig->deactivate(); - inpRIGdev->deactivate(); - mnuBaudRate->deactivate(); - btnPTT[1]->deactivate(); - btnPTT[2]->activate(); - btnPTT[3]->deactivate(); - } else if (chkUSEHAMLIBis) { - chkUSEMEMMAP->value(0); - chkUSERIGCAT->value(0); - chkUSEHAMLIB->value(1); - cboHamlibRig->activate(); - inpRIGdev->activate(); - mnuBaudRate->activate(); - btnPTT[1]->activate(); - btnPTT[2]->deactivate(); - btnPTT[3]->deactivate(); - } else if (chkUSERIGCATis) { - chkUSEMEMMAP->value(0); - chkUSEHAMLIB->value(0); - chkUSERIGCAT->value(1); - cboHamlibRig->deactivate(); - inpRIGdev->deactivate(); - mnuBaudRate->deactivate(); - btnPTT[1]->deactivate(); - btnPTT[2]->deactivate(); - btnPTT[3]->activate(); - } else { - chkUSEMEMMAP->value(0); - chkUSEHAMLIB->value(0); - chkUSERIGCAT->value(0); - btnPTT[1]->deactivate(); - btnPTT[2]->deactivate(); - btnPTT[3]->deactivate(); - } - - inpRIGdev->value(HamRigDevice.c_str()); - mnuBaudRate->value(HamRigBaudrate); - - sldrSquelch->value(squelch); - - valCWsweetspot->value(CWsweetspot); - valRTTYsweetspot->value(RTTYsweetspot); - valPSKsweetspot->value(PSKsweetspot); - btnStartAtSweetSpot->value(StartAtSweetSpot); - btnPSKmailSweetSpot->value(PSKmailSweetSpot); - cntSearchRange->value(SearchRange); - cntServerOffset->value(ServerOffset); - cntACQsn->value(ACQsn); - - btnCursorBWcolor->color( - fl_rgb_color(cursorLineRGBI.R, cursorLineRGBI.G, cursorLineRGBI.B) ); - btnCursorCenterLineColor->color( - fl_rgb_color(cursorCenterRGBI.R, cursorCenterRGBI.G, cursorCenterRGBI.B) ); - btnBwTracksColor->color( - fl_rgb_color(bwTrackRGBI.R, bwTrackRGBI.G, bwTrackRGBI.B) ); - - cntCWweight->value(CWweight); - sldrCWxmtWPM->value(CWspeed); - cntCWdefWPM->value(defCWspeed); - sldrCWbandwidth->value(CWbandwidth); - btnCWrcvTrack->value(CWtrack); - cntCWrange->value(CWrange); - cntCWlowerlimit->value(CWlowerlimit); - cntCWupperlimit->value(CWupperlimit); - cntCWlowerlimit->maximum(CWupperlimit - 20); - cntCWupperlimit->minimum(CWlowerlimit + 20); - cntCWrisetime->value(CWrisetime); - cntCWdash2dot->value(CWdash2dot); - sldrCWxmtWPM->minimum(CWlowerlimit); - sldrCWxmtWPM->maximum(CWupperlimit); - btnQSK->value(QSK); - cntPreTiming->maximum((int)(2400/CWspeed)/2.0); - cntPreTiming->value(CWpre); - cntPostTiming->maximum((int)(2400/CWspeed)/2.0); - cntPostTiming->value(CWpost); - btnCWID->value(CWid); - - selHellFont->value(feldfontnbr); - btnFeldHellIdle->value(FELD_IDLE); - - string bandsfname = HomeDir; - bandsfname.append("frequencies.def"); - ifstream bandsfile(bandsfname.c_str(), ios::in); - if (bandsfile) { - string sBand; - cboBand->add(" "); - while (!bandsfile.eof()) { - sBand = ""; - bandsfile >> sBand; bandsfile.ignore(); - if (sBand.length() > 0) - cboBand->add(sBand.c_str()); - } - bandsfile.close(); - } else { - int i = 0; - while (szBands[i]) { - cboBand->add((char *)szBands[i]); - i++; - } - } - btnQRZnotavailable->value(0); - btnQRZsocket->value(0); - btnQRZcdrom->value(0); - btnHAMCALLsocket->value(0); - if (QRZ == 0) - btnQRZnotavailable->value(1); - else if (QRZ == 1) - btnQRZsocket->value(1); - else if (QRZ == 2) - btnQRZcdrom->value(1); - else if (QRZ == 3) - btnHAMCALLsocket->value(1); - - btnRTTY_USB->value(RTTY_USB); - btnsendid->value(sendid); - btnsendvideotext->value(sendtextid); - - valRcvMixer->value(RcvMixer); - valXmtMixer->value(XmtMixer); - valPCMvolume->value(PCMvolume); - btnMicIn->value(MicIn); - btnLineIn->value(LineIn); - - menuOSSDev->value(OSSdevice.c_str()); - menuPortInDev->value(PortInDevice.c_str()); - menuPortOutDev->value(PortOutDevice.c_str()); - inpPulseServer->value(PulseServer.c_str()); - - btnMixer->value(EnableMixer); - resetMixerControls(); - menuMix->value(MXdevice.c_str()); - - - char sr[6+1]; - if (in_sample_rate == SAMPLE_RATE_UNSET && - (in_sample_rate = sample_rate) == SAMPLE_RATE_UNSET) - in_sample_rate = SAMPLE_RATE_AUTO; - else if (in_sample_rate > SAMPLE_RATE_OTHER) - snprintf(sr, sizeof(sr), "%d", in_sample_rate); - if (in_sample_rate <= SAMPLE_RATE_NATIVE) - menuInSampleRate->value(in_sample_rate); - else - menuInSampleRate->value(menuInSampleRate->find_item(sr)); - - if (out_sample_rate == SAMPLE_RATE_UNSET && - (out_sample_rate = sample_rate) == SAMPLE_RATE_UNSET) - out_sample_rate = SAMPLE_RATE_AUTO; - else if (out_sample_rate > SAMPLE_RATE_OTHER) - snprintf(sr, sizeof(sr), "%d", out_sample_rate); - if (out_sample_rate <= SAMPLE_RATE_NATIVE) - menuOutSampleRate->value(out_sample_rate); - else - menuOutSampleRate->value(menuOutSampleRate->find_item(sr)); - - - cntRxRateCorr->value(RX_corr); - cntTxRateCorr->value(TX_corr); - cntTxOffset->value(TxOffset); -#ifdef USE_BOTH_TEXT_WIDGETS - btntextwidgets->value(alt_text_widgets); - btntextwidgets->activate(); -#else -// alt_text_widgets = true; - btntextwidgets->deactivate(); -#endif - FL_UNLOCK(); - - enableMixer(EnableMixer); + FL_LOCK(); + inpMyCallsign->value(myCall.c_str()); + inpMyName->value(myName.c_str()); + inpMyQth->value(myQth.c_str()); + inpMyLocator->value(myLocator.c_str()); + UseLeadingZeros = btnUseLeadingZeros->value(); + ContestStart = (int)nbrContestStart->value(); + ContestDigits = (int)nbrContestDigits->value(); - ReceiveText->setFont((Fl_Font)RxFontnbr); - ReceiveText->setFontSize(RxFontsize); - - TransmitText->setFont((Fl_Font)TxFontnbr); - TransmitText->setFontSize(TxFontsize); - - wf->setPrefilter(wfPreFilter); - - for (int i = 0; i < 9; i++) { - palette[i].R = (uchar)cfgpal[i].R; - palette[i].G = (uchar)cfgpal[i].G; - palette[i].B = (uchar)cfgpal[i].B; - } - wf->setcolors(); - setColorButtons(); - - return 1; - } else { - for (int i = 0; i < 9; i++) { - palette[i].R = (uchar)cfgpal[i].R; - palette[i].G = (uchar)cfgpal[i].G; - palette[i].B = (uchar)cfgpal[i].B; - } - wf->setcolors(); - setColorButtons(); + txtSecondary->value(secText.c_str()); + valDominoEX_BW->value(DOMINOEX_BW); + + for (int i = 0; i < 5; i++) { + btnPTT[i]->value(0); + btnPTT[i]->activate(); } - return 0; + btnPTT[btnPTTis]->value(1); +#if !USE_HAMLIB + btnPTT[1]->deactivate(); + chkUSEHAMLIB->deactivate(); + inpRIGdev->hide(); + mnuBaudRate->hide(); + cboHamlibRig->hide(); +#else + btnPTT[1]->activate(); + chkUSEHAMLIB->activate(); + inpRIGdev->show(); + mnuBaudRate->show(); + cboHamlibRig->show(); + cboHamlibRig->value(HamRigName.c_str()); +#endif + btnRTSptt->value(RTSptt); + btnDTRptt->value(DTRptt); + btnRTSplusV->value(RTSplus); + btnDTRplusV->value(DTRplus); + + inpTTYdev->value(PTTdev.c_str()); + + if(chkUSEMEMMAPis) { + chkUSEMEMMAP->value(1); chkUSEHAMLIB->value(0); chkUSERIGCAT->value(0); + cboHamlibRig->deactivate(); + inpRIGdev->deactivate(); + mnuBaudRate->deactivate(); + btnPTT[1]->deactivate(); btnPTT[2]->activate(); btnPTT[3]->deactivate(); + } else if (chkUSEHAMLIBis) { + chkUSEMEMMAP->value(0); chkUSERIGCAT->value(0); chkUSEHAMLIB->value(1); + cboHamlibRig->activate(); + inpRIGdev->activate(); + mnuBaudRate->activate(); + btnPTT[1]->activate(); btnPTT[2]->deactivate(); btnPTT[3]->deactivate(); + } else if (chkUSERIGCATis) { + chkUSEMEMMAP->value(0); chkUSEHAMLIB->value(0); chkUSERIGCAT->value(1); + cboHamlibRig->deactivate(); + inpRIGdev->deactivate(); + mnuBaudRate->deactivate(); + btnPTT[1]->deactivate(); btnPTT[2]->deactivate(); btnPTT[3]->activate(); + } else { + chkUSEMEMMAP->value(0); chkUSEHAMLIB->value(0); chkUSERIGCAT->value(0); + btnPTT[1]->deactivate(); btnPTT[2]->deactivate(); btnPTT[3]->deactivate(); + } + + inpRIGdev->value(HamRigDevice.c_str()); + mnuBaudRate->value(HamRigBaudrate); + + valCWsweetspot->value(CWsweetspot); + valRTTYsweetspot->value(RTTYsweetspot); + valPSKsweetspot->value(PSKsweetspot); + btnStartAtSweetSpot->value(StartAtSweetSpot); + btnPSKmailSweetSpot->value(PSKmailSweetSpot); + cntSearchRange->value(SearchRange); + cntServerOffset->value(ServerOffset); + cntACQsn->value(ACQsn); + + btnCursorBWcolor->color( + fl_rgb_color(cursorLineRGBI.R, cursorLineRGBI.G, cursorLineRGBI.B) ); + btnCursorCenterLineColor->color( + fl_rgb_color(cursorCenterRGBI.R, cursorCenterRGBI.G, cursorCenterRGBI.B) ); + btnBwTracksColor->color( + fl_rgb_color(bwTrackRGBI.R, bwTrackRGBI.G, bwTrackRGBI.B) ); + + cntCWweight->value(CWweight); + sldrCWxmtWPM->value(CWspeed); + cntCWdefWPM->value(defCWspeed); + sldrCWbandwidth->value(CWbandwidth); + btnCWrcvTrack->value(CWtrack); + cntCWrange->value(CWrange); + cntCWlowerlimit->value(CWlowerlimit); + cntCWupperlimit->value(CWupperlimit); + cntCWlowerlimit->maximum(CWupperlimit - 20); + cntCWupperlimit->minimum(CWlowerlimit + 20); + cntCWrisetime->value(CWrisetime); + cntCWdash2dot->value(CWdash2dot); + sldrCWxmtWPM->minimum(CWlowerlimit); + sldrCWxmtWPM->maximum(CWupperlimit); + btnQSK->value(QSK); + cntPreTiming->maximum((int)(2400/CWspeed)/2.0); + cntPreTiming->value(CWpre); + cntPostTiming->maximum((int)(2400/CWspeed)/2.0); + cntPostTiming->value(CWpost); + btnCWID->value(CWid); + + selHellFont->value(feldfontnbr); + btnFeldHellIdle->value(FELD_IDLE); + + string bandsfname = HomeDir; + bandsfname.append("frequencies.def"); + ifstream bandsfile(bandsfname.c_str(), ios::in); + if (bandsfile) { + string sBand; + cboBand->add(" "); + while (!bandsfile.eof()) { + sBand = ""; + bandsfile >> sBand; bandsfile.ignore(); + if (sBand.length() > 0) + cboBand->add(sBand.c_str()); + } + bandsfile.close(); + } else { + int i = 0; + while (szBands[i]) { + cboBand->add((char *)szBands[i]); + i++; + } + } + btnQRZnotavailable->value(0); + btnQRZsocket->value(0); + btnQRZcdrom->value(0); + btnHAMCALLsocket->value(0); + if (QRZ == 0) + btnQRZnotavailable->value(1); + else if (QRZ == 1) + btnQRZsocket->value(1); + else if (QRZ == 2) + btnQRZcdrom->value(1); + else if (QRZ == 3) + btnHAMCALLsocket->value(1); + + btnRTTY_USB->value(RTTY_USB); + btnsendid->value(sendid); + btnsendvideotext->value(sendtextid); + + valPCMvolume->value(PCMvolume); + btnMicIn->value(MicIn); + btnLineIn->value(LineIn); + + menuOSSDev->value(OSSdevice.c_str()); + menuPortInDev->value(PortInDevice.c_str()); + menuPortOutDev->value(PortOutDevice.c_str()); + inpPulseServer->value(PulseServer.c_str()); + + btnMixer->value(EnableMixer); + resetMixerControls(); + menuMix->value(MXdevice.c_str()); + + + char sr[6+1]; + if (in_sample_rate == SAMPLE_RATE_UNSET && + (in_sample_rate = sample_rate) == SAMPLE_RATE_UNSET) + in_sample_rate = SAMPLE_RATE_AUTO; + else if (in_sample_rate > SAMPLE_RATE_OTHER) + snprintf(sr, sizeof(sr), "%d", in_sample_rate); + if (in_sample_rate <= SAMPLE_RATE_NATIVE) + menuInSampleRate->value(in_sample_rate); + else + menuInSampleRate->value(menuInSampleRate->find_item(sr)); + + if (out_sample_rate == SAMPLE_RATE_UNSET && + (out_sample_rate = sample_rate) == SAMPLE_RATE_UNSET) + out_sample_rate = SAMPLE_RATE_AUTO; + else if (out_sample_rate > SAMPLE_RATE_OTHER) + snprintf(sr, sizeof(sr), "%d", out_sample_rate); + if (out_sample_rate <= SAMPLE_RATE_NATIVE) + menuOutSampleRate->value(out_sample_rate); + else + menuOutSampleRate->value(menuOutSampleRate->find_item(sr)); + + + cntRxRateCorr->value(RX_corr); + cntTxRateCorr->value(TX_corr); + cntTxOffset->value(TxOffset); +#ifdef USE_BOTH_TEXT_WIDGETS + btntextwidgets->value(alt_text_widgets); + btntextwidgets->activate(); +#else + btntextwidgets->deactivate(); +#endif + FL_UNLOCK(); + + enableMixer(EnableMixer); + + ReceiveText->setFont((Fl_Font)RxFontnbr); + ReceiveText->setFontSize(RxFontsize); + + TransmitText->setFont((Fl_Font)TxFontnbr); + TransmitText->setFontSize(TxFontsize); + + wf->setPrefilter(wfPreFilter); + + for (int i = 0; i < 9; i++) { + palette[i].R = (uchar)cfgpal[i].R; + palette[i].G = (uchar)cfgpal[i].G; + palette[i].B = (uchar)cfgpal[i].B; + } + wf->setcolors(); + setColorButtons(); + + return 1; } void configuration::initOperator() { @@ -1538,7 +1437,6 @@ void configuration::initInterface() { wf->setQSY(1); activate_rig_menu_item(false); } else if (chkUSERIGCATis) { // start the rigCAT thread -// btnPTT[3]->activate(); if (rigCAT_init() == false) { wf->USB(true); cboBand->show(); @@ -1554,7 +1452,6 @@ void configuration::initInterface() { } #if USE_HAMLIB } else if (chkUSEHAMLIBis) { // start the hamlib thread -// btnPTT[1]->activate(); if (hamlib_init(btnPTTis == 1 ? true : false) == false) { wf->USB(true); cboBand->show(); diff --git a/src/misc/macros.cxx b/src/misc/macros.cxx index 6ba66f5b..81b3bb5d 100644 --- a/src/misc/macros.cxx +++ b/src/misc/macros.cxx @@ -318,7 +318,6 @@ int MACROTEXT::loadMacros(string filename) bool inMacro = false; int mNumber = 0; unsigned long int crlf; // 64 bit cpu's - char szTemp[10]; char szLine[4096]; bool convert = false; diff --git a/src/misc/status.cxx b/src/misc/status.cxx index b63e6985..3a9a801f 100644 --- a/src/misc/status.cxx +++ b/src/misc/status.cxx @@ -5,6 +5,8 @@ #include "status.h" #include "configuration.h" +#include "fl_digi.h" + #include "waterfall.h" #include "modem.h" @@ -44,7 +46,12 @@ status progStatus = { 50, // uint VIEWERxpos 50, // uint VIEWERypos false, // bool VIEWERvisible - false // bool LOGenabled + false, // bool LOGenabled + 30.0, // double sldrSquelchValue + true, // bool afconoff + true, // bool sqlonoff + 1.0, // double RcvMixer; + 1.0 // double XmtMixer; }; @@ -112,6 +119,12 @@ void status::saveLastState() deffile << VIEWERypos << endl; deffile << VIEWERvisible << endl; deffile << LOGenabled << endl; + deffile << sldrSquelchValue << endl; + deffile << afconoff << endl; + deffile << sqlonoff << endl; + deffile << RcvMixer << endl; + deffile << XmtMixer << endl; + deffile.close(); } @@ -140,6 +153,11 @@ void status::initLastState() deffile >> VIEWERypos; deffile >> VIEWERvisible; deffile >> LOGenabled; + deffile >> sldrSquelchValue; + deffile >> afconoff; + deffile >> sqlonoff; + deffile >> RcvMixer; + deffile >> XmtMixer; deffile.close(); progdefaults.wfRefLevel = reflevel; progdefaults.wfAmpSpan = ampspan; @@ -155,6 +173,19 @@ void status::initLastState() wf->setAmpSpan(); wf->movetocenter(); + FL_LOCK_D(); + if (useCheckButtons) { + chk_afconoff->value(afconoff); + chk_sqlonoff->value(sqlonoff); + } else { + btn_afconoff->value(afconoff); + btn_sqlonoff->value(sqlonoff); + } + sldrSquelch->value(sldrSquelchValue); + valRcvMixer->value(RcvMixer); + valXmtMixer->value(XmtMixer); + FL_UNLOCK_D(); + // if (IMAGE_WIDTH == DEFAULT_IMAGE_WIDTH && Hwfall == DEFAULT_HWFALL && // HNOM == DEFAULT_HNOM && WNOM == DEFAULT_WNOM) { diff --git a/src/mt63/mt63.cxx b/src/mt63/mt63.cxx index 2bec75f6..15bab956 100644 --- a/src/mt63/mt63.cxx +++ b/src/mt63/mt63.cxx @@ -30,6 +30,7 @@ #include #include "mt63.h" +#include "status.h" using namespace std; @@ -38,7 +39,7 @@ static int IntegLen = 32; // integration period for sync./data tracking void mt63::tx_init(SoundBase *sb) { scard = sb; - Tx->Preset((int)bandwidth, Interleave); + Tx->Preset((int)bandwidth, Interleave == 64 ? 1 : 0); set_freq(500.0 + bandwidth / 2.0); flush = Tx->DataInterleave; videoText(); @@ -46,7 +47,7 @@ void mt63::tx_init(SoundBase *sb) void mt63::rx_init() { - Rx->Preset((int)bandwidth, Interleave, IntegLen); + Rx->Preset((int)bandwidth, Interleave == 64 ? 1 : 0, IntegLen); set_freq(500.0 + bandwidth / 2.0); InpLevel->Preset(64.0, 0.75); escape = 0; @@ -74,14 +75,14 @@ int mt63::tx_process() if ((progdefaults.mt63_8bit && c > 255) || (!progdefaults.mt63_8bit && c > 127)) c = '.'; + put_echo_char(c); + if (c > 127) { c &= 127; Tx->SendChar(127); ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len); } - put_echo_char(c); - Tx->SendChar(c); ModulateXmtr((Tx->Comb.Output.Data), Tx->Comb.Output.Len); @@ -120,7 +121,7 @@ int mt63::rx_process(const double *buf, int len) // snprintf(msg1, sizeof(msg1), "s/n %2d dB", (int)(floor(s2n))); // put_Status1(msg1); - if (squelchon && snr < squelch) + if (progStatus.sqlonoff && snr < progStatus.sldrSquelchValue) return 0; for (i = 0; i < Rx->Output.Len; i++) { @@ -158,12 +159,12 @@ void mt63::restart() digiscope->mode(Digiscope::BLANK); set_freq(500.0 + bandwidth / 2.0); - err = Tx->Preset((int)bandwidth, Interleave); + err = Tx->Preset((int)bandwidth, Interleave == 64 ? 1 : 0); if (err) fprintf(stderr, "mt63_txinit: init failed\n"); // flush = Tx->DataInterleave; - err = Rx->Preset((int)bandwidth, Interleave, IntegLen); + err = Rx->Preset((int)bandwidth, Interleave == 64 ? 1 : 0, IntegLen); if (err) fprintf(stderr, "mt63_rxinit: init failed\n"); InpLevel->Preset(64.0, 0.75); diff --git a/src/olivia/olivia.cxx b/src/olivia/olivia.cxx index ba3f64eb..66283e83 100644 --- a/src/olivia/olivia.cxx +++ b/src/olivia/olivia.cxx @@ -33,6 +33,7 @@ #include "olivia.h" #include "sound.h" +#include "status.h" #include "confdialog.h" @@ -243,7 +244,7 @@ int olivia::rx_process(const double *buf, int len) for (i = 0; i < len; i++) rxbuffer[i] = (short int) (buf[i] * 32767.0); - Rx->SyncThreshold = squelchon ? squelch : 0.0; + Rx->SyncThreshold = progStatus.sqlonoff ? progStatus.sldrSquelchValue : 0.0; Rx->Process(rxbuffer, len); @@ -309,7 +310,7 @@ void olivia::restart() Rx->Bandwidth = Tx->Bandwidth; Rx->SyncMargin = smargin; Rx->SyncIntegLen = sinteg; - Rx->SyncThreshold = squelchon ? squelch : 0.0; + Rx->SyncThreshold = progStatus.sqlonoff ? progStatus.sldrSquelchValue : 0.0; Rx->SampleRate = 8000.0;//samplerate; Rx->InputSampleRate = samplerate; diff --git a/src/psk/psk.cxx b/src/psk/psk.cxx index b69598be..e8b869e3 100644 --- a/src/psk/psk.cxx +++ b/src/psk/psk.cxx @@ -35,6 +35,7 @@ #include "psk.h" #include "waterfall.h" #include "configuration.h" +#include "status.h" #include "viewpsk.h" #include "pskeval.h" @@ -367,7 +368,7 @@ void psk::phaseafc() void psk::afc() { - if (!afcon) + if (!progStatus.afconoff) return; if (dcd == true || acquire) phaseafc(); @@ -413,7 +414,7 @@ void psk::rx_symbol(complex symbol) break; default: - if (metric > squelch || squelchon == false) + if (metric > progStatus.sldrSquelchValue || progStatus.sqlonoff == false) dcd = true; else dcd = false; @@ -470,9 +471,6 @@ int psk::rx_process(const double *buf, int len) if (pskviewer && !bHistory) pskviewer->rx_process(buf, len); if (evalpsk) evalpsk->sigdensity(); -// if (afcon == 2) -// sigsearch = 0; - delta = twopi * frequency / samplerate; signalquality(); diff --git a/src/soundcard/sound.cxx b/src/soundcard/sound.cxx index fab0b3bd..132a7709 100644 --- a/src/soundcard/sound.cxx +++ b/src/soundcard/sound.cxx @@ -46,6 +46,7 @@ #include "sound.h" #include "configuration.h" +#include "status.h" #include #include "File_Selector.h" @@ -508,7 +509,7 @@ size_t SoundOSS::Read(double *buffer, size_t buffersize) if (playback) { readPlayback( buffer, buffersize); if (progdefaults.EnableMixer) { - double vol = valRcvMixer->value(); + double vol = progStatus.RcvMixer; for (size_t i = 0; i < buffersize; i++) buffer[i] *= vol; } @@ -815,7 +816,7 @@ size_t SoundPort::Read(double *buf, size_t count) if (playback) { readPlayback(buf, count); if (progdefaults.EnableMixer) { - double vol = valRcvMixer->value(); + double vol = progStatus.RcvMixer; for (size_t i = 0; i < count; i++) buf[i] *= vol; } @@ -1319,7 +1320,7 @@ size_t SoundPulse::Read(double *buf, size_t count) if (playback) { readPlayback(buf, count); if (progdefaults.EnableMixer) { - double vol = valRcvMixer->value(); + double vol = progStatus.RcvMixer; for (size_t i = 0; i < count; i++) buf[i] *= vol; } @@ -1434,7 +1435,7 @@ size_t SoundNull::Read(double *buf, size_t count) if (playback) { readPlayback(buf, count); if (progdefaults.EnableMixer) { - double vol = valRcvMixer->value(); + double vol = progStatus.RcvMixer; for (size_t i = 0; i < count; i++) buf[i] *= vol; } diff --git a/src/throb/throb.cxx b/src/throb/throb.cxx index 4356a547..a7269c97 100644 --- a/src/throb/throb.cxx +++ b/src/throb/throb.cxx @@ -33,6 +33,7 @@ #include "throb.h" #include "ascii.h" #include "configuration.h" +#include "status.h" #undef CLAMP #define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x))) @@ -340,7 +341,7 @@ int throb::findtones(complex *word, int &tone1, int &tone2) } void throb::show_char(int c) { - if (metric > squelch || squelchon == false) + if (metric > progStatus.sldrSquelchValue || progStatus.sqlonoff == false) put_rx_char(c); } @@ -426,7 +427,7 @@ void throb::rx(complex in) else decodechar (tone1, tone2); - if (afcon == true && (metric >= squelch || squelchon == false)) { + if (progStatus.afconoff == true && (metric >= progStatus.sldrSquelchValue || progStatus.sqlonoff == false)) { complex z1, z2; double f; @@ -480,7 +481,7 @@ void throb::sync(complex in) /* correct sync */ rxcntr += (maxpos - rxsymlen / 2) / (num_tones - 1); waitsync = 0; - if (metric >= squelch || squelchon == false) + if (metric >= progStatus.sldrSquelchValue || progStatus.sqlonoff == false) set_scope(dispbuf, rxsymlen); else { dispbuf[0] = 0.0; diff --git a/src/trx/modem.cxx b/src/trx/modem.cxx index ae6848ce..7283d509 100644 --- a/src/trx/modem.cxx +++ b/src/trx/modem.cxx @@ -64,16 +64,11 @@ modem::modem() bool wfrev = wf->Reverse(); bool wfsb = wf->USB(); reverse = wfrev ^ !wfsb; - afcon = true; - squelchon = true; historyON = false; } void modem::init() { - afcon = progdefaults.afconoff; - squelchon = progdefaults.sqlonoff; - squelch = progdefaults.sldrSquelchValue; bool wfrev = wf->Reverse(); bool wfsb = wf->USB(); reverse = wfrev ^ !wfsb; diff --git a/src/trx/trx.cxx b/src/trx/trx.cxx index 87fd40dc..ecf2a02d 100644 --- a/src/trx/trx.cxx +++ b/src/trx/trx.cxx @@ -35,6 +35,7 @@ #include "misc.h" //#include "modeIO.h" #include "configuration.h" +#include "status.h" #include "macros.h" #include @@ -132,8 +133,8 @@ void trx_trx_receive_loop() if (!bHistory) active_modem->rx_process(rbvec[0].buf, numread); else { - bool afc = active_modem->get_afcOnOff(); - active_modem->set_afcOnOff(0); + bool afc = progStatus.afconoff; + progStatus.afconoff = false; QRUNNER_DROP(true); active_modem->HistoryON(true); trxrb.get_rv(rbvec); @@ -142,7 +143,7 @@ void trx_trx_receive_loop() if (rbvec[1].len) active_modem->rx_process(rbvec[1].buf, rbvec[1].len); QRUNNER_DROP(false); - active_modem->set_afcOnOff(afc); + progStatus.afconoff = afc; bHistory = false; active_modem->HistoryON(false); } diff --git a/src/waterfall/waterfall.cxx b/src/waterfall/waterfall.cxx index f5133497..1e985905 100644 --- a/src/waterfall/waterfall.cxx +++ b/src/waterfall/waterfall.cxx @@ -1450,7 +1450,7 @@ int WFdisp::handle(int event) if (Fl::event_state() & FL_CTRL) viewer_paste_freq(cursorFreq(xpos)); else { - Fl_Button *b = useCheckButtons ? chk_afconoff : afconoff; + Fl_Button *b = useCheckButtons ? chk_afconoff : btn_afconoff; b->value(!b->value()); b->do_callback(); }