Allow xmit of EOT character

* Still retains use of " ^r " in the user window
  * Covers special-case for FLARQ usage where ETX should
    stop the modem
  * EOT character can  now be transmitted from Tx window instead
    of switching to Rx mode
  * From: Andrej Lajovic <s57ln@hamradio.si>
    - Substitute symbolic names for negative return values of
      get_tx_char()
pull/1/head
John Phelps 2012-10-31 20:55:39 -05:00 zatwierdzone przez David Freese
rodzic 600db9e24b
commit 51db482d9a
18 zmienionych plików z 65 dodań i 48 usunięć

Wyświetl plik

@ -204,9 +204,9 @@ int xmtbyte;
case TX_STATE_DATA:
xmtbyte = get_tx_char();
if (xmtbyte == -1)
if (xmtbyte == GET_TX_CHAR_NODATA)
sendidle();
else if ( xmtbyte == 0x03 || stopflag)
else if ( xmtbyte == GET_TX_CHAR_ETX || stopflag)
txstate = TX_STATE_FLUSH;
else
sendchar(xmtbyte);

Wyświetl plik

@ -160,14 +160,14 @@ int contestia::tx_process()
// to read any more. If stopflag is set, we will always read
// whatever there is.
if (stopflag || (Tx->GetReadReady() < Tx->BitsPerSymbol)) {
if (!stopflag && (c = get_tx_char()) == 0x03)
if (!stopflag && (c = get_tx_char()) == GET_TX_CHAR_ETX)
stopflag = true;
if (stopflag)
Tx->Stop();
else {
if (c == GET_TX_CHAR_NODATA)
c = 0;
/* Replace un-representable characters with a dot */
if (c == -1)
c = 0;
if (c > (progdefaults.contestia8bit ? 255 : 127))
c = '.';
if (c > 127) {

Wyświetl plik

@ -1169,7 +1169,7 @@ int cw::tx_process()
}
c = get_tx_char();
if (c == 0x03 || stopflag) {
if (c == GET_TX_CHAR_ETX || stopflag) {
send_symbol(0, symbollen);
stopflag = false;
return -1;

Wyświetl plik

@ -762,7 +762,7 @@ int rtty::tx_process()
c = get_tx_char();
// TX buffer empty
if (c == 3 || stopflag) {
if (c == GET_TX_CHAR_ETX || stopflag) {
stopflag = false;
line_char_count = 0;
if (nbits != 5) {
@ -780,7 +780,7 @@ int rtty::tx_process()
}
// send idle character if c == -1
if (c == -1) {
if (c == GET_TX_CHAR_NODATA) {
send_idle();
return 0;
}

Wyświetl plik

@ -6353,14 +6353,21 @@ int get_tx_char(void)
enum { STATE_CHAR, STATE_CTRL };
static int state = STATE_CHAR;
if (!que_ok) { return -1; }
if (Qwait_time) { return -1; }
if (Qidle_time) { return -1; }
if (macro_idle_on) { return -1; }
if (idling) { return -1; }
if (arq_text_available)
return (arq_get_char() & 0xFF);
if (!que_ok) { return GET_TX_CHAR_NODATA; }
if (Qwait_time) { return GET_TX_CHAR_NODATA; }
if (Qidle_time) { return GET_TX_CHAR_NODATA; }
if (macro_idle_on) { return GET_TX_CHAR_NODATA; }
if (idling) { return GET_TX_CHAR_NODATA; }
if (arq_text_available) {
char character = (arq_get_char() & 0xFF);
if (character == 0x03) {
// ETX (0x03) in ARQ data means "stop transmitting" not "send ETX"
return(GET_TX_CHAR_ETX);
}
else
return(character);
}
if (active_modem == cw_modem && progdefaults.QSKadjust)
return szTestChar[2 * progdefaults.TestChar];
@ -6369,7 +6376,7 @@ int get_tx_char(void)
!idling ) {
Fl::add_timeout(progStatus.repeatIdleTime, get_tx_char_idle);
idling = true;
return -1;
return GET_TX_CHAR_NODATA;
}
int c;
@ -6398,7 +6405,7 @@ int get_tx_char(void)
if (c == -1) {
queue_reset();
return(-1);
return(GET_TX_CHAR_NODATA);
}
if (state == STATE_CTRL) {
@ -6407,33 +6414,33 @@ int get_tx_char(void)
switch (c) {
case 'r':
REQ_SYNC(&FTextTX::clear_sent, TransmitText);
return(3); // ETX
return(GET_TX_CHAR_ETX);
break;
case 'R':
if (TransmitText->eot()) {
REQ_SYNC(&FTextTX::clear_sent, TransmitText);
return(3); // ETX
return(GET_TX_CHAR_ETX);
} else
return(-1);
return(GET_TX_CHAR_NODATA);
break;
case 'L':
REQ(qso_save_now);
return(-1);
return(GET_TX_CHAR_NODATA);
break;
case 'C':
REQ(clearQSO);
return(-1);
return(GET_TX_CHAR_NODATA);
break;
case '!':
if (queue_must_rx()) {
que_timeout = 400; // 20 seconds
REQ(queue_execute_after_rx, (void *)0);
while(que_waiting) MilliSleep(1);
return(3);
return(GET_TX_CHAR_ETX);
} else {
REQ(do_que_execute, (void*)0);
while(que_waiting) MilliSleep(1);
return(-1);
return(GET_TX_CHAR_NODATA);
}
break;
default:
@ -6454,8 +6461,10 @@ int get_tx_char(void)
transmit:
c = tx_encoder.pop();
if (c == -1)
if (c == -1) {
LOG_ERROR("TX encoding conversion error: pushed content, but got nothing back");
return(GET_TX_CHAR_NODATA);
}
return(c);
}

Wyświetl plik

@ -720,9 +720,9 @@ int dominoex::tx_process()
break;
case TX_STATE_DATA:
i = get_tx_char();
if (i == -1)
if (i == GET_TX_CHAR_NODATA)
sendsecondary();
else if (i == 3)
else if (i == GET_TX_CHAR_ETX)
txstate = TX_STATE_END;
else
sendchar(i, 0);

Wyświetl plik

@ -575,7 +575,7 @@ int feld::tx_process()
c = get_tx_char();
if (c == 0x03 || stopflag) {
if (c == GET_TX_CHAR_ETX || stopflag) {
tx_state = POSTAMBLE;
postamble = 3;
return 0;
@ -583,7 +583,7 @@ int feld::tx_process()
// if TX buffer empty
// send idle character
if (c == -1) {
if (c == GET_TX_CHAR_NODATA) {
if (progdefaults.HellXmtIdle == true)
c = '.';
else {

Wyświetl plik

@ -236,6 +236,14 @@ extern void queue_execute_after_rx(void*);
extern int rxtx_charset;
extern void put_rx_data(int *data, int len);
// Values returned by get_tx_char() to signal various conditions to the
// modems. These values need to be negative so they don't interfere with
// normal TX data (which is always byte-sized and positive).
#define GET_TX_CHAR_NODATA -1 // no data available
#define GET_TX_CHAR_ETX -3 // end of transmission requested
extern int get_tx_char();
extern int get_secondary_char();
extern void put_echo_char(unsigned int data, int style = FTextBase::XMIT);

Wyświetl plik

@ -914,9 +914,9 @@ int mfsk::tx_process()
startpic = false;
txstate = TX_STATE_PICTURE_START;
}
else if ( xmtbyte == 0x03 || stopflag)
else if ( xmtbyte == GET_TX_CHAR_ETX || stopflag)
txstate = TX_STATE_FLUSH;
else if (xmtbyte == -1)
else if (xmtbyte == GET_TX_CHAR_NODATA)
sendidle();
else
sendchar(xmtbyte);

Wyświetl plik

@ -76,12 +76,12 @@ int mt63::tx_process()
}
c = get_tx_char();
if (c == 0x03) {
if (c == GET_TX_CHAR_ETX) {
stopflag = true;
flush = Tx->DataInterleave;
}
if (c == -1 || stopflag == true) c = 0;
if (c == GET_TX_CHAR_NODATA || stopflag == true) c = 0;
if (stopflag) {
stopflag = false;

Wyświetl plik

@ -1586,7 +1586,7 @@ public:
for(;;)
{
int c = get_tx_char();
if( c == -1 ) {
if( c == GET_TX_CHAR_NODATA ) {
break ;
}
msg.push_back( c );

Wyświetl plik

@ -161,12 +161,12 @@ int olivia::tx_process()
// whatever there is.
if (stopflag || (Tx->GetReadReady() < Tx->BitsPerSymbol)) {
if (!stopflag && (c = get_tx_char()) == 0x03)
if (!stopflag && (c = get_tx_char()) == GET_TX_CHAR_ETX)
stopflag = true;
if (stopflag)
Tx->Stop();
else {
if (c == -1)
if (c == GET_TX_CHAR_NODATA)
c = 0;
if (c > 127) {
if (progdefaults.olivia8bit && c <= 255) {
@ -183,9 +183,8 @@ int olivia::tx_process()
}
}
if (c != 0 && c != 0x03) {
if (c > 0)
put_echo_char(c);
}
if ((len = Tx->Output(txfbuffer)) > 0)
ModulateXmtr(txfbuffer, len);

Wyświetl plik

@ -2304,7 +2304,7 @@ int pkt::tx_process()
// TX buffer empty
// if (c == 0x03 || stopflag) {
if (c == -1 || stopflag || tx_char_count == 0) {
if (c == GET_TX_CHAR_ETX || stopflag || tx_char_count == 0) {
if (!stopflag) {
// compute FCS and add it to the frame via *tx_cbuf
unsigned int fcs = computeFCS(&txbuf[0], tx_cbuf);

Wyświetl plik

@ -1081,14 +1081,14 @@ int psk::tx_process()
c = get_tx_char();
if (c == 0x03 || stopflag) {
if (c == GET_TX_CHAR_ETX || stopflag) {
tx_flush();
stopflag = false;
cwid();
return -1; // we're done
}
if (c == -1) {
if (c == GET_TX_CHAR_NODATA) {
if (_pskr) {
// MFSK varicode instead of psk
tx_char(0); // <NUL>

Wyświetl plik

@ -869,9 +869,9 @@ int thor::tx_process()
break;
case TX_STATE_DATA:
i = get_tx_char();
if (i == -1)
if (i == GET_TX_CHAR_NODATA)
sendsecondary();
else if (i == 3)
else if (i == GET_TX_CHAR_ETX)
txstate = TX_STATE_END;
else
sendchar(i, 0);

Wyświetl plik

@ -621,7 +621,7 @@ int throb::tx_process()
c = get_tx_char();
// end of transmission
if (c == 0x03 || stopflag) {
if (c == GET_TX_CHAR_ETX || stopflag) {
send(idlesym);
// reset_syms(); //prepare RX. idle/space syms always start as 0 and 1, respectively.
cwid();
@ -629,7 +629,7 @@ int throb::tx_process()
}
// TX buffer empty
if (c == -1) {
if (c == GET_TX_CHAR_NODATA) {
send(idlesym); /* send idle throbs */
flip_syms();
return 0;

Wyświetl plik

@ -85,7 +85,8 @@ int NULLMODEM::rx_process(const double *buf, int len)
int NULLMODEM::tx_process()
{
if ( get_tx_char() == 0x03 || stopflag) {
MilliSleep(10);
if ( get_tx_char() == GET_TX_CHAR_ETX || stopflag) {
stopflag = false;
return -1;
}

Wyświetl plik

@ -202,7 +202,7 @@ int wwv::tx_process()
static int cycle = 4;
int c = get_tx_char();
if (c == 0x03 || stopflag) {
if (c == GET_TX_CHAR_ETX || stopflag) {
stopflag = false;
return -1;
}