Files
templates/tools/dsview/driver-summary.patch

84 lines
3.4 KiB
Diff

--- a/DSView/pv/data/decoderstack.h
+++ b/DSView/pv/data/decoderstack.h
@@ -30,6 +30,7 @@
#include <QString>
#include <mutex>
+#include "decode/gate_summary.h"
#include "decode/row.h"
#include "../data/signaldata.h"
#include "decode/decoderstatus.h"
@@ -96,6 +97,7 @@
}
const char* get_root_decoder_id();
+ GateSummary gate_summary;
void add_sub_decoder(decode::Decoder *decoder);
void remove_sub_decoder(decode::Decoder *decoder);
--- a/DSView/pv/data/decoderstack.cpp
+++ b/DSView/pv/data/decoderstack.cpp
@@ -369,6 +369,7 @@
void DecoderStack::init()
{
+ gate_summary.reset();
_sample_count = 0;
_samples_decoded = 0;
_error_message = QString();
@@ -814,6 +815,9 @@
const srd_decoder *const decc = pdata->pdo->di->decoder;
assert(decc);
+ if (strcmp(decc->id, "gate_driver_timing") == 0)
+ d->gate_summary.observe(a->format());
+
auto row_iter = d->_rows.end();
// Try looking up the sub-row of this class
--- a/DSView/pv/dock/protocoldock.cpp
+++ b/DSView/pv/dock/protocoldock.cpp
@@ -190,6 +190,42 @@
match_layout->addStretch(1);
QVBoxLayout *bot_layout = new QVBoxLayout();
+ auto gate_status = new QLabel(bot_panel);
+ gate_status->setObjectName("gateDriverSummary");
+ gate_status->setAlignment(Qt::AlignCenter);
+ gate_status->setMinimumHeight(64);
+ gate_status->hide();
+ bot_layout->addWidget(gate_status);
+ auto gate_timer = new QTimer(this);
+ connect(gate_timer, &QTimer::timeout, this, [this, gate_status]() {
+ int severity = 0;
+ int drivers = 0;
+ bool complete = true;
+ for (auto trace : _session->get_decode_signals()) {
+ auto stack = trace->decoder();
+ if (QString(stack->get_root_decoder_id()) != "gate_driver_timing") continue;
+ ++drivers;
+ const bool done = !stack->IsRunning() && stack->get_progress() == 100;
+ complete = complete && done;
+ int result = stack->gate_summary.severity(done);
+ if (stack->out_of_memory() || !stack->error_message().isEmpty())
+ result = qMax(result, 1);
+ severity = qMax(severity, result);
+ }
+ gate_status->setVisible(drivers > 0);
+ if (!drivers) return;
+ const QString text = severity == 2 ? "FAULT" : severity == 1 ? "WARNING" : "OK";
+ const QString color = severity == 2 ? "#ff6262" : severity == 1 ? "#ffc857" : "#41d687";
+ if (gate_status->text() != text) {
+ gate_status->setText(text);
+ gate_status->setStyleSheet("QLabel#gateDriverSummary { font-size: 32px; font-weight: bold; "
+ "padding: 8px; border: 2px solid " + color + "; border-radius: 6px; color: " + color + "; }");
+ }
+ gate_status->setToolTip(complete
+ ? QString::fromUtf8("Итог всех анализаторов драйвера за всю запись. FAULT: ошибки ACK, Vstat или входов; WARNING: предупреждения, неполные события или нет подтверждений; OK: проверки пройдены.")
+ : QString::fromUtf8("Анализ ещё не завершён. Итог OK пока недоступен."));
+ });
+ gate_timer->start(250);
bot_layout->addLayout(bot_title_layout);
bot_layout->addLayout(ann_search_layout);
bot_layout->addLayout(match_layout);