2
0
forked from Ivasoft/DSView

Merge remote-tracking branch 'source/dev-1.3' into demo

This commit is contained in:
yunyaobaihong
2023-06-06 10:23:41 +08:00
10 changed files with 77 additions and 35 deletions

View File

@@ -100,6 +100,7 @@ void _loadApp(AppOptions &o, QSettings &st){
getFiled("transDecoderDlg", st, o.transDecoderDlg, true);
getFiled("trigPosDisplayInMid", st, o.trigPosDisplayInMid, true);
getFiled("displayProfileInBar", st, o.displayProfileInBar, false);
getFiled("swapBackBufferAlways", st, o.swapBackBufferAlways, false);
QString fmt;
getFiled("protocalFormats", st, fmt, "");
@@ -121,6 +122,7 @@ void _saveApp(AppOptions &o, QSettings &st){
setFiled("transDecoderDlg", st, o.transDecoderDlg);
setFiled("trigPosDisplayInMid", st, o.trigPosDisplayInMid);
setFiled("displayProfileInBar", st, o.displayProfileInBar);
setFiled("swapBackBufferAlways", st, o.swapBackBufferAlways);
QString fmt = FormatArrayToString(o.m_protocolFormats);
setFiled("protocalFormats", st, fmt);

View File

@@ -64,6 +64,7 @@ struct AppOptions
bool transDecoderDlg;
bool trigPosDisplayInMid;
bool displayProfileInBar;
bool swapBackBufferAlways;
std::vector<StringPair> m_protocolFormats;
};

View File

@@ -117,6 +117,7 @@ void LogicSnapshot::first_payload(const sr_datafeed_logic &logic, uint64_t total
bool channel_changed = false;
uint16_t channel_num = 0;
_able_free = able_free;
_lst_free_block_index = 0;
for(void *p : _free_block_list){
free(p);
@@ -231,10 +232,20 @@ void LogicSnapshot::append_cross_payload(const sr_datafeed_logic &logic)
return;
_sample_count = _total_sample_count;
}
if (_is_loop && (_loop_offset + samples >= LeafBlockSamples * Scale)){
move_first_node_to_last();
_loop_offset -= LeafBlockSamples * Scale;
if (_is_loop)
{
if (_loop_offset + samples >= LeafBlockSamples * Scale){
move_first_node_to_last();
_loop_offset -= LeafBlockSamples * Scale;
_lst_free_block_index = 0;
}
else{
int free_count = _loop_offset / LeafBlockSamples;
if (free_count > _lst_free_block_index){
free_head_blocks(free_count);
}
}
}
_ring_sample_count += _loop_offset;
@@ -937,6 +948,8 @@ bool LogicSnapshot::block_pre_edge(uint64_t *lbp, uint64_t &index, bool last_sam
const uint64_t last = last_sample ? ~0ULL : 0ULL;
uint64_t block_start = index & ~LeafMask;
assert(lbp);
//----- Search Next Edge Within Current LeafBlock -----//
if (level == 0)
{
@@ -1262,38 +1275,22 @@ void LogicSnapshot::free_decode_lpb(void *lbp)
}
void LogicSnapshot::free_head_blocks(int count)
{
for (unsigned int i = 0; i < _channel_num; i++)
{
for (int j=0; j<count; j++)
{
{
assert(count > 0);
for (int i = 0; i < (int)_channel_num; i++)
{
for (int j=_lst_free_block_index; j<count; j++){
if (_ch_data[i][0].lbp[j] != NULL){
free(_ch_data[i][0].lbp[j]);
_ch_data[i][0].lbp[j] = NULL;
}
}
int rnum = (int)_ch_data[i].size();
uint64_t lst_top = 0;
uint64_t lst_val = 0;
for (int r=0; r<rnum; r++)
{
}
_ch_data[i][0].tog = (_ch_data[i][0].tog) << count;
_ch_data[i][0].value = (_ch_data[i][0].value) << count;
for (int k=count; k < Scale; k++)
{
}
int len = (int)_ch_data[i].size();
_ch_data[i][0].tog = (_ch_data[i][0].tog >> count) << count;
_ch_data[i][0].value = (_ch_data[i][0].value >> count) << count;
}
}
_lst_free_block_index = count;
}
} // namespace data

View File

@@ -237,6 +237,7 @@ private:
bool _able_free;
std::vector<void*> _free_block_list;
struct BlockIndex _cur_ref_block_indexs[CHANNEL_MAX_COUNT];
int _lst_free_block_index;
friend class LogicSnapshotTest::Pow2;
friend class LogicSnapshotTest::Basic;

View File

@@ -66,10 +66,14 @@ bool ApplicationParamDlg::ShowDlg(QWidget *parent)
QCheckBox *ck_profileBar = new QCheckBox();
ck_profileBar->setChecked(app._appOptions.displayProfileInBar);
QCheckBox *ck_abortData = new QCheckBox();
ck_abortData->setChecked(app._appOptions.swapBackBufferAlways);
lay.setHorizontalSpacing(8);
if (mode == LOGIC){
lay.addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_QUICK_SCROLL), "Quick scroll"), ck_quickScroll);
lay.addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_USE_ABORT_DATA_REPEAT), "Used abort data"), ck_abortData);
}
else if (mode == DSO){
lay.addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TRIG_DISPLAY_MIDDLE), "Tig pos in middle"), ck_trigInMid);
@@ -88,6 +92,7 @@ bool ApplicationParamDlg::ShowDlg(QWidget *parent)
app._appOptions.quickScroll = ck_quickScroll->isChecked();
app._appOptions.trigPosDisplayInMid = ck_trigInMid->isChecked();
app._appOptions.displayProfileInBar = ck_profileBar->isChecked();
app._appOptions.swapBackBufferAlways = ck_abortData->isChecked();
app.SaveApp();

