diff --git a/src/cw_rtty/cw.cxx b/src/cw_rtty/cw.cxx index b5abdd12..7266f3b4 100644 --- a/src/cw_rtty/cw.cxx +++ b/src/cw_rtty/cw.cxx @@ -48,6 +48,7 @@ #include "status.h" #include "debug.h" #include "FTextRXTX.h" +#include "modem.h" #include "qrunner.h" @@ -181,6 +182,10 @@ void cw::tx_init(SoundBase *sc) phaseacc = 0; lastsym = 0; qskphase = 0; + + symbols = 0; + acc_symbols = 0; + ovhd_symbols = 0; } void cw::rx_init() @@ -952,6 +957,8 @@ void cw::send_symbol(int bits, int len) float dsymlen = 0.0; int currsym = bits & 1; + acc_symbols += len; + freq = get_txfreq_woffset(); delta = (int) (len * (progdefaults.CWweight - 50) / 100.0); @@ -1193,11 +1200,20 @@ int cw::tx_process() c = get_tx_char(); if (c == GET_TX_CHAR_ETX || stopflag) { -// send_symbol(0, symbollen); stopflag = false; return -1; } + acc_symbols = 0; send_ch(c); + + xmt_samples = char_samples = acc_symbols; + + printf("%5s %d samples, overhead %d, %f sec's\n", + ascii3[c & 0xff], + char_samples, + ovhd_samples, + 1.0 * char_samples / samplerate); + return 0; } diff --git a/src/cw_rtty/rtty.cxx b/src/cw_rtty/rtty.cxx index 0a2c8be5..e2460945 100644 --- a/src/cw_rtty/rtty.cxx +++ b/src/cw_rtty/rtty.cxx @@ -45,6 +45,7 @@ using namespace std; #include "debug.h" #include "synop.h" #include "main.h" +#include "modem.h" #define FILTER_DEBUG 0 @@ -85,6 +86,10 @@ void rtty::tx_init(SoundBase *sc) phaseacc = 0; preamble = true; videoText(); + + symbols = 0; + acc_symbols = 0; + ovhd_symbols = 0; } // Customizes output of Synop decoded data. @@ -728,10 +733,13 @@ if (mnum < 2 * filter_length) // this makes the scope looking a little bit nicer, too... // aka: less noisy... if( abs(zp_mark[i]) > abs(zp_space[i]) ) { - xy.imag( xy.imag() * abs(zp_space[i])/abs(zp_mark[i]) ); +// note ox x complex lib does not support xy.real(double) or xy.imag(double) + xy = cmplx( xy.real(), + xy.imag() * abs(zp_space[i])/abs(zp_mark[i]) ); // xy.imag() *= abs(zp_space[i])/abs(zp_mark[i]); } else { - xy.real( xy.real() / ( abs(zp_space[i])/abs(zp_mark[i]) ) ); + xy = cmplx( xy.real() / ( abs(zp_space[i])/abs(zp_mark[i]) ), + xy.imag() ); // xy.real() /= abs(zp_space[i])/abs(zp_mark[i]); } @@ -854,6 +862,7 @@ double rtty::FSKnco() void rtty::send_symbol(int symbol, int len) { + acc_symbols += len; #if 0 double freq; @@ -1060,7 +1069,16 @@ int rtty::tx_process() // if NOT Baudot if (nbits != 5) { +/// + acc_symbols = 0; send_char(c); + xmt_samples = char_samples = acc_symbols; + + printf("%5s %d samples, overhead %d, %f sec's\n", + ascii3[c & 0xff], + char_samples, + ovhd_samples, + 1.0 * char_samples / samplerate); return 0; } @@ -1118,8 +1136,16 @@ int rtty::tx_process() txmode = FIGURES; } } - +/// + acc_symbols = 0; send_char(c & 0x1F); + xmt_samples = char_samples = acc_symbols; + + printf("%5s %d samples, overhead %d, %f sec's\n", + ascii3[c & 0xff], + char_samples, + ovhd_samples, + 1.0 * char_samples / samplerate); return 0; } diff --git a/src/dialogs/confdialog.cxx b/src/dialogs/confdialog.cxx index 8b1d194e..3c5f12b1 100644 --- a/src/dialogs/confdialog.cxx +++ b/src/dialogs/confdialog.cxx @@ -8877,7 +8877,7 @@ nce.\nYou may change the state from either location.\n...")); mnuWavSampleRate->down_box(FL_BORDER_BOX); mnuWavSampleRate->callback((Fl_Callback*)cb_mnuWavSampleRate); mnuWavSampleRate->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->add("22050|24000|44100|48000"); + o->add("8000|11025|16000|22050|24000|44100|48000"); o->value(progdefaults.wavSampleRate); } // Fl_Choice* mnuWavSampleRate tabWavFile->end(); diff --git a/src/dialogs/confdialog.fl b/src/dialogs/confdialog.fl index 89b94a14..cc7bdba1 100644 --- a/src/dialogs/confdialog.fl +++ b/src/dialogs/confdialog.fl @@ -4927,7 +4927,7 @@ if (o->value()) { callback {progdefaults.wavSampleRate = o->value(); progdefaults.changed = true;} open tooltip {Pick baud rate from list} xywh {60 96 150 24} down_box BORDER_BOX align 5 - code0 {o->add("22050|24000|44100|48000");} + code0 {o->add("8000|11025|16000|22050|24000|44100|48000");} code1 {o->value(progdefaults.wavSampleRate);} } {} } diff --git a/src/dialogs/fl_digi.cxx b/src/dialogs/fl_digi.cxx index 8eee72e8..1bdae6cd 100644 --- a/src/dialogs/fl_digi.cxx +++ b/src/dialogs/fl_digi.cxx @@ -6522,6 +6522,11 @@ int get_tx_char(void) if (macro_idle_on) { return GET_TX_CHAR_NODATA; } if (idling) { return GET_TX_CHAR_NODATA; } + if (xmltest_char_available) { + num_cps_chars++; + return xmltest_char(); + } + if (arq_text_available) { char character = (arq_get_char() & 0xFF); if (character == 0x03) { @@ -6564,6 +6569,10 @@ int get_tx_char(void) c = TransmitText->nextChar(); + if (c == GET_TX_CHAR_ETX) { + return c; + } + if (c == '^' && state == STATE_CHAR) { state = STATE_CTRL; c = TransmitText->nextChar(); @@ -6643,7 +6652,10 @@ int get_tx_char(void) void put_echo_char(unsigned int data, int style) { - trx_mode mode = active_modem->get_mode(); +// suppress print to rx widget when making timing tests + if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) return; + + trx_mode mode = active_modem->get_mode(); if (mode == MODE_CW && progdefaults.QSKadjust) return; @@ -6659,6 +6671,8 @@ void put_echo_char(unsigned int data, int style) asc = ascii2; else if (mode == MODE_RTTY || mode == MODE_CW) asc = ascii; + else if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) + asc = ascii3; // assign a style to the data if (asc == ascii2 && iscntrl(data)) diff --git a/src/include/ascii.h b/src/include/ascii.h index bdb2e953..b5c750d5 100644 --- a/src/include/ascii.h +++ b/src/include/ascii.h @@ -30,6 +30,7 @@ extern const char *ascii[]; extern const char *ascii2[]; +extern const char *ascii3[]; #define SOH 0x01 // SOH ascii character #define EOT 0x04 // EOT ascii character diff --git a/src/include/configuration.h b/src/include/configuration.h index 4205a254..a01c1f1b 100644 --- a/src/include/configuration.h +++ b/src/include/configuration.h @@ -1058,8 +1058,9 @@ 0) \ ELEM_(int, wavSampleRate, "WAV_SAMPLERATE", \ "Wave file record sample rate\n" \ - "0 - 22050, 1 - 24000, 2 - 44100, 3 - 48000", \ - 3) \ + "0 - 8000, 1 - 11025, 2 - 16000, 3 - 22050\n" \ + "4 - 24000, 5 - 44100, 6 - 48000", \ + 0) \ ELEM_(bool, loop_playback, "LOOPPLAYBACK", \ "true = continuous loop of sound file playback\n" \ "false = single pass through playback file.", \ diff --git a/src/include/macros.h b/src/include/macros.h index 7e8cc897..c205a443 100644 --- a/src/include/macros.h +++ b/src/include/macros.h @@ -8,6 +8,12 @@ #define MAXKEYROWS 4 #define MAXMACROS (MAXKEYROWS * NUMMACKEYS) +extern void CPS_report(int); +extern bool PERFORM_CPS_TEST; +extern int num_cps_chars; +extern struct timeval tv_cps_start; + + struct CONTESTCNTR { int count; char szCount[20]; diff --git a/src/include/modem.h b/src/include/modem.h index 7e50444c..bf901f4e 100644 --- a/src/include/modem.h +++ b/src/include/modem.h @@ -11,6 +11,7 @@ #include "digiscope.h" #include "globals.h" #include "morse.h" +#include "ascii.h" #define OUTBUFSIZE 16384 // Constants for signal searching & s/n threshold @@ -23,6 +24,9 @@ public: static double frequency; static double tx_frequency; static bool freqlock; + static unsigned long tx_sample_count; + static unsigned int tx_sample_rate; + static bool XMLRPC_CPS_TEST; protected: cMorse morse; trx_mode mode; @@ -187,6 +191,20 @@ private: protected: virtual void s2nreport(void); + +// JD & DF for multiple carriers +public: + int numcarriers; //Number of parallel carriers for M CAR PSK and PSKR and QPSKR + int symbols; //JD for multiple carriers + int acc_symbols; + int char_symbols; + int xmt_symbols; + int ovhd_symbols; + int acc_samples; + int char_samples; + int xmt_samples; + int ovhd_samples; + }; extern modem *null_modem; diff --git a/src/include/psk.h b/src/include/psk.h index cbf7da62..119d3573 100644 --- a/src/include/psk.h +++ b/src/include/psk.h @@ -63,8 +63,7 @@ private: unsigned int shreg; //FEC: 2nd stream unsigned int shreg2; - int numinterleavers; //interleaver size (speed dependant) - double numcarriers; //Number of parallel carriers for M CAR PSK and PSKR and QPSKR + int numinterleavers; //interleaver size (speed dependant) double inter_carrier; // Frequency gap betweeb carriers // rx variables & functions @@ -141,11 +140,11 @@ private: // cmplx thirdorder; // tx variables & functions - int accumulated_bits; //JD for multiple carriers - int txsymbols[MAX_CARRIERS]; + int txsymbols[MAX_CARRIERS]; double *tx_shape; int preamble; + void tx_carriers(); void tx_symbol(int sym); void tx_bit(int bit); void tx_char(unsigned char c); @@ -177,6 +176,7 @@ public: int tx_process(); void searchDown(); void searchUp(); + }; #endif diff --git a/src/include/xmlrpc.h b/src/include/xmlrpc.h index 08492b4f..18b06f7d 100644 --- a/src/include/xmlrpc.h +++ b/src/include/xmlrpc.h @@ -2,6 +2,7 @@ #define XMLRPC_H #include +#include class XmlRpcImpl; @@ -25,6 +26,8 @@ private: XmlRpcImpl* server_impl; }; -void xmlrpc_set_qsy(long long rfc); - +extern void xmlrpc_set_qsy(long long rfc); +extern int xmltest_char(); +extern bool xmltest_char_available; +extern int number_of_samples(std::string s); #endif // XMLRPC_H diff --git a/src/mfsk/mfsk.cxx b/src/mfsk/mfsk.cxx index 91f40cfe..f0e8b7a6 100644 --- a/src/mfsk/mfsk.cxx +++ b/src/mfsk/mfsk.cxx @@ -1069,6 +1069,15 @@ int mfsk::tx_process() case TX_STATE_DATA: xmtbyte = get_tx_char(); + if(active_modem->XMLRPC_CPS_TEST) { + if(startpic) startpic = false; + if(xmtbyte == 0x05) { + sendchar(0x04); // 0x4 has the same symbol count as 0x5 + break; + } + } + + if (xmtbyte == 0x05 || startpic == true) { put_status("Tx pic: start"); int len = (int)strlen(picheader); diff --git a/src/misc/ascii.cxx b/src/misc/ascii.cxx index 9879ea7a..a3c20b95 100644 --- a/src/misc/ascii.cxx +++ b/src/misc/ascii.cxx @@ -4,7 +4,7 @@ // Copyright (C) 2006 // Dave Freese, W1HKJ // -// This file is part of fldigi. Adapted from code contained in gmfsk source code +// This file is part of fldigi. Adapted from code contained in gmfsk source code // distribution. // gmfsk Copyright (C) 2001, 2002, 2003 // Tomi Manninen (oh2bns@sral.fi) @@ -32,36 +32,36 @@ const char *ascii[256] = { "", "", "", "", "", "", "", "", - "\b", "\t", "\n", "", + "\b", "\t", "\n", "", "", "\r", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", - " ", "!", "\"", "#", - "$", "%", "&", "\'", - "(", ")", "*", "+", - ",", "-", ".", "/", - "0", "1", "2", "3", - "4", "5", "6", "7", - "8", "9", ":", ";", - "<", "=", ">", "?", - "@", "A", "B", "C", - "D", "E", "F", "G", - "H", "I", "J", "K", - "L", "M", "N", "O", - "P", "Q", "R", "S", - "T", "U", "V", "W", - "X", "Y", "Z", "[", - "\\", "]", "^", "_", - "`", "a", "b", "c", - "d", "e", "f", "g", - "h", "i", "j", "k", - "l", "m", "n", "o", - "p", "q", "r", "s", - "t", "u", "v", "w", - "x", "y", "z", "{", - "|", "}", "~", "" + " ", "!", "\"", "#", + "$", "%", "&", "\'", + "(", ")", "*", "+", + ",", "-", ".", "/", + "0", "1", "2", "3", + "4", "5", "6", "7", + "8", "9", ":", ";", + "<", "=", ">", "?", + "@", "A", "B", "C", + "D", "E", "F", "G", + "H", "I", "J", "K", + "L", "M", "N", "O", + "P", "Q", "R", "S", + "T", "U", "V", "W", + "X", "Y", "Z", "[", + "\\", "]", "^", "_", + "`", "a", "b", "c", + "d", "e", "f", "g", + "h", "i", "j", "k", + "l", "m", "n", "o", + "p", "q", "r", "s", + "t", "u", "v", "w", + "x", "y", "z", "{", + "|", "}", "~", "", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", @@ -75,36 +75,36 @@ const char *ascii[256] = { const char *ascii2[256] = { "", "", "", "", "", "", "", "", - "\b", "\t", "\n", "", + "\b", "\t", "\n", "", "", "\r", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", - " ", "!", "\"", "#", - "$", "%", "&", "\'", - "(", ")", "*", "+", - ",", "-", ".", "/", - "0", "1", "2", "3", - "4", "5", "6", "7", - "8", "9", ":", ";", - "<", "=", ">", "?", - "@", "A", "B", "C", - "D", "E", "F", "G", - "H", "I", "J", "K", - "L", "M", "N", "O", - "P", "Q", "R", "S", - "T", "U", "V", "W", - "X", "Y", "Z", "[", - "\\", "]", "^", "_", - "`", "a", "b", "c", - "d", "e", "f", "g", - "h", "i", "j", "k", - "l", "m", "n", "o", - "p", "q", "r", "s", - "t", "u", "v", "w", - "x", "y", "z", "{", - "|", "}", "~", "" + " ", "!", "\"", "#", + "$", "%", "&", "\'", + "(", ")", "*", "+", + ",", "-", ".", "/", + "0", "1", "2", "3", + "4", "5", "6", "7", + "8", "9", ":", ";", + "<", "=", ">", "?", + "@", "A", "B", "C", + "D", "E", "F", "G", + "H", "I", "J", "K", + "L", "M", "N", "O", + "P", "Q", "R", "S", + "T", "U", "V", "W", + "X", "Y", "Z", "[", + "\\", "]", "^", "_", + "`", "a", "b", "c", + "d", "e", "f", "g", + "h", "i", "j", "k", + "l", "m", "n", "o", + "p", "q", "r", "s", + "t", "u", "v", "w", + "x", "y", "z", "{", + "|", "}", "~", "", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", @@ -114,3 +114,38 @@ const char *ascii2[256] = { "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-" }; + +const char *ascii3[256] = { + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + " ", "!", "\"", "#", "$", "%", "&", "\'", + "(", ")", "*", "+", ",", "-", ".", "/", + "0", "1", "2", "3", "4", "5", "6", "7", + "8", "9", ":", ";", "<", "=", ">", "?", + "@", "A", "B", "C", "D", "E", "F", "G", + "H", "I", "J", "K", "L", "M", "N", "O", + "P", "Q", "R", "S", "T", "U", "V", "W", + "X", "Y", "Z", "[", "\\", "]", "^", "_", + "`", "a", "b", "c", "d", "e", "f", "g", + "h", "i", "j", "k", "l", "m", "n", "o", + "p", "q", "r", "s", "t", "u", "v", "w", + "x", "y", "z", "{", "|", "}", "~", "", + "<128>", "<129>", "<130>", "<131>", "<132>", "<133>", "<134>", "<135>", + "<136>", "<137>", "<138>", "<139>", "<140>", "<141>", "<142>", "<143>", + "<144>", "<145>", "<146>", "<147>", "<148>", "<149>", "<150>", "<151>", + "<152>", "<153>", "<154>", "<155>", "<156>", "<157>", "<158>", "<159>", + "<160>", "<161>", "<162>", "<163>", "<164>", "<165>", "<166>", "<167>", + "<168>", "<169>", "<170>", "<171>", "<172>", "<173>", "<174>", "<175>", + "<176>", "<177>", "<178>", "<179>", "<180>", "<181>", "<182>", "<183>", + "<184>", "<185>", "<186>", "<187>", "<188>", "<189>", "<190>", "<191>", + "<192>", "<193>", "<194>", "<195>", "<196>", "<197>", "<198>", "<199>", + "<200>", "<201>", "<202>", "<203>", "<204>", "<205>", "<206>", "<207>", + "<208>", "<209>", "<210>", "<211>", "<212>", "<213>", "<214>", "<215>", + "<216>", "<217>", "<218>", "<219>", "<220>", "<221>", "<222>", "<223>", + "<224>", "<225>", "<226>", "<227>", "<228>", "<229>", "<230>", "<231>", + "<232>", "<233>", "<234>", "<235>", "<236>", "<237>", "<238>", "<239>", + "<240>", "<241>", "<242>", "<243>", "<244>", "<245>", "<246>", "<247>", + "<248>", "<249>", "<250>", "<251>", "<252>", "<253>", "<254>", "<255>" +}; diff --git a/src/misc/macroedit.cxx b/src/misc/macroedit.cxx index bb996a1b..8f71b9a9 100644 --- a/src/misc/macroedit.cxx +++ b/src/misc/macroedit.cxx @@ -199,6 +199,16 @@ void loadBrowser(Fl_Widget *widget) { w->add(LINE_SEP); w->add(_("\tignore all comment text")); + w->add(LINE_SEP); + w->add(_("\tmodem timing test internal string")); + w->add(_("\tmodem timing test, spec' file")); + w->add(_("\tmodem timing test, string 's'")); + + w->add(LINE_SEP); + w->add(_("\tWAV file; internal string")); + w->add(_("\tWAV file; spec' file")); + w->add(_("\tWAV file; string 's'")); + w->add(LINE_SEP); assert(MODE_CONTESTIA < MODE_OLIVIA); char s[256]; @@ -318,6 +328,14 @@ void cbInsertMacro(Fl_Widget *, void *) text.insert(6, p); } else text = ""; + } else if ((text == "") || (text == "")) { + string filters = "Text\t*." "txt"; + const char* p = FSEL::select(_("Test text file"), filters.c_str(), + "text." "txt"); + if (p) { + text.insert(10, p); + } else + text = ""; } else if (text == "") { string filters = "Text\t*." "txt"; const char *p = FSEL::select(_("MFSK image file"), "*.{png,jpg,bmp}\t*", ""); diff --git a/src/misc/macros.cxx b/src/misc/macros.cxx index cbb8ca46..cc067dab 100644 --- a/src/misc/macros.cxx +++ b/src/misc/macros.cxx @@ -25,6 +25,7 @@ // ---------------------------------------------------------------------------- #include +#include #include "macros.h" @@ -51,6 +52,7 @@ #include "icons.h" #include "weather.h" #include "utf8file_io.h" +#include "xmlrpc.h" #include #include @@ -132,6 +134,343 @@ static size_t mystrftime( char *s, size_t max, const char *fmt, const struct tm return strftime(s, max, fmt, tm); } +static string CPSstring = "\ +=============================================\n\ + ABCDEFGHIJKLMN OPQRSTUVWXYZ\n\ + abcdefghijklmn opqrstuvwxyz\n\ + 0123456789 9876543210\n\ + !@#$%&*()_+-=[]{}\\|;:'\",.<>/?\n\ +=============================================\n\ +\n\ + The Jaberwocky\n\ +\n\ +'Twas brillig, and the slithy toves\n\ +Did gyre and gimble in the wabe;\n\ +All mimsy were the borogoves,\n\ +And the mome raths outgrabe.\n\ +\n\ +\"Beware the Jabberwock, my son!\n\ +The jaws that bite, the claws that catch!\n\ +Beware the Jubjub bird, and shun\n\ +The frumious Bandersnatch!\"\n\ +\n\ +He took his vorpal sword in hand:\n\ +Long time the manxome foe he sought-\n\ +So rested he by the Tumtum tree,\n\ +And stood awhile in thought.\n\ +\n\ +And as in uffish thought he stood,\n\ +The Jabberwock, with eyes of flame,\n\ +Came whiffling through the tulgey wood,\n\ +And burbled as it came!\n\ +\n\ +One, two! One, two! and through and through\n\ +The vorpal blade went snicker-snack!\n\ +He left it dead, and with its head\n\ +He went galumphing back.\n\ +\n\ +\"And hast thou slain the Jabberwock?\n\ +Come to my arms, my beamish boy!\n\ +O frabjous day! Callooh! Callay!\"\n\ +He chortled in his joy.\n\ +\n\ +'Twas brillig, and the slithy toves\n\ +Did gyre and gimble in the wabe;\n\ +All mimsy were the borogoves,\n\ +And the mome raths outgrabe.\n"; + +bool PERFORM_CPS_TEST = false; +int num_cps_chars = 0; +string testfilename; + +void CPS_report(int samples, int prepost) +{ + char results[1000]; + double xmttime = 1.0 * samples / active_modem->get_samplerate(); + double datatime = 1.0 * (samples - prepost) / active_modem->get_samplerate(); + num_cps_chars--; + snprintf(results, sizeof(results), "\n\ +CPS test\n\ +text: %s\n\ +mode: %s\n\ +# chars: %d\n\ +xmt time: %f\n\ +data time: %f\n\ +xmt samples: %d\n\ +prepost: %d\n\ +data samples: %d\n\ +sample rate: %d\n\ +chars/sec: %f\n\ +~WPM: %f\n", +testfilename.c_str(), +mode_info[active_modem->get_mode()].name, +num_cps_chars, +xmttime, +datatime, +samples, +prepost, +samples - prepost, +active_modem->get_samplerate(), +num_cps_chars / datatime, +10 * num_cps_chars / datatime); + + ReceiveText->add(results, FTextBase::ALTR); + LOG_INFO("%s", results); + PERFORM_CPS_TEST = false; +} + +static void pCPS_TEST(std::string &s, size_t &i, size_t endbracket) +{ + s.clear(); + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 || + id == MODE_SITORB || id == MODE_NAVTEX ) { + ReceiveText->add("Mode not supported\n", FTextBase::ALTR); + return; + } + testfilename = "internal string"; + + stopMacroTimer(); + active_modem->set_stopflag(false); + PERFORM_CPS_TEST = true; + trx_transmit(); + + int s0 = number_of_samples(""); + int s1 = 0; + int start_stop_samples = 0; + int j = 0; + for(j = 1; j < 32; j++) { + s1 = number_of_samples(string(j, 'e')); + if(s1 > s0) break; + } + start_stop_samples = 2*s0 - s1; + + num_cps_chars = 0; + CPS_report(number_of_samples(CPSstring), start_stop_samples); + PERFORM_CPS_TEST = false; + +} + +static void pCPS_FILE(std::string &s, size_t &i, size_t endbracket) +{ + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 || + id == MODE_SITORB || id == MODE_NAVTEX ) { + ReceiveText->add("Mode not supported\n", FTextBase::ALTR); + s.clear(); + return; + } + + std::string fname = s.substr(i+10, endbracket - i - 10); + if (fname.length() > 0 && !within_exec) { + FILE *toadd = fopen(fname.c_str(), "r"); + if (toadd) { + std::string buffer; + char c = getc(toadd); + while (c && !feof(toadd)) { + if (c != '\r') buffer += c; // damn MSDOS txt files + c = getc(toadd); + } + s.clear(); + fclose(toadd); + TransmitText->clear(); + testfilename = fname; + + stopMacroTimer(); + active_modem->set_stopflag(false); + PERFORM_CPS_TEST = true; + trx_transmit(); + + int s0 = number_of_samples(""); + int s1 = 0; + int start_stop_samples = 0; + int j = 0; + for(j = 1; j < 32; j++) { + s1 = number_of_samples(string(j, 'e')); + if(s1 > s0) break; + } + start_stop_samples = 2*s0 - s1; + + num_cps_chars = 0; + CPS_report(number_of_samples(buffer), start_stop_samples); + PERFORM_CPS_TEST = false; + + } else { + string resp = "Could not locate "; + resp.append(fname).append("\n"); + ReceiveText->add(resp.c_str(), FTextBase::ALTR); + LOG_WARN("%s not found", fname.c_str()); + s.replace(i, endbracket - i + 1, ""); + PERFORM_CPS_TEST = false; + } + } else { + PERFORM_CPS_TEST = false; + s.clear(); + } +} + +static void pCPS_STRING(std::string &s, size_t &i, size_t endbracket) +{ + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 || + id == MODE_SITORB || id == MODE_NAVTEX ) { + ReceiveText->add("Mode not supported\n", FTextBase::ALTR); + s.clear(); + return; + } + + std::string buffer = s.substr(i+12, endbracket - i - 12); + std::string txtbuf = buffer; + s.clear(); + size_t p = buffer.find("\\n"); + while (p != string::npos) { + buffer.replace(p,2,"\n"); + p = buffer.find("\\n"); + } + if (buffer.length()) { + TransmitText->clear(); + + stopMacroTimer(); + active_modem->set_stopflag(false); + PERFORM_CPS_TEST = true; + trx_transmit(); + + int s0 = number_of_samples(""); +printf("j %d: s %d\n", 0, s0); + int s1 = 0; + int start_stop_samples = 0; + int j = 0; + for(j = 1; j < 32; j++) { + s1 = number_of_samples(string(j, 'e')); +printf("j %d: s %d\n", j, s1); + if(s1 > s0) break; + } + start_stop_samples = 2*s0 - s1; + + num_cps_chars = 0; + testfilename = txtbuf; + CPS_report(number_of_samples(buffer), start_stop_samples); + PERFORM_CPS_TEST = false; + } else { + string resp = "Text not specified"; + LOG_WARN("%s", resp.c_str()); + resp.append("\n"); + ReceiveText->add(resp.c_str(), FTextBase::ALTR); + PERFORM_CPS_TEST = false; + } +} + +static void pWAV_TEST(std::string &s, size_t &i, size_t endbracket) +{ + s.clear(); + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 || + id == MODE_SITORB || id == MODE_NAVTEX ) { + ReceiveText->add("Mode not supported\n", FTextBase::ALTR); + return; + } + testfilename = "internal string"; + + stopMacroTimer(); + active_modem->set_stopflag(false); + + PERFORM_CPS_TEST = true; + trx_transmit(); + number_of_samples(CPSstring); + PERFORM_CPS_TEST = false; +} + +static void pWAV_FILE(std::string &s, size_t &i, size_t endbracket) +{ + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 || + id == MODE_SITORB || id == MODE_NAVTEX ) { + ReceiveText->add("Mode not supported\n", FTextBase::ALTR); + s.clear(); + return; + } + + std::string fname = s.substr(i+10, endbracket - i - 10); + if (fname.length() > 0 && !within_exec) { + FILE *toadd = fopen(fname.c_str(), "r"); + if (toadd) { + std::string buffer; + char c = getc(toadd); + while (c && !feof(toadd)) { + if (c != '\r') buffer += c; // damn MSDOS txt files + c = getc(toadd); + } + s.clear(); + fclose(toadd); + TransmitText->clear(); + testfilename = fname; + + stopMacroTimer(); + active_modem->set_stopflag(false); + PERFORM_CPS_TEST = true; + trx_transmit(); + + number_of_samples(buffer); + PERFORM_CPS_TEST = false; + + } else { + string resp = "Could not locate "; + resp.append(fname).append("\n"); + ReceiveText->add(resp.c_str(), FTextBase::ALTR); + LOG_WARN("%s not found", fname.c_str()); + s.replace(i, endbracket - i + 1, ""); + PERFORM_CPS_TEST = false; + } + } else { + PERFORM_CPS_TEST = false; + s.clear(); + } +} + +static void pWAV_STRING(std::string &s, size_t &i, size_t endbracket) +{ + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 || + id == MODE_SITORB || id == MODE_NAVTEX ) { + ReceiveText->add("Mode not supported\n", FTextBase::ALTR); + s.clear(); + return; + } + + std::string buffer = s.substr(i+12, endbracket - i - 12); + std::string txtbuf = buffer; + s.clear(); + size_t p = buffer.find("\\n"); + while (p != string::npos) { + buffer.replace(p,2,"\n"); + p = buffer.find("\\n"); + } + if (buffer.length()) { + TransmitText->clear(); + + stopMacroTimer(); + active_modem->set_stopflag(false); + PERFORM_CPS_TEST = true; + trx_transmit(); + + testfilename = txtbuf; + number_of_samples(buffer); + PERFORM_CPS_TEST = false; + } else { + string resp = "Text not specified"; + LOG_WARN("%s", resp.c_str()); + resp.append("\n"); + ReceiveText->add(resp.c_str(), FTextBase::ALTR); + PERFORM_CPS_TEST = false; + } +} + static void pCOMMENT(std::string &s, size_t &i, size_t endbracket) { s.replace(i, endbracket - i + 1, ""); @@ -2219,6 +2558,14 @@ static std::string rxcmds = "", pCALL}, {"", pFREQ}, diff --git a/src/misc/xmlrpc.cxx b/src/misc/xmlrpc.cxx index b57b1710..d1310284 100644 --- a/src/misc/xmlrpc.cxx +++ b/src/misc/xmlrpc.cxx @@ -64,6 +64,7 @@ #include "wefax.h" #include "wefax-pic.h" #include "navtex.h" +#include "ascii.h" #if USE_HAMLIB #include "hamlib.h" @@ -237,7 +238,7 @@ XML_RPC_Server::XML_RPC_Server() XML_RPC_Server::~XML_RPC_Server() { // run = false; -// the xmlrpc server is closed and deleted when +// the xmlrpc server is closed and deleted when // XML_RPC_Server::stop(); // is called from main // delete methods; @@ -1565,6 +1566,207 @@ public: } }; + +static string xmlchars; +bool xmltest_char_available; +static size_t pxmlchar = 0; +int xmltest_char() +{ + if (pxmlchar >= xmlchars.length() ) return -3; + return xmlchars[pxmlchar++] & 0xFF; +} + +int number_of_samples( string s) +{ + active_modem->XMLRPC_CPS_TEST = true; + xmlchars = s; + pxmlchar = 0; + xmltest_char_available = true; + + active_modem->set_stopflag(false); + trx_transmit(); + + MilliSleep(10); + while(trx_state != STATE_RX) { + MilliSleep(10); + Fl::awake(); + } + xmltest_char_available = false; + active_modem->XMLRPC_CPS_TEST = false; + return active_modem->tx_sample_count; +} + +class Main_get_char_rates : public xmlrpc_c::method +{ +public: + Main_get_char_rates() + { + _signature = "s:n"; + _help = "Returns table of char rates."; + } + void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval) + { + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 ) { + *retval = xmlrpc_c::value_string("0:1:0"); + return; + } + + XMLRPC_LOCK; + stopMacroTimer(); + int s0 = 0;//number_of_samples(""); + int s1 = 0; + + string xmlbuf; + static char result[100]; + static string line; + int chsamples = 0; + int i = 0; + for (int m = 0; m < 32; m++) { + line.clear(); + for (int n = 0; n < 8; n++) { + i = m*8+n; + + if ( (id >= MODE_PSK31 && id <= MODE_PSK1000R) || + (id >= MODE_4X_PSK63R && id <= MODE_2X_PSK1000R) || + id == MODE_CW || id == MODE_RTTY ) { + s1 = number_of_samples(string(1,i)); + chsamples = active_modem->char_samples; + } else { + s0 = number_of_samples(string(1, i)); + int j; + for(j = 2; j < 32; j++) { + s1 = number_of_samples(string(j, i)); + if(s1 > s0) break; + } + chsamples = (s1 - s0) / (j-1); + } + snprintf(result, sizeof(result), + n == 7 ? " %.8f\n" : n == 0 ? "%.8f," : " %.8f,", + 1.0 * chsamples / active_modem->get_samplerate()); + line.append(result); + } + xmlbuf.append(line); + } + *retval = xmlrpc_c::value_string(xmlbuf); + } +}; + +class Main_get_char_timing : public xmlrpc_c::method +{ +public: + Main_get_char_timing() + { + _signature = "n:6"; + _help = "Input: value of character. Returns transmit duration for specified character (samples:sample rate)."; + } + void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval) + { + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 ) { + *retval = xmlrpc_c::value_string("0,1,0,0,0.0"); + return; + } + + XMLRPC_LOCK; + stopMacroTimer(); + + vector bytes = params.getBytestring(0); + bytes.push_back(0); + std::string totest = (const char*)&bytes[0]; + + if (totest.empty() || !active_modem) { + *retval = xmlrpc_c::value_string("0:1:0"); + return; + } + + static std::string xmlbuf; + char result[64]; + int character = 0; + + int count = sscanf(totest.c_str(), "%d", &character); + + if(count != 1) { + *retval = xmlrpc_c::value_string("0:1:0"); + return; + } + + unsigned int s0 = 0, chsamples = 0, over_head = 0; + + if ( (id >= MODE_4X_PSK63R && id <= MODE_2X_PSK1000R) || + (id >= MODE_PSK31 && id <= MODE_PSK1000R) || + id == MODE_CW || id == MODE_RTTY ) { + s0 = number_of_samples(string(1,character)); + chsamples = active_modem->char_samples; + over_head = active_modem->ovhd_samples; + } else { + unsigned int s1 = 0, s2 = 0; + unsigned int temp = 0, no_of_chars = 1, k = 0; + s0 = s1 = s2 = number_of_samples(string(no_of_chars, character)); + for(int i = no_of_chars + 1; i < 32; i++) { + s2 = number_of_samples(string(i, character)); + if(s2 > s1 && temp++ > 2) { + break; + } + s0 = s2; + no_of_chars++; + } + k = no_of_chars * 4; + s1 = number_of_samples(string(k, character)); + chsamples = (s1 - s0) / (k - no_of_chars); + over_head = s1 - (chsamples * k); + } + + snprintf(result, sizeof(result), "%5u:%6u:%6u", chsamples, + active_modem->get_samplerate(), + over_head); + xmlbuf.assign(result); + + *retval = xmlrpc_c::value_string(xmlbuf); + } +}; + +class Main_get_tx_timing : public xmlrpc_c::method +{ +public: + Main_get_tx_timing() + { + _signature = "n:6"; + _help = "Returns transmit duration for test string (samples:sample rate:secs)."; + } + void execute(const xmlrpc_c::paramList& params, xmlrpc_c::value* retval) + { + trx_mode id = active_modem->get_mode(); + if ( id == MODE_SSB || id == MODE_WWV || id == MODE_ANALYSIS || + id == MODE_WEFAX_576 || id == MODE_WEFAX_288 || + id == MODE_SITORB || id == MODE_NAVTEX ) { + *retval = xmlrpc_c::value_string("0:1:0.0"); + return; + } + XMLRPC_LOCK; + vector bytes = params.getBytestring(0); + bytes.push_back(0); + std::string totest = (const char*)&bytes[0]; + if (totest.empty() || !active_modem) { + *retval = xmlrpc_c::value_string("0:1:0.0"); + return; + } + + int chsamples = number_of_samples(totest);// - start_stop_samples; + + std::string xmlbuf; + char buf[64]; + memset(buf, 0, sizeof(buf)); + snprintf(buf, sizeof(buf) - 1, "%u : %u : %.9f", \ + chsamples, active_modem->tx_sample_rate, + 1.0 * chsamples / active_modem->tx_sample_rate); + xmlbuf.assign(buf); + *retval = xmlrpc_c::value_string(xmlbuf); + } +}; + class Rig_set_name : public xmlrpc_c::method { public: @@ -2853,46 +3055,46 @@ struct Navtex_send_message : public xmlrpc_c::method // method list: ELEM_(class_name, "method_name") #undef ELEM_ -#define METHOD_LIST \ - ELEM_(Fldigi_list, "fldigi.list") \ - ELEM_(Fldigi_name, "fldigi.name") \ +#define METHOD_LIST \ + ELEM_(Fldigi_list, "fldigi.list") \ + ELEM_(Fldigi_name, "fldigi.name") \ ELEM_(Fldigi_version_struct, "fldigi.version_struct") \ ELEM_(Fldigi_version_string, "fldigi.version") \ - ELEM_(Fldigi_name_version, "fldigi.name_version") \ - ELEM_(Fldigi_config_dir, "fldigi.config_dir") \ + ELEM_(Fldigi_name_version, "fldigi.name_version") \ + ELEM_(Fldigi_config_dir, "fldigi.config_dir") \ ELEM_(Fldigi_terminate, "fldigi.terminate") \ - \ + \ ELEM_(Modem_get_name, "modem.get_name") \ - ELEM_(Modem_get_names, "modem.get_names") \ + ELEM_(Modem_get_names, "modem.get_names") \ ELEM_(Modem_get_id, "modem.get_id") \ ELEM_(Modem_get_max_id, "modem.get_max_id") \ - ELEM_(Modem_set_by_name, "modem.set_by_name") \ - ELEM_(Modem_set_by_id, "modem.set_by_id") \ - \ - ELEM_(Modem_set_carrier, "modem.set_carrier") \ - ELEM_(Modem_inc_carrier, "modem.inc_carrier") \ - ELEM_(Modem_get_carrier, "modem.get_carrier") \ - \ - ELEM_(Modem_get_afc_sr, "modem.get_afc_search_range") \ - ELEM_(Modem_set_afc_sr, "modem.set_afc_search_range") \ - ELEM_(Modem_inc_afc_sr, "modem.inc_afc_search_range") \ - \ - ELEM_(Modem_get_bw, "modem.get_bandwidth") \ - ELEM_(Modem_set_bw, "modem.set_bandwidth") \ - ELEM_(Modem_inc_bw, "modem.inc_bandwidth") \ - \ - ELEM_(Modem_get_quality, "modem.get_quality") \ - ELEM_(Modem_search_up, "modem.search_up") \ - ELEM_(Modem_search_down, "modem.search_down") \ - \ + ELEM_(Modem_set_by_name, "modem.set_by_name") \ + ELEM_(Modem_set_by_id, "modem.set_by_id") \ + \ + ELEM_(Modem_set_carrier, "modem.set_carrier") \ + ELEM_(Modem_inc_carrier, "modem.inc_carrier") \ + ELEM_(Modem_get_carrier, "modem.get_carrier") \ + \ + ELEM_(Modem_get_afc_sr, "modem.get_afc_search_range") \ + ELEM_(Modem_set_afc_sr, "modem.set_afc_search_range") \ + ELEM_(Modem_inc_afc_sr, "modem.inc_afc_search_range") \ + \ + ELEM_(Modem_get_bw, "modem.get_bandwidth") \ + ELEM_(Modem_set_bw, "modem.set_bandwidth") \ + ELEM_(Modem_inc_bw, "modem.inc_bandwidth") \ + \ + ELEM_(Modem_get_quality, "modem.get_quality") \ + ELEM_(Modem_search_up, "modem.search_up") \ + ELEM_(Modem_search_down, "modem.search_down") \ + \ ELEM_(Modem_olivia_set_bandwidth, "modem.olivia.set_bandwidth") \ ELEM_(Modem_olivia_get_bandwidth, "modem.olivia.get_bandwidth") \ ELEM_(Modem_olivia_set_tones, "modem.olivia.set_tones") \ ELEM_(Modem_olivia_get_tones, "modem.olivia.get_tones") \ - \ + \ ELEM_(Main_get_status1, "main.get_status1") \ ELEM_(Main_get_status2, "main.get_status2") \ - \ + \ ELEM_(Main_get_sb, "main.get_sideband") \ ELEM_(Main_set_sb, "main.set_sideband") \ ELEM_(Main_get_wf_sideband, "main.get_wf_sideband") \ @@ -2900,124 +3102,127 @@ struct Navtex_send_message : public xmlrpc_c::method ELEM_(Main_get_freq, "main.get_frequency") \ ELEM_(Main_set_freq, "main.set_frequency") \ ELEM_(Main_inc_freq, "main.inc_frequency") \ - \ + \ ELEM_(Main_get_afc, "main.get_afc") \ ELEM_(Main_set_afc, "main.set_afc") \ - ELEM_(Main_toggle_afc, "main.toggle_afc") \ - \ + ELEM_(Main_toggle_afc, "main.toggle_afc") \ + \ ELEM_(Main_get_sql, "main.get_squelch") \ ELEM_(Main_set_sql, "main.set_squelch") \ - ELEM_(Main_toggle_sql, "main.toggle_squelch") \ - \ + ELEM_(Main_toggle_sql, "main.toggle_squelch") \ + \ ELEM_(Main_get_sql_level, "main.get_squelch_level") \ ELEM_(Main_set_sql_level, "main.set_squelch_level") \ ELEM_(Main_inc_sql_level, "main.inc_squelch_level") \ - \ + \ ELEM_(Main_get_rev, "main.get_reverse") \ ELEM_(Main_set_rev, "main.set_reverse") \ - ELEM_(Main_toggle_rev, "main.toggle_reverse") \ - \ - ELEM_(Main_get_lock, "main.get_lock") \ - ELEM_(Main_set_lock, "main.set_lock") \ + ELEM_(Main_toggle_rev, "main.toggle_reverse") \ + \ + ELEM_(Main_get_lock, "main.get_lock") \ + ELEM_(Main_set_lock, "main.set_lock") \ ELEM_(Main_toggle_lock, "main.toggle_lock") \ - \ - ELEM_(Main_get_rsid, "main.get_rsid") \ - ELEM_(Main_set_rsid, "main.set_rsid") \ + \ + ELEM_(Main_get_rsid, "main.get_rsid") \ + ELEM_(Main_set_rsid, "main.set_rsid") \ ELEM_(Main_toggle_rsid, "main.toggle_rsid") \ - \ - ELEM_(Main_get_trx_status, "main.get_trx_status") \ - ELEM_(Main_tx, "main.tx") \ - ELEM_(Main_tune, "main.tune") \ - ELEM_(Main_rsid, "main.rsid") \ - ELEM_(Main_rx, "main.rx") \ + \ + ELEM_(Main_get_trx_status, "main.get_trx_status") \ + ELEM_(Main_tx, "main.tx") \ + ELEM_(Main_tune, "main.tune") \ + ELEM_(Main_rsid, "main.rsid") \ + ELEM_(Main_rx, "main.rx") \ ELEM_(Main_abort, "main.abort") \ - \ + \ ELEM_(Main_get_trx_state, "main.get_trx_state") \ - ELEM_(Main_set_rig_name, "main.set_rig_name") \ + ELEM_(Main_get_tx_timing, "main.get_tx_timing") \ + ELEM_(Main_get_char_rates, "main.get_char_rates") \ + ELEM_(Main_get_char_timing, "main.get_char_timing") \ + ELEM_(Main_set_rig_name, "main.set_rig_name") \ ELEM_(Main_set_rig_frequency, "main.set_rig_frequency") \ ELEM_(Main_set_rig_modes, "main.set_rig_modes") \ - ELEM_(Main_set_rig_mode, "main.set_rig_mode") \ + ELEM_(Main_set_rig_mode, "main.set_rig_mode") \ ELEM_(Main_get_rig_modes, "main.get_rig_modes") \ - ELEM_(Main_get_rig_mode, "main.get_rig_mode") \ + ELEM_(Main_get_rig_mode, "main.get_rig_mode") \ ELEM_(Main_set_rig_bandwidths, "main.set_rig_bandwidths") \ ELEM_(Main_set_rig_bandwidth, "main.set_rig_bandwidth") \ ELEM_(Main_get_rig_bandwidth, "main.get_rig_bandwidth") \ ELEM_(Main_get_rig_bandwidths, "main.get_rig_bandwidths") \ - \ + \ ELEM_(Main_run_macro, "main.run_macro") \ ELEM_(Main_get_max_macro_id, "main.get_max_macro_id") \ - \ + \ ELEM_(Rig_set_name, "rig.set_name") \ ELEM_(Rig_get_name, "rig.get_name") \ - ELEM_(Rig_set_frequency, "rig.set_frequency") \ - ELEM_(Rig_set_modes, "rig.set_modes") \ + ELEM_(Rig_set_frequency, "rig.set_frequency") \ + ELEM_(Rig_set_modes, "rig.set_modes") \ ELEM_(Rig_set_mode, "rig.set_mode") \ - ELEM_(Rig_get_modes, "rig.get_modes") \ + ELEM_(Rig_get_modes, "rig.get_modes") \ ELEM_(Rig_get_mode, "rig.get_mode") \ ELEM_(Rig_set_bandwidths, "rig.set_bandwidths") \ - ELEM_(Rig_set_bandwidth, "rig.set_bandwidth") \ - ELEM_(Rig_get_bandwidth, "rig.get_bandwidth") \ + ELEM_(Rig_set_bandwidth, "rig.set_bandwidth") \ + ELEM_(Rig_get_bandwidth, "rig.get_bandwidth") \ ELEM_(Rig_get_bandwidths, "rig.get_bandwidths") \ - ELEM_(Rig_get_notch, "rig.get_notch") \ - ELEM_(Rig_set_notch, "rig.set_notch") \ + ELEM_(Rig_get_notch, "rig.get_notch") \ + ELEM_(Rig_set_notch, "rig.set_notch") \ ELEM_(Rig_take_control, "rig.take_control") \ - ELEM_(Rig_release_control, "rig.release_control") \ - \ - ELEM_(Log_get_freq, "log.get_frequency") \ - ELEM_(Log_get_time_on, "log.get_time_on") \ + ELEM_(Rig_release_control, "rig.release_control") \ + \ + ELEM_(Log_get_freq, "log.get_frequency") \ + ELEM_(Log_get_time_on, "log.get_time_on") \ ELEM_(Log_get_time_off, "log.get_time_off") \ ELEM_(Log_get_call, "log.get_call") \ ELEM_(Log_get_name, "log.get_name") \ ELEM_(Log_get_rst_in, "log.get_rst_in") \ - ELEM_(Log_get_rst_out, "log.get_rst_out") \ + ELEM_(Log_get_rst_out, "log.get_rst_out") \ ELEM_(Log_get_serial_number, "log.get_serial_number") \ ELEM_(Log_set_serial_number, "log.set_serial_number") \ ELEM_(Log_get_serial_number_sent, "log.get_serial_number_sent") \ ELEM_(Log_get_exchange, "log.get_exchange") \ ELEM_(Log_set_exchange, "log.set_exchange") \ - ELEM_(Log_get_state, "log.get_state") \ + ELEM_(Log_get_state, "log.get_state") \ ELEM_(Log_get_province, "log.get_province") \ - ELEM_(Log_get_country, "log.get_country") \ - ELEM_(Log_get_qth, "log.get_qth") \ + ELEM_(Log_get_country, "log.get_country") \ + ELEM_(Log_get_qth, "log.get_qth") \ ELEM_(Log_get_band, "log.get_band") \ - ELEM_(Log_get_sb, "log.get_sideband") \ - ELEM_(Log_get_notes, "log.get_notes") \ - ELEM_(Log_get_locator, "log.get_locator") \ + ELEM_(Log_get_sb, "log.get_sideband") \ + ELEM_(Log_get_notes, "log.get_notes") \ + ELEM_(Log_get_locator, "log.get_locator") \ ELEM_(Log_get_az, "log.get_az") \ - ELEM_(Log_clear, "log.clear") \ + ELEM_(Log_clear, "log.clear") \ ELEM_(Log_set_call, "log.set_call") \ ELEM_(Log_set_name, "log.set_name") \ - ELEM_(Log_set_qth, "log.set_qth") \ - ELEM_(Log_set_locator, "log.set_locator") \ - \ - ELEM_(Text_get_rx_length, "text.get_rx_length") \ - ELEM_(Text_get_rx, "text.get_rx") \ - ELEM_(Text_clear_rx, "text.clear_rx") \ - ELEM_(Text_add_tx, "text.add_tx") \ - ELEM_(Text_add_tx_bytes, "text.add_tx_bytes") \ - ELEM_(Text_clear_tx, "text.clear_tx") \ - \ - ELEM_(RXTX_get_data, "rxtx.get_data") \ - ELEM_(RX_get_data, "rx.get_data") \ - ELEM_(TX_get_data, "tx.get_data") \ - \ - ELEM_(Spot_get_auto, "spot.get_auto") \ - ELEM_(Spot_set_auto, "spot.set_auto") \ - ELEM_(Spot_toggle_auto, "spot.toggle_auto") \ - ELEM_(Spot_pskrep_get_count, "spot.pskrep.get_count") \ + ELEM_(Log_set_qth, "log.set_qth") \ + ELEM_(Log_set_locator, "log.set_locator") \ \ - ELEM_(Wefax_state_string, "wefax.state_string") \ - ELEM_(Wefax_skip_apt, "wefax.skip_apt") \ - ELEM_(Wefax_skip_phasing, "wefax.skip_phasing") \ - ELEM_(Wefax_set_tx_abort_flag, "wefax.set_tx_abort_flag") \ + ELEM_(Text_get_rx_length, "text.get_rx_length") \ + ELEM_(Text_get_rx, "text.get_rx") \ + ELEM_(Text_clear_rx, "text.clear_rx") \ + ELEM_(Text_add_tx, "text.add_tx") \ + ELEM_(Text_add_tx_bytes, "text.add_tx_bytes") \ + ELEM_(Text_clear_tx, "text.clear_tx") \ + \ + ELEM_(RXTX_get_data, "rxtx.get_data") \ + ELEM_(RX_get_data, "rx.get_data") \ + ELEM_(TX_get_data, "tx.get_data") \ + \ + ELEM_(Spot_get_auto, "spot.get_auto") \ + ELEM_(Spot_set_auto, "spot.set_auto") \ + ELEM_(Spot_toggle_auto, "spot.toggle_auto") \ + ELEM_(Spot_pskrep_get_count, "spot.pskrep.get_count") \ + \ + ELEM_(Wefax_state_string, "wefax.state_string") \ + ELEM_(Wefax_skip_apt, "wefax.skip_apt") \ + ELEM_(Wefax_skip_phasing, "wefax.skip_phasing") \ + ELEM_(Wefax_set_tx_abort_flag, "wefax.set_tx_abort_flag") \ ELEM_(Wefax_end_reception, "wefax.end_reception") \ ELEM_(Wefax_start_manual_reception, "wefax.start_manual_reception") \ - ELEM_(Wefax_set_adif_log, "wefax.set_adif_log") \ + ELEM_(Wefax_set_adif_log, "wefax.set_adif_log") \ ELEM_(Wefax_set_max_lines, "wefax.set_max_lines") \ - ELEM_(Wefax_get_received_file, "wefax.get_received_file") \ + ELEM_(Wefax_get_received_file, "wefax.get_received_file") \ ELEM_(Wefax_send_file, "wefax.send_file") \ \ - ELEM_(Navtex_get_message, "navtex.get_message") \ + ELEM_(Navtex_get_message, "navtex.get_message") \ ELEM_(Navtex_send_message, "navtex.send_message") \ struct rm_pred diff --git a/src/psk/psk.cxx b/src/psk/psk.cxx index 5251f913..46bff1d6 100644 --- a/src/psk/psk.cxx +++ b/src/psk/psk.cxx @@ -45,8 +45,9 @@ #include "status.h" #include "viewpsk.h" #include "pskeval.h" -#include "ascii.h" +#include "modem.h" #include "Viewer.h" +#include "macros.h" extern waterfall *wf; @@ -96,8 +97,9 @@ void psk::tx_init(SoundBase *sc) bitshreg = 0; startpreamble = true; -//Multiple carriers handling - accumulated_bits = 0; + symbols = 0; + acc_symbols = 0; + ovhd_symbols = 0; } @@ -130,6 +132,8 @@ void psk::rx_init() // interleaver, split incoming bit stream into two, one late by one bit rxbitstate = 0; fecmet = fecmet2 = 0; + if (Rxinlv) Rxinlv->flush(); + if (Rxinlv2) Rxinlv2->flush(); } @@ -560,7 +564,7 @@ psk::psk(trx_mode pskmode) : modem() numcarriers = 1; } -//printf("%s: symlen %d, dcdbits %d, _qpsk %d, _pskr %d, numc %f\n", +//printf("%s: symlen %d, dcdbits %d, _qpsk %d, _pskr %d, numc %d\n", //mode_info[mode].sname, //symbollen, dcdbits, _qpsk, _pskr, numcarriers); @@ -821,7 +825,7 @@ void psk::rx_pskr(unsigned char symbol) int c; //In the case of multiple carriers, if even number of carriers then we - // know the bit-order and don't need voting otherwise + // know the bit-order and don't need voting otherwise // we accumulate the soft bits for the interleaver THEN submit to Viterbi // decoder in alternance so that each one is processed one bit later. // Only two possibilities for sync: current bit or previous one since @@ -836,7 +840,7 @@ void psk::rx_pskr(unsigned char symbol) rxbitstate++; //Only use one decoder is using even carriers (we know the bits order) // if (((int)numcarriers) % 2 == 0) { -// fecmet2 = -9999.0; +// fecmet2 = -9999.0; // return; // } // copy to avoid scrambling symbolpair for the next bit @@ -970,12 +974,12 @@ void psk::findsignal() } } -//JD: disable for multiple carriers as we are running as modem and +//JD: disable for multiple carriers as we are running as modem and // therefore use other strategies for frequency alignment like RSID void psk::phaseafc() { double error; - if (afcmetric < 0.05 || + if (afcmetric < 0.05 || mode == MODE_PSK500 || mode == MODE_QPSK500 || numcarriers > 1 ) return; @@ -1028,7 +1032,7 @@ static double averageamp; } else { // bpsk and pskr bits = (((int) (phase / M_PI + 0.5)) & 1) << 1; // hard decode if needed - // softbit = (bits & 2) ? 0 : 255; + // softbit = (bits & 2) ? 0 : 255; // reversed as we normally pass "!bits" when hard decoding // Soft decode section below @@ -1106,7 +1110,7 @@ static double averageamp; } break; - case 0: // DCD off by postamble. Not for PSKR modes as this is not unique to postamble. + case 0: // DCD off by postamble. Not for PSKR modes as this is not unique to postamble. if (!_pskr) { dcd = false; acquire = 0; @@ -1218,7 +1222,7 @@ int psk::rx_process(const double *buf, int len) fir2[car]->run( z, z2[car] ); // fir2 returns value on every sample //On last carrier processing - if (car == numcarriers - 1) { + if (car == numcarriers - 1) { calcSN_IMD(z); //JD OR all carriers together check logic??? @@ -1228,9 +1232,9 @@ int psk::rx_process(const double *buf, int len) * expected to have been modified to a fairly symmetric shape. The * magnitude of the samples are taken, thus rectifying the signal to * positive values. "bitclk" is a counter that is very close in rate to -* (samples / symbol). Its purpose is to repeatedly "draw" one symbol +* (samples / symbol). Its purpose is to repeatedly "draw" one symbol * waveform in the syncbuf array, according to its amplitude (not phase). -*/ +*/ int idx = (int) bitclk; double sum = 0.0; @@ -1256,11 +1260,11 @@ int psk::rx_process(const double *buf, int len) /** * Here we sum up the difference between each sample's magnitude in the * lower half of the array with its counterpart on the upper half of the -* array, or the other side of the waveform. Each pair's difference is +* array, or the other side of the waveform. Each pair's difference is * divided by their sum, scaling it so that the signal amplitude does not * affect the result. When the differences are summed, it gives an * indication of which side is larger than the other. -*/ +*/ for (int i = 0; i < symsteps; i++) { sum += (syncbuf[i] - syncbuf[i+symsteps]); @@ -1275,11 +1279,11 @@ int psk::rx_process(const double *buf, int len) * be a little faster, so that the next drawing of the waveform in syncbuf * will be shifted right. Conversely, if the sum is positive, then it needs * to slow down bitclk so that the waveform is shifted left. Thus the -* error is subtracted from bitclk, rather than added. The goal is to +* error is subtracted from bitclk, rather than added. The goal is to * get the error as close to zero as possible, so that the receiver is * exactly synced with the transmitter and the waveform is exactly in -* the middle of syncbuf. -*/ +* the middle of syncbuf. +*/ // bitclk -= sum / 5.0; bitclk -= sum / (5.0 * 16 / bitsteps); @@ -1289,11 +1293,11 @@ int psk::rx_process(const double *buf, int len) * When bitclock reaches the end of the buffer, then a complete waveform * has been received. It is time to output the current sample and wrap * around to the next cycle. -* +* * There is a complete symbol waveform in syncbuf, so that each * sample[0..N/2-1] is very close in amplitude with the corresponding * sample in [N/2..N-1]. -* +* * | ******** ******** | * | **** **** **** **** | * | *** *** *** *** | @@ -1303,9 +1307,9 @@ int psk::rx_process(const double *buf, int len) * |* * *| * |_______________________________________________________________| * 0 N/2 N-1 -* +* * === or some variation of it .... === -* +* * |**** ******** *****| * | **** **** **** **** | * | *** *** *** *** | @@ -1320,7 +1324,7 @@ int psk::rx_process(const double *buf, int len) * have the maximum phase difference, if any, from the previous symbol's * phase. * -*/ +*/ // if (bitclk < 0) bitclk += 16.0; // if (bitclk >= 16.0) { @@ -1371,30 +1375,24 @@ int psk::rx_process(const double *buf, int len) // transmit processes //===================================================================== -void psk::tx_symbol(int sym) +void psk::tx_carriers() { double delta[MAX_CARRIERS]; double ival, qval, shapeA, shapeB; cmplx symbol; double frequencies[MAX_CARRIERS]; - txsymbols[accumulated_bits] = sym; - - if (++accumulated_bits < numcarriers) { - return; - } - //Process all carrier's symbols, then submit to sound card - accumulated_bits = 0; //reset frequencies[0] = get_txfreq_woffset() + ((-1 * numcarriers) + 1) * inter_carrier / 2; delta[0] = TWOPI * frequencies[0] / samplerate; - for (int car = 1; car < numcarriers; car++) { + for (int car = 1; car < symbols; car++) { frequencies[car] = frequencies[car - 1] + inter_carrier; delta[car] = TWOPI * frequencies[car] / samplerate; } -double maxamp = 0; - for (int car = 0; car < numcarriers; car++) { + double maxamp = 0; + int sym; + for (int car = 0; car < symbols; car++) { sym = txsymbols[car]; if (_qpsk && !reverse) @@ -1426,7 +1424,7 @@ double maxamp = 0; qval = shapeA * prevsymbol[car].imag() + shapeB * symbol.imag(); if (car != 0) { - outbuf[i] += (ival * cos(phaseacc[car]) + qval * sin(phaseacc[car]));// / numcarriers; + outbuf[i] += (ival * cos(phaseacc[car]) + qval * sin(phaseacc[car]));// / numcarriers; } else { outbuf[i] = (ival * cos(phaseacc[car]) + qval * sin(phaseacc[car]));// / numcarriers; } @@ -1441,12 +1439,23 @@ double maxamp = 0; prevsymbol[car] = symbol; } + if (maxamp) for (int i = 0; i < symbollen; i++) outbuf[i] /= maxamp; - ModulateXmtr(outbuf, symbollen); } +void psk::tx_symbol(int sym) +{ + acc_symbols++; + txsymbols[symbols] = sym; + if (++symbols < numcarriers) { + return; + } + tx_carriers(); + symbols = 0; //reset +} + void psk::tx_bit(int bit) { unsigned int sym; @@ -1454,35 +1463,33 @@ void psk::tx_bit(int bit) // qpsk transmission if (_qpsk) { sym = enc->encode(bit); - //JD add interleaver -// Txinlv->bits(&sym); sym = sym & 3;//JD just to make sure tx_symbol(sym); - // else pskr (fec + interleaver) transmission } else if (_pskr) { - // Encode into two bits +// Encode into two bits bitshreg = enc->encode(bit); - // pass through interleaver +// pass through interleaver if (mode != MODE_PSK63F) Txinlv->bits(&bitshreg); - // Send low bit first. tx_symbol expects 0 or 2 for BPSK +// Send low bit first. tx_symbol expects 0 or 2 for BPSK sym = (bitshreg & 1) << 1; tx_symbol(sym); sym = bitshreg & 2; tx_symbol(sym); - // else normal bpsk tranmission +// else normal bpsk tranmission } else { sym = bit << 1; tx_symbol(sym); } } - - +unsigned char ch; void psk::tx_char(unsigned char c) { + ch = c; const char *code; - + char_symbols = acc_symbols; if (_pskr) { +// acc_symbols = 0; // ARQ varicode instead of MFSK for PSK63FEC code = varienc(c); } else { @@ -1498,21 +1505,18 @@ void psk::tx_char(unsigned char c) tx_bit(0); tx_bit(0); } + char_symbols = acc_symbols - char_symbols; } - void psk::tx_flush() { if (_pskr) { - //VK2ETA replace with a more effective flushing sequence (avoids cutting the last characters in low s/n) -/* for (int i = 0; i < dcdbits; i++) - tx_bit(0); - } -*/ - for (int i = 0; i < dcdbits / 2; i++) { - tx_bit(1); - tx_bit(1); - } + ovhd_symbols = ((numcarriers - symbols) % numcarriers); +//VK2ETA replace with a more effective flushing sequence (avoids cutting the last characters in low s/n) + for (int i = 0; i < ovhd_symbols/2; i++) tx_bit(0); + + for (int i = 0; i < dcdbits; i++) tx_bit(0); + return; } // QPSK - flush the encoder if (_qpsk) { @@ -1538,8 +1542,6 @@ void psk::clearbits() } } - - int psk::tx_process() { int c; @@ -1555,9 +1557,10 @@ int psk::tx_process() preamble--; tx_bit(1); tx_bit(0); - // FEC: Mark start of first character with a double zero + // FEC: Mark start of first character with a double zero // to ensure sync at end of preamble - if (preamble == 0) tx_bit(0); + if (preamble == 0) + while (acc_symbols % numcarriers) tx_bit(0); return 0; } else { //JD for QPSK500R @@ -1575,6 +1578,11 @@ int psk::tx_process() tx_flush(); stopflag = false; cwid(); + + char_samples = char_symbols * symbollen / numcarriers; + xmt_samples = acc_symbols * symbollen / numcarriers; + ovhd_samples = (acc_symbols - char_symbols - ovhd_symbols) * symbollen / numcarriers; + return -1; // we're done } diff --git a/src/soundcard/sound.cxx b/src/soundcard/sound.cxx index 5bdd6f68..6f4ec45e 100644 --- a/src/soundcard/sound.cxx +++ b/src/soundcard/sound.cxx @@ -71,6 +71,7 @@ #include "debug.h" #include "qrunner.h" #include "icons.h" +#include "macros.h" #define SND_BUF_LEN 65536 #define SND_RW_LEN (8 * SND_BUF_LEN) @@ -79,7 +80,7 @@ // We never write duplicate/QSK/PTT tone/PseudoFSK data to the sound files #define SNDFILE_CHANNELS 1 -int sndfile_samplerate[4] = {22050, 24000, 44100, 48000}; +int sndfile_samplerate[7] = {8000, 11025, 16000, 22050, 24000, 44100, 48000}; using namespace std; @@ -376,7 +377,8 @@ LOG_INFO("src ratio %f", play_src_data->src_ratio); // --------------------------------------------------------------------- // write_file -// All sound buffer data is resampled to 48000 samples/sec +// All sound buffer data is resampled to a specified sample rate +// progdefaults.wavSampleRate // resultant data (left channel only) is written to a wav file //---------------------------------------------------------------------- void SoundBase::write_file(SNDFILE* file, float* buf, size_t count) @@ -384,7 +386,7 @@ void SoundBase::write_file(SNDFILE* file, float* buf, size_t count) int err; if (modem_wr_sr != sample_frequency) { modem_wr_sr = sample_frequency; - writ_src_data->src_ratio = sndfile_samplerate[progdefaults.wavSampleRate] / modem_wr_sr; + writ_src_data->src_ratio = 1.0 * sndfile_samplerate[progdefaults.wavSampleRate] / modem_wr_sr; src_set_ratio(writ_src_state, writ_src_data->src_ratio); } writ_src_data->data_in = buf; @@ -742,6 +744,11 @@ size_t SoundOSS::Write(double *buf, size_t count) write_file(ofGenerate, buf, count); #endif + if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) { + return count; + } + + if (txppm != progdefaults.TX_corr) { txppm = progdefaults.TX_corr; tx_src_data->src_ratio = 1.0 + txppm/1e6; @@ -806,6 +813,10 @@ size_t SoundOSS::Write_stereo(double *bufleft, double *bufright, size_t count) write_file(ofGenerate, bufleft, count); #endif + if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) { + return count; + } + if (txppm != progdefaults.TX_corr) { txppm = progdefaults.TX_corr; tx_src_data->src_ratio = 1.0 + txppm/1e6; @@ -1241,6 +1252,10 @@ size_t SoundPort::Write(double *buf, size_t count) write_file(ofGenerate, buf, count); #endif + if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) { + return count; + } + // copy input to both channels if right channel enabled for (size_t i = 0; i < count; i++) if (progdefaults.mono_audio) @@ -1270,6 +1285,10 @@ size_t SoundPort::Write_stereo(double *bufleft, double *bufright, size_t count) write_file(ofCapture, bufleft, count); #endif + if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) { + return count; + } + // interleave into fbuf for (size_t i = 0; i < count; i++) { if (progdefaults.ReverseAudio) { @@ -1895,6 +1914,10 @@ size_t SoundPulse::Write(double* buf, size_t count) write_file(ofGenerate, buf, count); #endif + if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) { + return count; + } + // copy input to both channels for (size_t i = 0; i < count; i++) if (progdefaults.mono_audio) @@ -1924,6 +1947,10 @@ size_t SoundPulse::Write_stereo(double* bufleft, double* bufright, size_t count) write_file(ofGenerate, bufleft, count); #endif + if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) { + return count; + } + for (size_t i = 0; i < count; i++) { if (progdefaults.ReverseAudio) { fbuf[sd[1].stream_params.channels * i + 1] = bufleft[i]; @@ -2061,6 +2088,10 @@ size_t SoundNull::Write(double* buf, size_t count) write_file(ofGenerate, buf, count); #endif + if (PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST) { + return count; + } + MilliSleep((long)ceil((1e3 * count) / sample_frequency)); return count; diff --git a/src/trx/modem.cxx b/src/trx/modem.cxx index 9f05c588..5382d5ad 100644 --- a/src/trx/modem.cxx +++ b/src/trx/modem.cxx @@ -36,6 +36,7 @@ #include "configuration.h" #include "waterfall.h" #include "qrunner.h" +#include "macros.h" #include "status.h" #include "debug.h" @@ -182,6 +183,11 @@ double modem::frequency = 1000; double modem::tx_frequency = 1000; bool modem::freqlock = false; +// For xml socket command +unsigned long modem::tx_sample_count = 0; +unsigned int modem::tx_sample_rate = 0; +bool modem::XMLRPC_CPS_TEST = false; + modem::modem() { scptr = 0; @@ -426,6 +432,8 @@ void modem::ModulateXmtr(double *buffer, int len) { if (unlikely(!scard)) return; + tx_sample_count += len; + if (progdefaults.PTTrightchannel) { for (int i = 0; i < len; i++) PTTchannel[i] = PTTnco(); @@ -433,7 +441,8 @@ void modem::ModulateXmtr(double *buffer, int len) return; } - if (progdefaults.viewXmtSignal) + if (progdefaults.viewXmtSignal && + !(PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST)) trx_xmit_wfall_queue(samplerate, buffer, (size_t)len); if (withnoise && progdefaults.noise) add_noise(buffer, len); @@ -463,7 +472,10 @@ void modem::ModulateStereo(double *left, double *right, int len) { if (unlikely(!scard)) return; - if (progdefaults.viewXmtSignal) + tx_sample_count += len; + + if (progdefaults.viewXmtSignal && + !(PERFORM_CPS_TEST || active_modem->XMLRPC_CPS_TEST)) trx_xmit_wfall_queue(samplerate, left, (size_t)len); if (withnoise && progdefaults.noise) add_noise(left, len); @@ -699,7 +711,7 @@ struct mfntchr { char c; int byte[MAXROWS]; }; extern mfntchr idch1[]; // original id font definition extern mfntchr idch2[]; // extended id font definition -static int symbols[MAXCHARS]; +static int id_symbols[MAXCHARS]; static C_FIR_filter vidfilt; @@ -728,7 +740,7 @@ void modem::wfid_send(int numchars) for (i = 0; i < IDSYMLEN; i++) { val = 0.0; for (k = 0; k < numchars; k++) { - sym = symbols[numchars - k - 1]; + sym = id_symbols[numchars - k - 1]; for (j = 0; j < NUMCOLS; j++) { if (sym & 1) val += sin(wfid_w[j + k * NUMCOLS] * i); @@ -764,9 +776,9 @@ void modem::wfid_sendchars(string s) for (int row = 0; row < NUMROWS; row++) { for (int i = 0; i < len; i++) { if (useIDSMALL) - symbols[i] = idch1[n[i]].byte[NUMROWS - 1 - row]; + id_symbols[i] = idch1[n[i]].byte[NUMROWS - 1 - row]; else - symbols[i] = idch2[n[i]].byte[NUMROWS - 1 - row]; + id_symbols[i] = idch2[n[i]].byte[NUMROWS - 1 - row]; } wfid_send(len); if (stopflag) @@ -856,7 +868,7 @@ void modem::wfid_text(const string& s) break; } // blank lines - for (int i = 0; i < vidwidth; i++) symbols[i] = 0; + for (int i = 0; i < vidwidth; i++) id_symbols[i] = 0; wfid_send(vidwidth); wfid_send(vidwidth); diff --git a/src/trx/trx.cxx b/src/trx/trx.cxx index 3dc1c410..7848aba5 100644 --- a/src/trx/trx.cxx +++ b/src/trx/trx.cxx @@ -25,6 +25,7 @@ #include +#include #include #include #include @@ -310,6 +311,7 @@ void trx_trx_transmit_loop() return; } if (active_modem) { + try { current_samplerate = active_modem->get_samplerate(); scard->Open(O_WRONLY, current_samplerate); @@ -321,7 +323,10 @@ void trx_trx_transmit_loop() return; } - if (active_modem != ssb_modem && active_modem != anal_modem) { + if ((active_modem != ssb_modem) && + (active_modem != anal_modem) && + !active_modem->XMLRPC_CPS_TEST && + !PERFORM_CPS_TEST ) { push2talk->set(true); REQ(&waterfall::set_XmtRcvBtn, wf, true); } @@ -348,10 +353,17 @@ void trx_trx_transmit_loop() } if (progStatus.n_rsids >= 0) { + +// if(trx_state == STATE_TX) { + active_modem->tx_sample_count = 0; + active_modem->tx_sample_rate = active_modem->get_samplerate(); +// } + while (trx_state == STATE_TX) { try { - if (active_modem->tx_process() < 0) + if (active_modem->tx_process() < 0) { trx_state = STATE_RX; + } } catch (const SndException& e) { scard->Close(); diff --git a/src/waterfall/waterfall.cxx b/src/waterfall/waterfall.cxx index b5e13fd7..ece40555 100644 --- a/src/waterfall/waterfall.cxx +++ b/src/waterfall/waterfall.cxx @@ -2105,12 +2105,10 @@ void waterfall::handle_mouse_wheel(int what, int d) val->do_callback(); progdefaults.changed = changed_save; if (val == cntServerOffset || val == cntSearchRange) { - if (active_modem) - active_modem->set_sigsearch(SIGSEARCH); - } - else if (val == sldrSquelch) // sldrSquelch gives focus to TransmitText + if (active_modem) active_modem->set_sigsearch(SIGSEARCH); + } else if (val == sldrSquelch) { // sldrSquelch gives focus to TransmitText take_focus(); - + } if (msg_fmt) { char msg[60]; snprintf(msg, sizeof(msg), msg_fmt, msg_label, val->value());