forked from Ivasoft/DSView
Get the triged time
This commit is contained in:
@@ -99,6 +99,7 @@ namespace pv
|
||||
_is_stream_mode = false;
|
||||
_is_action = false;
|
||||
_decoder_pannel = NULL;
|
||||
_is_triged = false;
|
||||
|
||||
_data_list.push_back(new SessionData());
|
||||
_data_list.push_back(new SessionData());
|
||||
@@ -125,7 +126,8 @@ namespace pv
|
||||
_feed_timer.SetCallback(std::bind(&SigSession::feed_timeout, this));
|
||||
_repeat_timer.SetCallback(std::bind(&SigSession::repeat_capture_wait_timeout, this));
|
||||
_repeat_wait_prog_timer.SetCallback(std::bind(&SigSession::repeat_wait_prog_timeout, this));
|
||||
_refresh_rt_timer.SetCallback(std::bind(&SigSession::realtime_refresh_timeout, this));
|
||||
_refresh_rt_timer.SetCallback(std::bind(&SigSession::realtime_refresh_timeout, this));
|
||||
_trig_check_timer.SetCallback(std::bind(&SigSession::trig_check_timeout, this));
|
||||
}
|
||||
|
||||
SigSession::SigSession(SigSession &o)
|
||||
@@ -534,6 +536,8 @@ namespace pv
|
||||
set_cur_snap_samplerate(_device_agent.get_sample_rate());
|
||||
set_cur_samplelimits(_device_agent.get_sample_limit());
|
||||
|
||||
set_session_time(QDateTime::currentDateTime());
|
||||
|
||||
int mode = _device_agent.get_work_mode();
|
||||
if (mode == LOGIC)
|
||||
{
|
||||
@@ -588,6 +592,7 @@ namespace pv
|
||||
if (is_realtime_refresh()){
|
||||
_refresh_rt_timer.Start(1000 / 30);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -610,6 +615,7 @@ namespace pv
|
||||
}
|
||||
|
||||
_capture_times++;
|
||||
_is_triged = false;
|
||||
|
||||
int mode = _device_agent.get_work_mode();
|
||||
bool bAddDecoder = false;
|
||||
@@ -651,6 +657,12 @@ namespace pv
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == LOGIC && _device_agent.is_hardware()
|
||||
&& _device_agent.get_hardware_operation_mode() == LO_OP_BUFFER)
|
||||
{
|
||||
_trig_check_timer.Start(200);
|
||||
}
|
||||
|
||||
if (bAddDecoder){
|
||||
clear_all_decode_task2();
|
||||
clear_decode_result();
|
||||
@@ -1133,7 +1145,13 @@ namespace pv
|
||||
{
|
||||
dsv_err("Unexpected logic packet");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_is_triged && o.length > 0)
|
||||
{
|
||||
_is_triged = true;
|
||||
_trig_time = QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
if (_capture_data->get_logic()->last_ended())
|
||||
{
|
||||
@@ -1180,6 +1198,13 @@ namespace pv
|
||||
|
||||
_dso_packet_count++;
|
||||
|
||||
if (!_is_triged && o.num_samples > 0)
|
||||
{
|
||||
_is_triged = true;
|
||||
_trig_time = QDateTime::currentDateTime();
|
||||
set_session_time(_trig_time);
|
||||
}
|
||||
|
||||
if (_capture_data->get_dso()->last_ended())
|
||||
{
|
||||
// reset scale of dso signal
|
||||
@@ -1372,7 +1397,6 @@ namespace pv
|
||||
_callback->trigger_message(DSV_MSG_REV_END_PACKET);
|
||||
}
|
||||
else{
|
||||
set_session_time(QDateTime::currentDateTime());
|
||||
_callback->frame_ended();
|
||||
}
|
||||
}
|
||||
@@ -2158,6 +2182,8 @@ namespace pv
|
||||
clear_decode_result();
|
||||
}
|
||||
|
||||
_trig_check_timer.Stop();
|
||||
|
||||
//Switch the caputrued data buffer to view.
|
||||
if (bSwapBuffer)
|
||||
{
|
||||
@@ -2166,6 +2192,7 @@ namespace pv
|
||||
|
||||
_view_data = _capture_data;
|
||||
attach_data_to_signal(_view_data);
|
||||
set_session_time(_trig_time);
|
||||
}
|
||||
|
||||
for (auto de : _decode_traces)
|
||||
@@ -2400,4 +2427,22 @@ namespace pv
|
||||
}
|
||||
}
|
||||
|
||||
void SigSession::trig_check_timeout()
|
||||
{
|
||||
bool triged = false;
|
||||
int pro;
|
||||
|
||||
if (_is_triged){
|
||||
_trig_check_timer.Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_capture_status(triged, pro) && triged)
|
||||
{
|
||||
_trig_time = QDateTime::currentDateTime();
|
||||
_is_triged = true;
|
||||
_trig_check_timer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pv
|
||||
|
||||
@@ -184,14 +184,18 @@ public:
|
||||
start_capture(_is_instant);
|
||||
}
|
||||
|
||||
inline void set_session_time(QDateTime time){
|
||||
_session_time = time;
|
||||
}
|
||||
|
||||
inline QDateTime get_session_time(){
|
||||
return _session_time;
|
||||
}
|
||||
|
||||
inline QDateTime get_trig_time(){
|
||||
return _trig_time;
|
||||
}
|
||||
|
||||
inline bool is_triged(){
|
||||
return _is_triged;
|
||||
}
|
||||
|
||||
inline uint64_t get_trigger_pos(){
|
||||
return _trigger_pos;
|
||||
}
|
||||
@@ -472,6 +476,10 @@ private:
|
||||
|
||||
bool action_start_capture(bool instant);
|
||||
bool action_stop_capture();
|
||||
|
||||
inline void set_session_time(QDateTime time){
|
||||
_session_time = time;
|
||||
}
|
||||
|
||||
//IMessageListener
|
||||
void OnMessage(int msg);
|
||||
@@ -510,6 +518,7 @@ private:
|
||||
void repeat_capture_wait_timeout();
|
||||
void repeat_wait_prog_timeout();
|
||||
void realtime_refresh_timeout();
|
||||
void trig_check_timeout();
|
||||
|
||||
void clear_signals();
|
||||
|
||||
@@ -544,6 +553,7 @@ private:
|
||||
DsTimer _repeat_timer;
|
||||
DsTimer _repeat_wait_prog_timer;
|
||||
DsTimer _refresh_rt_timer;
|
||||
DsTimer _trig_check_timer;
|
||||
|
||||
int _noData_cnt;
|
||||
bool _data_lock;
|
||||
@@ -551,6 +561,8 @@ private:
|
||||
int _data_auto_lock;
|
||||
|
||||
QDateTime _session_time;
|
||||
QDateTime _trig_time;
|
||||
bool _is_triged;
|
||||
uint64_t _trigger_pos;
|
||||
bool _trigger_flag;
|
||||
uint8_t _trigger_ch;
|
||||
|
||||
@@ -226,7 +226,7 @@ void View::capture_init()
|
||||
set_scale_offset(_maxscale, 0);
|
||||
|
||||
status_clear();
|
||||
_trig_time_setted = false;
|
||||
|
||||
_trig_hoff = 0;
|
||||
}
|
||||
|
||||
@@ -458,15 +458,6 @@ void View::frame_began()
|
||||
set_search_pos(_search_pos, _search_hit);
|
||||
}
|
||||
|
||||
void View::set_trig_time()
|
||||
{
|
||||
if (!_trig_time_setted && _device_agent->get_work_mode() == LOGIC) {
|
||||
_session->set_session_time(QDateTime::currentDateTime());
|
||||
_viewbottom->set_trig_time(_session->get_session_time());
|
||||
}
|
||||
_trig_time_setted = true;
|
||||
}
|
||||
|
||||
void View::receive_end()
|
||||
{
|
||||
if (_device_agent->get_work_mode() == LOGIC) {
|
||||
|
||||
@@ -375,13 +375,6 @@ public slots:
|
||||
// --
|
||||
void update_hori_res();
|
||||
|
||||
// --
|
||||
void set_trig_time();
|
||||
|
||||
inline bool trig_time_setted(){
|
||||
return _trig_time_setted;
|
||||
}
|
||||
|
||||
//
|
||||
void header_updated();
|
||||
|
||||
@@ -473,7 +466,6 @@ private:
|
||||
bool _dso_auto;
|
||||
bool _show_lissajous;
|
||||
bool _back_ready;
|
||||
bool _trig_time_setted;
|
||||
DeviceAgent *_device_agent;
|
||||
};
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ Viewport::Viewport(View &parent, View_type type) :
|
||||
_timer_cnt = 0;
|
||||
_clickX = 0;
|
||||
_sample_received = 0;
|
||||
_is_checked_trig = false;
|
||||
|
||||
_lst_wait_tigger_time = high_resolution_clock::now();
|
||||
_tigger_wait_times = 0;
|
||||
@@ -593,7 +594,6 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
||||
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_CAPTURED), "% Captured"));
|
||||
_view.set_trig_time();
|
||||
}
|
||||
else {
|
||||
p.drawText(status_rect,
|
||||
@@ -606,10 +606,7 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back)
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
if (!_view.trig_time_setted())
|
||||
_view.set_trig_time();
|
||||
|
||||
else {
|
||||
p.setPen(View::Green);
|
||||
QFont font=p.font();
|
||||
font.setPointSize(50);
|
||||
@@ -1366,6 +1363,7 @@ void Viewport::set_receive_len(quint64 length)
|
||||
_sample_received = 0;
|
||||
start_trigger_timer(333);
|
||||
_tigger_wait_times = 0;
|
||||
_is_checked_trig = false;
|
||||
}
|
||||
else {
|
||||
stop_trigger_timer();
|
||||
@@ -1374,10 +1372,19 @@ void Viewport::set_receive_len(quint64 length)
|
||||
_sample_received = _view.session().cur_samplelimits();
|
||||
else
|
||||
_sample_received += length;
|
||||
}
|
||||
}
|
||||
|
||||
if (_view.session().get_device()->get_work_mode() == LOGIC)
|
||||
{
|
||||
if (_view.session().get_device()->is_file() == false)
|
||||
{
|
||||
if (!_is_checked_trig && _view.session().is_triged()){
|
||||
_view.get_viewstatus()->set_trig_time(_view.session().get_trig_time());
|
||||
_view.get_viewstatus()->update();
|
||||
_is_checked_trig = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (_view.session().is_repeat_mode())
|
||||
{
|
||||
double progress = 0;
|
||||
@@ -1886,6 +1893,23 @@ void Viewport::stop_trigger_timer()
|
||||
void Viewport::on_trigger_timer()
|
||||
{
|
||||
_timer_cnt++;
|
||||
|
||||
if (!_is_checked_trig)
|
||||
{
|
||||
if (_view.session().get_device()->get_work_mode() == LOGIC
|
||||
&& _view.session().get_device()->is_file() == false)
|
||||
{
|
||||
if (_view.session().is_triged()){
|
||||
_is_checked_trig = true;
|
||||
_view.get_viewstatus()->set_trig_time(_view.session().get_trig_time());
|
||||
_view.get_viewstatus()->update();
|
||||
}
|
||||
}
|
||||
else{
|
||||
_is_checked_trig = true;
|
||||
}
|
||||
}
|
||||
|
||||
update(); // To refresh the trigger status information.
|
||||
}
|
||||
|
||||
|
||||
@@ -195,6 +195,7 @@ private:
|
||||
QString _em_edges;
|
||||
|
||||
QTimer _trigger_timer;
|
||||
bool _is_checked_trig;
|
||||
bool _transfer_started;
|
||||
int _timer_cnt;
|
||||
Signal *_drag_sig;
|
||||
|
||||
@@ -190,6 +190,7 @@ void ViewStatus::repeat_unshow()
|
||||
void ViewStatus::set_trig_time(QDateTime time)
|
||||
{
|
||||
_trig_time = L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TRIGGER_TIME), "Trigger Time: ") + time.toString("yyyy-MM-dd hh:mm:ss");
|
||||
// assert(0);
|
||||
}
|
||||
|
||||
void ViewStatus::set_rle_depth(uint64_t depth)
|
||||
|
||||
Reference in New Issue
Block a user