Skip to content

Commit

Permalink
plugins/swiotrefactor/ad74413r: Rolling mode acquisition.
Browse files Browse the repository at this point in the history
Signed-off-by: andrei.danila <andrei.danila@analog.com>
  • Loading branch information
andreidanila1 committed Apr 9, 2024
1 parent fb747c3 commit 1b9836a
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 135 deletions.
34 changes: 16 additions & 18 deletions plugins/swiotrefactor/include/swiotrefactor/ad74413r/ad74413r.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include <QVector>
#include <QWidget>
#include <plotinfo.h>
#include <spinbox_a.hpp>

#include <iioutil/connection.h>
Expand Down Expand Up @@ -71,24 +72,24 @@ public Q_SLOTS:
void onSamplingFrequencyUpdated(int channelId, int sampFreq);

Q_SIGNALS:
void timespanChanged(double val);
void broadcastReadThreshold();

void exportBtnClicked(QMap<int, bool> exportConfig);

void activateExportButton();
void activateRunBtns(bool activate);

void backBtnPressed();
void configBtnPressed();
private Q_SLOTS:
void onBackBtnPressed();
void refreshSampleRate();
void onConfigBtnPressed();
void showPlotLabels(bool b);
void setupChannel(int chnlIdx, QString function);
void onBufferRefilled(QMap<int, QVector<double>> bufferData);
void onSamplingFreqComputed(double freq);
void onBufferRefilled(QMap<int, QVector<double>> chnlData);
void onChannelBtnChecked(int chnWidgetId, bool en);

private:
void updateXData(int dataSize);
void plotData(QVector<double> curveData, int chnlIdx);
void createDevicesMap(iio_context *ctx);
void setupConnections();
void verifyChnlsChanges();
Expand All @@ -99,8 +100,9 @@ private Q_SLOTS:
void setupDeviceBtn();
void setupChannelBtn(MenuControlButton *btn, PlotChannel *ch, QString chnlId, int chnlIdx);
void setupChannelsMenuControlBtn(MenuControlButton *btn, QString name);
QPushButton *createBackBtn();
QPushButton *createConfigBtn();
QWidget *createSettingsMenu(QWidget *parent);
PlotAxis *createXChnlAxis(QPen pen, int xMin = -1, int xMax = 0);
PlotAxis *createYChnlAxis(QPen pen, QString unitType = "V", int yMin = -1, int yMax = 1);

private:
Expand All @@ -116,37 +118,33 @@ private Q_SLOTS:
BufferAcquisitionHandler *m_acqHandler;
CommandQueue *m_cmdQueue;

// ExportSettings *m_exportSettings;

struct iio_context *m_ctx;
Connection *m_conn;

////
/// \brief Added for the new adinstrument
///
double m_frequency = 1.0;
double m_sampleRate = 4800;
ToolTemplate *m_tool;
RunBtn *m_runBtn;
SingleShotBtn *m_singleBtn;
PrintBtn *m_printBtn;
QPushButton *m_backBtn;
PlotWidget *m_plot;
QPushButton *m_configBtn;
GearBtn *m_settingsBtn;

PlotWidget *m_plot;
TimePlotInfo *m_info;
PlotSamplingInfo m_currentSamplingInfo;
QMap<int, PlotChannel *> m_plotChnls;

QMap<QString, iio_device *> m_iioDevicesMap;
CollapsableMenuControlButton *m_devBtn;
QButtonGroup *m_rightMenuBtnGrp;
QButtonGroup *m_chnlsBtnGroup;

MapStackedWidget *m_channelStack;

bool m_fullyFilled = false;
int m_currentChannelSelected = 0;
QMap<int, QVector<double>> m_yValues;
QVector<double> m_xTime;

const QString channelsMenuId = "channels";
/////////////////
};
} // namespace swiotrefactor
} // namespace scopy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#ifndef BUFFERACQUISITIONHANDLER_H
#define BUFFERACQUISITIONHANDLER_H

//#include "channelplotscalescontroller.h"
#include <QObject>
#include <qmutex.h>
#include <QMap>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ class BufferMenu : public QWidget

public Q_SLOTS:
virtual void onBroadcastThreshold();
void onRunBtnsPressed(bool en);

Q_SIGNALS:
void broadcastThreshold();
void diagnosticFunctionUpdated();
void samplingFrequencyUpdated(int sr);

protected:
IIOWidget *m_samplingFreq;
QString m_chnlFunction;
Connection *m_connection;
QMap<QString, iio_channel *> m_chnls;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class BufferMenuView : public QWidget
void broadcastThresholdForward();
void broadcastThresholdBackward();

void runBtnsPressed(bool en);

private:
void createConnections();
QWidget *createDescriptionSection(QWidget *parent);
Expand Down
Loading

0 comments on commit 1b9836a

Please sign in to comment.