Skip to content

Commit

Permalink
adc: format.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Suciu <[email protected]>
  • Loading branch information
adisuciu committed Aug 29, 2024
1 parent 258ac1e commit 76ba807
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 36 deletions.
7 changes: 3 additions & 4 deletions gr-util/src/grfftfloatproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void GRFFTFloatProc::build_blks(GRTopBlock *top)
auto window = gr::fft::window::build(m_fftwindow, fft_size);
float window_sum = 0;
for(auto v : window) {
window_sum+=v;
window_sum += v;
}
auto corr = (m_windowCorr) ? window.size() / window_sum : 1;

Expand Down Expand Up @@ -137,12 +137,11 @@ void GRFFTComplexProc::build_blks(GRTopBlock *top)

float window_sum = 0;
for(auto v : window) {
window_sum+=v;
window_sum += v;
}
auto corr = (m_windowCorr) ? window.size() / window_sum : 1;

mult_nrbits =
gr::blocks::multiply_const_cc::make(gr_complex(1.0 / (1 << nrBits), 0), fft_size);
mult_nrbits = gr::blocks::multiply_const_cc::make(gr_complex(1.0 / (1 << nrBits), 0), fft_size);
fft_complex = gr::fft::fft_v<gr_complex, true>::make(fft_size, window, true);

