From 201bfbfb5a6242b3cfc534c6b7015eb0be623c5e Mon Sep 17 00:00:00 2001
From: "Michael J. Chudobiak" <mjc@avtechpulse.com>
Date: Thu, 3 May 2018 09:59:22 -0400
Subject: use new variables and range sizes (but not initialized correctly yet)

---
 device-functions.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

(limited to 'device-functions.c')

diff --git a/device-functions.c b/device-functions.c
index 8847d92..7671e1d 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -1705,7 +1705,7 @@ int Set_Amp_Calib(int channel,float meas_ampl)
 		return CalibrationPercentError;
 	}
 
-	for (i=0; i<10; ++i)
+	for (i=0; i<std_range_size; ++i)
 		globals.Flash.ampl_pwl[channel][relay_range][UseNegData][i]=
 		        globals.Flash.ampl_pwl[channel][relay_range][UseNegData][i]*change_ratio;
 
@@ -1715,7 +1715,7 @@ int Set_Amp_Calib(int channel,float meas_ampl)
 
 	if (status) {
 		/* revert to original calibration */
-		for (i=0; i<10; ++i)
+		for (i=0; i<std_range_size; ++i)
 			globals.Flash.ampl_pwl[channel][relay_range][UseNegData][i]=
 			        globals.Flash.ampl_pwl[channel][relay_range][UseNegData][i]/change_ratio;
 	}
@@ -1806,7 +1806,7 @@ int Set_OS_Calib(int channel,float meas_ampl)
 		return CalibrationPercentError;
 	}
 
-	for (i=0; i<10; ++i) {
+	for (i=0; i<std_range_size; ++i) {
 		globals.Flash.os_pwl[channel][0][0][i]=globals.Flash.os_pwl[channel][0][0][i]*change_ratio;
 	}
 
@@ -1816,7 +1816,7 @@ int Set_OS_Calib(int channel,float meas_ampl)
 
 	if (status) {
 		/* revert to original calibration */
-		for (i=0; i<10; ++i) {
+		for (i=0; i<std_range_size; ++i) {
 			globals.Flash.os_pwl[channel][0][0][i]=globals.Flash.os_pwl[channel][0][0][i]/change_ratio;
 		}
 	}
@@ -2311,7 +2311,7 @@ int Set_VI_Cal_Pnt(int parameter,int channel,int calibration_point_number,float
 	pwl = 0;
 	pwl_distort = 0;
 
-	max_points=old_range_size_ten;
+	max_points=std_range_size;
 	switch (parameter) {
 	case (pwl_ampl_values):
 		max_polarity=ampl_polarities;
@@ -2499,7 +2499,7 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number)
 
 	true_channel=channel;
 
-	max_points=old_range_size_ten;
+	max_points=std_range_size;
 	pointer_short2=0;
 
 	switch (parameter) {
@@ -2605,10 +2605,10 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number)
 		}
 	}
 
-	*(float *)(&pointer_float1[index+old_range_size_ten-1])=0.0;
-	*(short *)(&pointer_short1[index+old_range_size_ten-1])=0;
+	*(float *)(&pointer_float1[index+std_range_size-1])=0.0;
+	*(short *)(&pointer_short1[index+std_range_size-1])=0;
 	if (pointer_short2) {
-		*(short *)(&pointer_short2[index+old_range_size_ten-1])=0;
+		*(short *)(&pointer_short2[index+std_range_size-1])=0;
 	}
 
 	/* see if new point prevents min/max from being obtained */
@@ -2710,7 +2710,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
 
 	top_range_only=0;
 	starting_range=0;
-	max_points=old_range_size_ten;
+	max_points=std_range_size;
 	reciprocal_relationship=NO;
 	decreasing_values_allowed=NO;
 	min_os_in_range=max_os_in_range=0.0;
@@ -3006,7 +3006,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
 					*point_found=1;
 
 					if ((parameter==pwl_ampl_values) && globals.Flash.ampl_os_ranges_related[channel]) {
-						for (i=0; i<old_range_size_ten; i++) {
+						for (i=0; i<std_range_size; i++) {
 							if (max_os_in_range<globals.Flash.os_pwl[channel][range_i][0][i]) {
 								max_os_in_range=globals.Flash.os_pwl[channel][range_i][0][i];
 							}
@@ -3020,7 +3020,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
 					}
 
 					if ((parameter==pwl_os_values) && globals.Flash.ampl_os_ranges_related[channel]) {
-						for (i=0; i<old_range_size_ten; i++) {
+						for (i=0; i<std_range_size; i++) {
 							if (max_ampl_in_range<globals.Flash.ampl_pwl[channel][range_i][*UseNegData][i]) {
 								max_ampl_in_range=globals.Flash.ampl_pwl[channel][range_i][*UseNegData][i];
 							}
@@ -3141,10 +3141,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
 	float abs_cal_point;
 	int max_points,max_polarity,max_ranges;
 
-	float temp_y_float1[old_range_size_ten+1];
-	float temp_x_float1[old_range_size_ten+1];		/* float copy of short, for calculations */
-	int temp_x_short1[old_range_size_ten+1];
-	int temp_x_short2[old_range_size_ten+1];
+	float temp_y_float1[std_range_size+1];
+	float temp_x_float1[std_range_size+1];		/* float copy of short, for calculations */
+	int temp_x_short1[std_range_size+1];
+	int temp_x_short2[std_range_size+1];
 
 	int index,actual_pol;
 	float *pointer_y_float1;
@@ -3159,7 +3159,7 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
 
 	range=polarity=0;
 
-	max_points=old_range_size_ten;
+	max_points=std_range_size;
 	pointer_x_short2=0;
 
 	abs_cal_point=cal_point;
@@ -3465,7 +3465,7 @@ int Get_VI_Rng_Info(int parameter, int channel, int calibration_point_number, in
 	*num_in_range=0;
 
 	/* determine array structure */
-	max_points=old_range_size_ten;
+	max_points=std_range_size;
 
 	switch (parameter) {
 	case pwl_ampl_values:
-- 
cgit