continual indicator
This commit is contained in:
parent
14f2f78947
commit
2b0f2ae36e
2 changed files with 15 additions and 0 deletions
|
@ -19,6 +19,7 @@ static const double ChannelsSteps [] = {
|
|||
static constexpr double REF_Y = 3.3; // maximum napětí převodníku
|
||||
static constexpr double MAX_Y = double (1 << 12); // 12. bit rozlišení - 4096 steps
|
||||
static constexpr double HALF_Y = 0.5 * MAX_Y;
|
||||
static constexpr double QSCL_Y = 0.5 * HALF_Y;
|
||||
static constexpr double STEP_Y = REF_Y / MAX_Y; // jeden krok ve Voltech
|
||||
static constexpr unsigned T_SIZE = 1u << 10;
|
||||
static constexpr unsigned T_MASK = T_SIZE - 1u;
|
||||
|
@ -40,6 +41,7 @@ DisplayWidget::DisplayWidget(QWidget * p) : QWidget(p), pcol(), ACopy(), BCopy()
|
|||
for (QPointF & e : ChA) { const QPointF p (n++, 0); e = p; }
|
||||
n = 0;
|
||||
for (QPointF & e : ChB) { const QPointF p (n++, 0); e = p; }
|
||||
m_continual = false;
|
||||
}
|
||||
DisplayWidget::~DisplayWidget() {
|
||||
}
|
||||
|
@ -158,6 +160,7 @@ void DisplayWidget::resizeEvent(QResizeEvent * event) {
|
|||
void DisplayWidget::paintEvent(QPaintEvent * event) {
|
||||
QPainter p (this);
|
||||
p.drawImage(event->rect(), background);
|
||||
drawCurrent(p);
|
||||
QPen pa (pcol.colA, 2);
|
||||
QPen pb (pcol.colB, 2);
|
||||
p.setPen(pb);
|
||||
|
@ -169,6 +172,14 @@ void DisplayWidget::paintEvent(QPaintEvent * event) {
|
|||
ma.translate(0, m_offset.a - HALF_Y);
|
||||
p.drawPolyline (ma.map(ChA));
|
||||
}
|
||||
void DisplayWidget::drawCurrent(QPainter & p) {
|
||||
if (!m_continual) return;
|
||||
const QPen pen (QColor(192,192,192));
|
||||
p.setPen (pen);
|
||||
QLineF vl (QPointF(m_timeCount, -QSCL_Y), QPointF(m_timeCount, +QSCL_Y));
|
||||
p.drawLine (m_forward.map (vl)); // Stávající poloha v kontinuálním módu
|
||||
}
|
||||
|
||||
void DisplayWidget::setTrigger(TrigerSettings * ts) {
|
||||
m_ts = ts;
|
||||
}
|
||||
|
@ -184,6 +195,7 @@ void DisplayWidget::reloadData () {
|
|||
const size_t Amin = Alen < T_SIZE ? Alen : T_SIZE;
|
||||
const size_t Bmin = Blen < T_SIZE ? Blen : T_SIZE;
|
||||
if ((Alen == 1u) and (Blen == 1u)) { // kontinuální mód
|
||||
m_continual = true;
|
||||
const QPointF pta (m_timeCount, ACopy [0]), ptb (m_timeCount, BCopy [0]);
|
||||
ChA[m_timeCount] = pta;
|
||||
ChB[m_timeCount] = ptb;
|
||||
|
@ -191,6 +203,7 @@ void DisplayWidget::reloadData () {
|
|||
m_timeCount &= T_MASK;
|
||||
return;
|
||||
}
|
||||
m_continual = false;
|
||||
for (unsigned n=0u; n<Amin; n++) {
|
||||
QPointF & p = ChA [n];
|
||||
p.setY (ACopy [n]);
|
||||
|
|
|
@ -45,6 +45,7 @@ class DisplayWidget : public QWidget {
|
|||
MARKER_VOLT_B,
|
||||
} marker_type;
|
||||
unsigned m_timeCount;
|
||||
bool m_continual;
|
||||
public:
|
||||
explicit DisplayWidget (QWidget * p);
|
||||
virtual ~DisplayWidget ();
|
||||
|
@ -68,6 +69,7 @@ class DisplayWidget : public QWidget {
|
|||
signals:
|
||||
void SettingsChanged (int n);
|
||||
protected:
|
||||
void drawCurrent (QPainter & p);
|
||||
void drawBackground ();
|
||||
void reloadData ();
|
||||
void reloadMatrix (const QSize & sz);
|
||||
|
|
Loading…
Reference in a new issue