diff --git a/DSView/pv/dock/protocoldock.cpp b/DSView/pv/dock/protocoldock.cpp index 7a540ea0..a3106768 100644 --- a/DSView/pv/dock/protocoldock.cpp +++ b/DSView/pv/dock/protocoldock.cpp @@ -999,7 +999,7 @@ bool ProtocolDock::protocol_sort_callback(const DecoderInfoItem *o1, const Decod } } - void ProtocolDock::ResetView() + void ProtocolDock::reset_view() { decoded_progress(0); } diff --git a/DSView/pv/dock/protocoldock.h b/DSView/pv/dock/protocoldock.h index 6d2e5ba1..2776eb4f 100644 --- a/DSView/pv/dock/protocoldock.h +++ b/DSView/pv/dock/protocoldock.h @@ -84,7 +84,7 @@ public: void del_all_protocol(); bool add_protocol_by_id(QString id, bool silent, std::list &sub_decoders); - void ResetView(); + void reset_view(); private: void changeEvent(QEvent *event); diff --git a/DSView/pv/interface/icallbacks.h b/DSView/pv/interface/icallbacks.h index d3ebc219..e06fa1c1 100644 --- a/DSView/pv/interface/icallbacks.h +++ b/DSView/pv/interface/icallbacks.h @@ -90,6 +90,7 @@ public: #define DSV_MSG_TRIG_NEXT_COLLECT 7001 #define DSV_MSG_SAVE_COMPLETE 7002 +#define DSV_MSG_STORE_CONF_PREV 7003 #define DSV_MSG_CLEAR_DECODE_DATA 8001 diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp index d9d9a2ae..43a04f0f 100644 --- a/DSView/pv/mainwindow.cpp +++ b/DSView/pv/mainwindow.cpp @@ -1005,7 +1005,7 @@ namespace pv } // update UI settings - _sampling_bar->update_sample_rate_selector(); + _sampling_bar->update_sample_rate_list(); _trigger_widget->device_updated(); _view->header_updated(); @@ -1691,7 +1691,7 @@ namespace pv break; case DSV_MSG_DEVICE_MODE_CHANGED: - _sampling_bar->update_sample_rate_selector(); + _sampling_bar->update_sample_rate_list(); _view->mode_changed(); reset_all_view(); load_device_config(); @@ -1759,7 +1759,13 @@ namespace pv break; case DSV_MSG_CLEAR_DECODE_DATA: - _protocol_widget->ResetView(); + _protocol_widget->reset_view(); + break; + + case DSV_MSG_STORE_CONF_PREV: + if (_device_agent->is_hardware() && _session->have_hardware_data() == false){ + _sampling_bar->commit_settings(); + } break; } } diff --git a/DSView/pv/toolbars/filebar.cpp b/DSView/pv/toolbars/filebar.cpp index 5bd08ced..8594c264 100644 --- a/DSView/pv/toolbars/filebar.cpp +++ b/DSView/pv/toolbars/filebar.cpp @@ -32,6 +32,7 @@ #include "../ui/langresource.h" #include "../log.h" +#include "../interface/icallbacks.h" namespace pv { namespace toolbars { @@ -104,8 +105,6 @@ void FileBar::changeEvent(QEvent *event) QToolBar::changeEvent(event); } - - void FileBar::retranslateUi() { _file_button.setText(L_S(STR_PAGE_TOOLBAR, S_ID(IDS_FILEBAR_FILE), "File")); @@ -223,6 +222,8 @@ void FileBar::on_actionStore_triggered() app._userHistory.sessionDir = fname; app.SaveHistory(); } + + _session->broadcast_msg(DSV_MSG_STORE_CONF_PREV); sig_store_session(file_name); } diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index 4a8a0adf..ee0734fe 100644 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -273,7 +273,7 @@ namespace pv { _session->broadcast_msg(DSV_MSG_DEVICE_OPTIONS_UPDATED); - update_sample_rate_selector(); + update_sample_rate_list(); int mode = _device_agent->get_work_mode(); GVariant *gvar; @@ -634,7 +634,8 @@ namespace pv { for (int i = 0; i < _sample_count.count(); i++) { - if (pre_duration >= _sample_count.itemData(i).value()) + double sel_val = _sample_count.itemData(i).value(); + if (pre_duration >= sel_val) { _sample_count.setCurrentIndex(i); break; @@ -690,11 +691,13 @@ namespace pv assert(!_updating_sample_count); _updating_sample_count = true; - if (duration != _sample_count.itemData(_sample_count.currentIndex()).value()) + double cur_duration = _sample_count.itemData(_sample_count.currentIndex()).value(); + if (duration != cur_duration) { for (int i = 0; i < _sample_count.count(); i++) { - if (duration >= _sample_count.itemData(i).value()) + double sel_val = _sample_count.itemData(i).value(); + if (duration >= sel_val) { _sample_count.setCurrentIndex(i); break; @@ -1132,7 +1135,7 @@ namespace pv _device_selector.setCurrentIndex(select_index); if (cur_dev_handle != _last_device_handle){ - update_sample_rate_selector(); + update_sample_rate_list(); _last_device_handle = cur_dev_handle; } diff --git a/DSView/pv/toolbars/samplingbar.h b/DSView/pv/toolbars/samplingbar.h index 8e83c6e1..2d0b96ca 100644 --- a/DSView/pv/toolbars/samplingbar.h +++ b/DSView/pv/toolbars/samplingbar.h @@ -84,7 +84,6 @@ namespace pv void update_view_status(); void config_device(); ds_device_handle get_next_device_handle(); - void update_sample_rate_selector(); inline void set_view(view::View *view){ _view = view; @@ -94,6 +93,13 @@ namespace pv void run_or_stop_instant(); + inline void update_sample_rate_list() + { + update_sample_rate_selector(); + } + + void commit_settings(); + signals: void sig_store_session_data(); @@ -103,11 +109,12 @@ namespace pv void reStyle(); void set_sample_rate(uint64_t sample_rate); double commit_hori_res(); + + void update_sample_rate_selector(); void update_sample_rate_selector_value(); void update_sample_count_selector(); - void update_sample_count_selector_value(); - void commit_settings(); + void update_sample_count_selector_value(); void setting_adj(); void enable_toggle(bool enable); void update_mode_icon(); diff --git a/libsigrok4DSL/hwdriver.c b/libsigrok4DSL/hwdriver.c index 8d62a633..65112156 100644 --- a/libsigrok4DSL/hwdriver.c +++ b/libsigrok4DSL/hwdriver.c @@ -48,8 +48,8 @@ static struct sr_config_info sr_config_info_data[] = { {SR_CONF_CONN, SR_T_CHAR, "Connection"}, {SR_CONF_SERIALCOMM, SR_T_CHAR,"Serial communication"}, {SR_CONF_SAMPLERATE, SR_T_UINT64,"Sample rate"}, - {SR_CONF_LIMIT_SAMPLES, SR_T_UINT64,"Sample depth"}, - {SR_CONF_ACTUAL_SAMPLES, SR_T_UINT64,"Sample count"}, + {SR_CONF_LIMIT_SAMPLES, SR_T_UINT64,"Sample count"}, + {SR_CONF_ACTUAL_SAMPLES, SR_T_UINT64,"Sample count-actual"}, {SR_CONF_CLOCK_TYPE, SR_T_BOOL,"Using External Clock"}, {SR_CONF_CLOCK_EDGE, SR_T_BOOL, "Using Clock Negedge"}, {SR_CONF_CAPTURE_RATIO, SR_T_UINT64,"Pre-trigger capture ratio"},