71 lines
4.1 KiB
Diff
71 lines
4.1 KiB
Diff
--- a/DSView/pv/view/decodetrace.cpp
|
|
+++ b/DSView/pv/view/decodetrace.cpp
|
|
@@ -33,6 +33,7 @@
|
|
#include <QScrollArea>
|
|
#include <QApplication>
|
|
#include "decodetrace.h"
|
|
+#include "pwm_waveform.h"
|
|
#include "../sigsession.h"
|
|
#include "../data/decoderstack.h"
|
|
#include "../data/decode/decoder.h"
|
|
@@ -269,5 +270,35 @@
|
|
if ((*i).second) {
|
|
const Row &row = (*i).first;
|
|
+ // A PWM envelope stays a curve even when carrier periods
|
|
+ // are narrower than a pixel (normal annotation fallback
|
|
+ // would replace the entire sine with a solid box).
|
|
+ if (QString::fromUtf8(dec->decoder()->id) == "pwm_waveform"
|
|
+ && row.row() && QString::fromUtf8(row.row()->id).startsWith("wave_")) {
|
|
+ std::vector<Annotation*> points;
|
|
+ _decoder_stack->get_annotation_subset(points, row, start_sample, end_sample);
|
|
+ p.save();
|
|
+ const int wave_y = y + annotation_height;
|
|
+ p.setClipRect(QRectF(left, y - annotation_height * 0.5,
|
|
+ right - left, annotation_height * 3));
|
|
+ p.setPen(QPen(fore, 1, Qt::DotLine));
|
|
+ p.drawLine(QPointF(left, wave_y), QPointF(right, wave_y));
|
|
+ p.setRenderHint(QPainter::Antialiasing, true);
|
|
+ for (Annotation *a : points) {
|
|
+ if (a->annotations().empty()) continue;
|
|
+ const QColor colors[] = {QColor(80, 210, 255), QColor(255, 194, 70), QColor(145, 230, 100)};
|
|
+ p.setPen(QPen(colors[a->format() % 3], 1.6));
|
|
+ set_pwm::draw(p, a->annotations().back(),
|
|
+ a->start_sample() / samples_per_pixel - pixels_offset,
|
|
+ a->end_sample() / samples_per_pixel - pixels_offset,
|
|
+ wave_y, annotation_height * 1.20);
|
|
+ }
|
|
+ p.restore();
|
|
+ y += annotation_height * 3;
|
|
+ _cur_row_headings.push_back(row.title());
|
|
+ _cur_row_headings.push_back(QString());
|
|
+ _cur_row_headings.push_back(QString());
|
|
+ continue;
|
|
+ }
|
|
|
|
const uint64_t min_annotation =
|
|
_decoder_stack->get_min_annotation(row);
|
|
@@ -586,7 +617,12 @@
|
|
if (_row.decoder() == dec->decoder() &&
|
|
_decoder_stack->has_annotations((*i).first) &&
|
|
(*i).second)
|
|
+ {
|
|
size++;
|
|
+ if (QString::fromUtf8(dec->decoder()->id) == "pwm_waveform"
|
|
+ && _row.row() && QString::fromUtf8(_row.row()->id).startsWith("wave_"))
|
|
+ size += 2;
|
|
+ }
|
|
}
|
|
}
|
|
else {
|
|
--- a/DSView/pv/dock/protocoldock.cpp
|
|
+++ b/DSView/pv/dock/protocoldock.cpp
|
|
@@ -1060,7 +1060,7 @@
|
|
{
|
|
SearchComboBox *panel = new SearchComboBox(this);
|
|
|
|
- const QStringList customIds = {"gate_driver_timing", "transistor_pair", "set_uart", "set_can", "pm35_uart", "tms_uart", "plates_pbus", "plates_sbus"}; // При сборке пользовательский раздел включает анализаторы обеих шин 96-контактного интерфейса.
|
|
+ const QStringList customIds = {"gate_driver_timing", "transistor_pair", "pwm_waveform", "set_uart", "set_can", "pm35_uart", "tms_uart", "plates_pbus", "plates_sbus"}; // При сборке пользовательский раздел включает анализаторы обеих шин 96-контактного интерфейса.
|
|
for (bool custom : {true, false}) {
|
|
for (auto info : _decoderInfoList) {
|
|
srd_decoder *dec = (srd_decoder *)(info->_data_handle);
|