From 28b2a69c8a5d8f4aa62efde1b6c46521810a5ab5 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 27 Apr 2020 13:02:55 +0200 Subject: [PATCH] ZMQ module uses default base srate --- lib/src/phy/rf/rf_helper.h | 13 +++++++++++-- lib/src/phy/rf/rf_zmq_imp.c | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/src/phy/rf/rf_helper.h b/lib/src/phy/rf/rf_helper.h index aea03d90f..0feef655d 100644 --- a/lib/src/phy/rf/rf_helper.h +++ b/lib/src/phy/rf/rf_helper.h @@ -100,7 +100,12 @@ static inline int parse_double(char* args, const char* config_arg_base, int chan { char tmp_value[RF_PARAM_LEN] = {0}; int ret = parse_string(args, config_arg_base, channel_index, tmp_value); - *value = strtod(tmp_value, NULL); + + // Copy parsed value only if was found, otherwise it keeps the default + if (ret == SRSLTE_SUCCESS) { + *value = strtod(tmp_value, NULL); + } + return ret; } @@ -108,7 +113,11 @@ static inline int parse_uint32(char* args, const char* config_arg_base, int chan { double tmp_value; int ret = parse_double(args, config_arg_base, channel_index, &tmp_value); - *value = tmp_value; + + // Copy parsed value only if was found, otherwise it keeps the default + if (ret == SRSLTE_SUCCESS) { + *value = tmp_value; + } return ret; } diff --git a/lib/src/phy/rf/rf_zmq_imp.c b/lib/src/phy/rf/rf_zmq_imp.c index 11f478802..8603abeba 100644 --- a/lib/src/phy/rf/rf_zmq_imp.c +++ b/lib/src/phy/rf/rf_zmq_imp.c @@ -673,7 +673,7 @@ int rf_zmq_recv_with_time_multi(void* h, } // copy from rx buffer as many samples as requested into provided buffer - bool completed = false; + bool completed = false; int32_t count[SRSLTE_MAX_CHANNELS] = {}; while (!completed) { uint32_t completed_count = 0; @@ -805,7 +805,7 @@ int rf_zmq_send_timed_multi(void* h, int ret = SRSLTE_ERROR; if (h && data && nsamples > 0) { - rf_zmq_handler_t* handler = (rf_zmq_handler_t*)h; + rf_zmq_handler_t* handler = (rf_zmq_handler_t*)h; // Map ports to data buffers according to the selected frequencies pthread_mutex_lock(&handler->tx_config_mutex);