[SCPI_CMD_GET_COUPLING] = ":CHAN%d:COUP?",
[SCPI_CMD_SET_COUPLING] = ":CHAN%d:COUP %s",
[SCPI_CMD_GET_SAMPLE_RATE] = ":ACQ:SRAT?",
- [SCPI_CMD_GET_SAMPLE_RATE_LIVE] = ":%s:DATA:POINTS?",
[SCPI_CMD_GET_ANALOG_DATA] = ":FORM:BORD %s;" \
":FORM REAL,32;:CHAN%d:DATA?",
[SCPI_CMD_GET_VERTICAL_DIV] = ":CHAN%d:SCAL?",
static const uint32_t devopts[] = {
SR_CONF_OSCILLOSCOPE,
- SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET,
- SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET,
+ SR_CONF_LIMIT_SAMPLES | SR_CONF_SET,
+ SR_CONF_LIMIT_FRAMES | SR_CONF_SET,
SR_CONF_SAMPLERATE | SR_CONF_GET,
SR_CONF_TIMEBASE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_NUM_HDIV | SR_CONF_GET,
{ 2, 1 },
{ 5, 1 },
{ 10, 1 },
- { 20, 1 },
- { 50, 1 },
};
static const char *scope_analog_channel_names[] = {
for (i = 0; i < config->digital_pods; i++) {
if (strncmp("USER", (*config->logic_threshold)[state->digital_pods[i].threshold], 4))
- sr_info("State of digital POD %d -> %s : %s (threshold)", i,
+ sr_info("State of digital POD %d -> %s : %s (threshold)", i + 1,
state->digital_pods[i].state ? "On" : "Off",
(*config->logic_threshold)[state->digital_pods[i].threshold]);
else // user-defined or custom logic threshold
- sr_info("State of digital POD %d -> %s : %E (threshold)", i,
+ sr_info("State of digital POD %d -> %s : %E (threshold)", i + 1,
state->digital_pods[i].state ? "On" : "Off",
state->digital_pods[i].user_threshold);
}
char *tmp;
int idx;
- if (sr_scpi_get_string(scpi, command, &tmp) != SR_OK) {
- g_free(tmp);
+ if (sr_scpi_get_string(scpi, command, &tmp) != SR_OK)
return SR_ERR;
- }
if ((idx = std_str_idx_s(tmp, *array, n)) < 0) {
g_free(tmp);
struct dev_context *devc;
struct scope_state *state;
const struct scope_config *config;
- int tmp;
- unsigned int i;
float tmp_float;
- gboolean channel_found;
- char tmp_str[MAX_COMMAND_SIZE];
- char chan_name[20];
devc = sdi->priv;
config = devc->model_config;
state = devc->model_state;
- channel_found = FALSE;
- for (i = 0; i < config->analog_channels; i++) {
- if (!state->analog_channels[i].state)
- continue;
- g_snprintf(chan_name, sizeof(chan_name), "CHAN%d", i + 1);
- g_snprintf(tmp_str, sizeof(tmp_str),
- (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE_LIVE],
- chan_name);
- channel_found = TRUE;
- break;
- }
-
- if (!channel_found) {
- for (i = 0; i < config->digital_pods; i++) {
- if (!state->digital_pods[i].state)
- continue;
- g_snprintf(chan_name, sizeof(chan_name), "POD%d", i);
- g_snprintf(tmp_str, sizeof(tmp_str),
- (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE_LIVE],
- chan_name);
- channel_found = TRUE;
- break;
- }
- }
-
- /* No channel is active, ask the instrument for the sample rate
- * in single shot mode */
- if (!channel_found) {
- if (sr_scpi_get_float(sdi->conn,
- (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE],
- &tmp_float) != SR_OK)
- return SR_ERR;
+ if (sr_scpi_get_float(sdi->conn,
+ (*config->scpi_dialect)[SCPI_CMD_GET_SAMPLE_RATE],
+ &tmp_float) != SR_OK)
+ return SR_ERR;
- state->sample_rate = tmp_float;
- } else {
- if (sr_scpi_get_int(sdi->conn, tmp_str, &tmp) != SR_OK)
- return SR_ERR;
- state->sample_rate = tmp / (((float) (*config->timebases)[state->timebase][0] /
- (*config->timebases)[state->timebase][1]) *
- config->num_xdivs);
- }
+ state->sample_rate = tmp_float;
return SR_OK;
}
ret = SR_ERR_MALLOC;
break;
}
- devc->digital_groups[i]->name = g_strdup_printf("POD%d", i);
+ devc->digital_groups[i]->name = g_strdup_printf("POD%d", i + 1);
sdi->channel_groups = g_slist_append(sdi->channel_groups,
devc->digital_groups[i]);
}