Commit 48ab8049 authored by DreamSourceLab's avatar DreamSourceLab

Fix display issue, add signal height limit

parent 17c20781
...@@ -40,7 +40,7 @@ Annotation::Annotation(const srd_proto_data *const pdata) : ...@@ -40,7 +40,7 @@ Annotation::Annotation(const srd_proto_data *const pdata) :
(const srd_proto_data_annotation*)pdata->data; (const srd_proto_data_annotation*)pdata->data;
assert(pda); assert(pda);
_format = pda->ann_format; _format = pda->ann_class;
const char *const *annotations = (char**)pda->ann_text; const char *const *annotations = (char**)pda->ann_text;
while(*annotations) { while(*annotations) {
......
...@@ -48,7 +48,7 @@ Search::Search(QWidget *parent, struct sr_dev_inst *sdi, QString pattern) : ...@@ -48,7 +48,7 @@ Search::Search(QWidget *parent, struct sr_dev_inst *sdi, QString pattern) :
search_lineEdit.setInputMask("X X X X X X X X X X X X X X X X"); search_lineEdit.setInputMask("X X X X X X X X X X X X X X X X");
search_lineEdit.setFont(font); search_lineEdit.setFont(font);
QLabel *search_label = new QLabel("1 1 1 1 1\n5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0"); QLabel *search_label = new QLabel("1 1 1 1 1 1\n5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0");
search_label->setFont(font); search_label->setFont(font);
search_buttonBox.addButton(QDialogButtonBox::Ok); search_buttonBox.addButton(QDialogButtonBox::Ok);
......
...@@ -284,6 +284,7 @@ void MainWindow::update_device_list() ...@@ -284,6 +284,7 @@ void MainWindow::update_device_list()
{ {
assert(_sampling_bar); assert(_sampling_bar);
_session.stop_capture();
_view->show_trig_cursor(false); _view->show_trig_cursor(false);
_trigger_widget->device_change(); _trigger_widget->device_change();
#ifdef ENABLE_DECODE #ifdef ENABLE_DECODE
......
...@@ -82,6 +82,8 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) : ...@@ -82,6 +82,8 @@ DeviceOptions::DeviceOptions(struct sr_dev_inst *sdi) :
case SR_CONF_BUFFERSIZE: case SR_CONF_BUFFERSIZE:
case SR_CONF_TRIGGER_SOURCE: case SR_CONF_TRIGGER_SOURCE:
case SR_CONF_FILTER: case SR_CONF_FILTER:
case SR_CONF_MAX_HEIGHT:
case SR_CONF_MAX_HEIGHT_VALUE:
case SR_CONF_COUPLING: case SR_CONF_COUPLING:
case SR_CONF_EN_CH: case SR_CONF_EN_CH:
case SR_CONF_OPERATION_MODE: case SR_CONF_OPERATION_MODE:
......
...@@ -122,10 +122,10 @@ void DevMode::on_mode_change() ...@@ -122,10 +122,10 @@ void DevMode::on_mode_change()
i != _mode_button_list.end(); i++) { i != _mode_button_list.end(); i++) {
if ((*i).first.get() == button) { if ((*i).first.get() == button) {
if (dev_inst->dev_inst()->mode != (*i).second->mode) { if (dev_inst->dev_inst()->mode != (*i).second->mode) {
_view.session().stop_capture();
dev_inst->set_config(NULL, NULL, dev_inst->set_config(NULL, NULL,
SR_CONF_DEVICE_MODE, SR_CONF_DEVICE_MODE,
g_variant_new_int16((*i).second->mode)); g_variant_new_int16((*i).second->mode));
mode_changed(); mode_changed();
} }
} }
......
...@@ -57,6 +57,7 @@ const int View::LabelMarginWidth = 70; ...@@ -57,6 +57,7 @@ const int View::LabelMarginWidth = 70;
const int View::RulerHeight = 50; const int View::RulerHeight = 50;
const int View::MaxScrollValue = INT_MAX / 2; const int View::MaxScrollValue = INT_MAX / 2;
const int View::MaxHeightUnit = 20;
//const int View::SignalHeight = 30;s //const int View::SignalHeight = 30;s
const int View::SignalMargin = 10; const int View::SignalMargin = 10;
...@@ -470,6 +471,7 @@ void View::update_scale() ...@@ -470,6 +471,7 @@ void View::update_scale()
void View::signals_changed() void View::signals_changed()
{ {
int total_rows = 0; int total_rows = 0;
uint8_t max_height = MaxHeightUnit;
const vector< boost::shared_ptr<Trace> > traces(get_traces()); const vector< boost::shared_ptr<Trace> > traces(get_traces());
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces) BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
{ {
...@@ -483,7 +485,16 @@ void View::signals_changed() ...@@ -483,7 +485,16 @@ void View::signals_changed()
- horizontalScrollBar()->height() - horizontalScrollBar()->height()
- 2 * SignalMargin * traces.size()) * 1.0 / total_rows; - 2 * SignalMargin * traces.size()) * 1.0 / total_rows;
if (_session.get_device()->dev_inst()->mode == LOGIC) {
GVariant* gvar = _session.get_device()->get_config(NULL, NULL, SR_CONF_MAX_HEIGHT_VALUE);
if (gvar != NULL) {
max_height = (g_variant_get_byte(gvar) + 1) * MaxHeightUnit;
g_variant_unref(gvar);
}
_signalHeight = (int)((height <= 0) ? 1 : (height >= max_height) ? max_height : height);
} else {
_signalHeight = (int)((height <= 0) ? 1 : height); _signalHeight = (int)((height <= 0) ? 1 : height);
}
_spanY = _signalHeight + 2 * SignalMargin; _spanY = _signalHeight + 2 * SignalMargin;
int next_v_offset = SignalMargin; int next_v_offset = SignalMargin;
BOOST_FOREACH(boost::shared_ptr<Trace> t, traces) { BOOST_FOREACH(boost::shared_ptr<Trace> t, traces) {
......
...@@ -64,6 +64,7 @@ private: ...@@ -64,6 +64,7 @@ private:
static const int RulerHeight; static const int RulerHeight;
static const int MaxScrollValue; static const int MaxScrollValue;
static const int MaxHeightUnit;
public: public:
//static const int SignalHeight; //static const int SignalHeight;
......
...@@ -169,6 +169,7 @@ struct DSL_context { ...@@ -169,6 +169,7 @@ struct DSL_context {
int trigger_stage; int trigger_stage;
uint16_t trigger_buffer[NUM_TRIGGER_STAGES]; uint16_t trigger_buffer[NUM_TRIGGER_STAGES];
uint64_t timebase; uint64_t timebase;
uint8_t max_height;
uint8_t trigger_slope; uint8_t trigger_slope;
uint8_t trigger_source; uint8_t trigger_source;
uint8_t trigger_hrate; uint8_t trigger_hrate;
......
...@@ -89,6 +89,14 @@ static const char *filters[] = { ...@@ -89,6 +89,14 @@ static const char *filters[] = {
"1 Sample Clock", "1 Sample Clock",
}; };
static const char *maxHeights[] = {
"1X",
"2X",
"3X",
"4X",
"5X",
};
static const int32_t hwopts[] = { static const int32_t hwopts[] = {
SR_CONF_CONN, SR_CONF_CONN,
}; };
...@@ -99,6 +107,7 @@ static const int32_t hwcaps[] = { ...@@ -99,6 +107,7 @@ static const int32_t hwcaps[] = {
SR_CONF_SAMPLERATE, SR_CONF_SAMPLERATE,
/* These are really implemented in the driver, not the hardware. */ /* These are really implemented in the driver, not the hardware. */
SR_CONF_MAX_HEIGHT,
SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_SAMPLES,
SR_CONF_CONTINUOUS, SR_CONF_CONTINUOUS,
}; };
...@@ -107,6 +116,7 @@ static const int32_t hwoptions[] = { ...@@ -107,6 +116,7 @@ static const int32_t hwoptions[] = {
SR_CONF_OPERATION_MODE, SR_CONF_OPERATION_MODE,
SR_CONF_THRESHOLD, SR_CONF_THRESHOLD,
SR_CONF_FILTER, SR_CONF_FILTER,
SR_CONF_MAX_HEIGHT,
SR_CONF_CLOCK_TYPE, SR_CONF_CLOCK_TYPE,
SR_CONF_CLOCK_EDGE, SR_CONF_CLOCK_EDGE,
}; };
...@@ -115,6 +125,7 @@ static const int32_t hwoptions_pro[] = { ...@@ -115,6 +125,7 @@ static const int32_t hwoptions_pro[] = {
SR_CONF_OPERATION_MODE, SR_CONF_OPERATION_MODE,
SR_CONF_VTH, SR_CONF_VTH,
SR_CONF_FILTER, SR_CONF_FILTER,
SR_CONF_MAX_HEIGHT,
SR_CONF_CLOCK_TYPE, SR_CONF_CLOCK_TYPE,
SR_CONF_CLOCK_EDGE, SR_CONF_CLOCK_EDGE,
}; };
...@@ -682,6 +693,7 @@ static struct DSL_context *DSLogic_dev_new(void) ...@@ -682,6 +693,7 @@ static struct DSL_context *DSLogic_dev_new(void)
devc->stream = FALSE; devc->stream = FALSE;
devc->mstatus_valid = FALSE; devc->mstatus_valid = FALSE;
devc->data_lock = FALSE; devc->data_lock = FALSE;
devc->max_height = 1;
return devc; return devc;
} }
...@@ -1238,6 +1250,18 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -1238,6 +1250,18 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
devc = sdi->priv; devc = sdi->priv;
*data = g_variant_new_string(filters[devc->filter]); *data = g_variant_new_string(filters[devc->filter]);
break; break;
case SR_CONF_MAX_HEIGHT:
if (!sdi)
return SR_ERR;
devc = sdi->priv;
*data = g_variant_new_string(maxHeights[devc->max_height]);
break;
case SR_CONF_MAX_HEIGHT_VALUE:
if (!sdi)
return SR_ERR;
devc = sdi->priv;
*data = g_variant_new_byte(devc->max_height);
break;
case SR_CONF_THRESHOLD: case SR_CONF_THRESHOLD:
if (!sdi) if (!sdi)
return SR_ERR; return SR_ERR;
...@@ -1650,6 +1674,17 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi, ...@@ -1650,6 +1674,17 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} }
sr_dbg("%s: setting threshold to %d", sr_dbg("%s: setting threshold to %d",
__func__, devc->th_level); __func__, devc->th_level);
} else if (id == SR_CONF_MAX_HEIGHT) {
stropt = g_variant_get_string(data, NULL);
ret = SR_OK;
for (i = 0; i < ARRAY_SIZE(maxHeights); i++) {
if (!strcmp(stropt, maxHeights[i])) {
devc->max_height = i;
break;
}
}
sr_dbg("%s: setting Signal Max Height to %d",
__func__, devc->max_height);
} else if (id == SR_CONF_EN_CH) { } else if (id == SR_CONF_EN_CH) {
ch->enabled = g_variant_get_boolean(data); ch->enabled = g_variant_get_boolean(data);
if (sdi->mode == DSO) { if (sdi->mode == DSO) {
...@@ -1879,6 +1914,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -1879,6 +1914,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_FILTER: case SR_CONF_FILTER:
*data = g_variant_new_strv(filters, ARRAY_SIZE(filters)); *data = g_variant_new_strv(filters, ARRAY_SIZE(filters));
break; break;
case SR_CONF_MAX_HEIGHT:
*data = g_variant_new_strv(maxHeights, ARRAY_SIZE(maxHeights));
break;
default: default:
return SR_ERR_NA; return SR_ERR_NA;
} }
......
...@@ -78,6 +78,14 @@ static const char *pattern_strings[] = { ...@@ -78,6 +78,14 @@ static const char *pattern_strings[] = {
"Random", "Random",
}; };
static const char *maxHeights[] = {
"1X",
"2X",
"3X",
"4X",
"5X",
};
static struct sr_dev_mode mode_list[] = { static struct sr_dev_mode mode_list[] = {
{"LA", LOGIC}, {"LA", LOGIC},
{"DAQ", ANALOG}, {"DAQ", ANALOG},
...@@ -100,6 +108,7 @@ struct dev_context { ...@@ -100,6 +108,7 @@ struct dev_context {
uint64_t timebase; uint64_t timebase;
gboolean instant; gboolean instant;
gboolean data_lock; gboolean data_lock;
uint8_t max_height;
int trigger_stage; int trigger_stage;
uint16_t trigger_mask; uint16_t trigger_mask;
...@@ -112,6 +121,7 @@ static const int hwcaps[] = { ...@@ -112,6 +121,7 @@ static const int hwcaps[] = {
SR_CONF_DEMO_DEV, SR_CONF_DEMO_DEV,
SR_CONF_SAMPLERATE, SR_CONF_SAMPLERATE,
SR_CONF_PATTERN_MODE, SR_CONF_PATTERN_MODE,
SR_CONF_MAX_HEIGHT,
SR_CONF_LIMIT_SAMPLES, SR_CONF_LIMIT_SAMPLES,
SR_CONF_LIMIT_MSEC, SR_CONF_LIMIT_MSEC,
SR_CONF_CONTINUOUS, SR_CONF_CONTINUOUS,
...@@ -119,6 +129,7 @@ static const int hwcaps[] = { ...@@ -119,6 +129,7 @@ static const int hwcaps[] = {
static const int hwoptions[] = { static const int hwoptions[] = {
SR_CONF_PATTERN_MODE, SR_CONF_PATTERN_MODE,
SR_CONF_MAX_HEIGHT,
}; };
static const int32_t sessions[] = { static const int32_t sessions[] = {
...@@ -234,6 +245,7 @@ static GSList *hw_scan(GSList *options) ...@@ -234,6 +245,7 @@ static GSList *hw_scan(GSList *options)
devc->sample_generator = PATTERN_SINE; devc->sample_generator = PATTERN_SINE;
devc->timebase = 10000; devc->timebase = 10000;
devc->data_lock = FALSE; devc->data_lock = FALSE;
devc->max_height = 1;
sdi->priv = devc; sdi->priv = devc;
...@@ -355,6 +367,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -355,6 +367,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_PATTERN_MODE: case SR_CONF_PATTERN_MODE:
*data = g_variant_new_string(pattern_strings[devc->sample_generator]); *data = g_variant_new_string(pattern_strings[devc->sample_generator]);
break; break;
case SR_CONF_MAX_HEIGHT:
*data = g_variant_new_string(maxHeights[devc->max_height]);
break;
case SR_CONF_MAX_HEIGHT_VALUE:
*data = g_variant_new_byte(devc->max_height);
break;
case SR_CONF_VDIV: case SR_CONF_VDIV:
*data = g_variant_new_uint64(ch->vdiv); *data = g_variant_new_uint64(ch->vdiv);
break; break;
...@@ -484,6 +502,17 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi, ...@@ -484,6 +502,17 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
} }
sr_dbg("%s: setting pattern to %d", sr_dbg("%s: setting pattern to %d",
__func__, devc->sample_generator); __func__, devc->sample_generator);
} else if (id == SR_CONF_MAX_HEIGHT) {
stropt = g_variant_get_string(data, NULL);
ret = SR_OK;
for (i = 0; i < ARRAY_SIZE(maxHeights); i++) {
if (!strcmp(stropt, maxHeights[i])) {
devc->max_height = i;
break;
}
}
sr_dbg("%s: setting Signal Max Height to %d",
__func__, devc->max_height);
} else if (id == SR_CONF_INSTANT) { } else if (id == SR_CONF_INSTANT) {
devc->instant = g_variant_get_boolean(data); devc->instant = g_variant_get_boolean(data);
sr_dbg("%s: setting INSTANT mode to %d", __func__, sr_dbg("%s: setting INSTANT mode to %d", __func__,
...@@ -575,6 +604,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ...@@ -575,6 +604,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
case SR_CONF_PATTERN_MODE: case SR_CONF_PATTERN_MODE:
*data = g_variant_new_strv(pattern_strings, ARRAY_SIZE(pattern_strings)); *data = g_variant_new_strv(pattern_strings, ARRAY_SIZE(pattern_strings));
break; break;
case SR_CONF_MAX_HEIGHT:
*data = g_variant_new_strv(maxHeights, ARRAY_SIZE(maxHeights));
break;
default: default:
return SR_ERR_NA; return SR_ERR_NA;
} }
......
...@@ -83,6 +83,10 @@ static struct sr_config_info sr_config_info_data[] = { ...@@ -83,6 +83,10 @@ static struct sr_config_info sr_config_info_data[] = {
"Buffer size", "Buffer size", NULL}, "Buffer size", "Buffer size", NULL},
{SR_CONF_TIMEBASE, SR_T_UINT64, "timebase", {SR_CONF_TIMEBASE, SR_T_UINT64, "timebase",
"Time base", "Time base", NULL}, "Time base", "Time base", NULL},
{SR_CONF_MAX_HEIGHT, SR_T_CHAR, "height",
"Max Height", "Max Height", NULL},
{SR_CONF_MAX_HEIGHT_VALUE, SR_T_UINT8, "height",
"Max Height", "Max Height", NULL},
{SR_CONF_FILTER, SR_T_CHAR, "filter", {SR_CONF_FILTER, SR_T_CHAR, "filter",
"Filter Targets", "Filter Targets", NULL}, "Filter Targets", "Filter Targets", NULL},
{SR_CONF_VDIV, SR_T_RATIONAL_VOLT, "vdiv", {SR_CONF_VDIV, SR_T_RATIONAL_VOLT, "vdiv",
......
...@@ -804,6 +804,10 @@ enum { ...@@ -804,6 +804,10 @@ enum {
/** Device channel mode */ /** Device channel mode */
SR_CONF_CHANNEL_MODE, SR_CONF_CHANNEL_MODE,
/** Signal max height **/
SR_CONF_MAX_HEIGHT,
SR_CONF_MAX_HEIGHT_VALUE,
/** Device sample threshold */ /** Device sample threshold */
SR_CONF_THRESHOLD, SR_CONF_THRESHOLD,
SR_CONF_VTH, SR_CONF_VTH,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment