diff --git a/DSView/pv/sigsession.cpp b/DSView/pv/sigsession.cpp index 561687a8..70d043d9 100644 --- a/DSView/pv/sigsession.cpp +++ b/DSView/pv/sigsession.cpp @@ -468,11 +468,11 @@ namespace pv clear_decode_result(); _capture_data->clear(); - _view_data->clear(); - _capture_data = _view_data; + _view_data->clear(); _is_stream_mode = false; _capture_times = 0; + _capture_data = _view_data; set_cur_snap_samplerate(_device_agent.get_sample_rate()); set_cur_samplelimits(_device_agent.get_sample_limit()); @@ -2085,7 +2085,24 @@ namespace pv if (cur_mode == LOGIC){ clear_all_decode_task2(); - } + } + + _is_stream_mode = false; + if (mode == LOGIC){ + if (_device_agent.is_hardware()){ + _is_stream_mode = _device_agent.is_stream_mode(); + } + else if (_device_agent.is_demo()){ + _is_stream_mode = true; + } + } + + if (_view_data != _capture_data){ + _capture_data->clear(); + _capture_data = _view_data; + } + set_cur_snap_samplerate(_device_agent.get_sample_rate()); + set_cur_samplelimits(_device_agent.get_sample_limit()); init_signals(); dsv_info("Switch work mode to:%d", mode); @@ -2189,4 +2206,15 @@ namespace pv return NULL; } + bool SigSession::is_realtime_refresh() + { + if (is_loop_mode()) + return true; + if (_is_stream_mode && is_single_mode()) + return true; + if (_is_stream_mode && is_repeat_mode() && is_single_buffer()) + return true; + return false; + } + } // namespace pv diff --git a/DSView/pv/sigsession.h b/DSView/pv/sigsession.h index 58b991ed..a9114e43 100644 --- a/DSView/pv/sigsession.h +++ b/DSView/pv/sigsession.h @@ -343,13 +343,7 @@ public: return _opt_mode == OPT_LOOP; } - inline bool is_realtime_refresh(){ - if (is_loop_mode() || (_is_stream_mode && is_single_mode() )) - return true; - if (_is_stream_mode && is_repeat_mode() && is_single_buffer()) - return true; - return false; - } + bool is_realtime_refresh(); inline bool is_repeating(){ return _opt_mode == OPT_REPEAT && !_is_instant; diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index ebd46039..87c70902 100644 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -904,8 +904,8 @@ namespace pv } } - if (_device_agent->get_work_mode() == LOGIC && _session->is_realtime_refresh()){ - if (_view != NULL) + if (_device_agent->get_work_mode() == LOGIC && _view != NULL){ + if (_session->is_realtime_refresh()) _view->auto_set_max_scale(); }