From 39680f61398caf79a5c1d803152e3477794ac2f5 Mon Sep 17 00:00:00 2001 From: Ed Gonzalez Date: Tue, 17 Mar 2015 11:16:17 -0500 Subject: [PATCH] Eliminate control characters from rx_string. All control characters are replaced by 0x7F which is an intermediary representation for a space --- DSP_API/SmartSDR_Interface/sched_waveform.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DSP_API/SmartSDR_Interface/sched_waveform.c b/DSP_API/SmartSDR_Interface/sched_waveform.c index 4dd1aed..5bd1fe1 100644 --- a/DSP_API/SmartSDR_Interface/sched_waveform.c +++ b/DSP_API/SmartSDR_Interface/sched_waveform.c @@ -196,12 +196,17 @@ Circular_Float_Buffer TX4_cb = &tx4_cb; void my_put_next_rx_char(void *callback_state, char c) { char new_char[2]; - if ( c == ' ' ) { + if ( (uint32) c < 32 || (uint32) c > 126 ) { + /* Treat all control chars as spaces */ + output(ANSI_YELLOW "Non-valid RX_STRING char. ASCII code = %d\n", (uint32) c); + new_char[0] = (char) 0x7F; + } else if ( c == ' ' ) { /* Encode spaces differently */ new_char[0] = (char) 0x7F; } else { new_char[0] = c; } + new_char[1] = 0; strncat(_rx_string, new_char, MAX_RX_STRING_LENGTH+4);