siglent-sds: Fix SR_CONF_AVERAGING/SR_CONF_AVG_SAMPLES handling.

This commit is contained in:
Uwe Hermann 2018-10-14 00:27:24 +02:00
parent c90065a949
commit 023c6114c5
1 changed files with 13 additions and 3 deletions

View File

@ -50,7 +50,7 @@ static const uint32_t devopts[] = {
SR_CONF_SAMPLERATE | SR_CONF_GET, SR_CONF_SAMPLERATE | SR_CONF_GET,
SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET, SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET,
SR_CONF_DATA_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_DATA_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_AVERAGING | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_AVERAGING | SR_CONF_GET | SR_CONF_SET,
SR_CONF_AVG_SAMPLES | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_AVG_SAMPLES | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
}; };
@ -149,6 +149,10 @@ static const uint64_t probe_factor[] = {
1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000,
}; };
static const uint64_t averages[] = {
4, 16, 32, 64, 128, 256, 512, 1024,
};
/* Do not change the order of entries. */ /* Do not change the order of entries. */
static const char *data_sources[] = { static const char *data_sources[] = {
"Display", "Display",
@ -514,6 +518,12 @@ static int config_get(uint32_t key, GVariant **data,
} }
*data = g_variant_new_uint64(devc->attenuation[analog_channel]); *data = g_variant_new_uint64(devc->attenuation[analog_channel]);
break; break;
case SR_CONF_AVERAGING:
*data = g_variant_new_boolean(devc->average_enabled);
break;
case SR_CONF_AVG_SAMPLES:
*data = g_variant_new_uint64(devc->average_samples);
break;
default: default:
return SR_ERR_NA; return SR_ERR_NA;
} }
@ -774,8 +784,8 @@ static int config_list(uint32_t key, GVariant **data,
case SR_CONF_NUM_HDIV: case SR_CONF_NUM_HDIV:
*data = g_variant_new_int32(devc->model->series->num_horizontal_divs); *data = g_variant_new_int32(devc->model->series->num_horizontal_divs);
break; break;
case SR_CONF_AVERAGING: case SR_CONF_AVG_SAMPLES:
*data = g_variant_new_boolean(devc->average_enabled); *data = std_gvar_array_u64(ARRAY_AND_SIZE(averages));
break; break;
default: default:
return SR_ERR_NA; return SR_ERR_NA;