diff --git a/srsue/src/phy/lte/sf_worker.cc b/srsue/src/phy/lte/sf_worker.cc index 8b78be745..2428fc7f0 100644 --- a/srsue/src/phy/lte/sf_worker.cc +++ b/srsue/src/phy/lte/sf_worker.cc @@ -39,6 +39,7 @@ static void init_plots(srsue::lte::sf_worker* worker); static pthread_t plot_thread; static sem_t plot_sem; static int plot_worker_id = -1; +static bool plot_nr_enable = false; #else #pragma message "Compiling without srsGUI support" #endif @@ -294,6 +295,7 @@ void sf_worker::start_plot() #ifdef ENABLE_GUI if (plot_worker_id == -1) { plot_worker_id = get_id(); + plot_nr_enable = phy->args->nof_nr_carriers > 0; srslte::console("Starting plot for worker_id=%d\n", plot_worker_id); init_plots(this); } else { @@ -386,8 +388,10 @@ static void* plot_thread_run(void* arg) plot_scatter_setXAxisScale(&pconst_nr, -4, 4); plot_scatter_setYAxisScale(&pconst_nr, -4, 4); - plot_scatter_addToWindowGrid(&pconst_nr, (char*)"srsue", 0, row_count++); - pconst_nr_ready = true; + if (plot_nr_enable) { + plot_scatter_addToWindowGrid(&pconst_nr, (char*)"srsue", 0, row_count++); + pconst_nr_ready = true; + } #if CFO_PLOT_LEN > 0 plot_real_init(&pcfo); diff --git a/srsue/src/phy/nr/sf_worker.cc b/srsue/src/phy/nr/sf_worker.cc index efa941a83..bc53df4c6 100644 --- a/srsue/src/phy/nr/sf_worker.cc +++ b/srsue/src/phy/nr/sf_worker.cc @@ -115,25 +115,24 @@ void sf_worker::start_plot() extern plot_scatter_t pconst_nr; extern bool pconst_nr_ready; #define SCATTER_PDSCH_PLOT_LEN 4000 -static cf_t tmp_pconst_nr[SRSLTE_SF_LEN_RE(SRSLTE_MAX_PRB, SRSLTE_CP_NORM)]; +static cf_t tmp_pconst_nr[SRSLTE_NSYMB_PER_SLOT_NR * SRSLTE_NRE * SRSLTE_MAX_PRB_NR] = {}; extern bool plot_quit; static void* plot_thread_run(void* arg) { auto worker = (srsue::nr::sf_worker*)arg; - sleep(1); - int readed_pdsch_re = 0; + int pdsch_re_count = 0; while (!plot_quit) { sem_wait(&plot_sem); - if (readed_pdsch_re < SCATTER_PDSCH_PLOT_LEN) { - int n = worker->read_pdsch_d(&tmp_pconst_nr[readed_pdsch_re]); - readed_pdsch_re += n; + if (pdsch_re_count < SCATTER_PDSCH_PLOT_LEN) { + int n = worker->read_pdsch_d(&tmp_pconst_nr[pdsch_re_count]); + pdsch_re_count += n; } else { - if (readed_pdsch_re > 0 and pconst_nr_ready) { - plot_scatter_setNewData(&pconst_nr, tmp_pconst_nr, readed_pdsch_re); + if (pdsch_re_count > 0 and pconst_nr_ready) { + plot_scatter_setNewData(&pconst_nr, tmp_pconst_nr, pdsch_re_count); } - readed_pdsch_re = 0; + pdsch_re_count = 0; } } return nullptr;