MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / load_settings

Method load_settings

DSView/pv/view/dsosignal.cpp:248–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248bool DsoSignal::load_settings()
249{
250 int v;
251 uint32_t ui32;
252 bool ret;
253
254 // dso channel bits
255 ret = session->get_device()->get_config_byte(SR_CONF_UNIT_BITS, v);
256 if (ret) {
257 _bits = (uint8_t)v;
258 }
259 else {
260 _bits = DefaultBits;
261 dsv_warn("%s%d", "Warning: config_get SR_CONF_UNIT_BITS failed, set to %d(default).", DefaultBits);
262
263 if (session->get_device()->is_hardware())
264 return false;
265 }
266
267 ret = session->get_device()->get_config_uint32(SR_CONF_REF_MIN, ui32);
268 if (ret)
269 _ref_min = (double)ui32;
270 else
271 _ref_min = 1;
272
273 ret = session->get_device()->get_config_uint32(SR_CONF_REF_MAX, ui32);
274 if (ret)
275 _ref_max = (double)ui32;
276 else
277 _ref_max = ((1 << _bits) - 1);
278
279 // -- vdiv
280 uint64_t vdiv;
281 uint64_t vfactor;
282 ret = session->get_device()->get_config_uint64(SR_CONF_PROBE_VDIV, vdiv, _probe, NULL);
283 if (!ret) {
284 dsv_err("ERROR: config_get SR_CONF_PROBE_VDIV failed.");
285 return false;
286 }
287
288 ret = session->get_device()->get_config_uint64(SR_CONF_PROBE_FACTOR, vfactor, _probe, NULL);
289 if (!ret) {
290 dsv_err("ERROR: config_get SR_CONF_PROBE_FACTOR failed.");
291 return false;
292 }
293
294 _vDial->set_value(vdiv);
295 _vDial->set_factor(vfactor);
296
297 // -- coupling
298 ret = session->get_device()->get_config_byte(SR_CONF_PROBE_COUPLING, v, _probe, NULL);
299 if (ret) {
300 _acCoupling = uint8_t(v);
301 }
302 else {
303 dsv_err("ERROR: config_get SR_CONF_PROBE_COUPLING failed.");
304 return false;
305 }

Callers 1

load_config_from_jsonMethod · 0.80

Calls 10

get_config_byteMethod · 0.80
get_deviceMethod · 0.80
is_hardwareMethod · 0.80
get_config_uint32Method · 0.80
get_config_uint64Method · 0.80
get_config_uint16Method · 0.80
set_updateMethod · 0.80
set_valueMethod · 0.45
set_factorMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected