From a458af58ac269af036126fd58f6de058eb52ce95 Mon Sep 17 00:00:00 2001 From: Stelios Bounanos Date: Sat, 16 Feb 2008 05:57:07 +0000 Subject: [PATCH] Upstream version 2.10D --- ChangeLog | 1 + configure.ac | 2 +- src/misc/macroedit.cxx | 58 +++++++++++++++++++++--------- src/misc/macros.cxx | 31 ++++++++++++++++ src/psk/psk.cxx | 12 +++---- src/rigcontrol/rigio.cxx | 78 ++++++++++++++++++++++++++-------------- 6 files changed, 132 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0374b68b..79197811 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ Change Log: 4) The volume sliders will now be hidden if the mixer is disabled 5) Rename some classes so that fldigi builds on Mac OSX. Many thanks to Justin Burket and Diane Bruce. + 6) Added a macro that changes the current modem 2.09 1) Modified src/Makefile.am for FreeBSD name space clash 2) Added psk multi-channel viewer with regex search capability diff --git a/configure.ac b/configure.ac index 0e1f4d7e..864158f9 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_COPYRIGHT([Copyright (C) 2007 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)]) AC_PREREQ(2.61) -AC_INIT([fldigi], [2.10C], [w1hkj AT w1hkj DOT com]) +AC_INIT([fldigi], [2.10D], [w1hkj AT w1hkj DOT com]) AC_CONFIG_AUX_DIR([build-aux]) # define build, build_cpu, build_vendor, build_os diff --git a/src/misc/macroedit.cxx b/src/misc/macroedit.cxx index be572338..c5618916 100644 --- a/src/misc/macroedit.cxx +++ b/src/misc/macroedit.cxx @@ -2,6 +2,7 @@ #include "macros.h" #include "macroedit.h" +#include "globals.h" #include @@ -20,35 +21,57 @@ Fl_Hold_Browser *macroDefs=(Fl_Hold_Browser *)0; static int iMacro; +// fl_color(0) is always the foreground colour +#define LINE_SEP "@B0" + void loadBrowser(Fl_Widget *widget) { Fl_Browser *w = (Fl_Browser *)widget; - w->add("\tother call"); - w->add("\tmy frequency"); - w->add("\tother locator"); - w->add("\tmode"); - w->add("\tremote name"); - w->add("\tother qth"); - w->add("\tother RST"); w->add("\tmy call"); w->add("\tmy locator"); w->add("\tmy name"); w->add("\tmy qth"); w->add("\tmy RST"); + + w->add(LINE_SEP); + w->add("\tother call"); + w->add("\tother locator"); + w->add("\tremote name"); + w->add("\tother qth"); + w->add("\tother RST"); + + w->add(LINE_SEP); + w->add("\tmy frequency"); + w->add("\tmode"); + + w->add(LINE_SEP); w->add("\tLocal datetime"); - w->add("\tLocal datetime in iso-8601"); + w->add("\tLDT in iso-8601 format"); w->add("\tZulu datetime"); - w->add("\tZulu datetime in iso-8601"); - w->add("\tMode ID'r"); - w->add("\tVideo text"); - w->add("\tCW identifier"); - w->add("\treceive"); - w->add("\ttransmit"); - w->add("\tFldigi + version"); + w->add("\tZDT in iso-8601 format"); + + w->add(LINE_SEP); w->add("\tcontest cnt"); w->add("\tdecr cnt"); w->add("\tincr cnt"); + + w->add(LINE_SEP); + w->add("\tMode ID'r"); + w->add("\tVideo text"); + w->add("\tCW identifier"); + + w->add(LINE_SEP); + w->add("\treceive"); + w->add("\ttransmit"); w->add("\tsave QSO data"); + w->add("\tFldigi + version"); w->add("\trepeat every NNN sec"); + + w->add(LINE_SEP); + char s[48]; + for (size_t i = 0; i < NUM_MODES; i++) { + snprintf(s, sizeof(s), "%s", mode_info[i].sname); + w->add(s); + } } void cbMacroEditOK(Fl_Widget *w, void *) @@ -76,7 +99,10 @@ void cbInsertMacro(Fl_Widget *, void *) string edittext = macrotext->value(); string text = macroDefs->text(nbr); size_t tab = text.find('\t'); - text.erase(tab); + if (tab != string::npos) + text.erase(tab); + if (text == LINE_SEP) + return; macrotext->insert(text.c_str()); macrotext->take_focus(); } diff --git a/src/misc/macros.cxx b/src/misc/macros.cxx index abb30815..f7a77cca 100644 --- a/src/misc/macros.cxx +++ b/src/misc/macros.cxx @@ -9,6 +9,7 @@ #include "confdialog.h" #include "logger.h" #include "newinstall.h" +#include "globals.h" #include #include "File_Selector.h" @@ -52,6 +53,7 @@ void pDECR(string &, size_t &); void pINCR(string &, size_t &); void pLOG(string &, size_t &); void pTIMER(string &, size_t &); +void pMODEM(string &, size_t &); MTAGS mtags[] = { {"", pCALL}, @@ -81,6 +83,7 @@ MTAGS mtags[] = { {"", pINCR}, {"", pLOG}, {"", pTIMER}, +{"", pMODEM}, {0, 0} }; @@ -282,6 +285,31 @@ void pTIMER(string &s, size_t &i) progdefaults.useTimer = true; } +void pMODEM(string &s, size_t &i) +{ + if ((i = s.find('>', i)) == string::npos) + return; + + size_t len = s.length(); + while (++i < len) + if (!isspace(s[i])) + break; + size_t j = i; + while (++j < len) + if (isspace(s[j])) + break; + + string name = s.substr(i, j-i); + for (j = 0; j < NUM_MODES; j++) { + if (name == mode_info[j].sname) { + if (active_modem->get_mode() != mode_info[j].mode) + init_modem(mode_info[j].mode); + s.clear(); + break; + } + } +} + int MACROTEXT::loadMacros(string filename) { string mLine; @@ -453,6 +481,9 @@ string mtext = // retn to receive\n\ // start transmit\n\ // Fldigi + version\n\ +// name changes the current modem to name. name is the short modem name\n\ +// as it appears in the status/quick change box at the bottom left corner\n\ +// of the main window\n\ //\n\ // Contest macro definitions:\n\ // substitute the contest counter - no change in value\n\ diff --git a/src/psk/psk.cxx b/src/psk/psk.cxx index 3f6b8385..410bd7e6 100644 --- a/src/psk/psk.cxx +++ b/src/psk/psk.cxx @@ -49,7 +49,7 @@ extern waterfall *wf; // Change the following for DCD low pass filter adjustment #define SQLCOEFF 0.01 -#define SQLDECAY 100 +#define SQLDECAY 50 //===================================================================== @@ -347,6 +347,7 @@ void psk::findsignal() frequency = ftest; set_freq(frequency); freqerr = 0.0; + sigsearch = 0; } // searchBW = progdefaults.SearchRange; // ftest = wf->peakFreq((int)(frequency), searchBW); @@ -383,10 +384,7 @@ void psk::afc() { if (!afcon) return; -// if (sigsearch) -// findsignal(); - else if (dcd == true) - phaseafc(); + phaseafc(); } @@ -484,8 +482,8 @@ 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; +// if (afcon == 2) +// sigsearch = 0; delta = twopi * frequency / samplerate; diff --git a/src/rigcontrol/rigio.cxx b/src/rigcontrol/rigio.cxx index 0f6ac4f1..95b16d59 100644 --- a/src/rigcontrol/rigio.cxx +++ b/src/rigcontrol/rigio.cxx @@ -8,6 +8,7 @@ #include #include +#include #ifdef RIGCATTEST #include "rigCAT.h" @@ -59,6 +60,15 @@ void printhex(unsigned char *s, int len) std::cout << hex << (unsigned int)(s[i] & 0xFF) << " "; std::cout << std::endl; } +char * printtime() +{ + time_t t; + time(&t); + tm *now = gmtime(&t); + static char sztime[80]; + strftime(sztime, 79, "[%H:%M:%S]", now); + return sztime; +} bool readpending = false; int readtimeout; @@ -68,8 +78,11 @@ bool hexout( string s, int retnbr) // thread might call this function while a read from the rig is in process // wait here until that processing is finished or a timeout occurs // reset the readpending & return false if a timeout occurs -//printhex(s); - readtimeout = 500; // 500 msec timeout + +// debug code +//std::cout << printtime() << "Cmd: "; printhex(s); + + readtimeout = (rig.wait +rig.timeout) * rig.retries + 2000; // 2 second min timeout while (readpending && readtimeout--) MilliSleep(1); if (readtimeout == 0) { @@ -78,38 +91,51 @@ bool hexout( string s, int retnbr) return false; } - int num = 0; - memset(sendbuff,0, 200); - for (unsigned int i = 0; i < s.length(); i++) - sendbuff[i] = s[i]; - readpending = true; - rigio.FlushBuffer(); - rigio.WriteBuffer(sendbuff, s.size()); - if (rig.echo == true) - rigio.ReadBuffer (replybuff, s.size()); - memset (replybuff, 0, 200); + for (int n = 0; n < rig.retries; n++) { + int num = 0; + memset(sendbuff,0, 200); + for (unsigned int i = 0; i < s.length(); i++) + sendbuff[i] = s[i]; + + rigio.FlushBuffer(); + rigio.WriteBuffer(sendbuff, s.size()); + if (rig.echo == true) + rigio.ReadBuffer (replybuff, s.size()); + + memset (replybuff, 0, 200); // wait interval before trying to read response - if ((readtimeout = rig.wait) > 0) - while (readtimeout--) - MilliSleep(1); + if ((readtimeout = rig.wait) > 0) + while (readtimeout--) + MilliSleep(1); - if (retnbr > 0) { - num = rigio.ReadBuffer (replybuff, retnbr > 200 ? 200 : retnbr); + if (retnbr > 0) { + num = rigio.ReadBuffer (replybuff, retnbr > 200 ? 200 : retnbr); // debug code -// if (num) -// printhex(replybuff, num); -// else -// std::cout << "no reply" << std::endl; fflush(stdout); +/* + if (num) { + std::cout << printtime() << "Rsp (" << n << "): "; + printhex(replybuff, num); + } else + std::cout << printtime() << "Rsp (" << n << "): no reply" << std::endl; + std::cout.flush(); +*/ + } + + if (retnbr == 0 || num == retnbr) { + readpending = false; + return true; +// + if ((readtimeout = rig.timeout) > 0) + while (readtimeout--) + MilliSleep(1); + + } } - + readpending = false; - - if (retnbr == 0 || num == retnbr) - return true; - return false; }