mult_wind_corr = gr::blocks::multiply_const_cc::make(gr_complex(corr, 0), fft_size);
Expand Down
6 changes: 3 additions & 3 deletions gui/src/widgets/plotinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void PlotInfo::addCustomInfo(QWidget *info, InfoPosition hpos, InfoPosition vpos
if(vpos == IP_BOTTOM) {
m_leftLayout->addWidget(info);
} else {
m_leftLayout->insertWidget(0,info);
m_leftLayout->insertWidget(0, info);
}
info->setParent(m_leftInfo);
break;
Expand All @@ -35,7 +35,7 @@ void PlotInfo::addCustomInfo(QWidget *info, InfoPosition hpos, InfoPosition vpos
if(vpos == IP_BOTTOM) {
m_rightLayout->addWidget(info);
} else {
m_rightLayout->insertWidget(0,info);
m_rightLayout->insertWidget(0, info);
}
info->setParent(m_rightInfo);

Expand All @@ -49,7 +49,7 @@ void PlotInfo::addCustomInfo(QWidget *info, InfoPosition hpos, InfoPosition vpos
info->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
}

QLabel *PlotInfo::addLabelInfo(InfoPosition hpos, InfoPosition vpos)
QLabel *PlotInfo::addLabelInfo(InfoPosition hpos, InfoPosition vpos)
{
QLabel *label = new QLabel();
StyleHelper::PlotInfoLabel(label);
Expand Down
2 changes: 1 addition & 1 deletion plugins/adc/include/adc/adcplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SCOPY_ADC_EXPORT ADCPlugin : public QObject, public PluginBase
void newInstrument(ADCInstrumentType t, AcqTreeNode *root);
void deleteInstrument(ToolMenuEntry *w);

public Q_SLOT:
public Q_SLOTS:
void preferenceChanged(QString, QVariant t1);

private:
Expand Down
4 changes: 2 additions & 2 deletions plugins/adc/src/adcfftinstrumentcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ bool ADCFFTInstrumentController::getComplexChannelPair(AcqTreeNode *node, AcqTre
m_complexChannels.append(node);
auto cnt = m_complexChannels.count();
if(cnt % 2 == 0) {
if(node->name().endsWith("q",Qt::CaseInsensitive)) {
if(node->name().endsWith("q", Qt::CaseInsensitive)) {
*node_i = m_complexChannels[cnt - 2];
*node_q = m_complexChannels[cnt - 1];
} else if(node->name().endsWith("i",Qt::CaseInsensitive)){
} else if(node->name().endsWith("i", Qt::CaseInsensitive)) {
*node_i = m_complexChannels[cnt - 1];
*node_q = m_complexChannels[cnt - 2];
} else {
Expand Down
1 change: 0 additions & 1 deletion plugins/adc/src/adcinstrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ void ADCInstrument::switchToChannelMenu(QString id, bool force)
rightStack->show(id);
}


void ADCInstrument::addChannel(MenuControlButton *btn, ChannelComponent *ch, CompositeWidget *c)
{
c->add(btn);
Expand Down
4 changes: 1 addition & 3 deletions plugins/adc/src/adcinstrumentcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ ADCInstrumentController::~ADCInstrumentController() {}

ChannelIdProvider *ADCInstrumentController::getChannelIdProvider() { return chIdP; }

void ADCInstrumentController::setEnableAddRemovePlot(bool)
{
}
void ADCInstrumentController::setEnableAddRemovePlot(bool) {}

void ADCInstrumentController::setEnableAddRemoveInstrument(bool b)
{
Expand Down
13 changes: 6 additions & 7 deletions plugins/adc/src/adcplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ bool ADCPlugin::loadPreferencesPage()
auto adc_add_remove_instrument = PreferencesHelper::addPreferenceCheckBox(
p, "adc_add_remove_instrument", "Add/Remove instrument feature (EXPERIMENTAL)", m_preferencesPage);


generalSection->contentLayout()->addWidget(adc_plot_xaxis_label_position);
generalSection->contentLayout()->addWidget(adc_plot_yaxis_label_position);
generalSection->contentLayout()->addWidget(adc_plot_yaxis_handle_position);
Expand Down Expand Up @@ -135,8 +134,8 @@ void ADCPlugin::loadToolList()
{
m_toolList.append(
SCOPY_NEW_TOOLMENUENTRY("time", "Time", ":/gui/icons/scopy-default/icons/tool_oscilloscope.svg"));
m_toolList.append(
SCOPY_NEW_TOOLMENUENTRY("freq", "Frequency", ":/gui/icons/scopy-default/icons/tool_spectrum_analyzer.svg"));
m_toolList.append(SCOPY_NEW_TOOLMENUENTRY("freq", "Frequency",
":/gui/icons/scopy-default/icons/tool_spectrum_analyzer.svg"));
}

bool iio_is_buffer_capable(struct iio_device *dev)
Expand Down Expand Up @@ -255,13 +254,12 @@ void ADCPlugin::newInstrument(ADCInstrumentType t, AcqTreeNode *root)
}
}
deleteInstrument(t);

});
m_ctrls.append(adc);
} else if(t == FREQUENCY) {

m_toolList.append(SCOPY_NEW_TOOLMENUENTRY("freq", "Frequency",
":/gui/icons/scopy-default/icons/tool_spectrum_analyzer.svg"));
m_toolList.append(SCOPY_NEW_TOOLMENUENTRY(
"freq", "Frequency", ":/gui/icons/scopy-default/icons/tool_spectrum_analyzer.svg"));
auto tme = m_toolList.last();
tme->setEnabled(true);
tme->setRunBtnVisible(true);
Expand Down Expand Up @@ -324,7 +322,8 @@ void ADCPlugin::deleteInstrument(ToolMenuEntry *tool)
Q_EMIT toolListChanged();
}

void ADCPlugin::preferenceChanged(QString s, QVariant t1) {
void ADCPlugin::preferenceChanged(QString s, QVariant t1)
{
if(s == "adc_add_remove_plot") {
for(ADCInstrumentController *ctrl : m_ctrls) {
ctrl->setEnableAddRemovePlot(t1.toBool());
Expand Down
4 changes: 1 addition & 3 deletions plugins/adc/src/freq/fftplotcomponentsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ FFTPlotComponentSettings::FFTPlotComponentSettings(FFTPlotComponent *plt, QWidge
MenuOnOffSwitch *m_autoscaleBtn = new MenuOnOffSwitch(tr("AUTOSCALE"), plotMenu, false);
m_autoscaler = new PlotAutoscaler(this);

connect(m_autoscaler, &PlotAutoscaler::newMin, this, [=](double v) {m_yCtrl->setMin(v - 10);});
connect(m_autoscaler, &PlotAutoscaler::newMin, this, [=](double v) { m_yCtrl->setMin(v - 10); });
// connect(m_autoscaler, &PlotAutoscaler::newMax, m_yCtrl, &MenuPlotAxisRangeControl::setMax);

connect(m_autoscaleBtn->onOffswitch(), &QAbstractButton::toggled, this, [=](bool b) {
Expand Down Expand Up @@ -203,7 +203,6 @@ void FFTPlotComponentSettings::removeChannel(ChannelComponent *c)
connections.remove(c);
}


void FFTPlotComponentSettings::onStart()
{
m_running = true;
Expand All @@ -215,4 +214,3 @@ void FFTPlotComponentSettings::onStop()
m_running = false;
toggleAutoScale();
}

3 changes: 1 addition & 2 deletions plugins/adc/src/freq/fftplotmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ uint32_t FFTPlotManager::addPlot(QString name)
m_plotIdx++;
m_plots.append(plt);

connect(this, &PlotManager::newData,plt->plot(0), &PlotWidget::newData);
connect(this, &PlotManager::newData, plt->plot(0), &PlotWidget::newData);

plt->setXInterval(m_xInterval);

Expand All @@ -31,7 +31,6 @@ uint32_t FFTPlotManager::addPlot(QString name)
delete plt;
});


addComponent(plt);

int idx = m_lay->indexOf(m_statsPanel);
Expand Down
11 changes: 5 additions & 6 deletions plugins/adc/src/freq/fftplotmanagersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ QWidget *FFTPlotManagerSettings::createMenu(QWidget *parent)
StyleHelper::BlueButton(m_addPlotBtn, "AddPlotButton");

connect(m_addPlotBtn, &QPushButton::clicked, this, [=]() {
uint32_t idx = m_plotManager->addPlot("Frequency Plot " + QString::number(m_plotManager->plots().count()));
uint32_t idx =
m_plotManager->addPlot("Frequency Plot " + QString::number(m_plotManager->plots().count()));
FFTPlotComponent *plt = m_plotManager->plot(idx);
addPlot(plt);
});
Expand Down Expand Up @@ -85,7 +86,7 @@ QWidget *FFTPlotManagerSettings::createXAxisMenu(QWidget *parent)
new MenuSectionCollapseWidget("X-AXIS", MenuCollapseSection::MHCW_NONE, parent);

m_bufferSizeSpin = new MenuSpinbox("Buffer Size", 16, "samples", 0, 4000000, true, false, section);
m_bufferSizeSpin->setScaleRange(1,1e6);
m_bufferSizeSpin->setScaleRange(1, 1e6);
connect(m_bufferSizeSpin, &MenuSpinbox::valueChanged, this, [=](double val) { setBufferSize((uint32_t)val); });

QWidget *xMinMax = new QWidget(section);
Expand Down Expand Up @@ -202,7 +203,7 @@ QWidget *FFTPlotManagerSettings::createXAxisMenu(QWidget *parent)

void FFTPlotManagerSettings::onInit()
{
m_bufferSizeSpin->setValue(400);
m_bufferSizeSpin->setValue(4096);
m_sampleRateSpin->setValue(1);
m_xmin->setValue(0);
m_xmax->setValue(400);
Expand Down Expand Up @@ -388,9 +389,7 @@ void FFTPlotManagerSettings::setComplexMode(bool newComplexMode)
updateXAxis();
}

void FFTPlotManagerSettings::setEnableAddRemovePlot(bool b) {
m_addPlotBtn->setVisible(b);
}
void FFTPlotManagerSettings::setEnableAddRemovePlot(bool b) { m_addPlotBtn->setVisible(b); }

} // namespace adc
} // namespace scopy
2 changes: 1 addition & 1 deletion plugins/adc/src/time/timeplotmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ uint32_t TimePlotManager::addPlot(QString name)
m_lay->insertWidget(idx, m_plotpreviewer);
}

connect(this, &PlotManager::newData,plt->plot(0), &PlotWidget::newData);
connect(this, &PlotManager::newData, plt->plot(0), &PlotWidget::newData);

plt->setXInterval(m_xInterval);

Expand Down
4 changes: 1 addition & 3 deletions plugins/adc/src/time/timeplotmanagersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,7 @@ void TimePlotManagerSettings::updateXModeCombo()
}
}

void TimePlotManagerSettings::setEnableAddRemovePlot(bool b) {
m_addPlotBtn->setVisible(b);
}
void TimePlotManagerSettings::setEnableAddRemovePlot(bool b) { m_addPlotBtn->setVisible(b); }

} // namespace adc
} // namespace scopy

0 comments on commit 76ba807

Please sign in to comment.