mirror of https://github.com/PentHertz/srsLTE.git
SRSENB: added PRACH worker plot
This commit is contained in:
parent
a1a58507c1
commit
55a208ede8
|
@ -28,6 +28,13 @@
|
|||
#include "srslte/common/threads.h"
|
||||
#include "srslte/interfaces/enb_interfaces.h"
|
||||
|
||||
// Setting ENABLE_PRACH_GUI to non zero enables a GUI showing signal received in the PRACH window.
|
||||
#define ENABLE_PRACH_GUI 0
|
||||
|
||||
#if defined(ENABLE_GUI) and ENABLE_PRACH_GUI
|
||||
#include <srsgui/srsgui.h>
|
||||
#endif // defined(ENABLE_GUI) and ENABLE_PRACH_GUI
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
class prach_worker : srslte::thread
|
||||
|
@ -55,6 +62,11 @@ private:
|
|||
srslte_prach_cfg_t prach_cfg = {};
|
||||
srslte_prach_t prach = {};
|
||||
|
||||
#if defined(ENABLE_GUI) and ENABLE_PRACH_GUI
|
||||
plot_real_t plot_real;
|
||||
std::array<float, 3 * SRSLTE_SF_LEN_MAX> plot_buffer;
|
||||
#endif // defined(ENABLE_GUI) and ENABLE_PRACH_GUI
|
||||
|
||||
const static int sf_buffer_sz = 128 * 1024;
|
||||
class sf_buffer
|
||||
{
|
||||
|
|
|
@ -54,6 +54,19 @@ int prach_worker::init(const srslte_cell_t& cell_,
|
|||
initiated = true;
|
||||
|
||||
sf_cnt = 0;
|
||||
|
||||
#if defined(ENABLE_GUI) and ENABLE_PRACH_GUI
|
||||
char title[32] = {};
|
||||
snprintf(title, sizeof(title), "PRACH buffer %d", cc_idx);
|
||||
|
||||
sdrgui_init();
|
||||
plot_real_init(&plot_real);
|
||||
plot_real_setTitle(&plot_real, title);
|
||||
plot_real_setXAxisAutoScale(&plot_real, true);
|
||||
plot_real_setYAxisAutoScale(&plot_real, true);
|
||||
plot_real_addToWindowGrid(&plot_real, (char*)"PRACH", 0, cc_idx);
|
||||
#endif // defined(ENABLE_GUI) and ENABLE_PRACH_GUI
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -137,6 +150,12 @@ int prach_worker::run_tti(sf_buffer* b)
|
|||
|
||||
if (prach_offsets[i] * 1e6 < max_prach_offset_us) {
|
||||
stack->rach_detected(b->tti, cc_idx, prach_indices[i], (uint32_t)(prach_offsets[i] * 1e6));
|
||||
|
||||
#if defined(ENABLE_GUI) and ENABLE_PRACH_GUI
|
||||
uint32_t nof_samples = SRSLTE_MIN(nof_sf * SRSLTE_SF_LEN_PRB(cell.nof_prb), 3 * SRSLTE_SF_LEN_MAX);
|
||||
srslte_vec_abs_cf(b->samples, plot_buffer.data(), nof_samples);
|
||||
plot_real_setNewData(&plot_real, plot_buffer.data(), nof_samples);
|
||||
#endif // defined(ENABLE_GUI) and ENABLE_PRACH_GUI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue