yokogawa-dlm: Prevent duplicate channel index
This commit is contained in:
parent
7048bb1f35
commit
6fd78a9fd0
|
@ -599,17 +599,18 @@ static int dlm_setup_channels(const struct sr_dev_inst *sdi)
|
|||
setup_changed = TRUE;
|
||||
break;
|
||||
case SR_CHANNEL_LOGIC:
|
||||
i = ch->index - DLM_DIG_CHAN_INDEX_OFFS;
|
||||
if (ch->enabled)
|
||||
pod_enabled[ch->index / 8] = TRUE;
|
||||
pod_enabled[i / 8] = TRUE;
|
||||
|
||||
if (ch->enabled == state->digital_states[ch->index])
|
||||
if (ch->enabled == state->digital_states[i])
|
||||
break;
|
||||
|
||||
if (dlm_digital_chan_state_set(scpi, ch->index + 1,
|
||||
if (dlm_digital_chan_state_set(scpi, i + 1,
|
||||
ch->enabled) != SR_OK)
|
||||
return SR_ERR;
|
||||
|
||||
state->digital_states[ch->index] = ch->enabled;
|
||||
state->digital_states[i] = ch->enabled;
|
||||
setup_changed = TRUE;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -791,7 +791,7 @@ SR_PRIV int dlm_device_init(struct sr_dev_inst *sdi, int model_index)
|
|||
devc->digital_groups = g_malloc0(sizeof(struct sr_channel_group*) *
|
||||
scope_models[model_index].digital_channels);
|
||||
|
||||
/* Add analog channels. */
|
||||
/* Add analog channels, each in its own group. */
|
||||
for (i = 0; i < scope_models[model_index].analog_channels; i++) {
|
||||
ch = sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE,
|
||||
(*scope_models[model_index].analog_names)[i]);
|
||||
|
@ -821,7 +821,8 @@ SR_PRIV int dlm_device_init(struct sr_dev_inst *sdi, int model_index)
|
|||
|
||||
/* Add digital channels. */
|
||||
for (i = 0; i < scope_models[model_index].digital_channels; i++) {
|
||||
ch = sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE,
|
||||
ch = sr_channel_new(sdi, DLM_DIG_CHAN_INDEX_OFFS + i,
|
||||
SR_CHANNEL_LOGIC, TRUE,
|
||||
(*scope_models[model_index].digital_names)[i]);
|
||||
|
||||
devc->digital_groups[i / 8]->channels = g_slist_append(
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#define DLM_DIVISION_FOR_WORD_FORMAT 3200
|
||||
#define DLM_DIVISION_FOR_BYTE_FORMAT 12.5
|
||||
|
||||
#define DLM_DIG_CHAN_INDEX_OFFS (32)
|
||||
|
||||
enum trigger_slopes {
|
||||
SLOPE_POSITIVE,
|
||||
SLOPE_NEGATIVE
|
||||
|
|
Loading…
Reference in New Issue