Skip to content

Commit

Permalink
Update decoded data table on each new annotation
Browse files Browse the repository at this point in the history
Currently, the decoded data table only gets updated on 10% steps of the
overall capture time. This slows down updating of the table on long
running sessions, making realtime inspection of e.g. I2C communication
impossible.

Instead of relying on the capture progress, bind the table update to the
annotation generation.

Fixes: DreamSourceLab#728
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
  • Loading branch information
c0d3z3r0 committed Jan 24, 2024
1 parent 58a5bf0 commit b9288b1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions DSView/pv/data/decoderstack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *self)
// Add the annotation
if (!(*row_iter).second->push_annotation(a))
d->_no_memory = true;
d->new_annotation();
}

void DecoderStack::frame_ended()
Expand Down
1 change: 1 addition & 0 deletions DSView/pv/data/decoderstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class DecoderStack : public QObject, public SignalData
signals:
void new_decode_data();
void decode_done();
void new_annotation();

private:
std::list<decode::Decoder*> _stack;
Expand Down
11 changes: 6 additions & 5 deletions DSView/pv/dock/protocoldock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,10 @@ bool ProtocolDock::add_protocol_by_id(QString id, bool silent, std::list<pv::dat
// progress connection
const auto &decode_sigs = _session->get_decode_signals();
protocol_updated();
connect(decode_sigs.back(), SIGNAL(decoded_progress(int)), this, SLOT(decoded_progress(int)));
connect(decode_sigs.back(), SIGNAL(decoded_progress()), this, SLOT(decoded_progress()));

const auto _decoder_stack = _session->get_decoder_model()->getDecoderStack();
connect(_decoder_stack, SIGNAL(new_annotation()), this, SLOT(update_model()));

return true;
}
Expand Down Expand Up @@ -451,7 +454,7 @@ void ProtocolDock::del_all_protocol()
}
}

void ProtocolDock::decoded_progress(int progress)
void ProtocolDock::decoded_progress()
{
const auto &decode_sigs = _session->get_decode_signals();
unsigned int index = 0;
Expand All @@ -477,10 +480,8 @@ void ProtocolDock::decoded_progress(int progress)
index++;
}

if (progress == 0 || progress % 10 == 1){
update_model();
}
}

void ProtocolDock::set_model()
{
Expand Down Expand Up @@ -1017,7 +1018,7 @@ bool ProtocolDock::protocol_sort_callback(const DecoderInfoItem *o1, const Decod

void ProtocolDock::reset_view()
{
decoded_progress(0);
decoded_progress();
update();
}

Expand Down
2 changes: 1 addition & 1 deletion DSView/pv/dock/protocoldock.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public slots:
private slots:
void on_add_protocol();
void on_del_all_protocol();
void decoded_progress(int progress);
void decoded_progress();
void set_model();
void export_table_view();
void nav_table_view();
Expand Down
2 changes: 1 addition & 1 deletion DSView/pv/view/decodetrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ void DecodeTrace::draw_unshown_row(QPainter &p, int y, int h, int left,

void DecodeTrace::on_new_decode_data()
{
decoded_progress(_decoder_stack->get_progress());
decoded_progress();

if (_view && _view->session().is_stopped_status())
_view->data_updated();
Expand Down
2 changes: 1 addition & 1 deletion DSView/pv/view/decodetrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class DecodeTrace : public Trace


signals:
void decoded_progress(int progress);
void decoded_progress();

private slots:
void on_new_decode_data();
Expand Down

0 comments on commit b9288b1

Please sign in to comment.