diff options
author | root <root@julius.domain.avtechpulse.com> | 2017-10-05 16:26:28 -0400 |
---|---|---|
committer | root <root@julius.domain.avtechpulse.com> | 2017-10-05 16:26:28 -0400 |
commit | d7056c035a1b5addf6799e60331312000476e9d4 (patch) | |
tree | 6f60073d7990775bc78b2ed9b623589c911e95fa /device-functions.c | |
parent | b765f9376ec6713c574ae0c2fb0e797d2b6d57a5 (diff) |
auto-handle the EA V1 distort data when deleting an ampl cal point
Diffstat (limited to 'device-functions.c')
-rw-r--r-- | device-functions.c | 24 |
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; } |