forked from Ivasoft/DSView
fix: The captured progress status is error on repeat mode
This commit is contained in:
@@ -458,14 +458,25 @@ namespace pv
|
|||||||
|
|
||||||
int run_dex = 0;
|
int run_dex = 0;
|
||||||
clear_all_decode_task(run_dex);
|
clear_all_decode_task(run_dex);
|
||||||
|
|
||||||
|
_capture_data->clear();
|
||||||
|
_view_data->clear();
|
||||||
|
|
||||||
// If switch the data buffer
|
if (_device_agent.get_work_mode() == LOGIC && is_repeat_mode())
|
||||||
if (_view_data != _capture_data){
|
{
|
||||||
_capture_data->clear();
|
if (_view_data == _capture_data){
|
||||||
|
for (auto dt : _data_list){
|
||||||
|
if (dt != _view_data){
|
||||||
|
_capture_data = dt;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
_capture_data = _view_data;
|
_capture_data = _view_data;
|
||||||
}
|
}
|
||||||
_view_data->clear();
|
|
||||||
|
|
||||||
update_view();
|
update_view();
|
||||||
|
|
||||||
// update setting
|
// update setting
|
||||||
@@ -631,7 +642,7 @@ namespace pv
|
|||||||
sr_status status;
|
sr_status status;
|
||||||
|
|
||||||
if (_device_agent.get_status(status, true))
|
if (_device_agent.get_status(status, true))
|
||||||
{
|
{
|
||||||
triggered = status.trig_hit & 0x01;
|
triggered = status.trig_hit & 0x01;
|
||||||
uint64_t captured_cnt = status.trig_hit >> 2;
|
uint64_t captured_cnt = status.trig_hit >> 2;
|
||||||
captured_cnt = ((uint64_t)status.captured_cnt0 +
|
captured_cnt = ((uint64_t)status.captured_cnt0 +
|
||||||
@@ -647,6 +658,7 @@ namespace pv
|
|||||||
progress = (sample_limits - captured_cnt) * 100.0 / sample_limits;
|
progress = (sample_limits - captured_cnt) * 100.0 / sample_limits;
|
||||||
else
|
else
|
||||||
progress = captured_cnt * 100.0 / sample_limits;
|
progress = captured_cnt * 100.0 / sample_limits;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1138,14 +1138,10 @@ void View::repeat_show()
|
|||||||
_viewbottom->update();
|
_viewbottom->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::update_capture_status()
|
void View::show_captured_progress(bool triggered, int progress)
|
||||||
{
|
{
|
||||||
bool triggered;
|
_viewbottom->set_capture_status(triggered, progress);
|
||||||
int progress;
|
_viewbottom->update();
|
||||||
if (_session->get_capture_status(triggered, progress)) {
|
|
||||||
_viewbottom->set_capture_status(triggered, progress);
|
|
||||||
_viewbottom->update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool View::get_dso_trig_moved()
|
bool View::get_dso_trig_moved()
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ public:
|
|||||||
|
|
||||||
void viewport_update();
|
void viewport_update();
|
||||||
|
|
||||||
void update_capture_status();
|
void show_captured_progress(bool triggered, int progress);
|
||||||
|
|
||||||
bool get_dso_trig_moved();
|
bool get_dso_trig_moved();
|
||||||
|
|
||||||
|
|||||||
@@ -187,9 +187,18 @@ void Viewport::doPaint()
|
|||||||
paintSignals(p, fore, back);
|
paintSignals(p, fore, back);
|
||||||
}
|
}
|
||||||
else if (_view.session().is_running_status()){
|
else if (_view.session().is_running_status()){
|
||||||
if (_view.session().is_repeat_mode())// && !_transfer_started)
|
if (_view.session().is_repeat_mode())
|
||||||
{
|
{
|
||||||
paintSignals(p, fore, back);
|
paintSignals(p, fore, back);
|
||||||
|
|
||||||
|
if (!_transfer_started){
|
||||||
|
bool triggered;
|
||||||
|
int captured_progress;
|
||||||
|
|
||||||
|
if (_view.session().get_capture_status(triggered, captured_progress)){
|
||||||
|
_view.show_captured_progress(_transfer_started, captured_progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (_type == TIME_VIEW) {
|
else if (_type == TIME_VIEW) {
|
||||||
_view.repeat_unshow();
|
_view.repeat_unshow();
|
||||||
@@ -414,6 +423,13 @@ void Viewport::paintSignals(QPainter &p, QColor fore, QColor back)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewport::get_captured_progress(double &progress, int &progress100)
|
||||||
|
{
|
||||||
|
const uint64_t sample_limits = _view.session().cur_samplelimits();
|
||||||
|
progress = -(_sample_received * 1.0 / sample_limits * 360 * 16);
|
||||||
|
progress100 = ceil(progress / -3.6 / 16);
|
||||||
|
}
|
||||||
|
|
||||||
void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
||||||
{
|
{
|
||||||
(void)back;
|
(void)back;
|
||||||
@@ -427,9 +443,12 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
|||||||
|
|
||||||
const uint64_t sample_limits = _view.session().cur_samplelimits();
|
const uint64_t sample_limits = _view.session().cur_samplelimits();
|
||||||
|
|
||||||
double progress = -(_sample_received * 1.0 / sample_limits * 360 * 16);
|
double progress = 0;
|
||||||
|
int progress100 = 0;
|
||||||
int captured_progress = 0;
|
int captured_progress = 0;
|
||||||
|
|
||||||
|
get_captured_progress(progress, progress100);
|
||||||
|
|
||||||
p.setRenderHint(QPainter::Antialiasing, true);
|
p.setRenderHint(QPainter::Antialiasing, true);
|
||||||
p.setPen(Qt::gray);
|
p.setPen(Qt::gray);
|
||||||
p.setBrush(Qt::NoBrush);
|
p.setBrush(Qt::NoBrush);
|
||||||
@@ -440,6 +459,7 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
|||||||
p.drawArc(cenPos.x() - radius, cenPos.y() - radius, 2* radius, 2 * radius, 180 * 16, progress);
|
p.drawArc(cenPos.x() - radius, cenPos.y() - radius, 2* radius, 2 * radius, 180 * 16, progress);
|
||||||
|
|
||||||
p.setPen(Qt::gray);
|
p.setPen(Qt::gray);
|
||||||
|
|
||||||
const QPoint logoPoints[] = {
|
const QPoint logoPoints[] = {
|
||||||
QPoint(cenPos.x() - 0.75 * radius, cenPos.y()),
|
QPoint(cenPos.x() - 0.75 * radius, cenPos.y()),
|
||||||
QPoint(cenPos.x() - 0.75 * radius, cenPos.y() + 0.15 * radius),
|
QPoint(cenPos.x() - 0.75 * radius, cenPos.y() + 0.15 * radius),
|
||||||
@@ -462,6 +482,7 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
|||||||
QPoint(cenPos.x() + 0.75 * radius, cenPos.y()),
|
QPoint(cenPos.x() + 0.75 * radius, cenPos.y()),
|
||||||
QPoint(cenPos.x() + 0.75 * radius, cenPos.y() - 0.15 * radius)
|
QPoint(cenPos.x() + 0.75 * radius, cenPos.y() - 0.15 * radius)
|
||||||
};
|
};
|
||||||
|
|
||||||
const int logoRadius = 10;
|
const int logoRadius = 10;
|
||||||
p.drawLine(logoPoints[0], logoPoints[1]);
|
p.drawLine(logoPoints[0], logoPoints[1]);
|
||||||
p.drawLine(logoPoints[2], logoPoints[3]);
|
p.drawLine(logoPoints[2], logoPoints[3]);
|
||||||
@@ -511,6 +532,7 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
|||||||
p.drawEllipse(cenRightPos, trigger_radius, trigger_radius);
|
p.drawEllipse(cenRightPos, trigger_radius, trigger_radius);
|
||||||
|
|
||||||
bool triggered;
|
bool triggered;
|
||||||
|
|
||||||
if (_view.session().get_capture_status(triggered, captured_progress)){
|
if (_view.session().get_capture_status(triggered, captured_progress)){
|
||||||
p.setPen(View::Blue);
|
p.setPen(View::Blue);
|
||||||
QFont font=p.font();
|
QFont font=p.font();
|
||||||
@@ -518,26 +540,29 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
|||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
QRect status_rect = QRect(cenPos.x() - radius, cenPos.y() + radius * 0.4, radius * 2, radius * 0.5);
|
QRect status_rect = QRect(cenPos.x() - radius, cenPos.y() + radius * 0.4, radius * 2, radius * 0.5);
|
||||||
|
|
||||||
if (triggered) {
|
if (triggered) {
|
||||||
p.drawText(status_rect,
|
p.drawText(status_rect,
|
||||||
Qt::AlignCenter | Qt::AlignVCenter,
|
Qt::AlignCenter | Qt::AlignVCenter,
|
||||||
L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TRIGGERED), "Triggered! ") + QString::number(captured_progress)
|
L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TRIGGERED), "Triggered! ") + QString::number(captured_progress)
|
||||||
+ L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CAPTURED), "% Captured"));
|
+ L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CAPTURED), "% Captured"));
|
||||||
_view.set_trig_time();
|
_view.set_trig_time();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
p.drawText(status_rect,
|
p.drawText(status_rect,
|
||||||
Qt::AlignCenter | Qt::AlignVCenter,
|
Qt::AlignCenter | Qt::AlignVCenter,
|
||||||
L_S(STR_PAGE_DLG, S_ID(IDS_DLG_WAITING_FOR_TRIGGER), "Waiting for Trigger! ") + QString::number(captured_progress)
|
L_S(STR_PAGE_DLG, S_ID(IDS_DLG_WAITING_FOR_TRIGGER), "Waiting for Trigger! ") + QString::number(captured_progress)
|
||||||
+ L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CAPTURED), "% Captured"));
|
+ L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CAPTURED), "% Captured"));
|
||||||
}
|
}
|
||||||
|
|
||||||
prgRate(captured_progress);
|
prgRate(captured_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (!_view.trig_time_setted())
|
if (!_view.trig_time_setted())
|
||||||
_view.set_trig_time();
|
_view.set_trig_time();
|
||||||
|
|
||||||
const int progress100 = ceil(progress / -3.6 / 16);
|
|
||||||
p.setPen(View::Green);
|
p.setPen(View::Green);
|
||||||
QFont font=p.font();
|
QFont font=p.font();
|
||||||
font.setPointSize(50);
|
font.setPointSize(50);
|
||||||
@@ -1253,7 +1278,6 @@ bool Viewport::gestureEvent(QNativeGestureEvent *event)
|
|||||||
void Viewport::leaveEvent(QEvent *)
|
void Viewport::leaveEvent(QEvent *)
|
||||||
{
|
{
|
||||||
_mouse_point = QPoint(-1, -1);
|
_mouse_point = QPoint(-1, -1);
|
||||||
//_view.show_cursors(false);
|
|
||||||
|
|
||||||
if (_action_type == LOGIC_EDGE) {
|
if (_action_type == LOGIC_EDGE) {
|
||||||
_edge_rising = 0;
|
_edge_rising = 0;
|
||||||
@@ -1291,6 +1315,7 @@ void Viewport::set_receive_len(quint64 length)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stop_trigger_timer();
|
stop_trigger_timer();
|
||||||
|
|
||||||
if (_sample_received + length > _view.session().cur_samplelimits())
|
if (_sample_received + length > _view.session().cur_samplelimits())
|
||||||
_sample_received = _view.session().cur_samplelimits();
|
_sample_received = _view.session().cur_samplelimits();
|
||||||
else
|
else
|
||||||
@@ -1298,20 +1323,23 @@ void Viewport::set_receive_len(quint64 length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_view.session().get_device()->get_work_mode() == LOGIC)
|
if (_view.session().get_device()->get_work_mode() == LOGIC)
|
||||||
{
|
{
|
||||||
if (_view.session().is_realtime_mode() && _view.session().have_new_realtime_refresh(true) == false){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_view.session().is_repeat_mode())
|
if (_view.session().is_repeat_mode())
|
||||||
{
|
{
|
||||||
_view.update_capture_status();
|
double progress = 0;
|
||||||
|
int progress100 = 0;
|
||||||
|
get_captured_progress(progress, progress100);
|
||||||
|
_view.show_captured_progress(_transfer_started, progress100);
|
||||||
|
|
||||||
// On repeate mode, Not to refresh view when capturring.
|
// Do not to refresh the view until data collection is complete.
|
||||||
if (_view.session().is_single_buffer() == false){
|
return;
|
||||||
|
}
|
||||||
|
else if (_view.session().is_realtime_mode())
|
||||||
|
{
|
||||||
|
if (_view.session().have_new_realtime_refresh(true) == false){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Received new data, and refresh the view.
|
// Received new data, and refresh the view.
|
||||||
|
|||||||
@@ -130,6 +130,8 @@ private:
|
|||||||
void measure();
|
void measure();
|
||||||
void start_trigger_timer(int msec);
|
void start_trigger_timer(int msec);
|
||||||
|
|
||||||
|
void get_captured_progress(double &progress, int &progress100);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_trigger_timer();
|
void on_trigger_timer();
|
||||||
void on_drag_timer();
|
void on_drag_timer();
|
||||||
|
|||||||
Reference in New Issue
Block a user