View File

@@ -171,13 +171,26 @@ void DecoderOptionsDlg::load_options_view()
bool bLang = AppConfig::Instance()._appOptions.transDecoderDlg;
if (LangResource::Instance()->is_lang_en() == false){
QWidget *sp1 = new QWidget();
sp1->setFixedHeight(5);
form->addRow(sp1);
QString trans_lable(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_DECODER_IF_TRANS), "Translate param names"));
QCheckBox *ck_trans = new QCheckBox();
ck_trans->setFixedSize(20,20);
ck_trans->setChecked(bLang);
connect(ck_trans, SIGNAL(released()), this, SLOT(on_trans_pramas()));
ck_trans->setStyleSheet("margin-left:60px");
form->addRow(ck_trans, new QLabel(trans_lable));
h_ex2 = 30;
ck_trans->setStyleSheet("margin-top:5px");
QLabel *trans_lb = new QLabel(trans_lable);
QHBoxLayout *trans_lay = new QHBoxLayout();
QWidget *trans_wid = new QWidget();
trans_wid->setLayout(trans_lay);
trans_lay->setSpacing(0);
trans_lay->setContentsMargins(10,0,0,0);
trans_lay->addWidget(ck_trans);
trans_lay->addWidget(trans_lb);
form->addRow("", trans_wid);
h_ex2 = 40;
}
//tr

View File

@@ -2102,6 +2102,17 @@ namespace pv
bAddDecoder = true;
}
if (is_repeat_mode())
{
AppConfig &app = AppConfig::Instance();
bool swapBackBufferAlways = app._appOptions.swapBackBufferAlways;
if (!swapBackBufferAlways && !_is_working && _capture_times > 1){
bAddDecoder = false;
bSwapBuffer = false;
_capture_data->clear();
}
}
if (bAddDecoder){
clear_all_decode_task2();
clear_decode_result();
@@ -2323,7 +2334,7 @@ namespace pv
{
auto trace = get_decoder_trace(index);
if (trace != NULL){
trace->set_name(label);
set_trace_name(trace, label);
}
}

View File

@@ -689,7 +689,11 @@ bool DecodeTrace::create_popup(bool isnew)
}
dlg.get_cursor_range(_decode_cursor1, _decode_cursor2);
}
}
if (dlg.is_reload_form()){
ret = false;
}
if (QDialog::Rejected == dlg_ret || dlg.is_reload_form() == false){
break;

View File

@@ -698,5 +698,9 @@
{
"id": "IDS_DLG_SERIAL_INPUT_AS_HEX",
"text": "以十六进制格式输入"
},
{
"id": "IDS_DLG_USE_ABORT_DATA_REPEAT",
"text": "重复模式下允许使用中途停止的数据"
}
]

View File

@@ -698,5 +698,9 @@
{
"id": "IDS_DLG_SERIAL_INPUT_AS_HEX",
"text": "Input with hex format"
},
{
"id": "IDS_DLG_USE_ABORT_DATA_REPEAT",
"text": "Allow use of the midway stopped data on repeat mode"
}
]