*selector = 0;
for (i = 0; i < vreg->set_points->count; i++) {
if (uV >= vreg->set_points->range[i].set_point_min_uV
- && uV <= vreg->set_points->range[i].set_point_max_uV)
+ && uV <= vreg->set_points->range[i].set_point_max_uV) {
*selector +=
(uV - vreg->set_points->range[i].set_point_min_uV)
/ vreg->set_points->range[i].step_uV;
break;
+ }
*selector += vreg->set_points->range[i].n_voltages;
}
return 0;
for (i = 0; i < vreg->set_points->count; i++) {
- if (selector < vreg->set_points->range[i].n_voltages)
+ if (selector < vreg->set_points->range[i].n_voltages) {
uV = selector * vreg->set_points->range[i].step_uV
+ vreg->set_points->range[i].set_point_min_uV;
break;
+ }
selector -= vreg->set_points->range[i].n_voltages;
}