demo/inpn: correct ranges in range loop

The demo is supposed to take one reading for each channel for each
range, but was using the range from the command line options instead.

Thanks to Daniele Mazzi for spotting the bug!
This commit is contained in:
Ian Abbott 2014-01-09 15:23:13 +00:00
parent 6ee63ff0b0
commit 1465834a26

View file

@ -64,8 +64,8 @@ int main(int argc, char *argv[])
maxdata = comedi_get_maxdata(device, options.subdevice, chan);
for(range = 0; range < n_ranges; range++){
comedi_data_read(device, options.subdevice, chan, options.range, options.aref, &data);
voltage = comedi_to_phys(data, comedi_get_range(device, options.subdevice, chan, options.range), maxdata);
comedi_data_read(device, options.subdevice, chan, range, options.aref, &data);
voltage = comedi_to_phys(data, comedi_get_range(device, options.subdevice, chan, range), maxdata);
printf("%g ", voltage);
}
printf("\n");