Apply minor NR GUI comments

This commit is contained in:
Xavier Arteaga 2021-01-20 10:16:10 +01:00 committed by Andre Puschmann
parent 2baccc8b13
commit 13c594651e
2 changed files with 14 additions and 11 deletions

View File

@ -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);

View File

@ -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;