summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/device-functions.c b/device-functions.c
index 40f5f65..3acfb49 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -2423,24 +2423,29 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number)
int polarity,range,entry,status,i,num_in_range,num_of_ranges;
float temp_float1[10];
short temp_short1[10];
+ short temp_short2[10];
int index;
int max_points,max_polarity,max_ranges;
short *pointer_short1;
+ short *pointer_short2;
float *pointer_float1;
- int eprom_loc,size_of_float1,size_of_short1;
+ int eprom_loc,size_of_float1,size_of_short1,size_of_short2;
int true_channel;
true_channel=channel;
max_points=points_in_range;
+ pointer_short2=0;
switch (parameter) {
case (pwl_ampl_values):
max_polarity=ampl_polarities;
max_ranges=ampl_ranges;
pointer_short1=&globals.Flash.ampl_dacval[0][0][0][0];
+ pointer_short2=&globals.Flash.distort_dacval[0][0][0][0];
pointer_float1=&globals.Flash.ampl_pwl[0][0][0][0];
size_of_short1=sizeof(globals.Flash.ampl_dacval);
+ size_of_short2=sizeof(globals.Flash.distort_dacval);
size_of_float1=sizeof(globals.Flash.ampl_pwl);
break;
case (pwl_os_values):
@@ -2517,16 +2522,25 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number)
for (i=0; i<max_points; i++) {
temp_float1[i]=pointer_float1[index+i];
temp_short1[i]=pointer_short1[index+i];
+ if (pointer_short2) {
+ temp_short2[i]=pointer_short2[index+i];
+ }
}
/* move the data, overwriting the deleted point */
for (i=entry; i<max_points-1; i++) {
*(float *)(&pointer_float1[index+i])=pointer_float1[index+i+1];
*(short *)(&pointer_short1[index+i])=pointer_short1[index+i+1];
+ if (pointer_short2) {
+ *(short *)(&pointer_short2[index+i])=pointer_short2[index+i+1];
+ }
}
*(float *)(&pointer_float1[index+points_in_range-1])=0.0;
*(short *)(&pointer_short1[index+points_in_range-1])=0;
+ if (pointer_short2) {
+ *(short *)(&pointer_short2[index+points_in_range-1])=0;
+ }
/* see if new point prevents min/max from being obtained */
status=Check_MinMax_Cal(channel,parameter);
@@ -2536,6 +2550,9 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number)
for (i=0; i<max_points; i++) {
*(float *)(&pointer_float1[index+i])=temp_float1[i];
*(short *)(&pointer_short1[index+i])=temp_short1[i];
+ if (pointer_short2) {
+ *(short *)(&pointer_short2[index+i])=temp_short2[i];
+ }
}
}
@@ -2553,6 +2570,11 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number)
eprom_loc = (char *) pointer_float1 - (char *) &(globals.Flash.flash_start);
writeUserBlock(&globals.Flash, eprom_loc, size_of_float1);
+ if (pointer_short2) {
+ eprom_loc = (char *) pointer_short2 - (char *) &(globals.Flash.flash_start);
+ writeUserBlock(&globals.Flash, eprom_loc, size_of_short2);
+ }
+
return status;
}