change display

This commit is contained in:
Kizarm 2024-11-17 17:12:36 +01:00
parent 8027708b3e
commit 503e90b95a
2 changed files with 22 additions and 6 deletions

View file

@ -11,6 +11,10 @@ static const double TimeBaseSteps [] = {
2.0e-6, 5.0e-6, 1.0e-5, 2.0e-5, 5.0e-5, 1.0e-4, 2.0e-4, 5.0e-4, 1.0e-3, 2.0e-6, 5.0e-6, 1.0e-5, 2.0e-5, 5.0e-5, 1.0e-4, 2.0e-4, 5.0e-4, 1.0e-3,
2.0e-3, 5.0e-3, 1.0e-2, 2.0e-2, 5.0e-2, 1.0e-1, 2.0e-1, 5.0e-1, 1.0, 2.0e-3, 5.0e-3, 1.0e-2, 2.0e-2, 5.0e-2, 1.0e-1, 2.0e-1, 5.0e-1, 1.0,
}; };
static const int TimeBaseCounts [] = {
0, 0, 0, 0, 0, 0, 0, 0, 10,
5, 2, 1, 1, 1, 1, 1, 1, 1,
};
static const double ChannelsSteps [] = { static const double ChannelsSteps [] = {
0.1, 0.2, 0.5, 0.1, 0.2, 0.5,
1.0, 2.0, 5.0, 1.0, 2.0, 5.0,
@ -42,6 +46,8 @@ DisplayWidget::DisplayWidget(QWidget * p) : QWidget(p), pcol(), ACopy(), BCopy()
n = 0; n = 0;
for (QPointF & e : ChB) { const QPointF p (n++, 0); e = p; } for (QPointF & e : ChB) { const QPointF p (n++, 0); e = p; }
m_continual = false; m_continual = false;
m_cont_limit = 0;
m_cont_pass = 0;
} }
DisplayWidget::~DisplayWidget() { DisplayWidget::~DisplayWidget() {
} }
@ -189,10 +195,9 @@ void DisplayWidget::setTrigger(TrigerSettings * ts) {
void DisplayWidget::DispChannels(QVector<int> cha, QVector<int> chb) { void DisplayWidget::DispChannels(QVector<int> cha, QVector<int> chb) {
ACopy = cha; ACopy = cha;
BCopy = chb; BCopy = chb;
reloadData(); if (reloadData()) update();
update();
} }
void DisplayWidget::reloadData () { bool DisplayWidget::reloadData () {
const size_t Alen = ACopy.size(); const size_t Alen = ACopy.size();
const size_t Blen = BCopy.size(); const size_t Blen = BCopy.size();
const size_t Amin = Alen < T_SIZE ? Alen : T_SIZE; const size_t Amin = Alen < T_SIZE ? Alen : T_SIZE;
@ -204,7 +209,13 @@ void DisplayWidget::reloadData () {
ChB[m_timeCount] = ptb; ChB[m_timeCount] = ptb;
m_timeCount += 1u; m_timeCount += 1u;
m_timeCount &= T_MASK; m_timeCount &= T_MASK;
return; m_cont_pass += 1;
if (m_cont_pass >= m_cont_limit) {
m_cont_pass = 0;
return true;
} else {
return false;
}
} }
m_continual = false; m_continual = false;
for (unsigned n=0u; n<Amin; n++) { for (unsigned n=0u; n<Amin; n++) {
@ -220,6 +231,7 @@ void DisplayWidget::reloadData () {
x_lenght = l; x_lenght = l;
reloadMatrix (size()); reloadMatrix (size());
} }
return true;
} }
void DisplayWidget::reloadMatrix(const QSize & sz) { void DisplayWidget::reloadMatrix(const QSize & sz) {
const double xm = sz.width(); const double xm = sz.width();
@ -232,6 +244,8 @@ void DisplayWidget::reloadMatrix(const QSize & sz) {
} }
void DisplayWidget::TimeBaseRange(int n) { void DisplayWidget::TimeBaseRange(int n) {
m_timeBase = n; m_timeBase = n;
m_cont_limit = TimeBaseCounts [m_timeBase];
//qDebug("count = %d", m_cont_limit);
reloadMatrix (size()); reloadMatrix (size());
drawBackground(); drawBackground();
update(); update();

View file

@ -46,6 +46,8 @@ class DisplayWidget : public QWidget {
} marker_type; } marker_type;
unsigned m_timeCount; unsigned m_timeCount;
bool m_continual; bool m_continual;
int m_cont_limit;
int m_cont_pass;
public: public:
explicit DisplayWidget (QWidget * p); explicit DisplayWidget (QWidget * p);
virtual ~DisplayWidget (); virtual ~DisplayWidget ();
@ -71,7 +73,7 @@ class DisplayWidget : public QWidget {
protected: protected:
void drawCurrent (QPainter & p); void drawCurrent (QPainter & p);
void drawBackground (); void drawBackground ();
void reloadData (); bool reloadData ();
void reloadMatrix (const QSize & sz); void reloadMatrix (const QSize & sz);
}; };